Skip to content

Commit

Permalink
Change default value of min_len to extsize in tl.macs3.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed Mar 2, 2024
1 parent e683c19 commit 9c9a36c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
sudo pip install --upgrade pip
pip install --user coverage pytest hypothesis wheel
pip install --user coverage pytest hypothesis==6.72.4 wheel
- name: Build wheel files
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'
CIBW_SKIP: "pp* *-win32 *-musllinux*"
CIBW_BUILD: ${{ matrix.python_version }}
CIBW_TEST_REQUIRES: pytest hypothesis
CIBW_TEST_REQUIRES: pytest hypothesis==6.72.4
CIBW_TEST_COMMAND: "pytest {project}/snapatac2-python/tests"

steps:
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- Fix: #221: 'pp.knn' with 'method=pynndescent' invalid csr matrix.
- Fix: #226: Backed AnnData does not support numpy string array.
- Fix: #232: `tempdir` is not respected in `tl.macs3`.
- Fix: #242: Change default value of `min_len` to `extsize` in `tl.macs3`, in order to be
consistent with the `macs3` command line tool.
- Other minor bug fixes.

## Release 2.5.3 (released Jan 16, 2024)
Expand Down
2 changes: 1 addition & 1 deletion snapatac2-python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion snapatac2-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snapatac2"
version = "2.5.4-dev3"
version = "2.5.4-dev4"
edition = "2021"
authors = ["Kai Zhang <[email protected]>"]
description = "Rust APIs"
Expand Down
5 changes: 4 additions & 1 deletion snapatac2-python/python/snapatac2/tools/_call_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def macs3(
nolambda: bool = False,
shift: int = -100,
extsize: int = 200,
min_len: int | None = None,
blacklist: Path | None = None,
key_added: str = 'macs3',
tempdir: Path | None = None,
Expand Down Expand Up @@ -60,6 +61,8 @@ def macs3(
The shift size in MACS.
extsize
The extension size in MACS.
min_len
The minimum length of a called peak. If None, it is set to `extsize`.
blacklist
Path to the blacklist file in BED format. If provided, regions in the blacklist will be
removed.
Expand Down Expand Up @@ -110,7 +113,7 @@ def macs3(

options.gsize = adata.uns['reference_sequences']['reference_seq_length'].sum() # Estimated genome size
options.maxgap = 30 # The maximum allowed gap between two nearby regions to be merged
options.minlen = 50 # The minimum length of a called peak
options.minlen = extsize if min_len is None else min_len
options.shift = shift
options.nolambda = nolambda
options.smalllocal = 1000
Expand Down
4 changes: 3 additions & 1 deletion snapatac2-python/src/call_peaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ pub fn create_fwtrack_obj<'py>(
let replicates = files
.into_iter()
.map(|fl| {
let fwt = macs.getattr("FWTrack")?.call1((100000,))?;
let kwargs = pyo3::types::PyDict::new(py);
kwargs.set_item("buffer_size", 100000)?;
let fwt = macs.getattr("FWTrack")?.call((), Some(kwargs))?;
let reader = utils::open_file_for_read(&fl);
bed_utils::bed::io::Reader::new(reader, None)
.into_records::<Fragment>()
Expand Down

0 comments on commit 9c9a36c

Please sign in to comment.