Active Region Traversal should use GATKSAMRecords everywhere instead of SAMRecords. misc cleanup.
This commit is contained in:
parent
5af3999a2d
commit
894d3340be
|
|
@ -139,11 +139,11 @@ public class AnalyzeCovariates extends CommandLineProgram {
|
||||||
*/
|
*/
|
||||||
@Argument(fullName="max_histogram_value", shortName="maxHist", required = false, doc="If supplied, this value will be the max value of the histogram plots")
|
@Argument(fullName="max_histogram_value", shortName="maxHist", required = false, doc="If supplied, this value will be the max value of the histogram plots")
|
||||||
private int MAX_HISTOGRAM_VALUE = 0;
|
private int MAX_HISTOGRAM_VALUE = 0;
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@Argument(fullName="do_indel_quality", shortName="indels", required = false, doc="If supplied, do indel quality plotting")
|
@Argument(fullName="do_indel_quality", shortName="indels", required = false, doc="If supplied, do indel quality plotting")
|
||||||
private boolean DO_INDEL_QUALITY = false;
|
private boolean DO_INDEL_QUALITY = false;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Private Member Variables
|
// Private Member Variables
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|
@ -274,7 +274,6 @@ public class AnalyzeCovariates extends CommandLineProgram {
|
||||||
RecalDatum datum = new RecalDatum( Long.parseLong( vals[iii] ), Long.parseLong( vals[iii + 1] ), Double.parseDouble( vals[1] ), 0.0 );
|
RecalDatum datum = new RecalDatum( Long.parseLong( vals[iii] ), Long.parseLong( vals[iii + 1] ), Double.parseDouble( vals[1] ), 0.0 );
|
||||||
// Add that datum to all the collapsed tables which will be used in the sequential calculation
|
// Add that datum to all the collapsed tables which will be used in the sequential calculation
|
||||||
dataManager.addToAllTables( key, datum, IGNORE_QSCORES_LESS_THAN );
|
dataManager.addToAllTables( key, datum, IGNORE_QSCORES_LESS_THAN );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeDataTables() {
|
private void writeDataTables() {
|
||||||
|
|
@ -341,7 +340,7 @@ public class AnalyzeCovariates extends CommandLineProgram {
|
||||||
|
|
||||||
// for each covariate
|
// for each covariate
|
||||||
for( int iii = 1; iii < requestedCovariates.size(); iii++ ) {
|
for( int iii = 1; iii < requestedCovariates.size(); iii++ ) {
|
||||||
Covariate cov = requestedCovariates.get(iii);
|
final Covariate cov = requestedCovariates.get(iii);
|
||||||
final File outputFile = new File(OUTPUT_DIR, readGroup + "." + cov.getClass().getSimpleName()+ ".dat");
|
final File outputFile = new File(OUTPUT_DIR, readGroup + "." + cov.getClass().getSimpleName()+ ".dat");
|
||||||
if (DO_INDEL_QUALITY) {
|
if (DO_INDEL_QUALITY) {
|
||||||
RScriptExecutor executor = new RScriptExecutor();
|
RScriptExecutor executor = new RScriptExecutor();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.broadinstitute.sting.gatk.traversals;
|
package org.broadinstitute.sting.gatk.traversals;
|
||||||
|
|
||||||
import net.sf.samtools.SAMRecord;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.gatk.WalkerManager;
|
import org.broadinstitute.sting.gatk.WalkerManager;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
|
|
@ -29,7 +28,7 @@ public class TraverseActiveRegions <M,T> extends TraversalEngine<M,T,ActiveRegio
|
||||||
protected static Logger logger = Logger.getLogger(TraversalEngine.class);
|
protected static Logger logger = Logger.getLogger(TraversalEngine.class);
|
||||||
|
|
||||||
private final Queue<ActiveRegion> workQueue = new LinkedList<ActiveRegion>();
|
private final Queue<ActiveRegion> workQueue = new LinkedList<ActiveRegion>();
|
||||||
private final LinkedHashSet<SAMRecord> myReads = new LinkedHashSet<SAMRecord>();
|
private final LinkedHashSet<GATKSAMRecord> myReads = new LinkedHashSet<GATKSAMRecord>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTraversalType() {
|
protected String getTraversalType() {
|
||||||
|
|
@ -101,7 +100,7 @@ public class TraverseActiveRegions <M,T> extends TraversalEngine<M,T,ActiveRegio
|
||||||
|
|
||||||
// Grab all the previously unseen reads from this pileup and add them to the massive read list
|
// Grab all the previously unseen reads from this pileup and add them to the massive read list
|
||||||
for( final PileupElement p : locus.getBasePileup() ) {
|
for( final PileupElement p : locus.getBasePileup() ) {
|
||||||
final SAMRecord read = p.getRead();
|
final GATKSAMRecord read = p.getRead();
|
||||||
if( !myReads.contains(read) ) {
|
if( !myReads.contains(read) ) {
|
||||||
myReads.add(read);
|
myReads.add(read);
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +110,7 @@ public class TraverseActiveRegions <M,T> extends TraversalEngine<M,T,ActiveRegio
|
||||||
// which active regions in the work queue are now safe to process
|
// which active regions in the work queue are now safe to process
|
||||||
if( !locusView.hasNext() ) {
|
if( !locusView.hasNext() ) {
|
||||||
for( final PileupElement p : locus.getBasePileup() ) {
|
for( final PileupElement p : locus.getBasePileup() ) {
|
||||||
final SAMRecord read = p.getRead();
|
final GATKSAMRecord read = p.getRead();
|
||||||
if( !myReads.contains(read) ) {
|
if( !myReads.contains(read) ) {
|
||||||
myReads.add(read);
|
myReads.add(read);
|
||||||
}
|
}
|
||||||
|
|
@ -156,9 +155,9 @@ public class TraverseActiveRegions <M,T> extends TraversalEngine<M,T,ActiveRegio
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
private T processActiveRegion( final ActiveRegion activeRegion, final LinkedHashSet<SAMRecord> reads, final Queue<ActiveRegion> workQueue, final T sum, final ActiveRegionWalker<M,T> walker ) {
|
private T processActiveRegion( final ActiveRegion activeRegion, final LinkedHashSet<GATKSAMRecord> reads, final Queue<ActiveRegion> workQueue, final T sum, final ActiveRegionWalker<M,T> walker ) {
|
||||||
final ArrayList<SAMRecord> placedReads = new ArrayList<SAMRecord>();
|
final ArrayList<GATKSAMRecord> placedReads = new ArrayList<GATKSAMRecord>();
|
||||||
for( final SAMRecord read : reads ) {
|
for( final GATKSAMRecord read : reads ) {
|
||||||
final GenomeLoc readLoc = this.engine.getGenomeLocParser().createGenomeLoc( read );
|
final GenomeLoc readLoc = this.engine.getGenomeLocParser().createGenomeLoc( read );
|
||||||
if( activeRegion.getLocation().overlapsP( readLoc ) ) {
|
if( activeRegion.getLocation().overlapsP( readLoc ) ) {
|
||||||
// The region which the highest amount of overlap is chosen as the primary region for the read (tie breaking is done as right most region)
|
// The region which the highest amount of overlap is chosen as the primary region for the read (tie breaking is done as right most region)
|
||||||
|
|
@ -170,22 +169,22 @@ public class TraverseActiveRegions <M,T> extends TraversalEngine<M,T,ActiveRegio
|
||||||
bestRegion = otherRegionToTest;
|
bestRegion = otherRegionToTest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bestRegion.add( (GATKSAMRecord) read );
|
bestRegion.add( read );
|
||||||
|
|
||||||
// The read is also added to all other regions in which it overlaps but marked as non-primary
|
// The read is also added to all other regions in which it overlaps but marked as non-primary
|
||||||
if( walker.wantsNonPrimaryReads() ) {
|
if( walker.wantsNonPrimaryReads() ) {
|
||||||
if( !bestRegion.equals(activeRegion) ) {
|
if( !bestRegion.equals(activeRegion) ) {
|
||||||
activeRegion.add( (GATKSAMRecord) read );
|
activeRegion.add( read );
|
||||||
}
|
}
|
||||||
for( final ActiveRegion otherRegionToTest : workQueue ) {
|
for( final ActiveRegion otherRegionToTest : workQueue ) {
|
||||||
if( !bestRegion.equals(otherRegionToTest) && otherRegionToTest.getExtendedLoc().overlapsP( readLoc ) ) {
|
if( !bestRegion.equals(otherRegionToTest) && otherRegionToTest.getExtendedLoc().overlapsP( readLoc ) ) {
|
||||||
otherRegionToTest.add( (GATKSAMRecord) read );
|
otherRegionToTest.add( read );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
placedReads.add( read );
|
placedReads.add( read );
|
||||||
} else if( activeRegion.getExtendedLoc().overlapsP( readLoc ) && walker.wantsNonPrimaryReads() ) {
|
} else if( activeRegion.getExtendedLoc().overlapsP( readLoc ) && walker.wantsNonPrimaryReads() ) {
|
||||||
activeRegion.add( (GATKSAMRecord) read );
|
activeRegion.add( read );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reads.removeAll( placedReads ); // remove all the reads which have been placed into their active region
|
reads.removeAll( placedReads ); // remove all the reads which have been placed into their active region
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
||||||
if( tracker.getValues(knownSites).size() == 0 ) { // If something here is in one of the knownSites tracks then skip over it, otherwise proceed
|
if( tracker.getValues(knownSites).size() == 0 ) { // If something here is in one of the knownSites tracks then skip over it, otherwise proceed
|
||||||
// For each read at this locus
|
// For each read at this locus
|
||||||
for( final PileupElement p : context.getBasePileup() ) {
|
for( final PileupElement p : context.getBasePileup() ) {
|
||||||
final GATKSAMRecord gatkRead = (GATKSAMRecord) p.getRead();
|
final GATKSAMRecord gatkRead = p.getRead();
|
||||||
int offset = p.getOffset();
|
int offset = p.getOffset();
|
||||||
|
|
||||||
if( gatkRead.containsTemporaryAttribute( SKIP_RECORD_ATTRIBUTE ) ) {
|
if( gatkRead.containsTemporaryAttribute( SKIP_RECORD_ATTRIBUTE ) ) {
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
|
|
||||||
//compute all covariate values for this read
|
//compute all covariate values for this read
|
||||||
final Comparable[][] covariateValues_offset_x_covar =
|
final Comparable[][] covariateValues_offset_x_covar =
|
||||||
RecalDataManager.computeCovariates((GATKSAMRecord) read, requestedCovariates);
|
RecalDataManager.computeCovariates(read, requestedCovariates);
|
||||||
|
|
||||||
// For each base in the read
|
// For each base in the read
|
||||||
for( int offset = 0; offset < read.getReadLength(); offset++ ) {
|
for( int offset = 0; offset < read.getReadLength(); offset++ ) {
|
||||||
|
|
|
||||||
|
|
@ -673,7 +673,7 @@ public class BAQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if we don't think this read is eligable for the BAQ calculation. Examples include non-PF reads,
|
* Returns true if we don't think this read is eligible for the BAQ calculation. Examples include non-PF reads,
|
||||||
* duplicates, or unmapped reads. Used by baqRead to determine if a read should fall through the calculation.
|
* duplicates, or unmapped reads. Used by baqRead to determine if a read should fall through the calculation.
|
||||||
*
|
*
|
||||||
* @param read
|
* @param read
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue