centralize header element removal in reduce reads

This commit is contained in:
Mauricio Carneiro 2012-11-14 13:59:34 -05:00
parent e35fd1c717
commit 8b749673bc
2 changed files with 9 additions and 8 deletions

View File

@ -253,7 +253,6 @@ public class ReduceReads extends ReadWalker<LinkedList<GATKSAMRecord>, ReduceRea
intervalList.addAll(toolkit.getIntervals()); intervalList.addAll(toolkit.getIntervals());
// todo -- rework the whole NO_PG_TAG thing
final boolean preSorted = true; final boolean preSorted = true;
final boolean indexOnTheFly = true; final boolean indexOnTheFly = true;
final boolean keep_records = true; final boolean keep_records = true;

View File

@ -220,7 +220,6 @@ public class SlidingWindow {
regions = findVariantRegions(0, breakpoint, markedSites.getVariantSiteBitSet(), !forceClose); regions = findVariantRegions(0, breakpoint, markedSites.getVariantSiteBitSet(), !forceClose);
} }
// todo -- can be more aggressive here removing until the NEW window header start location after closing the variant regions
while (!readsInWindow.isEmpty() && readsInWindow.first().getSoftEnd() < windowHeaderStartLocation) { while (!readsInWindow.isEmpty() && readsInWindow.first().getSoftEnd() < windowHeaderStartLocation) {
readsInWindow.pollFirst(); readsInWindow.pollFirst();
} }
@ -607,9 +606,7 @@ public class SlidingWindow {
toRemove.add(read); toRemove.add(read);
} }
} }
for (GATKSAMRecord read : toRemove) { removeReadsFromWindow(toRemove);
readsInWindow.remove(read);
}
} }
return allReads; return allReads;
} }
@ -805,9 +802,8 @@ public class SlidingWindow {
hetReads.add(finalizeRunningConsensus()); hetReads.add(finalizeRunningConsensus());
} }
for (GATKSAMRecord read : toRemove) { removeReadsFromWindow(toRemove);
readsInWindow.remove(read);
}
return hetReads; return hetReads;
} }
@ -924,5 +920,11 @@ public class SlidingWindow {
} }
} }
} }
private void removeReadsFromWindow (List<GATKSAMRecord> readsToRemove) {
for (GATKSAMRecord read : readsToRemove) {
readsInWindow.remove(read);
}
}
} }