Skip to content

Commit

Permalink
updated bbconf overview
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Apr 15, 2024
1 parent 87289d7 commit 140691f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
1 change: 0 additions & 1 deletion docs/bbconf/demo.md

This file was deleted.

67 changes: 67 additions & 0 deletions docs/bbconf/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# DEMO of the bbconf module

`bbconf` is a configuration and management tool for BEDbase, facilitating the reading of configuration file,
setting up connections to PostgreSQL, PEPhub, S3, and Qdrant databases, managing file paths, and storing transformer models.

### Introduction

`bbconf` is divided into 2 main modules:
- `bbconf.config_parser` - reads the configuration file and sets up connections to databases.
`BedBaseConfig` class is used to store the passwords, configuration, connection objects, and other information.

- `bbconf.modules` - contains modules for managing `bed_files`, `bedsets`, and other common functionalities.
Users will mainly use this mudule because it provides classes with methods for managing the database.

### Example:

#### 1) Init the `BedBaseAgent` class

```python
from bbconf.bbagent import BedBaseAgent

bbagent = BedBaseAgent(bbconf_file_path)
```
Where `bbconf_file_path` is the path to the configuration file. How to create a configuration file is described in the configuration section.

#### Upload a bedfile to the database

```python

bbagent.bed.add(
identifier=bed_metadata.bed_digest,
stats=stats.model_dump(exclude_unset=True),
metadata=other_metadata,
plots=plots.model_dump(exclude_unset=True),
files=files.model_dump(exclude_unset=True),
classification=classification.model_dump(exclude_unset=True),
upload_qdrant=upload_qdrant,
upload_pephub=upload_pephub,
upload_s3=upload_s3,
local_path=outfolder,
overwrite=force_overwrite,
nofail=True,
)
```

#### Get a bedfile from the database

```python
bed = bbagent.bed.get(identifier=bed_id, full=True,)
```

#### Get a bedset from the database

```python
bedset = bbagent.bedset.get(identifier=bedset_id, full=True,)
```

#### User can access credentials and other configurations from the `BedBaseConfig` class

e.g. to get pephub namespace used in config you can use the following code:

```python
bbagent.config._config["pephub"]["namespace"]
```


Full API of bbconf can be found [here](./bbc_api.md)
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ nav:
- BBConf:
- BBConf: bbconf/README.md
- Configuring: bedboss/how-to-configure.md
- Demo: bbconf/demo.md
- Overview: bbconf/overview.md
- Guide: bbconf/bbc_api.md
- Changelog: bbconf/changelog.md
- Reference:
Expand Down

0 comments on commit 140691f

Please sign in to comment.