Merge branch 'master' of ssh://nickel.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
63b1e737c6
|
|
@ -103,21 +103,6 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
|
|||
argumentSources.add(walker);
|
||||
|
||||
Collection<RMDTriplet> rodBindings = ListFileUtils.unpackRODBindings(parser.getRodBindings(), parser);
|
||||
|
||||
// todo: remove me when the old style system is removed
|
||||
if ( getArgumentCollection().RODBindings.size() > 0 ) {
|
||||
logger.warn("################################################################################");
|
||||
logger.warn("################################################################################");
|
||||
logger.warn("Deprecated -B rod binding syntax detected. This syntax has been eliminated in GATK 1.2.");
|
||||
logger.warn("Please use arguments defined by each specific walker instead.");
|
||||
for ( String oldStyleRodBinding : getArgumentCollection().RODBindings ) {
|
||||
logger.warn(" -B rod binding with value " + oldStyleRodBinding + " tags: " + parser.getTags(oldStyleRodBinding).getPositionalTags());
|
||||
}
|
||||
logger.warn("################################################################################");
|
||||
logger.warn("################################################################################");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
engine.setReferenceMetaDataFiles(rodBindings);
|
||||
|
||||
for (ReadFilter filter: filters) {
|
||||
|
|
|
|||
|
|
@ -100,10 +100,11 @@ public class CommandLineGATK extends CommandLineExecutable {
|
|||
} catch(PicardException e) {
|
||||
// TODO: Should Picard exceptions be, in general, UserExceptions or ReviewedStingExceptions?
|
||||
exitSystemWithError(e);
|
||||
}
|
||||
catch (SAMException e) {
|
||||
} catch (SAMException e) {
|
||||
checkForTooManyOpenFilesProblem(e.getMessage());
|
||||
exitSystemWithSamError(e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
exitSystemWithUserError(new UserException.NotEnoughMemory());
|
||||
} catch (Throwable t) {
|
||||
checkForTooManyOpenFilesProblem(t.getMessage());
|
||||
exitSystemWithError(t);
|
||||
|
|
|
|||
|
|
@ -356,10 +356,6 @@ public class GenomeAnalysisEngine {
|
|||
public BAQ.QualityMode getWalkerBAQQualityMode() { return WalkerManager.getBAQQualityMode(walker); }
|
||||
public BAQ.ApplicationTime getWalkerBAQApplicationTime() { return WalkerManager.getBAQApplicationTime(walker); }
|
||||
|
||||
protected boolean generateExtendedEvents() {
|
||||
return walker.generateExtendedEvents();
|
||||
}
|
||||
|
||||
protected boolean includeReadsWithDeletionAtLoci() {
|
||||
return walker.includeReadsWithDeletionAtLoci();
|
||||
}
|
||||
|
|
@ -766,7 +762,6 @@ public class GenomeAnalysisEngine {
|
|||
new ValidationExclusion(Arrays.asList(argCollection.unsafe)),
|
||||
filters,
|
||||
includeReadsWithDeletionAtLoci(),
|
||||
generateExtendedEvents(),
|
||||
getWalkerBAQApplicationTime() == BAQ.ApplicationTime.ON_INPUT ? argCollection.BAQMode : BAQ.CalculationMode.OFF,
|
||||
getWalkerBAQQualityMode(),
|
||||
refReader,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public class ReadProperties {
|
|||
private final Collection<ReadFilter> supplementalFilters;
|
||||
private final boolean includeReadsWithDeletionAtLoci;
|
||||
private final boolean useOriginalBaseQualities;
|
||||
private final boolean generateExtendedEvents;
|
||||
private final BAQ.CalculationMode cmode;
|
||||
private final BAQ.QualityMode qmode;
|
||||
private final IndexedFastaSequenceFile refReader; // read for BAQ, if desired
|
||||
|
|
@ -52,16 +51,9 @@ public class ReadProperties {
|
|||
return includeReadsWithDeletionAtLoci;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the walker wants to see additional piles of "extended" events (indels). An indel is associated,
|
||||
* by convention, with the reference base immediately preceding the insertion/deletion, and if this flag is set
|
||||
* to 'true', any locus with an indel associated with it will cause exactly two subsequent calls to walker's map(): first call
|
||||
* will be made with a "conventional" base pileup, the next call will be made with a pileup of extended (indel/noevent)
|
||||
* events.
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean generateExtendedEvents() {
|
||||
return generateExtendedEvents;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,9 +136,6 @@ public class ReadProperties {
|
|||
* @param downsamplingMethod Method for downsampling reads at a given locus.
|
||||
* @param exclusionList what safety checks we're willing to let slide
|
||||
* @param supplementalFilters additional filters to dynamically apply.
|
||||
* @param generateExtendedEvents if true, the engine will issue an extra call to walker's map() with
|
||||
* a pile of indel/noevent extended events at every locus with at least one indel associated with it
|
||||
* (in addition to a "regular" call to map() at this locus performed with base pileup)
|
||||
* @param includeReadsWithDeletionAtLoci if 'true', the base pileups sent to the walker's map() method
|
||||
* will explicitly list reads with deletion over the current reference base; otherwise, only observed
|
||||
* bases will be seen in the pileups, and the deletions will be skipped silently.
|
||||
|
|
@ -163,7 +152,6 @@ public class ReadProperties {
|
|||
ValidationExclusion exclusionList,
|
||||
Collection<ReadFilter> supplementalFilters,
|
||||
boolean includeReadsWithDeletionAtLoci,
|
||||
boolean generateExtendedEvents,
|
||||
BAQ.CalculationMode cmode,
|
||||
BAQ.QualityMode qmode,
|
||||
IndexedFastaSequenceFile refReader,
|
||||
|
|
@ -176,7 +164,6 @@ public class ReadProperties {
|
|||
this.exclusionList = exclusionList == null ? new ValidationExclusion() : exclusionList;
|
||||
this.supplementalFilters = supplementalFilters;
|
||||
this.includeReadsWithDeletionAtLoci = includeReadsWithDeletionAtLoci;
|
||||
this.generateExtendedEvents = generateExtendedEvents;
|
||||
this.useOriginalBaseQualities = useOriginalBaseQualities;
|
||||
this.cmode = cmode;
|
||||
this.qmode = qmode;
|
||||
|
|
|
|||
|
|
@ -107,11 +107,6 @@ public class GATKArgumentCollection {
|
|||
@Input(fullName = "reference_sequence", shortName = "R", doc = "Reference sequence file", required = false)
|
||||
public File referenceFile = null;
|
||||
|
||||
@Deprecated
|
||||
@Hidden
|
||||
@Input(fullName = "rodBind", shortName = "B", doc = "Bindings for reference-ordered data, in the form :<name>,<type> <file>", required = false)
|
||||
public ArrayList<String> RODBindings = new ArrayList<String>();
|
||||
|
||||
@Argument(fullName = "nonDeterministicRandomSeed", shortName = "ndrs", doc = "Makes the GATK behave non deterministically, that is, the random numbers generated will be different in every run", required = false)
|
||||
public boolean nonDeterministicRandomSeed = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ public class SAMDataSource {
|
|||
null,
|
||||
new ValidationExclusion(),
|
||||
new ArrayList<ReadFilter>(),
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +185,7 @@ public class SAMDataSource {
|
|||
DownsamplingMethod downsamplingMethod,
|
||||
ValidationExclusion exclusionList,
|
||||
Collection<ReadFilter> supplementalFilters,
|
||||
boolean includeReadsWithDeletionAtLoci,
|
||||
boolean generateExtendedEvents) {
|
||||
boolean includeReadsWithDeletionAtLoci) {
|
||||
this( samFiles,
|
||||
threadAllocation,
|
||||
numFileHandles,
|
||||
|
|
@ -199,7 +197,6 @@ public class SAMDataSource {
|
|||
exclusionList,
|
||||
supplementalFilters,
|
||||
includeReadsWithDeletionAtLoci,
|
||||
generateExtendedEvents,
|
||||
BAQ.CalculationMode.OFF,
|
||||
BAQ.QualityMode.DONT_MODIFY,
|
||||
null, // no BAQ
|
||||
|
|
@ -216,9 +213,6 @@ public class SAMDataSource {
|
|||
* @param downsamplingMethod Method for downsampling reads at a given locus.
|
||||
* @param exclusionList what safety checks we're willing to let slide
|
||||
* @param supplementalFilters additional filters to dynamically apply.
|
||||
* @param generateExtendedEvents if true, the engine will issue an extra call to walker's map() with
|
||||
* a pile of indel/noevent extended events at every locus with at least one indel associated with it
|
||||
* (in addition to a "regular" call to map() at this locus performed with base pileup)
|
||||
* @param includeReadsWithDeletionAtLoci if 'true', the base pileups sent to the walker's map() method
|
||||
* will explicitly list reads with deletion over the current reference base; otherwise, only observed
|
||||
* bases will be seen in the pileups, and the deletions will be skipped silently.
|
||||
|
|
@ -236,7 +230,6 @@ public class SAMDataSource {
|
|||
ValidationExclusion exclusionList,
|
||||
Collection<ReadFilter> supplementalFilters,
|
||||
boolean includeReadsWithDeletionAtLoci,
|
||||
boolean generateExtendedEvents,
|
||||
BAQ.CalculationMode cmode,
|
||||
BAQ.QualityMode qmode,
|
||||
IndexedFastaSequenceFile refReader,
|
||||
|
|
@ -309,7 +302,6 @@ public class SAMDataSource {
|
|||
exclusionList,
|
||||
supplementalFilters,
|
||||
includeReadsWithDeletionAtLoci,
|
||||
generateExtendedEvents,
|
||||
cmode,
|
||||
qmode,
|
||||
refReader,
|
||||
|
|
|
|||
|
|
@ -66,9 +66,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
@Output
|
||||
PrintStream out;
|
||||
|
||||
@Argument(fullName="showIndelPileups",shortName="show_indels",doc="In addition to base pileups, generate pileups of extended indel events")
|
||||
public boolean SHOW_INDEL_PILEUPS = false;
|
||||
|
||||
@Argument(fullName="showVerbose",shortName="verbose",doc="Add an extra verbose section to the pileup output")
|
||||
public boolean SHOW_VERBOSE = false;
|
||||
|
||||
|
|
@ -78,8 +75,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
public void initialize() {
|
||||
}
|
||||
|
||||
public boolean generateExtendedEvents() { return SHOW_INDEL_PILEUPS; }
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
|
||||
String rods = getReferenceOrderedData( tracker );
|
||||
|
|
@ -92,17 +87,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
out.println();
|
||||
}
|
||||
|
||||
if ( context.hasExtendedEventPileup() ) {
|
||||
ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
|
||||
List<Pair<String,Integer>> eventCounts = indelPileup.getEventStringsWithCounts(ref.getBases());
|
||||
|
||||
out.printf("%s %s ", indelPileup.getShortPileupString(), rods);
|
||||
int i = 0;
|
||||
for ( ; i < eventCounts.size() - 1 ; i++ ) {
|
||||
out.printf("%s:%d,",eventCounts.get(i).first,eventCounts.get(i).second);
|
||||
}
|
||||
out.printf("%s:%d%n",eventCounts.get(i).first,eventCounts.get(i).second);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -132,21 +116,28 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
|
||||
return rodString;
|
||||
}
|
||||
|
||||
|
||||
private static final String verboseDelimiter = "@"; // it's ugly to use "@" but it's literally the only usable character not allowed in read names
|
||||
|
||||
private static String createVerboseOutput(final ReadBackedPileup pileup) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
boolean isFirst = true;
|
||||
|
||||
sb.append(pileup.getNumberOfDeletions());
|
||||
sb.append(" ");
|
||||
|
||||
for ( PileupElement p : pileup ) {
|
||||
if ( isFirst )
|
||||
isFirst = false;
|
||||
else
|
||||
sb.append(",");
|
||||
sb.append(p.getRead().getReadName());
|
||||
sb.append(":");
|
||||
sb.append(verboseDelimiter);
|
||||
sb.append(p.getOffset());
|
||||
sb.append(":");
|
||||
sb.append(verboseDelimiter);
|
||||
sb.append(p.getRead().getReadLength());
|
||||
sb.append(verboseDelimiter);
|
||||
sb.append(p.getRead().getMappingQuality());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,35 +114,6 @@ public abstract class Walker<MapType, ReduceType> {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method states whether you want to see pileups of "extended events" (currently, indels only)
|
||||
* at every locus that has at least one indel associated with it. Consider the following situation:
|
||||
*
|
||||
* ref: AT--CTGA (note that we expanded the ref here with -- to accomodate insertion in read3)
|
||||
* read1: AT--CTGA (perfectly matches the ref)
|
||||
* read2: AT----GA (deletion -CT w.r.t. the ref)
|
||||
* read3: ATGGCTGA (insertion +GG w.r.t the ref)
|
||||
*
|
||||
* Normally, the locus iterator only returns read base pileups over reference bases, optionally with deleted bases
|
||||
* included (see #includeReadsWithDeletionAtLoci()). In other words, the pileup over the second reference base (T)
|
||||
* will be [T,T,T] (all reads count), for the next reference base (C) the pileup will be [C,C] (or [C,-,C] if
|
||||
* #includeReadsWithDeletionAtLoci() is true), next pileup generated over the next reference
|
||||
* base (T) will be either [T,T], or [T,'-',T], etc. In this default mode, a) insertions are not seen by a walker at all, and
|
||||
* b) deletions are (optionally) seen only on a base-by-base basis (as the step-by-step traversal over the reference
|
||||
* bases is performed). In the extended event mode, however, if there is at least one indel associated with a reference
|
||||
* locus, the engine will generate an <i>additional</i> call to the walker's map() method, with a pileup of
|
||||
* full-length extended indel/noevent calls. This call will be made <i>after</i> the conventional base pileup call
|
||||
* at that locus. Thus, in the example above, a conventional call will be first made at the second reference base (T),
|
||||
* with the [T,T,T] pileup of read bases, then an extended event call will be made at the <i>same</i> locus with
|
||||
* pileup [no_event, -CT, +GG] (i.e. extended events associated with that reference base). After that, the traversal
|
||||
* engine will move to the next reference base.
|
||||
*
|
||||
* @return false if you do not want to receive extra pileups with extended events, or true if you do.
|
||||
*/
|
||||
public boolean generateExtendedEvents() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void initialize() { }
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -74,10 +74,6 @@ public class GCContentByIntervalWalker extends LocusWalker<Long, Long> {
|
|||
public void initialize() {
|
||||
}
|
||||
|
||||
public boolean generateExtendedEvents() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Long reduceInit() {
|
||||
return 0L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,10 +227,6 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
}
|
||||
}
|
||||
|
||||
public boolean generateExtendedEvents() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public PhasingStats reduceInit() {
|
||||
return new PhasingStats();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.qc;
|
||||
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* At each locus in the input data set, prints the reference base, genomic location, and
|
||||
* all aligning reads in a compact but human-readable form.
|
||||
*/
|
||||
public class PrintLocusContextWalker extends LocusWalker<AlignmentContext, Integer> implements TreeReducible<Integer> {
|
||||
@Output
|
||||
private PrintStream out;
|
||||
|
||||
public AlignmentContext map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
out.printf( "In map: ref = %s, loc = %s %s, reads = %s%n", ref.getBaseAsChar(),
|
||||
context.getLocation(),
|
||||
context.hasExtendedEventPileup() ? "[extended]" : "",
|
||||
Arrays.deepToString( getReadNames(context.getReads()) ) );
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer reduceInit() { return 0; }
|
||||
|
||||
public Integer reduce(AlignmentContext context, Integer sum) {
|
||||
return sum + 1;
|
||||
}
|
||||
|
||||
public Integer treeReduce(Integer lhs, Integer rhs) {
|
||||
return lhs + rhs;
|
||||
}
|
||||
|
||||
private String[] getReadNames( List<GATKSAMRecord> reads ) {
|
||||
String[] readNames = new String[ reads.size() ];
|
||||
for( int i = 0; i < reads.size(); i++ ) {
|
||||
readNames[i] = String.format("%nname = %s, start = %d, end = %d", reads.get(i).getReadName(), reads.get(i).getAlignmentStart(), reads.get(i).getAlignmentEnd());
|
||||
}
|
||||
//Arrays.sort(readNames);
|
||||
return readNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateExtendedEvents() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,6 +107,12 @@ public class UserException extends ReviewedStingException {
|
|||
}
|
||||
}
|
||||
|
||||
public static class NotEnoughMemory extends UserException {
|
||||
public NotEnoughMemory() {
|
||||
super(String.format("There was a failure because you did not provide enough memory to run this program. See the -Xmx JVM argument to adjust the maximum heap size provided to Java"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class ErrorWritingBamFile extends UserException {
|
||||
public ErrorWritingBamFile(String message) {
|
||||
super(String.format("An error occurred when trying to write the BAM file. Usually this happens when there is not enough space in the directory to which the data is being written (generally the temp directory) or when your system's open file handle limit is too small. To tell Java to use a bigger/better file system use -Djava.io.tmpdir=X on the command line. The exact error was %s", message));
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ public class DownsamplerBenchmark extends ReadProcessingBenchmark {
|
|||
new ValidationExclusion(Collections.singletonList(ValidationExclusion.TYPE.ALL)),
|
||||
Collections.<ReadFilter>emptyList(),
|
||||
false,
|
||||
false,
|
||||
BAQ.CalculationMode.OFF,
|
||||
BAQ.QualityMode.DONT_MODIFY,
|
||||
null, // no BAQ
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ public class SAMDataSourceUnitTest extends BaseTest {
|
|||
null,
|
||||
new ValidationExclusion(),
|
||||
new ArrayList<ReadFilter>(),
|
||||
false,
|
||||
false);
|
||||
|
||||
Iterable<Shard> strat = data.createShardIteratorOverMappedReads(seq.getSequenceDictionary(),new LocusShardBalancer());
|
||||
|
|
|
|||
|
|
@ -43,49 +43,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
return new LocusIteratorByState(new FakeCloseableIterator<SAMRecord>(reads.iterator()), readAttributes, genomeLocParser, LocusIteratorByState.sampleListForSAMWithoutReadGroups());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndelBaseQualityFiltering() {
|
||||
final byte[] bases = new byte[] {'A','A','A','A','A','A','A','A','A','A'};
|
||||
|
||||
// create a test version of the Reads object
|
||||
ReadProperties readAttributes = createTestReadProperties();
|
||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
||||
|
||||
SAMRecord before = ArtificialSAMUtils.createArtificialRead(header,"before",0,1,10);
|
||||
before.setReadBases(bases);
|
||||
before.setBaseQualities(new byte[] {20,20,20,20,0,20,20,20,20,20});
|
||||
before.setCigarString("10M");
|
||||
|
||||
SAMRecord during = ArtificialSAMUtils.createArtificialRead(header,"during",0,2,10);
|
||||
during.setReadBases(bases);
|
||||
during.setBaseQualities(new byte[] {20,20,20,20,20,20,20,20,20,20,20});
|
||||
during.setCigarString("4M1I6M");
|
||||
|
||||
SAMRecord after = ArtificialSAMUtils.createArtificialRead(header,"after",0,3,10);
|
||||
after.setReadBases(bases);
|
||||
after.setBaseQualities(new byte[] {20,20,0,20,20,20,20,20,20,20});
|
||||
after.setCigarString("10M");
|
||||
|
||||
List<SAMRecord> reads = Arrays.asList(before,during,after);
|
||||
|
||||
// create the iterator by state with the fake reads and fake records
|
||||
li = makeLTBS(reads,readAttributes);
|
||||
|
||||
boolean foundExtendedEventPileup = false;
|
||||
while (li.hasNext()) {
|
||||
AlignmentContext context = li.next();
|
||||
if(!context.hasExtendedEventPileup())
|
||||
continue;
|
||||
|
||||
ReadBackedExtendedEventPileup pileup = context.getExtendedEventPileup().getBaseFilteredPileup(10);
|
||||
Assert.assertEquals(pileup.getLocation().getStart(), 5, "Extended event pileup at wrong location");
|
||||
Assert.assertEquals(pileup.getNumberOfElements(), 3, "Pileup size is incorrect");
|
||||
|
||||
foundExtendedEventPileup = true;
|
||||
}
|
||||
|
||||
Assert.assertTrue(foundExtendedEventPileup,"Extended event pileup not found");
|
||||
}
|
||||
@Test
|
||||
public void testIndelsInRegularPileup() {
|
||||
final byte[] bases = new byte[] {'A','A','A','A','A','A','A','A','A','A'};
|
||||
|
|
@ -93,7 +50,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
|
||||
// create a test version of the Reads object
|
||||
ReadProperties readAttributes = createTestReadProperties();
|
||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
||||
|
||||
SAMRecord before = ArtificialSAMUtils.createArtificialRead(header,"before",0,1,10);
|
||||
before.setReadBases(bases);
|
||||
|
|
@ -136,59 +92,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
Assert.assertTrue(foundIndel,"Indel in pileup not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* Right now, the GATK's extended event pileup DOES NOT include reads which stop immediately before an insertion
|
||||
* but DOES include reads which stop immediately after an insertion. This is almost certainly WRONG. Eric is
|
||||
* figuring out the right way to handle this; in the meantime, adding this test to monitor that:
|
||||
* A) the behavior is consistent
|
||||
* B) so that we do end up with an automated test for this case when the model is fixed.
|
||||
*/
|
||||
@Test
|
||||
public void testIndelPileupContainsAbuttingReads() {
|
||||
final byte[] bases = new byte[] {'A','A','A','A','A','A','A','A','A','A'};
|
||||
final byte[] quals = new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
|
||||
|
||||
// create a test version of the Reads object
|
||||
ReadProperties readAttributes = createTestReadProperties();
|
||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
||||
|
||||
SAMRecord before = ArtificialSAMUtils.createArtificialRead(header,"before",0,1,10);
|
||||
before.setReadBases(bases);
|
||||
before.setBaseQualities(quals);
|
||||
before.setCigarString("10M");
|
||||
|
||||
SAMRecord during = ArtificialSAMUtils.createArtificialRead(header,"during",0,6,10);
|
||||
during.setReadBases(bases);
|
||||
during.setBaseQualities(quals);
|
||||
during.setCigarString("5M1I5M");
|
||||
|
||||
SAMRecord after = ArtificialSAMUtils.createArtificialRead(header,"after",0,11,10);
|
||||
after.setReadBases(bases);
|
||||
after.setBaseQualities(quals);
|
||||
after.setCigarString("10M");
|
||||
|
||||
List<SAMRecord> reads = Arrays.asList(before,during,after);
|
||||
|
||||
// create the iterator by state with the fake reads and fake records
|
||||
li = makeLTBS(reads,readAttributes);
|
||||
|
||||
boolean foundExtendedEventPileup = false;
|
||||
while (li.hasNext()) {
|
||||
AlignmentContext context = li.next();
|
||||
if(!context.hasExtendedEventPileup())
|
||||
continue;
|
||||
|
||||
Assert.assertEquals(context.getLocation().getStart(), 10, "Extended event pileup at wrong location");
|
||||
Assert.assertEquals(context.size(), 2, "Pileup size is incorrect");
|
||||
Assert.assertEquals(context.getExtendedEventPileup().getReads().get(0), during, "Read in pileup is incorrect");
|
||||
Assert.assertEquals(context.getExtendedEventPileup().getReads().get(1), after, "Read in pileup is incorrect");
|
||||
|
||||
foundExtendedEventPileup = true;
|
||||
}
|
||||
|
||||
Assert.assertTrue(foundExtendedEventPileup,"Extended event pileup not found");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWholeIndelReadInIsolation() {
|
||||
final int firstLocus = 44367789;
|
||||
|
|
@ -214,17 +117,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
ReadBackedPileup basePileup = alignmentContext.getBasePileup();
|
||||
Assert.assertEquals(basePileup.getReads().size(),1,"Pileup is of incorrect size");
|
||||
Assert.assertSame(basePileup.getReads().get(0),indelOnlyRead,"Read in pileup is incorrect");
|
||||
|
||||
// Turn on extended events, and make sure the event is found.
|
||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
||||
li = makeLTBS(reads, readAttributes);
|
||||
|
||||
Assert.assertTrue(li.hasNext(),"LocusIteratorByState with extended events should contain exactly one pileup");
|
||||
alignmentContext = li.next();
|
||||
Assert.assertEquals(alignmentContext.getLocation().getStart(),firstLocus-1,"Extended event pileup is at incorrect location.");
|
||||
ReadBackedExtendedEventPileup extendedEventPileup = alignmentContext.getExtendedEventPileup();
|
||||
Assert.assertEquals(extendedEventPileup.getReads().size(),1,"Pileup is of incorrect size");
|
||||
Assert.assertSame(extendedEventPileup.getReads().get(0),indelOnlyRead,"Read in pileup is incorrect");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -232,7 +124,7 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
* not negatively influence the ordering of the pileup.
|
||||
*/
|
||||
@Test
|
||||
public void testWholeIndelReadWithoutExtendedEvents() {
|
||||
public void testWholeIndelRead() {
|
||||
final int firstLocus = 44367788, secondLocus = firstLocus + 1;
|
||||
|
||||
SAMRecord leadingRead = ArtificialSAMUtils.createArtificialRead(header,"leading",0,firstLocus,76);
|
||||
|
|
@ -280,70 +172,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
Assert.assertEquals(numAlignmentContextsFound,2,"Found incorrect number of alignment contexts");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to make sure that reads supporting only an indel (example cigar string: 76I) do
|
||||
* not negatively influence the ordering of the pileup.
|
||||
*/
|
||||
@Test
|
||||
public void testWholeIndelReadWithExtendedEvents() {
|
||||
final int firstLocus = 44367788, secondLocus = firstLocus + 1;
|
||||
|
||||
// create a test version of the Reads object
|
||||
ReadProperties readAttributes = createTestReadProperties();
|
||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
||||
|
||||
SAMRecord leadingRead = ArtificialSAMUtils.createArtificialRead(header,"leading",0,firstLocus,76);
|
||||
leadingRead.setReadBases(Utils.dupBytes((byte)'A',76));
|
||||
leadingRead.setBaseQualities(Utils.dupBytes((byte)'@',76));
|
||||
leadingRead.setCigarString("1M75I");
|
||||
|
||||
SAMRecord indelOnlyRead = ArtificialSAMUtils.createArtificialRead(header,"indelOnly",0,secondLocus,76);
|
||||
indelOnlyRead.setReadBases(Utils.dupBytes((byte)'A',76));
|
||||
indelOnlyRead.setBaseQualities(Utils.dupBytes((byte)'@',76));
|
||||
indelOnlyRead.setCigarString("76I");
|
||||
|
||||
SAMRecord fullMatchAfterIndel = ArtificialSAMUtils.createArtificialRead(header,"fullMatch",0,secondLocus,1);
|
||||
fullMatchAfterIndel.setReadBases(Utils.dupBytes((byte)'A',1));
|
||||
fullMatchAfterIndel.setBaseQualities(Utils.dupBytes((byte)'@',1));
|
||||
fullMatchAfterIndel.setCigarString("1M");
|
||||
|
||||
List<SAMRecord> reads = Arrays.asList(leadingRead,indelOnlyRead,fullMatchAfterIndel);
|
||||
|
||||
// create the iterator by state with the fake reads and fake records
|
||||
li = makeLTBS(reads,readAttributes);
|
||||
|
||||
Assert.assertTrue(li.hasNext(),"Missing first locus at " + firstLocus);
|
||||
AlignmentContext alignmentContext = li.next();
|
||||
Assert.assertEquals(alignmentContext.getLocation().getStart(),firstLocus,"Incorrect locus at this position; should be " + firstLocus);
|
||||
List<GATKSAMRecord> readsAtLocus = alignmentContext.getBasePileup().getReads();
|
||||
Assert.assertEquals(readsAtLocus.size(),1,"Wrong number of reads at locus " + firstLocus);
|
||||
Assert.assertSame(readsAtLocus.get(0),leadingRead,"leadingRead absent from pileup at locus " + firstLocus);
|
||||
|
||||
Assert.assertTrue(li.hasNext(),"Missing extended event at " + firstLocus);
|
||||
alignmentContext = li.next();
|
||||
Assert.assertEquals(alignmentContext.getLocation().getStart(),firstLocus,"Incorrect extended event locus at this position; should be " + firstLocus);
|
||||
readsAtLocus = alignmentContext.getExtendedEventPileup().getReads();
|
||||
Assert.assertEquals(readsAtLocus.size(),3,"Wrong number of reads at extended event locus " + firstLocus);
|
||||
Assert.assertSame(readsAtLocus.get(0),leadingRead,"leadingRead absent from pileup at extended event locus " + firstLocus);
|
||||
Assert.assertSame(readsAtLocus.get(1),indelOnlyRead,"indelOnlyRead absent from pileup at extended event locus " + firstLocus);
|
||||
// Weird, but as above, reads immediately after the indel are included in the extended event pileup
|
||||
Assert.assertSame(readsAtLocus.get(2),fullMatchAfterIndel,"fullMatchAfterIndel absent from pileup at extended event locus " + firstLocus);
|
||||
|
||||
// Traditionally, reads that end with indels bleed into the pileup at the following locus. Verify that the next pileup contains this read
|
||||
// and considers it to be an indel-containing read.
|
||||
Assert.assertTrue(li.hasNext(),"Missing base pileup at " + secondLocus);
|
||||
alignmentContext = li.next();
|
||||
Assert.assertEquals(alignmentContext.getLocation().getStart(),secondLocus,"Incorrect extended event locus at this position; should be " + secondLocus);
|
||||
readsAtLocus = alignmentContext.getBasePileup().getReads();
|
||||
Assert.assertEquals(readsAtLocus.size(),3,"Wrong number of reads at extended event locus " + secondLocus);
|
||||
Assert.assertSame(readsAtLocus.get(0),leadingRead,"leadingRead absent from pileup at extended event locus " + secondLocus);
|
||||
Assert.assertSame(readsAtLocus.get(1),indelOnlyRead,"indelOnlyRead absent from pileup at extended event locus " + secondLocus);
|
||||
// Weird, but as above, reads immediately after the indel are included in the extended event pileup
|
||||
Assert.assertSame(readsAtLocus.get(2),fullMatchAfterIndel,"fullMatchAfterIndel absent from pileup at extended event locus " + secondLocus);
|
||||
|
||||
Assert.assertFalse(li.hasNext(),"Too many alignment contexts");
|
||||
}
|
||||
|
||||
private static ReadProperties createTestReadProperties() {
|
||||
return new ReadProperties(
|
||||
Collections.<SAMReaderID>emptyList(),
|
||||
|
|
@ -354,7 +182,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
|||
new ValidationExclusion(),
|
||||
Collections.<ReadFilter>emptyList(),
|
||||
false,
|
||||
false,
|
||||
BAQ.CalculationMode.OFF,
|
||||
BAQ.QualityMode.DONT_MODIFY,
|
||||
null, // no BAQ
|
||||
|
|
|
|||
|
|
@ -23,16 +23,4 @@ public class PileupWalkerIntegrationTest extends WalkerTest {
|
|||
WalkerTestSpec spec = new WalkerTestSpec(gatk_args, 1, Arrays.asList(expected_md5));
|
||||
executeTest("Testing the standard (no-indel) pileup on three merged FHS pools with 27 deletions in 969 bases", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtendedEventPileup() {
|
||||
String gatk_args = "-T Pileup -I " + validationDataLocation + "OV-0930.normal.chunk.bam "
|
||||
+ "-R " + hg18Reference
|
||||
+ " -show_indels -o %s";
|
||||
String expected_md5="06eedc2e7927650961d99d703f4301a4";
|
||||
WalkerTestSpec spec = new WalkerTestSpec(gatk_args,1,Arrays.asList(expected_md5));
|
||||
executeTest("Testing the extended pileup with indel records included on a small chunk of Ovarian dataset with 20 indels (1 D, 19 I)", spec);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue