Skip to content

Commit

Permalink
fix a bug in ex.export_coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed Jan 16, 2024
1 parent 306d908 commit ab502b5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SnapATAC2: A Python/Rust package for single-cell epigenomics analysis

![PyPI](https://img.shields.io/pypi/v/snapatac2)
![PyPI - Downloads](https://img.shields.io/pypi/dm/snapatac2)
![Continuous integration](https://github.com/kaizhang/SnapATAC2/workflows/Continuous%20integration/badge.svg)
![Continuous integration](https://github.com/kaizhang/SnapATAC2/workflows/test-python-package/badge.svg)
![GitHub Repo stars](https://img.shields.io/github/stars/kaizhang/SnapATAC2?style=social)

SnapATAC2 is a flexible, versatile, and scalable single-cell omics analysis framework, featuring:
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Add `count_frag_as_reads` argument to `pp.make_tile_matrix`, `pp.make_peak_matrix`,
and `pp.make_gene_matrix`.

### Bugs fixed:

- Fix: `ex.export_coverage` generates empty files in v2.5.2.

## Release 2.5.2 (released Jan 4, 2024)

### Features:
Expand Down
2 changes: 1 addition & 1 deletion snapatac2-core/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ where
fragments.for_each(|frag| {
let not_in_blacklist = blacklist_regions.map_or(true, |bl| !bl.is_overlapped(&frag));
let is_single = frag.strand().is_some();
if not_in_blacklist && is_single {
if not_in_blacklist {
if ignore_for_norm.map_or(true, |x| !x.contains(frag.chrom())) {
total_count += 1.0;
}
Expand Down
16 changes: 1 addition & 15 deletions snapatac2-python/snapatac2/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,4 @@ def export_coverage(
adata, list(groupby), bin_size, out_dir, prefix, suffix, output_format, selections,
blacklist, normalization, ignore_for_norm, min_frag_length,
max_frag_length, compression, compression_level, tempdir, n_jobs,
)

def export_bigwig(
adata: internal.AnnData | internal.AnnDataSet,
groupby: str | list[str],
selections: list[str] | None = None,
resolution: int = 1,
out_dir: Path = "./",
prefix: str = "",
suffix: str = ".bw",
) -> dict[str, str]:
import warnings
warnings.warn("Use `ex.export_coverage` instead.", DeprecationWarning)
return export_coverage(adata, groupby=groupby, selections=selections, resolution=resolution,
out_dir=out_dir, prefix=prefix, suffix=suffix, output_format="bigwig")
)
2 changes: 1 addition & 1 deletion snapatac2-python/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def pipeline(data):

snap.pp.make_gene_matrix(data, gene_anno=snap.genome.hg38)

snap.ex.export_fragments(data, groupby="leiden")
snap.ex.export_coverage(data, groupby="leiden")

def test_backed(tmp_path):
fragment_file = snap.datasets.pbmc500(downsample=True)
Expand Down

0 comments on commit ab502b5

Please sign in to comment.