Bypass reads with a bad CIGAR length
This commit is contained in:
parent
bfcac455c9
commit
d5f98e99f0
|
|
@ -127,7 +127,7 @@ import java.util.TreeSet;
|
|||
* @author ebanks
|
||||
*/
|
||||
@DocumentedGATKFeature( groupName = HelpConstants.DOCS_CAT_DATA, extraDocs = {CommandLineGATK.class} )
|
||||
@ReadFilters({MappingQualityZeroFilter.class, MappingQualityUnavailableFilter.class, BadMateFilter.class, Platform454Filter.class, BadCigarFilter.class})
|
||||
@ReadFilters({MappingQualityZeroFilter.class, MappingQualityUnavailableFilter.class, BadMateFilter.class, Platform454Filter.class})
|
||||
@Reference(window=@Window(start=-1,stop=50))
|
||||
@Allows(value={DataSource.READS, DataSource.REFERENCE})
|
||||
@By(DataSource.REFERENCE)
|
||||
|
|
|
|||
|
|
@ -107,13 +107,13 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
@DataProvider(name = "BQSRTest")
|
||||
public Object[][] createBQSRTestData() {
|
||||
return new Object[][]{
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, "", "f805a0020eea987b79f314fa99913806")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --no_standard_covs -cov ContextCovariate", "86075d3856eb06816a0dd81af55e421f")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --no_standard_covs -cov CycleCovariate", "155802237e1fc7a001398b8f4bcf4b72")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --indels_context_size 4", "38c7916cc019fe8d134df67639422b42")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --low_quality_tail 5", "b74e75f3c5aa90bd21af1e20f2ac8c40")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --quantizing_levels 6", "e564505aea11464de8ed72890d9ea89a")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --mismatches_context_size 4", "380d8be121ffaddd3461ee0ac3d1a76f")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, "", "fc9df1faf67bab70d32f89bcf4fa39db")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --no_standard_covs -cov ContextCovariate", "73ec38eb23b1739ecef8194cbb1132a3")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --no_standard_covs -cov CycleCovariate", "2d5721193ed4410d1a7d8db467a1fa05")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --indels_context_size 4", "16df7f1745f17f190c9fc33c475b91d8")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --low_quality_tail 5", "01811003ae811ee74c4b8d3eb5e992fe")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --quantizing_levels 6", "5e0eea6b0b300fbd2edabc3506ad3a60")},
|
||||
{new BQSRTest(hg18Reference, HiSeqBam, HiSeqInterval, " --mismatches_context_size 4", "8500b9747c16cb8eb17082163bdb8069")},
|
||||
{new BQSRTest(b36KGReference, SimpleCigarMatchMismatchBam, SimpleCigarMatchMismatchInterval, "", "56dfb2918a4cdae3ef9d705a43e85194")},
|
||||
{new BQSRTest(b36KGReference, validationDataLocation + "NA12892.SLX.SRP000031.2009_06.selected.1Mb.1RG.bam", "1:10,000,000-10,200,000", "", "0b5a8e259e997e4c7b5836d4c28e6f4d")},
|
||||
{new BQSRTest(b36KGReference, validationDataLocation + "NA19240.chr1.BFAST.SOLID.bam", "1:10,000,000-10,200,000", "", "281682124584ab384f23359934df0c3b")},
|
||||
|
|
@ -196,12 +196,12 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
public Object[][] createPRTestData() {
|
||||
List<Object[]> tests = new ArrayList<Object[]>();
|
||||
|
||||
tests.add(new Object[]{1, new PRTest(" -qq -1", "fcc136b877fbde38791533b0f1ae39e4")});
|
||||
tests.add(new Object[]{1, new PRTest(" -qq 6", "f21b537c1689b8051b878ea5cc9b61a0")});
|
||||
tests.add(new Object[]{1, new PRTest(" -DIQ", "1d04a242bf825177d6a45eff9fbed647")});
|
||||
tests.add(new Object[]{1, new PRTest(" -qq -1", "ce09e16466151bb37305dbfd5dc88f35")});
|
||||
tests.add(new Object[]{1, new PRTest(" -qq 6", "2d12f3d48b1797ea0671e28a435527fe")});
|
||||
tests.add(new Object[]{1, new PRTest(" -DIQ", "f3dbf3ae2725f1e7aa8ae61a09beac51")});
|
||||
|
||||
for ( final int nct : Arrays.asList(1, 2, 4) ) {
|
||||
tests.add(new Object[]{nct, new PRTest("", "b6f343ac69c63cdb49205c13e67297fc")});
|
||||
tests.add(new Object[]{nct, new PRTest("", "0746ae12c106a8af0b3b01f22e9efcba")});
|
||||
}
|
||||
|
||||
return tests.toArray(new Object[][]{});
|
||||
|
|
|
|||
|
|
@ -175,12 +175,13 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
|
|||
executeTest("test realigner nWayOut", spec1);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = RuntimeException.class) // because TESTNG wraps UserExceptions in RuntimeExceptions
|
||||
public void testBadCigarString() {
|
||||
@Test
|
||||
public void testBadCigarStringDoesNotFail() {
|
||||
// Just making sure the test runs without an error, don't care about the MD5 value
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T IndelRealigner -R " + b37KGReference + " -I " + privateTestDir + "Realigner.error.bam -L 19:5787200-5787300 -targetIntervals 19:5787205-5787300 -o %s",
|
||||
1,
|
||||
Arrays.asList("FAILFAILFAILFAILFAILFAILFAILFAIL"));
|
||||
executeTest("test bad cigar", spec);
|
||||
Arrays.asList(""));
|
||||
executeTest("test bad cigar string does not fail", spec);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,4 +100,14 @@ public class RealignerTargetCreatorIntegrationTest extends WalkerTest {
|
|||
Arrays.asList("5206cee6c01b299417bf2feeb8b3dc96"));
|
||||
executeTest("test rods only", spec3);
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testBadCigarStringDoesNotFail() {
|
||||
// Just making sure the test runs without an error, don't care about the MD5 value
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T RealignerTargetCreator -R " + b37KGReference + " -I " + privateTestDir + "Realigner.error.bam -L 19:5787200-5787300 -o %s",
|
||||
1,
|
||||
Arrays.asList(""));
|
||||
executeTest("test bad cigar string string does not fail", spec);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class SplitNCigarReadsUnitTest extends BaseTest {
|
|||
if(numOfSplits != 0 && isCigarDoesNotHaveEmptyRegionsBetweenNs(cigar)){
|
||||
|
||||
final TestManager manager = new TestManager();
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
SplitNCigarReads.splitNCigarRead(read, manager);
|
||||
List<OverhangFixingManager.SplitRead> splitReads = manager.getReadsInQueueForTesting();
|
||||
final int expectedReads = numOfSplits+1;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import java.util.Iterator;
|
|||
/**
|
||||
* Filter out reads with wonky cigar strings.
|
||||
*
|
||||
* - No reads with a different length and cigar length
|
||||
* - No reads with Hard/Soft clips in the middle of the cigar
|
||||
* - No reads starting with deletions (with or without preceding clips)
|
||||
* - No reads ending in deletions (with or without follow-up clips)
|
||||
|
|
@ -57,6 +58,11 @@ public class BadCigarFilter extends ReadFilter {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Read and it's CIGAR not the same length
|
||||
if ( rec.getReadLength() != c.getReadLength() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Iterator<CigarElement> elementIterator = c.getCigarElements().iterator();
|
||||
|
||||
CigarOperator firstOp = CigarOperator.H;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import org.apache.log4j.Logger;
|
|||
import org.broadinstitute.gatk.engine.CommandLineGATK;
|
||||
import org.broadinstitute.gatk.engine.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.gatk.utils.downsampling.DownsampleType;
|
||||
import org.broadinstitute.gatk.engine.filters.BadCigarFilter;
|
||||
import org.broadinstitute.gatk.engine.filters.MalformedReadFilter;
|
||||
import org.broadinstitute.gatk.engine.iterators.ReadTransformer;
|
||||
import org.broadinstitute.gatk.engine.samples.Sample;
|
||||
|
|
@ -49,7 +50,7 @@ import java.util.List;
|
|||
* Time: 1:53:31 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
@ReadFilters(MalformedReadFilter.class)
|
||||
@ReadFilters({MalformedReadFilter.class,BadCigarFilter.class})
|
||||
@PartitionBy(PartitionType.NONE)
|
||||
@Downsample(by = DownsampleType.NONE)
|
||||
@BAQMode(QualityMode = BAQ.QualityMode.OVERWRITE_QUALS, ApplicationTime = ReadTransformer.ApplicationTime.ON_INPUT)
|
||||
|
|
|
|||
|
|
@ -73,18 +73,24 @@ public class BadCigarFilterUnitTest {
|
|||
}
|
||||
|
||||
@Test(enabled = true)
|
||||
public void testWonkyCigars () {
|
||||
public void testWonkyCigars() {
|
||||
for (String cigarString : BAD_CIGAR_LIST) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigarString);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigarString, 0);
|
||||
Assert.assertTrue(filter.filterOut(read), read.getCigarString());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(enabled = true)
|
||||
public void testReadCigarLengthMismatch() {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar("4M", 1);
|
||||
Assert.assertTrue(filter.filterOut(read), read.getCigarString());
|
||||
}
|
||||
|
||||
@Test(enabled = true)
|
||||
public void testGoodCigars() {
|
||||
List<Cigar> cigarList = ReadClipperTestUtils.generateCigarList(10);
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
Assert.assertFalse(filter.filterOut(read), read.getCigarString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ public class PrintReadsIntegrationTest extends WalkerTest {
|
|||
@DataProvider(name = "PRTest")
|
||||
public Object[][] createPrintReadsTestData() {
|
||||
return new Object[][]{
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, "", "fa9c66f66299fe5405512ac36ec9d0f2")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, " -compress 0", "488eb22abc31c6af7cbb1a3d41da1507")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, " -simplifyBAM", "1510dc4429f3ed49caf96da41e8ed396")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, "", "5aee1c592f7b0505430df4d4452b8000")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, " -compress 0", "62a542230502c9e54124ebd46242e252")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, " -simplifyBAM", "a054a6618ffa8cd2d1113b005335922b")},
|
||||
{new PRTest(hg18Reference, new String[]{"HiSeq.1mb.bam"}, " -n 10", "0e3d1748ad1cb523e3295cab9d09d8fc")},
|
||||
// See: GATKBAMIndex.getStartOfLastLinearBin(), BAMScheduler.advance(), IntervalOverlapFilteringIterator.advance()
|
||||
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.bam"}, "", "d7f23fd77d7dc7cb50d3397f644c6d8a")},
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
|||
"currentCigarElementOffset <= nCigarElements"
|
||||
})
|
||||
public class AlignmentStateMachine {
|
||||
|
||||
public static final String MAKE_PILEUP_EDGE_ERROR = "Cannot make a pileup element from an edge alignment state";
|
||||
/**
|
||||
* Our read
|
||||
*/
|
||||
|
|
@ -359,7 +361,7 @@ public class AlignmentStateMachine {
|
|||
@Ensures("result != null")
|
||||
public final PileupElement makePileupElement() {
|
||||
if ( isLeftEdge() || isRightEdge() )
|
||||
throw new IllegalStateException("Cannot make a pileup element from an edge alignment state");
|
||||
throw new IllegalStateException(MAKE_PILEUP_EDGE_ERROR);
|
||||
return new PileupElement(read,
|
||||
getReadOffset(),
|
||||
getCurrentCigarElement(),
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import java.util.*;
|
|||
* There are a few constraints on required and ensured by LIBS:
|
||||
*
|
||||
* -- Requires the Iterator<GATKSAMRecord> to returns reads in coordinate sorted order, consistent with the ordering
|
||||
* defined by the SAM file format. That that for performance reasons this constraint isn't actually enforced.
|
||||
* defined by the SAM file format. That for performance reasons this constraint isn't actually enforced.
|
||||
* The behavior of LIBS is undefined in the case where the reads are badly ordered.
|
||||
* -- The reads in the ReadBackedPileup are themselves in the order of appearance of the reads from the iterator.
|
||||
* That is, the pileup is ordered in a way consistent with the SAM coordinate ordering
|
||||
|
|
|
|||
|
|
@ -52,13 +52,31 @@ public class ReadClipperTestUtils {
|
|||
new CigarElement(1, CigarOperator.DELETION),
|
||||
new CigarElement(1, CigarOperator.MATCH_OR_MISMATCH)};
|
||||
|
||||
/**
|
||||
* Make a read fom the CIGAR
|
||||
*
|
||||
* @param cigar the CIGAR
|
||||
* @param lengthChange change in read length relative the CIGAR length
|
||||
* @return artificial read
|
||||
*/
|
||||
public static GATKSAMRecord makeReadFromCigar(Cigar cigar, int lengthChange) {
|
||||
int readLength = cigar.getReadLength();
|
||||
if ( readLength >= -lengthChange ) {
|
||||
readLength += lengthChange;
|
||||
}
|
||||
|
||||
public static GATKSAMRecord makeReadFromCigar(Cigar cigar) {
|
||||
return ArtificialSAMUtils.createArtificialRead(Utils.arrayFromArrayWithLength(BASES, cigar.getReadLength()), Utils.arrayFromArrayWithLength(QUALS, cigar.getReadLength()), cigar.toString());
|
||||
return ArtificialSAMUtils.createArtificialRead(Utils.arrayFromArrayWithLength(BASES, readLength), Utils.arrayFromArrayWithLength(QUALS, readLength), cigar.toString());
|
||||
}
|
||||
|
||||
public static GATKSAMRecord makeReadFromCigar(String cigarString) {
|
||||
return makeReadFromCigar(CigarUtils.cigarFromString(cigarString));
|
||||
/**
|
||||
* Make a read from the CIGAR string
|
||||
*
|
||||
* @param cigarString string used to create a CIGAR
|
||||
* @param lengthChange change in read length relative the CIGAR length
|
||||
* @return artificial read
|
||||
*/
|
||||
public static GATKSAMRecord makeReadFromCigar(String cigarString, int lengthChange) {
|
||||
return makeReadFromCigar(CigarUtils.cigarFromString(cigarString), lengthChange);
|
||||
}
|
||||
|
||||
public static List<Cigar> generateCigarList(int maximumLength) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipBothEndsByReferenceCoordinates() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int alnStart = read.getAlignmentStart();
|
||||
int alnEnd = read.getAlignmentEnd();
|
||||
int readLength = alnStart - alnEnd;
|
||||
|
|
@ -76,7 +76,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipByReadCoordinates() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int readLength = read.getReadLength();
|
||||
for (int i = 0; i < readLength; i++) {
|
||||
GATKSAMRecord clipLeft = ReadClipper.hardClipByReadCoordinates(read, 0, i);
|
||||
|
|
@ -105,7 +105,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
|
||||
@Test(dataProvider = "ClippedReadLengthData", enabled = !DEBUG)
|
||||
public void testHardClipReadLengthIsRight(final int originalReadLength, final int nToClip) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(originalReadLength + "M");
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(originalReadLength + "M", 0);
|
||||
read.getReadLength(); // provoke the caching of the read length
|
||||
final int expectedReadLength = originalReadLength - nToClip;
|
||||
GATKSAMRecord clipped = ReadClipper.hardClipByReadCoordinates(read, 0, nToClip - 1);
|
||||
|
|
@ -117,7 +117,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipByReferenceCoordinates() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int start = read.getSoftStart();
|
||||
int stop = read.getSoftEnd();
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipByReferenceCoordinatesLeftTail() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int alnStart = read.getAlignmentStart();
|
||||
int alnEnd = read.getAlignmentEnd();
|
||||
if (read.getSoftStart() == alnStart) { // we can't test left clipping if the read has hanging soft clips on the left side
|
||||
|
|
@ -159,7 +159,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipByReferenceCoordinatesRightTail() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int alnStart = read.getAlignmentStart();
|
||||
int alnEnd = read.getAlignmentEnd();
|
||||
if (read.getSoftEnd() == alnEnd) { // we can't test right clipping if the read has hanging soft clips on the right side
|
||||
|
|
@ -181,7 +181,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
|
||||
/** create a read for every cigar permutation */
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
int readLength = read.getReadLength();
|
||||
byte[] quals = new byte[readLength];
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
@Test(enabled = !DEBUG)
|
||||
public void testHardClipSoftClippedBases() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
GATKSAMRecord clippedRead = ReadClipper.hardClipSoftClippedBases(read);
|
||||
CigarCounter original = new CigarCounter(read);
|
||||
CigarCounter clipped = new CigarCounter(clippedRead);
|
||||
|
|
@ -235,7 +235,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
public void testHardClipLeadingInsertions() {
|
||||
for (Cigar cigar : cigarList) {
|
||||
if (startsWithInsertion(cigar)) {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
GATKSAMRecord clippedRead = ReadClipper.hardClipLeadingInsertions(read);
|
||||
|
||||
assertUnclippedLimits(read, clippedRead); // Make sure limits haven't changed
|
||||
|
|
@ -259,7 +259,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
final int leadingSoftClips = leadingCigarElementLength(cigar, CigarOperator.SOFT_CLIP);
|
||||
final int tailSoftClips = leadingCigarElementLength(CigarUtils.invertCigar(cigar), CigarOperator.SOFT_CLIP);
|
||||
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
final GATKSAMRecord unclipped = ReadClipper.revertSoftClippedBases(read);
|
||||
|
||||
assertUnclippedLimits(read, unclipped); // Make sure limits haven't changed
|
||||
|
|
@ -281,7 +281,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
final int leadingSoftClips = leadingCigarElementLength(cigar, CigarOperator.SOFT_CLIP);
|
||||
final int tailSoftClips = leadingCigarElementLength(CigarUtils.invertCigar(cigar), CigarOperator.SOFT_CLIP);
|
||||
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
final GATKSAMRecord unclipped = ReadClipper.revertSoftClippedBases(read);
|
||||
|
||||
assertUnclippedLimits(read, unclipped); // Make sure limits haven't changed
|
||||
|
|
@ -313,7 +313,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
final int nMatches = 10;
|
||||
final int nSoft = -1 * (softStart - alignmentStart);
|
||||
final String cigar = nSoft + "S" + nMatches + "M";
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar);
|
||||
final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0);
|
||||
read.setAlignmentStart(alignmentStart);
|
||||
|
||||
Assert.assertEquals(read.getSoftStart(), softStart);
|
||||
|
|
@ -413,7 +413,7 @@ public class ReadClipperUnitTest extends BaseTest {
|
|||
|
||||
@Test(enabled = !DEBUG)
|
||||
public void testRevertEntirelySoftclippedReads() {
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar("2H1S3H");
|
||||
GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar("2H1S3H", 0);
|
||||
GATKSAMRecord clippedRead = ReadClipper.revertSoftClippedBases(read);
|
||||
Assert.assertEquals(clippedRead.getAlignmentStart(), read.getSoftStart());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ public class AlignmentStateMachineUnitTest extends LocusIteratorByStateBaseTest
|
|||
|
||||
// TODO -- more tests about test state machine state before first step?
|
||||
Assert.assertTrue(state.isLeftEdge());
|
||||
try {
|
||||
state.makePileupElement();
|
||||
Assert.fail("makePileupElement should've thrown an exception");
|
||||
} catch (IllegalStateException e) {
|
||||
Assert.assertTrue(e.getMessage().indexOf(state.MAKE_PILEUP_EDGE_ERROR) != -1);
|
||||
}
|
||||
Assert.assertNull(state.getCigarOperator());
|
||||
Assert.assertNotNull(state.toString());
|
||||
Assert.assertEquals(state.getReadOffset(), -1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue