Cleaned code and reorganized -- moving in the right direction for v2

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1052 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-06-18 22:28:34 +00:00
parent 9fe330cdf1
commit d748c85dc4
6 changed files with 15 additions and 11 deletions

View File

@ -1,4 +1,4 @@
package org.broadinstitute.sting.playground.gatk.walkers.recalibration;
package org.broadinstitute.sting.gatk.walkers.recalibration;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMReadGroupRecord;
@ -43,8 +43,9 @@ public class CovariateCounterWalker extends LocusWalker<Integer, Integer> {
@Argument(fullName="MAX_READ_GROUPS", shortName="mrg", required=false, doc="Abort if number of read groups in input file exceeeds this count.")
public int MAX_READ_GROUPS = 100;
@Argument(fullName="PLATFORM", shortName="pl", required=false, doc="Only calibrate read groups generated from the given platform (default = Illumina)")
public List<String> platforms = Collections.singletonList("ILLUMINA");
@Argument(fullName="PLATFORM", shortName="pl", required=false, doc="Only calibrate read groups generated from the given platform (default = * for all platforms)")
public List<String> platforms = Collections.singletonList("*");
//public List<String> platforms = Collections.singletonList("ILLUMINA");
@Argument(fullName="rawData", shortName="raw", required=false, doc="If true, raw mismatch observations will be output to a file")
public boolean outputRawData = true;
@ -380,7 +381,9 @@ public class CovariateCounterWalker extends LocusWalker<Integer, Integer> {
private boolean isSupportedReadGroup( SAMReadGroupRecord readGroup ) {
for( String platform: platforms ) {
platform = platform.trim();
if( readGroup.getAttribute("PL") == null || readGroup.getAttribute("PL").toString().equalsIgnoreCase(platform) )
if( readGroup.getAttribute("PL") == null ||
platform.equals("*") ||
readGroup.getAttribute("PL").toString().equalsIgnoreCase(platform) )
return true;
}

View File

@ -1,4 +1,4 @@
package org.broadinstitute.sting.playground.gatk.walkers.recalibration;
package org.broadinstitute.sting.gatk.walkers.recalibration;
import net.sf.samtools.*;
import org.broadinstitute.sting.gatk.walkers.WalkerName;

View File

@ -1,4 +1,4 @@
package org.broadinstitute.sting.playground.gatk.walkers.recalibration;
package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.BaseUtils;
@ -38,7 +38,7 @@ public class RecalData {
public double empiricalQualDouble() {
double empiricalQual = -10 * Math.log10((double)B / N);
if (empiricalQual > QualityUtils.MAX_QUAL_SCORE) empiricalQual = QualityUtils.MAX_QUAL_SCORE;
if (empiricalQual > QualityUtils.MAX_REASONABLE_Q_SCORE) empiricalQual = QualityUtils.MAX_REASONABLE_Q_SCORE;
return empiricalQual;
}

View File

@ -1,4 +1,4 @@
package org.broadinstitute.sting.playground.gatk.walkers.recalibration;
package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broadinstitute.sting.utils.QualityUtils;

View File

@ -1,4 +1,4 @@
package org.broadinstitute.sting.playground.gatk.walkers.recalibration;
package org.broadinstitute.sting.gatk.walkers.recalibration;
import net.sf.samtools.*;
import org.broadinstitute.sting.gatk.walkers.WalkerName;
@ -7,7 +7,6 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.playground.gatk.walkers.recalibration.RecalData;
import org.apache.log4j.Logger;
import java.util.*;

View File

@ -8,6 +8,8 @@ package org.broadinstitute.sting.utils;
*/
public class QualityUtils {
public final static byte MAX_QUAL_SCORE = 63;
public final static double MIN_REASONABLE_ERROR = 0.0001;
public final static byte MAX_REASONABLE_Q_SCORE = 40;
/**
* Private constructor. No instantiating this class!
@ -47,7 +49,7 @@ public class QualityUtils {
* @return a quality score (0-40)
*/
static public byte probToQual(double prob) {
return probToQual(prob, 0.0001);
return probToQual(prob, MIN_REASONABLE_ERROR);
//return (byte) Math.round(-10.0*Math.log10(1.0 - prob + 0.0001));
}