|
|
@@ -128,13 +128,16 @@ pub fn range_depths(
|
|
|
) -> Result<Vec<u32>> {
|
|
|
bam.fetch((chr, start, stop))?;
|
|
|
|
|
|
- let mut depths = Vec::new();
|
|
|
+ let mut depths = Vec::with_capacity((stop - start) as usize);
|
|
|
+ depths.fill(0);
|
|
|
|
|
|
for p in bam.pileup() {
|
|
|
let pileup = p.context(format!("eRR"))?;
|
|
|
let rstart = pileup.pos() as i32;
|
|
|
if rstart >= start && rstart < stop {
|
|
|
- depths.push(pileup.depth());
|
|
|
+ // depths.push(pileup.depth());
|
|
|
+ let v = depths.get_mut((rstart - start) as usize).unwrap();
|
|
|
+ *v = pileup.depth();
|
|
|
} else if rstart >= stop {
|
|
|
break;
|
|
|
}
|