Skip to content

Commit 5a21300

Browse files
Merge pull request #73 from databio/dev
Release 0.4.0
2 parents 813a61a + 9bd2963 commit 5a21300

31 files changed

+831
-117
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ include bedboss/qdrant_index/*
99
include bedboss/bedbuncher/*
1010
include bedboss/bedbuncher/tools/*
1111
include bedboss/bedclassifier/*
12-
include bedboss/tokens/*
12+
include bedboss/tokens/*
13+
include bedboss/bbuploader/*

bedboss/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
""" Package-level data """
22

3-
import logmuse
4-
import coloredlogs
53
import logging
64

5+
import coloredlogs
6+
import logmuse
77

88
from bedboss._version import __version__
99

10-
1110
__package_name__ = "bedboss"
1211

1312
__author__ = [

bedboss/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
23
import logmuse
34

45
from bedboss.cli import app

bedboss/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.4.0"

bedboss/bbuploader/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
""" Package-level data """
2+
3+
import coloredlogs
4+
import logmuse
5+
6+
from bedboss.bbuploader.constants import PKG_NAME
7+
8+
_LOGGER = logmuse.init_logger(PKG_NAME)
9+
coloredlogs.install(
10+
logger=_LOGGER,
11+
datefmt="%H:%M:%S",
12+
fmt="[%(levelname)s] [%(asctime)s] [BBUPLOADER] %(message)s",
13+
)

bedboss/bbuploader/cli.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import typer
2+
from bedboss._version import __version__
3+
4+
app_bbuploader = typer.Typer(
5+
pretty_exceptions_short=False,
6+
pretty_exceptions_show_locals=False,
7+
help="Automatic BEDbase uploader for GEO data",
8+
)
9+
10+
11+
@app_bbuploader.command(
12+
help="Run bedboss uploading pipeline for specified genome in specified period of time."
13+
)
14+
def upload_all(
15+
bedbase_config: str = typer.Option(..., help="Path to bedbase config file"),
16+
outfolder: str = typer.Option(..., help="Path to output folder"),
17+
start_date: str = typer.Option(
18+
None, help="The earliest date when opep was updated [Default: 2000/01/01]"
19+
),
20+
end_date: str = typer.Option(
21+
None, help="The latest date when opep was updated [Default: today's date]"
22+
),
23+
search_limit: int = typer.Option(
24+
10, help="Limit of projects to be searched. [Default: 10]"
25+
),
26+
search_offset: int = typer.Option(
27+
0, help="Limit of projects to be searched. [Default: 0]"
28+
),
29+
download_limit: int = typer.Option(
30+
100, help="Limit of projects to be downloaded [Default: 100]"
31+
),
32+
genome: str = typer.Option(
33+
None,
34+
help="Reference genome [Default: None] (e.g. hg38) - if None, all genomes will be processed",
35+
),
36+
create_bedset: bool = typer.Option(
37+
True, help="Create bedset from bed files. [Default: True]"
38+
),
39+
rerun: bool = typer.Option(True, help="Re-run all the samples. [Default: False]"),
40+
run_skipped: bool = typer.Option(
41+
True, help="Run skipped projects. [Default: False]"
42+
),
43+
run_failed: bool = typer.Option(True, help="Run failed projects. [Default: False]"),
44+
):
45+
from .main import upload_all as upload_all_function
46+
47+
upload_all_function(
48+
bedbase_config=bedbase_config,
49+
outfolder=outfolder,
50+
start_date=start_date,
51+
end_date=end_date,
52+
search_limit=search_limit,
53+
search_offset=search_offset,
54+
download_limit=download_limit,
55+
genome=genome,
56+
create_bedset=create_bedset,
57+
rerun=rerun,
58+
run_skipped=run_skipped,
59+
run_failed=run_failed,
60+
)
61+
62+
63+
@app_bbuploader.command(help="Run bedboss uploading pipeline for GSE.")
64+
def upload_gse(
65+
bedbase_config: str = typer.Option(..., help="Path to bedbase config file"),
66+
outfolder: str = typer.Option(..., help="Path to output folder"),
67+
gse: str = typer.Option(
68+
..., help="GSE number that can be found in pephub. eg. GSE123456"
69+
),
70+
create_bedset: bool = typer.Option(
71+
True, help="Create bedset from bed files. [Default: True]"
72+
),
73+
genome: str = typer.Option(
74+
None,
75+
help=" reference genome to upload to database. If None, all genomes will be processed",
76+
),
77+
rerun: bool = typer.Option(True, help="Re-run all the samples. [Default: False]"),
78+
run_skipped: bool = typer.Option(
79+
True, help="Run skipped projects. [Default: False]"
80+
),
81+
run_failed: bool = typer.Option(True, help="Run failed projects. [Default: False]"),
82+
):
83+
from .main import upload_gse as upload_gse_function
84+
85+
upload_gse_function(
86+
bedbase_config=bedbase_config,
87+
outfolder=outfolder,
88+
gse=gse,
89+
create_bedset=create_bedset,
90+
genome=genome,
91+
rerun=rerun,
92+
run_skipped=run_skipped,
93+
run_failed=run_failed,
94+
)
95+
96+
97+
def version_callback(value: bool):
98+
if value:
99+
typer.echo(f"Bedboss version: {__version__}")
100+
raise typer.Exit()
101+
102+
103+
@app_bbuploader.callback()
104+
def common(
105+
ctx: typer.Context,
106+
version: bool = typer.Option(
107+
None, "--version", "-v", callback=version_callback, help="App version"
108+
),
109+
):
110+
pass

bedboss/bbuploader/constants.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PKG_NAME = "bbuploader"
2+
3+
FILE_FOLDER_NAME = "files"
4+
5+
DEFAULT_GEO_TAG = "samples"
6+
7+
8+
class STATUS:
9+
SUCCESS = "SUCCESS"
10+
FAIL = "FAIL"
11+
PARTIAL = "PARTIAL"
12+
PROCESSING = "PROCESSING"
13+
SKIPPED = "SKIPPED"

0 commit comments

Comments
 (0)