From 2b02324587b1373ea59913cbc78a342cd532e067 Mon Sep 17 00:00:00 2001 From: depristo Date: Sun, 30 May 2010 18:00:12 +0000 Subject: [PATCH] Support for detecting and automatically excluding reads reading into the adaptor sequence and, if desired, also only showing the first pair when two reads overlap in the fragment. Not enabled, an intermediate check in before updating and verifying the impact on locus walkers everywhere. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3465 348d0f76-0448-11de-a6fe-93d51630548a --- .../arguments/GATKArgumentCollection.java | 7 ++ .../gatk/executive/LinearMicroScheduler.java | 4 +- .../sting/gatk/executive/ShardTraverser.java | 4 +- .../sting/gatk/executive/WindowMaker.java | 11 ++- .../DownsamplingLocusIteratorByState.java | 2 +- .../gatk/iterators/LocusIteratorByState.java | 87 +++++++++---------- .../sting/gatk/walkers/LocusWalker.java | 46 +++------- .../sting/utils/pileup/PileupElement.java | 1 + .../sting/utils/pileup/ReadBackedPileup.java | 11 +-- .../sting/utils/sam/ReadUtils.java | 74 ++++++++++++++++ .../providers/LocusViewTemplate.java | 25 +++--- 11 files changed, 162 insertions(+), 110 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java b/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java index 6d3746d3e..e4e060fef 100755 --- a/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java +++ b/java/src/org/broadinstitute/sting/gatk/arguments/GATKArgumentCollection.java @@ -180,6 +180,10 @@ public class GATKArgumentCollection { @Argument(fullName = "enable_threaded_debugging",shortName="etd", doc="Enable debugging of threaded apps by applying exception catching in the threaded version of the GATK.", required = false) public boolean enableThreadedDebugging = false; + @Element(required = false) + @Argument(fullName = "enable_overlap_filters",shortName="eof", doc="Enable automatic removal of bases that overlap adaptor sequence or that overlap their mate pair", required = false) + public boolean enableOverlapFilters = false; + /** * marshal the data out to a object * @@ -340,6 +344,9 @@ public class GATKArgumentCollection { if (enableThreadedDebugging != other.enableThreadedDebugging) { return false; } + if (enableOverlapFilters != other.enableOverlapFilters) { + return false; + } if ((other.RODToInterval == null && RODToInterval != null) || (other.RODToInterval != null && !other.RODToInterval.equals(RODToInterval))) { return false; diff --git a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java index 0db4feb20..c427c8479 100644 --- a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java @@ -8,6 +8,7 @@ import org.broadinstitute.sting.gatk.datasources.shards.ShardStrategy; import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource; import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMDataSource; import org.broadinstitute.sting.gatk.walkers.Walker; +import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.io.DirectOutputTracker; import org.broadinstitute.sting.gatk.io.OutputTracker; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; @@ -57,7 +58,8 @@ public class LinearMicroScheduler extends MicroScheduler { for (Shard shard : shardStrategy) { // New experimental code for managing locus intervals. if(shard.getShardType() == Shard.ShardType.LOCUS || shard.getShardType() == Shard.ShardType.LOCUS_INTERVAL) { - WindowMaker windowMaker = new WindowMaker(getReadIterator(shard), shard.getGenomeLocs(), walker.getMandatoryReadFilters()); + LocusWalker lWalker = (LocusWalker)walker; + WindowMaker windowMaker = new WindowMaker(getReadIterator(shard), shard.getGenomeLocs(), walker.getMandatoryReadFilters(), lWalker.getDiscards()); for(WindowMaker.WindowMakerIterator iterator: windowMaker) { ShardDataProvider dataProvider = new LocusShardDataProvider(shard,iterator.getSourceInfo(),iterator.getLocus(),iterator,reference,rods); Object result = traversalEngine.traverse(walker, dataProvider, accumulator.getReduceInit()); diff --git a/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java b/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java index ad316d398..709a59e2c 100755 --- a/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/ShardTraverser.java @@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.datasources.shards.Shard; import org.broadinstitute.sting.gatk.traversals.TraversalEngine; import org.broadinstitute.sting.gatk.io.ThreadLocalOutputTracker; import org.broadinstitute.sting.gatk.walkers.Walker; +import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.iterators.StingSAMIterator; import org.broadinstitute.sting.utils.StingException; @@ -59,7 +60,8 @@ public class ShardTraverser implements Callable { long startTime = System.currentTimeMillis(); Object accumulator = walker.reduceInit(); - WindowMaker windowMaker = new WindowMaker(microScheduler.getReadIterator(shard),shard.getGenomeLocs(),walker.getMandatoryReadFilters()); + LocusWalker lWalker = (LocusWalker)walker; + WindowMaker windowMaker = new WindowMaker(microScheduler.getReadIterator(shard),shard.getGenomeLocs(),walker.getMandatoryReadFilters(), lWalker.getDiscards()); ShardDataProvider dataProvider = null; try { for(WindowMaker.WindowMakerIterator iterator: windowMaker) { diff --git a/java/src/org/broadinstitute/sting/gatk/executive/WindowMaker.java b/java/src/org/broadinstitute/sting/gatk/executive/WindowMaker.java index 55833be09..4deff1f9a 100644 --- a/java/src/org/broadinstitute/sting/gatk/executive/WindowMaker.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/WindowMaker.java @@ -1,6 +1,7 @@ package org.broadinstitute.sting.gatk.executive; import org.broadinstitute.sting.utils.GenomeLoc; +import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.gatk.iterators.*; import org.broadinstitute.sting.gatk.Reads; import org.broadinstitute.sting.gatk.DownsampleType; @@ -61,17 +62,19 @@ public class WindowMaker implements Iterable, I * @param iterator The data source for this window. * @param intervals The set of intervals over which to traverse. */ - public WindowMaker(StingSAMIterator iterator, List intervals, List filters) { + public WindowMaker(StingSAMIterator iterator, List intervals, List filters, EnumSet discards ) { this.sourceInfo = iterator.getSourceInfo(); this.readIterator = iterator; LocusIterator locusIterator; Iterator wrappedIterator = TraversalEngine.addMandatoryFilteringIterators(iterator, filters); if(sourceInfo.getDownsamplingMethod() != null && - (sourceInfo.getDownsamplingMethod().type == DownsampleType.EXPERIMENTAL_BY_SAMPLE || sourceInfo.getDownsamplingMethod().type == DownsampleType.EXPERIMENTAL_NAIVE_DUPLICATE_ELIMINATOR)) + (sourceInfo.getDownsamplingMethod().type == DownsampleType.EXPERIMENTAL_BY_SAMPLE || sourceInfo.getDownsamplingMethod().type == DownsampleType.EXPERIMENTAL_NAIVE_DUPLICATE_ELIMINATOR)) { + if ( discards.size() > 0 ) + throw new StingException("Experimental downsampling iterator doesn't support base discarding at this point; complain to Matt Hanna"); locusIterator = new DownsamplingLocusIteratorByState(wrappedIterator,sourceInfo); - else - locusIterator = new LocusIteratorByState(wrappedIterator,sourceInfo); + } else + locusIterator = new LocusIteratorByState(wrappedIterator,sourceInfo, discards); this.locusOverflowTracker = locusIterator.getLocusOverflowTracker(); diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java b/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java index 5c2a797f2..34e82674f 100755 --- a/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java +++ b/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java @@ -45,7 +45,7 @@ import java.util.*; public class DownsamplingLocusIteratorByState extends LocusIterator { /** our log, which we want to capture anything from this class */ - private static Logger logger = Logger.getLogger(LocusIteratorByState.class); + private static Logger logger = Logger.getLogger(DownsamplingLocusIteratorByState.class); // ----------------------------------------------------------------------------------------------------------------- // diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java b/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java index e98ca7ba5..bfb1adcb4 100755 --- a/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java +++ b/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java @@ -28,8 +28,10 @@ package org.broadinstitute.sting.gatk.iterators; import net.sf.samtools.*; import org.apache.log4j.Logger; import org.broadinstitute.sting.gatk.Reads; +import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.utils.*; +import org.broadinstitute.sting.utils.sam.ReadUtils; import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement; @@ -39,6 +41,12 @@ import java.util.*; /** Iterator that traverses a SAM File, accumulating information on a per-locus basis */ public class LocusIteratorByState extends LocusIterator { + private static long discarded_adaptor_bases = 0L; + private static long discarded_overlapped_bases = 0L; + private static long observed_bases = 0L; + + public enum Discard { ADAPTOR_BASES, SECOND_READ_OVERLAPPING_BASES } + public static final EnumSet NO_DISCARDS = EnumSet.noneOf(Discard.class); /** * the overflow tracker, which makes sure we get a limited number of warnings for locus pile-ups that @@ -251,15 +259,21 @@ public class LocusIteratorByState extends LocusIterator { //final boolean DEBUG2 = false && DEBUG; private Reads readInfo; private AlignmentContext nextAlignmentContext; + private EnumSet discards; // ----------------------------------------------------------------------------------------------------------------- // // constructors and other basic operations // // ----------------------------------------------------------------------------------------------------------------- - public LocusIteratorByState(final Iterator samIterator, Reads readInformation) { + public LocusIteratorByState(final Iterator samIterator, Reads readInformation ) { + this(samIterator, readInformation, NO_DISCARDS); + } + + public LocusIteratorByState(final Iterator samIterator, Reads readInformation, EnumSet discards ) { this.it = new PushbackIterator(samIterator); this.readInfo = readInformation; + this.discards = discards; overflowTracker = new LocusOverflowTracker(readInformation.getMaxReadsAtLocus()); } @@ -387,22 +401,36 @@ public class LocusIteratorByState extends LocusIterator { // todo -- performance problem -- should be lazy, really for ( SAMRecordState state : readStates ) { if ( state.getCurrentCigarOperator() != CigarOperator.D && state.getCurrentCigarOperator() != CigarOperator.N ) { - size++; - PileupElement p = new PileupElement(state.getRead(), state.getReadOffset()); - pile.add(p); + ReadUtils.OverlapType overlapType = ReadUtils.readPairBaseOverlapType(state.getRead(), getLocation().getStart()); + if (discards.contains(Discard.ADAPTOR_BASES) && + overlapType == ReadUtils.OverlapType.IN_ADAPTOR ) { + discarded_adaptor_bases++; + //printStatus("Adaptor bases", discarded_adaptor_bases); + continue; + } else if ( discards.contains(Discard.SECOND_READ_OVERLAPPING_BASES) && + overlapType == ReadUtils.OverlapType.OVERLAPPING && + state.getRead().getSecondOfPairFlag() ) { + // only discard second bases in the base pair + discarded_overlapped_bases++; + //printStatus("Overlapping bases", discarded_overlapped_bases); + continue; + } else { + observed_bases++; + pile.add(new PileupElement(state.getRead(), state.getReadOffset())); + size++; + } } else if ( readInfo.includeReadsWithDeletionAtLoci() && state.getCurrentCigarOperator() != CigarOperator.N ) { size++; pile.add(new PileupElement(state.getRead(), -1)); nDeletions++; } + // todo -- this looks like a bug w.r.t. including reads with deletion at loci -- MAD 05/27/10 if ( state.getRead().getMappingQuality() == 0 ) { nMQ0Reads++; } - -// if ( state.hadIndel() ) System.out.println("Indel at "+getLocation()+" in read "+state.getRead().getReadName()) ; - } + GenomeLoc loc = getLocation(); updateReadStates(); // critical - must be called after we get the current state offsets and location // if we got reads with non-D/N over the current position, we are done @@ -411,44 +439,12 @@ public class LocusIteratorByState extends LocusIterator { } } - // old implementation -- uses lists of reads and offsets -// public AlignmentContext next() { -// //if (DEBUG) { -// // logger.debug("in Next:"); -// // printState(); -// //} -// -// ArrayList reads = new ArrayList(readStates.size()); -// ArrayList offsets = new ArrayList(readStates.size()); -// -// // keep iterating forward until we encounter a reference position that has something "real" hanging over it -// // (i.e. either a real base, or a real base or a deletion if includeReadsWithDeletion is true) -// while(true) { -// collectPendingReads(readInfo.getMaxReadsAtLocus()); -// -// // todo -- performance problem -- should be lazy, really -// for ( SAMRecordState state : readStates ) { -// if ( state.getCurrentCigarOperator() != CigarOperator.D && state.getCurrentCigarOperator() != CigarOperator.N ) { -//// System.out.println("Location: "+getLocation()+"; Read "+state.getRead().getReadName()+"; offset="+state.getReadOffset()); -// reads.add(state.getRead()); -// offsets.add(state.getReadOffset()); -// } else if ( readInfo.includeReadsWithDeletionAtLoci() && state.getCurrentCigarOperator() != CigarOperator.N ) { -// reads.add(state.getRead()); -// offsets.add(-1); -// } -// } -// GenomeLoc loc = getLocation(); -// -// updateReadStates(); // critical - must be called after we get the current state offsets and location -// -// //if (DEBUG) { -// // logger.debug("DONE WITH NEXT, updating read states, current state is:"); -// // printState(); -// //} -// // if we got reads with non-D/N over the current position, we are done -// if ( reads.size() != 0 ) return new AlignmentContext(loc, reads, offsets); -// } -// } + private void printStatus(final String title, long n) { + if ( n % 10000 == 0 ) + System.out.printf("%s %d / %d = %.2f%n", title, n, observed_bases, 100.0 * n / (observed_bases + 1)); + } + + private void collectPendingReads(int maxReads) { //if (DEBUG) { @@ -483,6 +479,7 @@ public class LocusIteratorByState extends LocusIterator { } } + if (location != null) overflowTracker.exceeded(GenomeLocParser.createGenomeLoc(location.getContigIndex(),location.getStart(),rightMostEnd), curSize); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java index d8d5adefb..1d4dd149d 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java @@ -7,11 +7,13 @@ import org.broadinstitute.sting.gatk.traversals.TraversalStatistics; import org.broadinstitute.sting.gatk.filters.UnmappedReadFilter; import org.broadinstitute.sting.gatk.filters.NotPrimaryAlignmentReadFilter; import org.broadinstitute.sting.gatk.filters.DuplicateReadFilter; +import org.broadinstitute.sting.gatk.iterators.LocusIteratorByState; import net.sf.picard.filter.SamRecordFilter; import net.sf.samtools.SAMRecord; import java.util.List; import java.util.Arrays; +import java.util.EnumSet; /** * Created by IntelliJ IDEA. @@ -52,42 +54,14 @@ public abstract class LocusWalker extends Walker %b %s", rec.getReadName(), result, why); - } else { - TraversalStatistics.nReads++; - } - - return result; - } + public EnumSet getDiscards() { + return LocusIteratorByState.NO_DISCARDS; + //return EnumSet.of(LocusIteratorByState.Discard.ADAPTOR_BASES); } } diff --git a/java/src/org/broadinstitute/sting/utils/pileup/PileupElement.java b/java/src/org/broadinstitute/sting/utils/pileup/PileupElement.java index 3bc8b09a8..e5f600aa1 100755 --- a/java/src/org/broadinstitute/sting/utils/pileup/PileupElement.java +++ b/java/src/org/broadinstitute/sting/utils/pileup/PileupElement.java @@ -2,6 +2,7 @@ package org.broadinstitute.sting.utils.pileup; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.utils.*; +import org.broadinstitute.sting.utils.sam.ReadUtils; import net.sf.samtools.SAMRecord; import java.util.List; diff --git a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java index 627727389..7883230e8 100755 --- a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java +++ b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedPileup.java @@ -7,6 +7,7 @@ import org.broadinstitute.sting.utils.pileup.ExtendedPileupElement; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.BaseUtils; +import org.broadinstitute.sting.utils.sam.ReadUtils; import java.util.*; @@ -350,16 +351,6 @@ public class ReadBackedPileup implements Iterable { return nMQ0Reads; } -// public int getNumberOfDeletions() { -// int n = 0; -// -// for ( int i = 0; i < size(); i++ ) { -// if ( getOffsets().get(i) != -1 ) { n++; } -// } -// -// return n; -// } - /** * @return the number of elements in this pileup */ diff --git a/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index b78d25321..52ced53a5 100644 --- a/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -72,6 +72,80 @@ public class ReadUtils { return false; } + // --------------------------------------------------------------------------------------------------------- + // + // utilities for detecting overlapping reads + // + // --------------------------------------------------------------------------------------------------------- + + /** + * Detects read pairs where the reads are so long relative to the over fragment size that they are + * reading into each other's adaptors. + * + * Normally, fragments are sufficiently far apart that reads aren't reading into each other. + * + * |--------------------> first read + * <--------------------| second read + * + * Sometimes, mostly due to lab errors or constraints, fragment library are made too short relative to the + * length of the reads. For example, it's possible to have 76bp PE reads with 125 bp inserts, so that ~25 bp of each + * read overlaps with its mate. + * + * |--------OOOOOOOOOOOO> first read + * first read + * 0 ) { // we're not an unmapped pair -- cannot filter out + long adaptorStart, adaptorEnd; + long mateStart = rec.getMateAlignmentStart(); + long mateEnd = rec.getAlignmentStart() + isize; + + if ( rec.getReadNegativeStrandFlag() ) { + // we are on the negative strand, so our mate is on the positive strand + adaptorStart = mateStart - adaptorLength - 1; + adaptorEnd = mateStart - 1; + } else { + // we are on the positive strand, so our mate is on the negative strand + adaptorStart = mateEnd + 1; + adaptorEnd = mateEnd + adaptorLength; + } + + boolean inMate = basePos >= mateStart && basePos <= mateEnd; + boolean inAdapator = basePos >= adaptorStart && basePos < adaptorEnd; + + + if ( inAdapator ) state = OverlapType.IN_ADAPTOR; + else if ( inMate ) state = OverlapType.OVERLAPPING; + +// if ( inMate || inAdapator ) +// System.out.printf("baseOverlapState: %s start=%d base=%d mateStart=%d mateStop=%d adaptorStart=%d adaptorEnd=%d => %s%n", +// rec.getReadName(), rec.getAlignmentStart(), basePos, mateStart, mateEnd, adaptorStart, adaptorEnd, state); + } + + return state; + } + + private static int DEFAULT_ADAPTOR_SIZE = 100; + public static OverlapType readPairBaseOverlapType(final SAMRecord rec, long basePos) { + return readPairBaseOverlapType(rec, basePos, DEFAULT_ADAPTOR_SIZE); + } public static boolean is454Read(SAMRecord read) { return isPlatformRead(read, "454"); diff --git a/java/test/org/broadinstitute/sting/gatk/datasources/providers/LocusViewTemplate.java b/java/test/org/broadinstitute/sting/gatk/datasources/providers/LocusViewTemplate.java index b0fdca18f..cb9a42892 100755 --- a/java/test/org/broadinstitute/sting/gatk/datasources/providers/LocusViewTemplate.java +++ b/java/test/org/broadinstitute/sting/gatk/datasources/providers/LocusViewTemplate.java @@ -10,6 +10,7 @@ import org.broadinstitute.sting.gatk.executive.WindowMaker; import org.broadinstitute.sting.gatk.datasources.shards.LocusShard; import org.broadinstitute.sting.gatk.datasources.shards.Shard; import org.broadinstitute.sting.gatk.iterators.StingSAMIterator; +import org.broadinstitute.sting.gatk.iterators.LocusIteratorByState; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLocParser; import org.junit.BeforeClass; @@ -48,7 +49,7 @@ public abstract class LocusViewTemplate extends BaseTest { GenomeLoc shardBounds = GenomeLocParser.createGenomeLoc("chr1", 1, 5); Shard shard = new LocusShard(Collections.singletonList(shardBounds)); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, null, window.getLocus(), window, null, null); @@ -64,7 +65,7 @@ public abstract class LocusViewTemplate extends BaseTest { GenomeLoc shardBounds = GenomeLocParser.createGenomeLoc("chr1", 1, 5); Shard shard = new LocusShard(Collections.singletonList(shardBounds)); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); @@ -79,7 +80,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -93,7 +94,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -107,7 +108,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -121,7 +122,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 6, 15))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -135,7 +136,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -150,7 +151,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read1, read2); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -169,7 +170,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read1, read2, read3, read4); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -188,7 +189,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read1, read2, read3, read4); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -209,7 +210,7 @@ public abstract class LocusViewTemplate extends BaseTest { SAMRecordIterator iterator = new SAMRecordIterator(read1, read2, read3, read4, read5, read6); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 1, 10))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider); @@ -237,7 +238,7 @@ public abstract class LocusViewTemplate extends BaseTest { read07, read08, read09, read10, read11, read12); Shard shard = new LocusShard(Collections.singletonList(GenomeLocParser.createGenomeLoc("chr1", 6, 15))); - WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList()); + WindowMaker windowMaker = new WindowMaker(iterator,shard.getGenomeLocs(),new ArrayList(), LocusIteratorByState.NO_DISCARDS); WindowMaker.WindowMakerIterator window = windowMaker.next(); LocusShardDataProvider dataProvider = new LocusShardDataProvider(shard, window.getSourceInfo(), window.getLocus(), window, null, null); LocusView view = createView(dataProvider);