Skip to content

Commit

Permalink
Fixed insert cli
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Nov 27, 2023
1 parent ad61770 commit fb99493
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
13 changes: 10 additions & 3 deletions bedboss/bedboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ def insert_pep(
just_db_commit: bool = False,
no_db_commit: bool = False,
force_overwrite: bool = False,
*args,
**kwargs,
) -> NoReturn:
"""
Run all bedboss pipelines for all samples in the pep file.
bedmaker -> bedqc -> bedstat -> qdrant_indexing -> bedbuncher
:param bedbase_config: bedbase configuration file path
:param output_folder: output statistics folder
Expand Down Expand Up @@ -256,13 +259,17 @@ def insert_pep(
just_db_commit=just_db_commit,
no_db_commit=no_db_commit,
force_overwrite=force_overwrite,
skip_qdrant=skip_qdrant
skip_qdrant=skip_qdrant,
)
pep.samples[i].record_identifier = bed_id

if create_bedset:
_LOGGER.info(f"Creating bedset from {pep.name}")
run_bedbuncher(bedbase_config=bedbase_config, bedset_pep=pep, pephub_registry_path=pephub_registry_path)
run_bedbuncher(
bedbase_config=bedbase_config,
bedset_pep=pep,
pephub_registry_path=pephub_registry_path,
)
else:
_LOGGER.info(
f"Skipping bedset creation. Create_bedset is set to {create_bedset}"
Expand Down Expand Up @@ -297,7 +304,7 @@ def main(test_args: dict = None) -> NoReturn:
if args_dict["command"] == "all":
run_all(pm=pm, **args_dict)
elif args_dict["command"] == "insert":
insert_pep(args_dict["pep_config"])
insert_pep(**args_dict)
elif args_dict["command"] == "make":
BedMaker(pm=pm, **args_dict)
elif args_dict["command"] == "qc":
Expand Down
2 changes: 2 additions & 0 deletions bedboss/bedbuncher/bedbuncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def add_bedset_to_database(
"pephub_path": pephub_registry_path or "",
}

print(pephub_registry_path)

if heavy:
_LOGGER.info("Heavy processing is True. Calculating plots...")
plot_value = create_plots(
Expand Down
22 changes: 16 additions & 6 deletions bedboss/bedstat/bedstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ def bedstat(
)
if not just_db_commit:
if not pm:
pm_out_path = os.path.abspath(
os.path.join(outfolder_stats, "pypiper", bed_digest)
)
try:
os.makedirs(pm_out_path)
except FileExistsError:
pass
pm = pypiper.PipelineManager(
name="bedstat-pipeline",
outfolder=outfolder,
outfolder=pm_out_path,
pipestat_sample_name=bed_digest,
)

rscript_path = os.path.join(
Expand Down Expand Up @@ -148,11 +156,13 @@ def bedstat(

if not other_metadata:
other_metadata = {}
other_metadata.update({"description": description,
"treatment": treatment,
"cell_type": cell_type,
})

other_metadata.update(
{
"description": description,
"treatment": treatment,
"cell_type": cell_type,
}
)

# unlist the data, since the output of regionstat.R is a dict of lists of
# length 1 and force keys to lower to correspond with the
Expand Down

0 comments on commit fb99493

Please sign in to comment.