Skip to content

Commit 219225d

Browse files
authored
Merge pull request #58 from dburkhardt/master
Update pl.read_csv call (#57) + peak_calling bugfix (#61)
2 parents 242c2a4 + cf4ec85 commit 219225d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pycisTopic/pseudobulk_peak_calling.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def export_pseudobulk(
6464
remove_duplicates: bool, optional
6565
Whether duplicates should be removed before converting the data to bigwig.
6666
split_pattern: str, optional
67-
Pattern to split cell barcode from sample id. Default: ___ .
67+
Pattern to split cell barcode from sample id. Default: '___'. Note, if `split_pattern` is not None, then `export_pseudobulk` will
68+
attempt to infer `sample_id` from the index of `input_data` and ignore `sample_id_col`.
6869
use_polars: bool, optional
6970
Whether to use polars to read fragments files. Default: True.
7071
**kwargs
@@ -521,7 +522,7 @@ def macs_call_peak(
521522
q_value=q_value,
522523
nolambda=nolambda,
523524
)
524-
log.info(name + " done!")
525+
log.info(f"{name} done!")
525526
return MACS_peak_calling
526527

527528
@ray.remote
@@ -645,7 +646,7 @@ def __init__(
645646
):
646647
self.macs_path = macs_path
647648
self.treatment = bed_path
648-
self.name = name
649+
self.name = str(name)
649650
self.outdir = outdir
650651
self.input_format = input_format
651652
self.gsize = genome_size
@@ -691,7 +692,7 @@ def call_peak(self):
691692
self.ext_size,
692693
self.keep_dup,
693694
)
694-
log.info("Calling peaks for " + self.name + " with %s", cmd)
695+
log.info(f"Calling peaks for {self.name} with {cmd}")
695696
try:
696697
subprocess.check_output(args=cmd, shell=True, stderr=subprocess.STDOUT)
697698
except subprocess.CalledProcessError as e:
@@ -707,7 +708,7 @@ def load_narrow_peak(self):
707708
Load MACS2 narrow peak files as :class:`pr.PyRanges`.
708709
"""
709710
narrow_peak = pd.read_csv(
710-
os.path.join(self.outdir, self.name + "_peaks.narrowPeak"),
711+
os.path.join(self.outdir, f"{self.name}_peaks.narrowPeak"),
711712
sep="\t",
712713
header=None,
713714
)

pycisTopic/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def read_fragments_from_file(
394394
df = (
395395
pl.read_csv(
396396
fragments_bed_filename,
397-
has_headers=False,
397+
has_header=False,
398398
skip_rows=skip_rows,
399399
sep="\t",
400400
use_pyarrow=True,

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ numba
1818
numpy
1919
pyopenssl
2020
pandas>=1.2.0,!=1.3.0
21-
polars
21+
polars>=0.11.0
2222
pybedtools
2323
pyfasta
2424
pyranges

0 commit comments

Comments
 (0)