Skip to content

Commit

Permalink
Merge pull request #58 from dburkhardt/master
Browse files Browse the repository at this point in the history
Update pl.read_csv call (#57) + peak_calling bugfix (#61)
  • Loading branch information
cbravo93 authored Jan 31, 2023
2 parents 242c2a4 + cf4ec85 commit 219225d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions pycisTopic/pseudobulk_peak_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def export_pseudobulk(
remove_duplicates: bool, optional
Whether duplicates should be removed before converting the data to bigwig.
split_pattern: str, optional
Pattern to split cell barcode from sample id. Default: ___ .
Pattern to split cell barcode from sample id. Default: '___'. Note, if `split_pattern` is not None, then `export_pseudobulk` will
attempt to infer `sample_id` from the index of `input_data` and ignore `sample_id_col`.
use_polars: bool, optional
Whether to use polars to read fragments files. Default: True.
**kwargs
Expand Down Expand Up @@ -521,7 +522,7 @@ def macs_call_peak(
q_value=q_value,
nolambda=nolambda,
)
log.info(name + " done!")
log.info(f"{name} done!")
return MACS_peak_calling

@ray.remote
Expand Down Expand Up @@ -645,7 +646,7 @@ def __init__(
):
self.macs_path = macs_path
self.treatment = bed_path
self.name = name
self.name = str(name)
self.outdir = outdir
self.input_format = input_format
self.gsize = genome_size
Expand Down Expand Up @@ -691,7 +692,7 @@ def call_peak(self):
self.ext_size,
self.keep_dup,
)
log.info("Calling peaks for " + self.name + " with %s", cmd)
log.info(f"Calling peaks for {self.name} with {cmd}")
try:
subprocess.check_output(args=cmd, shell=True, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
Expand All @@ -707,7 +708,7 @@ def load_narrow_peak(self):
Load MACS2 narrow peak files as :class:`pr.PyRanges`.
"""
narrow_peak = pd.read_csv(
os.path.join(self.outdir, self.name + "_peaks.narrowPeak"),
os.path.join(self.outdir, f"{self.name}_peaks.narrowPeak"),
sep="\t",
header=None,
)
Expand Down
2 changes: 1 addition & 1 deletion pycisTopic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def read_fragments_from_file(
df = (
pl.read_csv(
fragments_bed_filename,
has_headers=False,
has_header=False,
skip_rows=skip_rows,
sep="\t",
use_pyarrow=True,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ numba
numpy
pyopenssl
pandas>=1.2.0,!=1.3.0
polars
polars>=0.11.0
pybedtools
pyfasta
pyranges
Expand Down

0 comments on commit 219225d

Please sign in to comment.