From 7f1cf69f46d65666b20e2b49a62dba520e126233 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Wed, 4 Oct 2023 22:23:40 +0200 Subject: [PATCH] added docs + updated bbconf and pipestat --- bedboss/__init__.py | 12 +++-- bedboss/_version.py | 2 +- bedboss/bedboss.py | 8 +++- bedboss/bedstat/bedstat.py | 2 +- bedboss/cli.py | 4 +- docs/how_run_script.md | 77 +++++++++++++++++++++++++++++++ requirements/requirements-all.txt | 7 ++- 7 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 docs/how_run_script.md diff --git a/bedboss/__init__.py b/bedboss/__init__.py index 22e102d..ba8f9e0 100644 --- a/bedboss/__init__.py +++ b/bedboss/__init__.py @@ -3,10 +3,12 @@ import coloredlogs from bedboss import * -from bedboss.bedqc import bedqc -from bedboss.bedmaker import bedmaker -from bedboss.bedstat import bedstat + +# from bedboss.bedqc.bedqc import bedqc +# from bedboss.bedmaker.bedmaker import BedMaker +# from bedboss.bedstat.bedstat import bedstat from bedboss._version import __version__ +from bedboss.bedboss import run_all, run_all_by_pep, bedqc, BedMaker, bedstat __package_name__ = "bedboss" @@ -24,9 +26,13 @@ "__version__", "__package_name__", "__author__", + "bedboss", "bedqc", "bedmaker", + "BedMaker", "bedstat", + "run_all", + "run_all_by_pep", ] _LOGGER = logmuse.init_logger("bedboss") diff --git a/bedboss/_version.py b/bedboss/_version.py index 1822f2d..b0548b6 100644 --- a/bedboss/_version.py +++ b/bedboss/_version.py @@ -1 +1 @@ -__version__ = "0.1.0a3" +__version__ = "0.1.0a4" diff --git a/bedboss/bedboss.py b/bedboss/bedboss.py index f444f15..5b20030 100644 --- a/bedboss/bedboss.py +++ b/bedboss/bedboss.py @@ -28,7 +28,7 @@ check_db_connection, ) from bedboss.exceptions import OpenSignalMatrixException -from bedboss import __version__ +from bedboss._version import __version__ _LOGGER = logging.getLogger("bedboss") @@ -57,7 +57,11 @@ def get_osm_path(genome: str) -> Union[str, None]: if not os.path.exists(osm_path): if not os.path.exists(OPEN_SIGNAL_FOLDER): os.makedirs(OPEN_SIGNAL_FOLDER) - download_file(url=f"{OPEN_SIGNAL_URL}{osm_name}", path=osm_path, no_fail=True,) + download_file( + url=f"{OPEN_SIGNAL_URL}{osm_name}", + path=osm_path, + no_fail=True, + ) return osm_path diff --git a/bedboss/bedstat/bedstat.py b/bedboss/bedstat/bedstat.py index 0360235..ef14112 100755 --- a/bedboss/bedstat/bedstat.py +++ b/bedboss/bedstat/bedstat.py @@ -239,7 +239,7 @@ def bedstat( del plot["name"] data.update({plot_id: plot}) bbc.bed.report( - sample_name=bed_digest, + record_identifier=bed_digest, values=data, force_overwrite=force_overwrite, ) diff --git a/bedboss/cli.py b/bedboss/cli.py index ef97d3b..c566436 100644 --- a/bedboss/cli.py +++ b/bedboss/cli.py @@ -2,7 +2,7 @@ from argparse import ArgumentParser import logmuse -from bedboss import __version__, __package_name__ +from bedboss._version import __version__ def build_argparser() -> ArgumentParser: @@ -11,7 +11,7 @@ def build_argparser() -> ArgumentParser: :retrun: Tuple[pipeline, arguments] """ parser = VersionInHelpParser( - prog=__package_name__, + prog="bedboss", description="Warehouse of pipelines for BED-like files: " "bedmaker, bedstat, and bedqc.", epilog="", diff --git a/docs/how_run_script.md b/docs/how_run_script.md new file mode 100644 index 0000000..c45c814 --- /dev/null +++ b/docs/how_run_script.md @@ -0,0 +1,77 @@ +# How to run bedboss as a Python API + +## Install bedboss + +```bash +pip install bedboss +``` + +## Run bedboss all + +```python +from bedboss import run_all + +run_all( + sample_name="example_sample_name", + input_file="example/path/to/input_file", + input_type="bed", + outfolder="example/path/to/outfolder", + genome="hg38", + bedbase_config="example/path/to/bedbase_config.yaml", + # + another optional arguments +) + + +``` + + +## Run bedboss all-pep + +```python +from bedboss import run_all_by_pep + +run_all_by_pep( + pep="example/path/to/pep.yaml" +) +``` + +## Run bedboss make + +```python +from bedboss import BedMaker + +BedMaker( + input_file="example/path/to/input_file", + input_type="bed", + output_bed="example/path/to/output_bed", + output_bigbed="example/path/to/output_bigbed", + sample_name="example_sample_name", + genome="hg38", +) + +``` + +## Run bedboss stat + +```python +from bedboss import bedstat + +bedstat( + bedfile="example/path/to/bedfile.bed", + bedbase_config="example/path/to/bedbase_config.yaml", + genome="hg38", + outfolder="example/path/to/outfolder", +) + +``` + +## Run bedboss qc + +```python +from bedboss import bedqc + +bedqc( + bedfile="example/path/to/bedfile.bed", + outfolder="example/path/to/outfolder", +) +``` \ No newline at end of file diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index 31c63db..d03f2b5 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -3,9 +3,8 @@ coloredlogs>=15.0.1 peppy>=0.40.0a4 yacman>=0.8.4 requests>=2.28.2 -piper>=0.13.2 -bbconf>=0.4.0a1 +piper>=0.13.3a1 +bbconf>=0.4.0a3 refgenconf>=0.12.2 pandas>=1.5.3 -ubiquerg>=0.6.2 -# geniml \ No newline at end of file +ubiquerg>=0.6.2 \ No newline at end of file