Trivial formatting changes as I moved more legacy code into this system

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1381 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-08-05 00:54:26 +00:00
parent 34af669dbb
commit 4dc23f2763
1 changed files with 23 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.utils.ReadBackedPileup; import org.broadinstitute.sting.utils.ReadBackedPileup;
import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.genotype.BasicGenotype; import org.broadinstitute.sting.utils.genotype.BasicGenotype;
import org.broadinstitute.sting.utils.genotype.Genotype; import org.broadinstitute.sting.utils.genotype.Genotype;
import org.broadinstitute.sting.utils.genotype.confidence.BayesianConfidenceScore; import org.broadinstitute.sting.utils.genotype.confidence.BayesianConfidenceScore;
@ -31,6 +32,7 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
private double priorHet; private double priorHet;
private double priorHomVar; private double priorHomVar;
private double[] oneHalfMinusData; private double[] oneHalfMinusData;
public double[] likelihoods;
public boolean isThreeStateErrors() { public boolean isThreeStateErrors() {
return threeStateErrors; return threeStateErrors;
@ -38,6 +40,7 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
public void setThreeStateErrors(boolean threeStateErrors) { public void setThreeStateErrors(boolean threeStateErrors) {
this.threeStateErrors = threeStateErrors; this.threeStateErrors = threeStateErrors;
this.oneHalfMinusData = threeStateErrors ? oneHalfMinusData3Base : oneHalfMinusDataArachne;
} }
private boolean threeStateErrors = false; private boolean threeStateErrors = false;
@ -51,6 +54,20 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
return pdbls; return pdbls;
} }
public final static String[] genotypes = new String[10];
static {
genotypes[0] = "AA";
genotypes[1] = "AC";
genotypes[2] = "AG";
genotypes[3] = "AT";
genotypes[4] = "CC";
genotypes[5] = "CG";
genotypes[6] = "CT";
genotypes[7] = "GG";
genotypes[8] = "GT";
genotypes[9] = "TT";
}
/** /**
* set the mode to discovery * set the mode to discovery
* @param isInDiscoveryMode * @param isInDiscoveryMode
@ -145,15 +162,18 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
likelihoods[i] = 0; likelihoods[i] = 0;
} }
} }
//System.out.printf("%s %s%n", OldAndBustedGenotypeLikelihoods.class, this.toString('A'));
for (int i = 0; i < genotypes.length; i++) for (int i = 0; i < genotypes.length; i++)
{ {
double likelihood = calculateAlleleLikelihood(ref, read, genotypes[i], qual); double likelihood = calculateAlleleLikelihood(ref, read, genotypes[i], qual);
//if ( originalQual == 0 ) System.out.printf("Likelihood is %f for %c %c %d %s%n", likelihood, ref, read, qual, genotypes[i]); System.out.printf("Likelihood is %f for %c %c %d %s%n", likelihood, ref, read, qual, genotypes[i]);
likelihoods[i] += likelihood; likelihoods[i] += likelihood;
coverage += 1; coverage += 1;
} }
//System.out.printf("%s %s%n", OldAndBustedGenotypeLikelihoods.class, this.toString('A'));
return 1; return 1;
} }
@ -176,7 +196,7 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
p_base = getOneHalfMinusQual(qual); p_base = getOneHalfMinusQual(qual);
} else if ( threeStateErrors ) { } else if ( threeStateErrors ) {
// error // error
//System.out.printf("%s %b %f %f%n", genotype, h1 != h2, log10Of2_3, log10Of1_3 ); //System.out.printf("%s %c %c %b %f %f%n", genotype, h1, h2, h1 != h2, log10Of2_3, log10Of1_3 );
p_base = qual / -10.0 + ( h1 != h2 ? log10Of1_3 : log10Of1_3 ); p_base = qual / -10.0 + ( h1 != h2 ? log10Of1_3 : log10Of1_3 );
} else { } else {
// error // error
@ -209,7 +229,7 @@ public class OldAndBustedGenotypeLikelihoods extends GenotypeLikelihoods {
if (i != 0) { if (i != 0) {
s = s + " "; s = s + " ";
} }
s = s + sorted_genotypes[i] + ":" + String.format("%.2f", sorted_likelihoods[i]); s = s + sorted_genotypes[i] + ":" + String.format("%.10f", sorted_likelihoods[i]);
sum += Math.pow(10,sorted_likelihoods[i]); sum += Math.pow(10,sorted_likelihoods[i]);
} }
s = s + String.format(" %f", sum); s = s + String.format(" %f", sum);