Skip to content

Commit

Permalink
fix duplication rate calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed May 2, 2024
1 parent f1245ee commit 1228d3e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
### Bugs fixed:
- Fix #252: `tl.spectral` does not raise an error when the input matrix is in
compressed column format, whereas it should expect a compressed sparse row format.
- Fix a bug in `pp.import_data` which produces incorrect duplication rates when
the input data contains mitochondrial reads.

## Release 2.6.0 (released March 9, 2024)

Expand Down
2 changes: 1 addition & 1 deletion snapatac2-core/src/preprocessing/count_data/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ where
let mut qc = FragmentSummary::new(mitochrondrial_dna);
let mut values = Vec::new();
fragments.into_iter().for_each(|f| {
qc.update(&f);
let chrom = &f.chrom;
if genome_index.contain_chrom(chrom) {
qc.update(&f);
let start = f.start as i64;
let end = f.end as i64;
let size = end - start;
Expand Down
2 changes: 1 addition & 1 deletion snapatac2-core/src/preprocessing/qc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ impl<'a> FragmentSummary<'a> {
}

pub(crate) fn update(&mut self, fragment: &Fragment) {
self.num_total_fragment += fragment.count as u64;
if self.mitochondrial_dna.contains(fragment.chrom.as_str()) {
self.num_mitochondrial += 1;
} else {
self.num_total_fragment += fragment.count as u64;
self.num_unique_fragment += 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions snapatac2-python/python/snapatac2/preprocessing/_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def import_data(
temporary files is proportional to the number of records in the fragment file.
For large fragment files, it is recommended to set `tempdir` to a location with
sufficient space in order to avoid running out of disk space.
- The QC metrics are computed only for reads that are included by the `whitelist`
or `chrom_sizes`.
Warning
-------
Expand Down

0 comments on commit 1228d3e

Please sign in to comment.