Clarified some of the comments in the individual covariates now that things have been moved around to speed up the code. In general most error checking and adjustments to the data are done per read instead of per base. This means that functionality was moved out of the covariate modules and into CovariateCounterWalker and TableRecalibrationWalker.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2047 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
rpoplin 2009-11-14 18:44:05 +00:00
parent 672472789e
commit b05119987c
4 changed files with 9 additions and 12 deletions

View File

@ -33,13 +33,12 @@ import net.sf.samtools.SAMRecord;
* Date: Oct 30, 2009
*
* The Covariate interface. A Covariate is a feature used in the recalibration that can be picked out of the read, offset, and corresponding reference bases
* In general most error checking and adjustments to the data are done before the call to the covariates getValue methods in order to speed up the code.
* This unfortunately muddies the code, but most of these corrections can be done per read while the covariates get called per base, resulting in a big speed up.
*/
public interface Covariate {
public static final String COVARIATE_ERROR = "COVARIATE_ERROR";
public static final String COVARIATE_NULL = "COVARITATE_NULL";
public Comparable getValue(SAMRecord read, int offset, String readGroup, byte[] quals, char[] bases, char refBase); //used to pick out the value from attributes of the read
public Comparable getValue(SAMRecord read, int offset, String readGroup, byte[] quals, char[] bases, char refBase); // used to pick out the value from attributes of the read
public Comparable getValue(String str); // used to get value from input file
public int estimatedNumberOfBins(); // used to estimate the amount space required for the HashMap
}

View File

@ -242,14 +242,14 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
prevBase = bases[offset-1];
// Get the complement base strand if we are a negative strand read
if( read.getReadNegativeStrandFlag() ) {
bases = BaseUtils.simpleComplement( read.getReadString() ).toCharArray();
bases = BaseUtils.simpleComplement( read.getReadString() ).toCharArray(); // this is an expensive call
refBase = BaseUtils.simpleComplement( refBase );
prevBase = bases[offset+1];
}
// skip if this base or the previous one was an 'N' or etc.
if( BaseUtils.isRegularBase(prevBase) && BaseUtils.isRegularBase(bases[offset]) ) {
readGroup = read.getReadGroup().getReadGroupId();
readGroup = read.getReadGroup().getReadGroupId(); // this is an expensive call
updateDataFromRead( read, offset, readGroup, quals, bases, refBase );
}
}

View File

@ -47,7 +47,7 @@ public class CycleCovariate implements Covariate {
private String platform;
public CycleCovariate() { // empty constructor is required to instantiate covariate in CovariateCounterWalker and TableRecalibrationWalker
platform = "SLX";
platform = "SLX"; // Solexa is the default
}
public CycleCovariate(final String _platform) {

View File

@ -1,8 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.Recalibration;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.Pair;
/*
* Copyright (c) 2009 The Broad Institute
@ -34,9 +32,9 @@ import org.broadinstitute.sting.utils.Pair;
* User: rpoplin
* Date: Nov 3, 2009
*
* The Dinucleotide covariate. This base and the one that came before it in the read, remembering to swap directions on cardinality if negative strand read.
* This covariate will return null if there are bases that don't belong such as 'N' or 'X'.
* This covariate will also return null if attempting to get previous base at the start of the read.
* The Dinucleotide covariate. This base and the one that came before it in the read, remembering to swap directions if negative strand read.
* This covariate assumes that the bases have been swapped to their complement base counterpart if this is a negative strand read.
* This assumption is made to speed up the code.
*/
public class DinucCovariate implements Covariate {