Skip to content

Commit

Permalink
feat: skip empty regions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvollger committed Jul 23, 2024
1 parent bff5459 commit 1e75fb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pileup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,16 @@ fn run_rgn(
let chrom_len = bam.header().target_len(tid).unwrap() as usize;

let windows = split_fetch_definition(&rgn, chrom_len, WINDOW_SIZE);
log::debug!("Splitting region into {} windows", windows.len());
log::debug!("Splitting {} into {} windows", chrom, windows.len());
for (chrom_start, chrom_end) in windows {
// check if region has data
bam.fetch((chrom, chrom_start, chrom_end))?;
let mut tmp_records = bam.records();
let tmp_rec = tmp_records.next();
if tmp_rec.is_none() {
continue;
}
// fetch the data
bam.fetch((chrom, chrom_start, chrom_end))?;
let records = bam.records();
// make the pileup
Expand Down

0 comments on commit 1e75fb4

Please sign in to comment.