Merge branch 'master' of ssh://nickel.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
0b37c556f5
|
|
@ -356,10 +356,6 @@ public class GenomeAnalysisEngine {
|
||||||
public BAQ.QualityMode getWalkerBAQQualityMode() { return WalkerManager.getBAQQualityMode(walker); }
|
public BAQ.QualityMode getWalkerBAQQualityMode() { return WalkerManager.getBAQQualityMode(walker); }
|
||||||
public BAQ.ApplicationTime getWalkerBAQApplicationTime() { return WalkerManager.getBAQApplicationTime(walker); }
|
public BAQ.ApplicationTime getWalkerBAQApplicationTime() { return WalkerManager.getBAQApplicationTime(walker); }
|
||||||
|
|
||||||
protected boolean generateExtendedEvents() {
|
|
||||||
return walker.generateExtendedEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean includeReadsWithDeletionAtLoci() {
|
protected boolean includeReadsWithDeletionAtLoci() {
|
||||||
return walker.includeReadsWithDeletionAtLoci();
|
return walker.includeReadsWithDeletionAtLoci();
|
||||||
}
|
}
|
||||||
|
|
@ -766,7 +762,6 @@ public class GenomeAnalysisEngine {
|
||||||
new ValidationExclusion(Arrays.asList(argCollection.unsafe)),
|
new ValidationExclusion(Arrays.asList(argCollection.unsafe)),
|
||||||
filters,
|
filters,
|
||||||
includeReadsWithDeletionAtLoci(),
|
includeReadsWithDeletionAtLoci(),
|
||||||
generateExtendedEvents(),
|
|
||||||
getWalkerBAQApplicationTime() == BAQ.ApplicationTime.ON_INPUT ? argCollection.BAQMode : BAQ.CalculationMode.OFF,
|
getWalkerBAQApplicationTime() == BAQ.ApplicationTime.ON_INPUT ? argCollection.BAQMode : BAQ.CalculationMode.OFF,
|
||||||
getWalkerBAQQualityMode(),
|
getWalkerBAQQualityMode(),
|
||||||
refReader,
|
refReader,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ public class ReadProperties {
|
||||||
private final Collection<ReadFilter> supplementalFilters;
|
private final Collection<ReadFilter> supplementalFilters;
|
||||||
private final boolean includeReadsWithDeletionAtLoci;
|
private final boolean includeReadsWithDeletionAtLoci;
|
||||||
private final boolean useOriginalBaseQualities;
|
private final boolean useOriginalBaseQualities;
|
||||||
private final boolean generateExtendedEvents;
|
|
||||||
private final BAQ.CalculationMode cmode;
|
private final BAQ.CalculationMode cmode;
|
||||||
private final BAQ.QualityMode qmode;
|
private final BAQ.QualityMode qmode;
|
||||||
private final IndexedFastaSequenceFile refReader; // read for BAQ, if desired
|
private final IndexedFastaSequenceFile refReader; // read for BAQ, if desired
|
||||||
|
|
@ -52,16 +51,9 @@ public class ReadProperties {
|
||||||
return includeReadsWithDeletionAtLoci;
|
return includeReadsWithDeletionAtLoci;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Deprecated
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public boolean generateExtendedEvents() {
|
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 downsamplingMethod Method for downsampling reads at a given locus.
|
||||||
* @param exclusionList what safety checks we're willing to let slide
|
* @param exclusionList what safety checks we're willing to let slide
|
||||||
* @param supplementalFilters additional filters to dynamically apply.
|
* @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
|
* @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
|
* 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.
|
* bases will be seen in the pileups, and the deletions will be skipped silently.
|
||||||
|
|
@ -163,7 +152,6 @@ public class ReadProperties {
|
||||||
ValidationExclusion exclusionList,
|
ValidationExclusion exclusionList,
|
||||||
Collection<ReadFilter> supplementalFilters,
|
Collection<ReadFilter> supplementalFilters,
|
||||||
boolean includeReadsWithDeletionAtLoci,
|
boolean includeReadsWithDeletionAtLoci,
|
||||||
boolean generateExtendedEvents,
|
|
||||||
BAQ.CalculationMode cmode,
|
BAQ.CalculationMode cmode,
|
||||||
BAQ.QualityMode qmode,
|
BAQ.QualityMode qmode,
|
||||||
IndexedFastaSequenceFile refReader,
|
IndexedFastaSequenceFile refReader,
|
||||||
|
|
@ -176,7 +164,6 @@ public class ReadProperties {
|
||||||
this.exclusionList = exclusionList == null ? new ValidationExclusion() : exclusionList;
|
this.exclusionList = exclusionList == null ? new ValidationExclusion() : exclusionList;
|
||||||
this.supplementalFilters = supplementalFilters;
|
this.supplementalFilters = supplementalFilters;
|
||||||
this.includeReadsWithDeletionAtLoci = includeReadsWithDeletionAtLoci;
|
this.includeReadsWithDeletionAtLoci = includeReadsWithDeletionAtLoci;
|
||||||
this.generateExtendedEvents = generateExtendedEvents;
|
|
||||||
this.useOriginalBaseQualities = useOriginalBaseQualities;
|
this.useOriginalBaseQualities = useOriginalBaseQualities;
|
||||||
this.cmode = cmode;
|
this.cmode = cmode;
|
||||||
this.qmode = qmode;
|
this.qmode = qmode;
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ public class SAMDataSource {
|
||||||
null,
|
null,
|
||||||
new ValidationExclusion(),
|
new ValidationExclusion(),
|
||||||
new ArrayList<ReadFilter>(),
|
new ArrayList<ReadFilter>(),
|
||||||
false,
|
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,8 +185,7 @@ public class SAMDataSource {
|
||||||
DownsamplingMethod downsamplingMethod,
|
DownsamplingMethod downsamplingMethod,
|
||||||
ValidationExclusion exclusionList,
|
ValidationExclusion exclusionList,
|
||||||
Collection<ReadFilter> supplementalFilters,
|
Collection<ReadFilter> supplementalFilters,
|
||||||
boolean includeReadsWithDeletionAtLoci,
|
boolean includeReadsWithDeletionAtLoci) {
|
||||||
boolean generateExtendedEvents) {
|
|
||||||
this( samFiles,
|
this( samFiles,
|
||||||
threadAllocation,
|
threadAllocation,
|
||||||
numFileHandles,
|
numFileHandles,
|
||||||
|
|
@ -199,7 +197,6 @@ public class SAMDataSource {
|
||||||
exclusionList,
|
exclusionList,
|
||||||
supplementalFilters,
|
supplementalFilters,
|
||||||
includeReadsWithDeletionAtLoci,
|
includeReadsWithDeletionAtLoci,
|
||||||
generateExtendedEvents,
|
|
||||||
BAQ.CalculationMode.OFF,
|
BAQ.CalculationMode.OFF,
|
||||||
BAQ.QualityMode.DONT_MODIFY,
|
BAQ.QualityMode.DONT_MODIFY,
|
||||||
null, // no BAQ
|
null, // no BAQ
|
||||||
|
|
@ -216,9 +213,6 @@ public class SAMDataSource {
|
||||||
* @param downsamplingMethod Method for downsampling reads at a given locus.
|
* @param downsamplingMethod Method for downsampling reads at a given locus.
|
||||||
* @param exclusionList what safety checks we're willing to let slide
|
* @param exclusionList what safety checks we're willing to let slide
|
||||||
* @param supplementalFilters additional filters to dynamically apply.
|
* @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
|
* @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
|
* 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.
|
* bases will be seen in the pileups, and the deletions will be skipped silently.
|
||||||
|
|
@ -236,7 +230,6 @@ public class SAMDataSource {
|
||||||
ValidationExclusion exclusionList,
|
ValidationExclusion exclusionList,
|
||||||
Collection<ReadFilter> supplementalFilters,
|
Collection<ReadFilter> supplementalFilters,
|
||||||
boolean includeReadsWithDeletionAtLoci,
|
boolean includeReadsWithDeletionAtLoci,
|
||||||
boolean generateExtendedEvents,
|
|
||||||
BAQ.CalculationMode cmode,
|
BAQ.CalculationMode cmode,
|
||||||
BAQ.QualityMode qmode,
|
BAQ.QualityMode qmode,
|
||||||
IndexedFastaSequenceFile refReader,
|
IndexedFastaSequenceFile refReader,
|
||||||
|
|
@ -309,7 +302,6 @@ public class SAMDataSource {
|
||||||
exclusionList,
|
exclusionList,
|
||||||
supplementalFilters,
|
supplementalFilters,
|
||||||
includeReadsWithDeletionAtLoci,
|
includeReadsWithDeletionAtLoci,
|
||||||
generateExtendedEvents,
|
|
||||||
cmode,
|
cmode,
|
||||||
qmode,
|
qmode,
|
||||||
refReader,
|
refReader,
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
||||||
@Output
|
@Output
|
||||||
PrintStream out;
|
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")
|
@Argument(fullName="showVerbose",shortName="verbose",doc="Add an extra verbose section to the pileup output")
|
||||||
public boolean SHOW_VERBOSE = false;
|
public boolean SHOW_VERBOSE = false;
|
||||||
|
|
||||||
|
|
@ -78,8 +75,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generateExtendedEvents() { return SHOW_INDEL_PILEUPS; }
|
|
||||||
|
|
||||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
|
|
||||||
String rods = getReferenceOrderedData( tracker );
|
String rods = getReferenceOrderedData( tracker );
|
||||||
|
|
@ -92,17 +87,6 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
||||||
out.println();
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,35 +114,6 @@ public abstract class Walker<MapType, ReduceType> {
|
||||||
return false;
|
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() { }
|
public void initialize() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,6 @@ public class GCContentByIntervalWalker extends LocusWalker<Long, Long> {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generateExtendedEvents() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long reduceInit() {
|
public Long reduceInit() {
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,10 +227,6 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generateExtendedEvents() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhasingStats reduceInit() {
|
public PhasingStats reduceInit() {
|
||||||
return new PhasingStats();
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -76,7 +76,6 @@ public class DownsamplerBenchmark extends ReadProcessingBenchmark {
|
||||||
new ValidationExclusion(Collections.singletonList(ValidationExclusion.TYPE.ALL)),
|
new ValidationExclusion(Collections.singletonList(ValidationExclusion.TYPE.ALL)),
|
||||||
Collections.<ReadFilter>emptyList(),
|
Collections.<ReadFilter>emptyList(),
|
||||||
false,
|
false,
|
||||||
false,
|
|
||||||
BAQ.CalculationMode.OFF,
|
BAQ.CalculationMode.OFF,
|
||||||
BAQ.QualityMode.DONT_MODIFY,
|
BAQ.QualityMode.DONT_MODIFY,
|
||||||
null, // no BAQ
|
null, // no BAQ
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,6 @@ public class SAMDataSourceUnitTest extends BaseTest {
|
||||||
null,
|
null,
|
||||||
new ValidationExclusion(),
|
new ValidationExclusion(),
|
||||||
new ArrayList<ReadFilter>(),
|
new ArrayList<ReadFilter>(),
|
||||||
false,
|
|
||||||
false);
|
false);
|
||||||
|
|
||||||
Iterable<Shard> strat = data.createShardIteratorOverMappedReads(seq.getSequenceDictionary(),new LocusShardBalancer());
|
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());
|
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
|
@Test
|
||||||
public void testIndelsInRegularPileup() {
|
public void testIndelsInRegularPileup() {
|
||||||
final byte[] bases = new byte[] {'A','A','A','A','A','A','A','A','A','A'};
|
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
|
// create a test version of the Reads object
|
||||||
ReadProperties readAttributes = createTestReadProperties();
|
ReadProperties readAttributes = createTestReadProperties();
|
||||||
JVMUtils.setFieldValue(JVMUtils.findField(ReadProperties.class,"generateExtendedEvents"),readAttributes,true);
|
|
||||||
|
|
||||||
SAMRecord before = ArtificialSAMUtils.createArtificialRead(header,"before",0,1,10);
|
SAMRecord before = ArtificialSAMUtils.createArtificialRead(header,"before",0,1,10);
|
||||||
before.setReadBases(bases);
|
before.setReadBases(bases);
|
||||||
|
|
@ -136,59 +92,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
||||||
Assert.assertTrue(foundIndel,"Indel in pileup not found");
|
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
|
@Test
|
||||||
public void testWholeIndelReadInIsolation() {
|
public void testWholeIndelReadInIsolation() {
|
||||||
final int firstLocus = 44367789;
|
final int firstLocus = 44367789;
|
||||||
|
|
@ -214,17 +117,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
||||||
ReadBackedPileup basePileup = alignmentContext.getBasePileup();
|
ReadBackedPileup basePileup = alignmentContext.getBasePileup();
|
||||||
Assert.assertEquals(basePileup.getReads().size(),1,"Pileup is of incorrect size");
|
Assert.assertEquals(basePileup.getReads().size(),1,"Pileup is of incorrect size");
|
||||||
Assert.assertSame(basePileup.getReads().get(0),indelOnlyRead,"Read in pileup is incorrect");
|
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.
|
* not negatively influence the ordering of the pileup.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWholeIndelReadWithoutExtendedEvents() {
|
public void testWholeIndelRead() {
|
||||||
final int firstLocus = 44367788, secondLocus = firstLocus + 1;
|
final int firstLocus = 44367788, secondLocus = firstLocus + 1;
|
||||||
|
|
||||||
SAMRecord leadingRead = ArtificialSAMUtils.createArtificialRead(header,"leading",0,firstLocus,76);
|
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");
|
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() {
|
private static ReadProperties createTestReadProperties() {
|
||||||
return new ReadProperties(
|
return new ReadProperties(
|
||||||
Collections.<SAMReaderID>emptyList(),
|
Collections.<SAMReaderID>emptyList(),
|
||||||
|
|
@ -354,7 +182,6 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
|
||||||
new ValidationExclusion(),
|
new ValidationExclusion(),
|
||||||
Collections.<ReadFilter>emptyList(),
|
Collections.<ReadFilter>emptyList(),
|
||||||
false,
|
false,
|
||||||
false,
|
|
||||||
BAQ.CalculationMode.OFF,
|
BAQ.CalculationMode.OFF,
|
||||||
BAQ.QualityMode.DONT_MODIFY,
|
BAQ.QualityMode.DONT_MODIFY,
|
||||||
null, // no BAQ
|
null, // no BAQ
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,4 @@ public class PileupWalkerIntegrationTest extends WalkerTest {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(gatk_args, 1, Arrays.asList(expected_md5));
|
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);
|
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