Skip to content

Commit

Permalink
Merge pull request #61 from databio/dev
Browse files Browse the repository at this point in the history
Release 0.2.1
  • Loading branch information
khoroshevskyi authored Apr 11, 2024
2 parents efa915c + 426df48 commit 4298e4b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bedboss/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0"
__version__ = "0.2.1"
5 changes: 4 additions & 1 deletion bedboss/bedboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from bbconf.bbagent import BedBaseAgent
from bbconf.models.base_models import FileModel


from bedboss.bedstat.bedstat import bedstat
from bedboss.bedmaker.bedmaker import make_all
from bedboss.bedbuncher import run_bedbuncher
Expand Down Expand Up @@ -231,6 +230,7 @@ def insert_pep(
:param str output_folder: output statistics folder
:param Union[str, peppy.Project] pep: path to the pep file or pephub registry path
:param str bedset_id: bedset identifier
:param str bedset_name: bedset name
:param str rfg_config: path to the genome config file (refgenie)
:param bool create_bedset: whether to create bedset
:param bool upload_qdrant: whether to upload bedfiles to qdrant
Expand Down Expand Up @@ -263,6 +263,7 @@ def insert_pep(
validate_project(pep, BEDBOSS_PEP_SCHEMA_PATH)

for i, pep_sample in enumerate(pep.samples):
m.print_success(f"Processing sample {i + 1}/{len(pep.samples)}")
_LOGGER.info(f"Running bedboss pipeline for {pep_sample.sample_name}")
if pep_sample.get("file_type"):
if pep_sample.get("file_type").lower() == "narrowpeak":
Expand All @@ -276,6 +277,7 @@ def insert_pep(
input_file=pep_sample.input_file,
input_type=pep_sample.input_type,
genome=pep_sample.genome,
name=pep_sample.sample_name,
bedbase_config=bbagent,
narrowpeak=is_narrow_peak,
chrom_sizes=pep_sample.get("chrom_sizes"),
Expand Down Expand Up @@ -310,6 +312,7 @@ def insert_pep(
upload_pephub=upload_pephub,
upload_s3=upload_s3,
no_fail=no_fail,
force_overwrite=force_overwrite,
)
else:
_LOGGER.info(
Expand Down
1 change: 1 addition & 0 deletions bedboss/bedbuncher/bedbuncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def run_bedbuncher(
plots=plots.model_dump(exclude_none=True, exclude_unset=True),
local_path=output_folder,
no_fail=no_fail,
overwrite=force_overwrite,
)


Expand Down
18 changes: 11 additions & 7 deletions bedboss/bedmaker/bedmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ def make_bigbed(
pm_clean = False
_LOGGER.info(f"Generating bigBed files for: {bed_path}")

if not os.path.exists(output_path):
os.makedirs(output_path)
bigbed_output_folder = os.path.join(output_path, BIGBED_FILE_NAME)
if not os.path.exists(bigbed_output_folder):
os.makedirs(bigbed_output_folder)

bedfile_name = os.path.split(bed_path)[1]
fileid = os.path.splitext(os.path.splitext(bedfile_name)[0])[0]
# Produce bigBed (big_narrow_peak) file from peak file
big_bed_path = os.path.join(output_path, BIGBED_FILE_NAME, fileid + ".bigBed")
big_bed_path = os.path.join(bigbed_output_folder, fileid + ".bigBed")
if not chrom_sizes:
try:
chrom_sizes = get_chrom_sizes(genome=genome, rfg_config=rfg_config)
Expand Down Expand Up @@ -191,10 +192,13 @@ def make_bed(

# creat cmd to run that convert non bed file to bed file
if input_type == InputTypes.BED.value:
# If bed file was provided:
bbclient = BBClient()
bed_id = bbclient.add_bed_to_cache(input_file)
output_path = bbclient.seek(bed_id)
try:
# If bed file was provided:
bbclient = BBClient()
bed_id = bbclient.add_bed_to_cache(input_file)
output_path = bbclient.seek(bed_id)
except FileNotFoundError as e:
raise BedBossException(f"File not found: {input_file} Error: {e}")

else:
_LOGGER.info(f"Converting {input_file} to BED format")
Expand Down
8 changes: 8 additions & 0 deletions bedboss/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@ def delete_bedset(
print(f"BedSet {identifier} deleted from the bedbase database")


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

print("Checking piplines requirements...")
requirements_check()


@app.callback()
def common(
ctx: typer.Context,
Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

# [0.2.1] - 2024-04-09
## Changed
- small naming tweaks

## Added
- added requirement check to cli


# [0.2.0] - 2024-04-08
## Changed
- moved all uploading functionality to the `bbconf` package
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ peppy>=0.40.1
yacman>=0.8.4
requests>=2.28.2
piper>=v0.14.0
bbconf>=0.5.0
bbconf>=0.5.1
# bbconf @ git+https://github.com/databio/bbconf.git@dev#egg=bbconf
refgenconf>=0.12.2
pandas>=1.5.3
Expand Down

0 comments on commit 4298e4b

Please sign in to comment.