Skip to content

Commit

Permalink
added universe to ppipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Jun 3, 2024
1 parent 040ddac commit 605ff78
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
6 changes: 6 additions & 0 deletions bedboss/bedboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ def insert_pep(
upload_pephub=upload_pephub,
pm=pm,
)
if pep_sample.get("universe"):
bbagent.bed.add_universe(
bed_id,
bedset_id=pep_sample.get("universe_bedset"),
construct_method=pep_sample.get("universe_method"),
)
processed_ids.append(bed_id)
except BedBossException as e:
_LOGGER.error(f"Failed to process {pep_sample.sample_name}. See {e}")
Expand Down
47 changes: 45 additions & 2 deletions bedboss/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ def run_all(
upload_qdrant: bool = typer.Option(False, help="Upload to Qdrant"),
upload_s3: bool = typer.Option(False, help="Upload to S3"),
upload_pephub: bool = typer.Option(False, help="Upload to PEPHub"),
# Universes
universe: bool = typer.Option(False, help="Create a universe"),
universe_method: str = typer.Option(
None, help="Method used to create the universe"
),
universe_bedset: str = typer.Option(
None, help="Bedset used used to create the universe"
),
# PipelineManager
multi: bool = typer.Option(False, help="Run multiple samples"),
recover: bool = typer.Option(True, help="Recover from previous run"),
Expand All @@ -94,13 +102,16 @@ def run_all(
Run the bedboss pipeline for a single bed file
"""
from bedboss.bedboss import run_all as run_all_bedboss
from bbconf.bbagent import BedBaseAgent

run_all_bedboss(
agent = BedBaseAgent(bedbase_config)

bed_id = run_all_bedboss(
input_file=input_file,
input_type=input_type,
outfolder=outfolder,
genome=genome,
bedbase_config=bedbase_config,
bedbase_config=agent,
license_id=license_id,
rfg_config=rfg_config,
narrowpeak=narrowpeak,
Expand All @@ -117,6 +128,13 @@ def run_all(
pm=create_pm(outfolder=outfolder, multi=multi, recover=recover, dirty=dirty),
)

if universe:
agent.bed.add_universe(
bedfile_id=bed_id,
bedset_id=universe_bedset,
construct_method=universe_method,
)


@app.command(help="Run the all bedboss pipeline for a bed files in a PEP")
def run_pep(
Expand Down Expand Up @@ -426,6 +444,31 @@ def delete_bedset(
print(f"BedSet {identifier} deleted from the bedbase database")


#
# @app.command(help="Tokenize a bed file")
# def tokenize_bed(
# bed_id: str = typer.Option(
# ...,
# help="Path to the bed file",
# exists=True,
# file_okay=True,
# readable=True,
# ),
# universe_id: str = typer.Option(
# None,
# help="Universe ID",
# ),
# bedbase_config: str = typer.Option(
# ...,
# help="Path to the bedbase config file",
# exists=True,
# file_okay=True,
# readable=True,
# ),
#
# )


@app.command(help="check installed R packages")
def check_requirements():
from bedboss.bedboss import requirements_check
Expand Down

0 comments on commit 605ff78

Please sign in to comment.