Merge pull request #307 from broadinstitute/eb_rr_off_by_one_error
Proper fix for previous RR -cancer_mode fix.
This commit is contained in:
commit
a514dd0643
|
|
@ -878,7 +878,7 @@ public class SlidingWindow {
|
||||||
int stop = region.getStop() - windowHeaderStart;
|
int stop = region.getStop() - windowHeaderStart;
|
||||||
|
|
||||||
// make sure the bitset is complete given the region (it might not be in multi-sample mode)
|
// make sure the bitset is complete given the region (it might not be in multi-sample mode)
|
||||||
if ( region.getStop() > markedSites.getStartLocation() + markedSites.getVariantSiteBitSet().length )
|
if ( region.getStop() > markedSites.getStartLocation() + markedSites.getVariantSiteBitSet().length - 1 )
|
||||||
markSites(region.getStop());
|
markSites(region.getStop());
|
||||||
|
|
||||||
CloseVariantRegionResult closeVariantRegionResult = closeVariantRegion(start, stop, knownSnpPositions);
|
CloseVariantRegionResult closeVariantRegionResult = closeVariantRegion(start, stop, knownSnpPositions);
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,33 @@ public class SlidingWindowUnitTest extends BaseTest {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(enabled = true)
|
||||||
|
public void testMarkingRegionInCancerMode() {
|
||||||
|
|
||||||
|
final int contextSize = 10;
|
||||||
|
final SlidingWindow slidingWindow = new SlidingWindow("1", 0, contextSize, header, new GATKSAMReadGroupRecord("test"), 0, 0.05, 0.05, 0.05, 20, 20, 100, ReduceReads.DownsampleStrategy.Normal, false);
|
||||||
|
slidingWindow.addRead(createSimpleRead("1", 0, 34, 75));
|
||||||
|
slidingWindow.addRead(createSimpleRead("2", 0, 97, 73));
|
||||||
|
slidingWindow.addRead(createSimpleRead("3", 0, 98, 75));
|
||||||
|
slidingWindow.addRead(createSimpleRead("4", 0, 98, 75));
|
||||||
|
slidingWindow.addRead(createSimpleRead("5", 0, 98, 75));
|
||||||
|
|
||||||
|
final CompressionStash regions = new CompressionStash();
|
||||||
|
regions.add(new FinishedGenomeLoc("1", 0, 89, 109, true));
|
||||||
|
|
||||||
|
slidingWindow.closeVariantRegions(regions, null, false);
|
||||||
|
Assert.assertEquals(slidingWindow.getMarkedSitesForTesting().getVariantSiteBitSet().length, 76 + contextSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private GATKSAMRecord createSimpleRead(final String name, final int refIndex, final int alignmentStart, final int length) {
|
||||||
|
|
||||||
|
final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, name, refIndex, alignmentStart, length);
|
||||||
|
read.setReadBases(Utils.dupBytes((byte) 'A', length));
|
||||||
|
read.setBaseQualities(Utils.dupBytes((byte) 30, length));
|
||||||
|
read.setMappingQuality(60);
|
||||||
|
return read;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
//// This section tests the consensus creation functionality ////
|
//// This section tests the consensus creation functionality ////
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue