1. Fixed bug in PrimaryBaseSecondaryBaseSymmetry code (not checking for null before trying to access object's methods) which was causing Integration Tests to fail.

2. Retired allele frequency range from UG, which wasn't very useful.



git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2113 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-11-23 01:31:48 +00:00
parent b24240664f
commit bf935a6ab1
8 changed files with 8 additions and 102 deletions

View File

@ -71,7 +71,11 @@ public class PrimaryBaseSecondaryBaseSymmetry implements VariantAnnotation{
return null;
}
char[] secondaryPileup = p.getSecondaryBasePileup().toCharArray();
String secondaryPileupStr = p.getSecondaryBasePileup();
if ( secondaryPileupStr == null )
return null;
char[] secondaryPileup = secondaryPileupStr.toCharArray();
int depth = p.size();
int support = 0;

View File

@ -38,7 +38,6 @@ public abstract class GenotypeCalculationModel implements Cloneable {
protected int POOL_SIZE;
protected double CONFIDENCE_THRESHOLD;
protected double MINIMUM_ALLELE_FREQUENCY;
protected double ALLELE_FREQUENCY_RANGE;
protected boolean REPORT_SLOD;
protected int maxDeletionsInPileup;
protected String assumedSingleSample;
@ -71,9 +70,6 @@ public abstract class GenotypeCalculationModel implements Cloneable {
POOL_SIZE = UAC.POOLSIZE;
CONFIDENCE_THRESHOLD = UAC.CONFIDENCE_THRESHOLD;
MINIMUM_ALLELE_FREQUENCY = UAC.MINIMUM_ALLELE_FREQUENCY;
ALLELE_FREQUENCY_RANGE = UAC.ALLELE_FREQUENCY_RANGE;
if ( ALLELE_FREQUENCY_RANGE < 0.0 || ALLELE_FREQUENCY_RANGE > 1.0 )
throw new StingException("Allele frequency fraction must be a value between 0.0 and 1.0");
maxDeletionsInPileup = UAC.MAX_DELETIONS;
assumedSingleSample = UAC.ASSUME_SINGLE_SAMPLE;
if ( UAC.VERBOSE != null ) {

View File

@ -261,11 +261,6 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
}
if ( locusdata instanceof AlleleFrequencyBacked ) {
((AlleleFrequencyBacked)locusdata).setAlleleFrequency((double)bestAFguess / (double)(frequencyEstimationPoints-1));
// frequenc range doesn't make sense for single samples
if ( getNSamples(contexts) > 1 ) {
AlleleFrequencyBacked.AlleleFrequencyRange range = computeAFrange(alleleFrequencyPosteriors[indexOfMax], frequencyEstimationPoints-1, bestAFguess, ALLELE_FREQUENCY_RANGE);
((AlleleFrequencyBacked)locusdata).setAlleleFrequencyRange(range);
}
}
if ( locusdata instanceof IDBacked ) {
rodDbSNP dbsnp = getDbSNP(tracker);
@ -308,33 +303,4 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
return new Pair<List<Genotype>, GenotypeLocusData>(calls, locusdata);
}
// computes the range of allele frequencies making up the given fraction of the total probability
private static AlleleFrequencyBacked.AlleleFrequencyRange computeAFrange(double[] alleleFrequencyProbs, int N, int bestAFguess, double fraction) {
double totalProb = alleleFrequencyProbs[bestAFguess];
int lowIndex = bestAFguess;
int highIndex = bestAFguess;
// it's possible that AF=0 contains more probability than 1-fraction
if ( alleleFrequencyProbs[0] >= (1.0 - fraction) ) {
// in this case, the range is all possible AFs
lowIndex = 1;
highIndex = N;
}
// otherwise, find the range moving out from the best AF guess
else {
while ( totalProb < fraction ) {
if ( lowIndex > 1 ) {
lowIndex--;
totalProb += alleleFrequencyProbs[lowIndex];
}
if ( highIndex < N ) {
highIndex++;
totalProb += alleleFrequencyProbs[highIndex];
}
}
}
return new AlleleFrequencyBacked.AlleleFrequencyRange((double)lowIndex / (double)N, (double)highIndex / (double)N, fraction);
}
}

View File

@ -84,7 +84,4 @@ public class UnifiedArgumentCollection {
@Argument(fullName = "min_allele_frequency", shortName = "min_freq", doc = "The minimum possible allele frequency in a population (advanced)", required = false)
public double MINIMUM_ALLELE_FREQUENCY = 1e-8;
@Argument(fullName = "allele_frequency_range", shortName = "freq_range", doc = "The range/fraction to emit of the total probability over all frequencies (in JOINT_ESTIMATION model only)", required = false)
public double ALLELE_FREQUENCY_RANGE = 0.95;
}

View File

@ -20,40 +20,4 @@ public interface AlleleFrequencyBacked {
* @param frequency the allele frequency for this genotype
*/
public void setAlleleFrequency(double frequency);
/**
*
* @return returns the allele frequency for this genotype
*/
public AlleleFrequencyRange getAlleleFrequencyRange();
/**
*
* @param range the allele frequency range for this genotype
*/
public void setAlleleFrequencyRange(AlleleFrequencyRange range);
/**
* A class representing a range of allele frequencies that make up a given
* fraction of the total probability over all frequencies.
*/
public class AlleleFrequencyRange {
private double mLow, mHigh, mFraction;
public AlleleFrequencyRange(double low, double high, double fraction) {
mLow = low;
mHigh = high;
mFraction = fraction;
}
public double getLowEnd() { return mLow; }
public double getHighEnd() { return mHigh; }
public double getPercentageOfProbability() { return mFraction; }
public String toString() {
return String.format("%.2f-%.2f,%.0f%%", mLow, mHigh, 100*mFraction);
}
}
}

View File

@ -21,9 +21,8 @@ public class VCFGenotypeLocusData implements GenotypeLocusData, ConfidenceBacked
// the strand score lod
private double mSLOD = 0.0;
// the allele frequency fields
// the allele frequency field
private double mAlleleFrequency = 0.0;
private AlleleFrequencyRange mAFrange = null;
// the location
private GenomeLoc mLoc;
@ -133,23 +132,6 @@ public class VCFGenotypeLocusData implements GenotypeLocusData, ConfidenceBacked
mAlleleFrequency = frequency;
}
/**
* get the allele frequency range
*
* @return the allele frequency range
*/
public AlleleFrequencyRange getAlleleFrequencyRange() {
return mAFrange;
}
/**
*
* @param range the allele frequency range for this genotype
*/
public void setAlleleFrequencyRange(AlleleFrequencyRange range) {
mAFrange = range;
}
/**
* @return returns the dbsnp id for this genotype
*/

View File

@ -189,9 +189,6 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
if ( locusdata != null ) {
infoFields.put("SB", String.format("%.2f", locusdata.getSLOD()));
infoFields.put("AF", String.format("%.2f", locusdata.getAlleleFrequency()));
AlleleFrequencyBacked.AlleleFrequencyRange range = locusdata.getAlleleFrequencyRange();
if ( range != null )
infoFields.put("AFrange", range.toString());
Map<String, String> otherFields = locusdata.getFields();
if ( otherFields != null ) {
infoFields.putAll(otherFields);

View File

@ -68,7 +68,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
public void testMultiSamplePilot1Joint() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,023,400-10,024,000 -bm empirical -gm JOINT_ESTIMATE -confidence 30", 1,
Arrays.asList("6f2753dbbf6b4ff98a75510e7ff2d5ae"));
Arrays.asList("a80abdc63117564ccd65a13ee9ca46be"));
executeTest("testMultiSamplePilot1 - Joint Estimate", spec);
}
@ -76,7 +76,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
public void testMultiSamplePilot2Joint() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/pilot2_daughters.chr20.10k-11k.bam -varout %s -L 20:10,000,000-10,010,000 -bm empirical -gm JOINT_ESTIMATE -confidence 30", 1,
Arrays.asList("979c1d88f2464548e83027daf685c2ad"));
Arrays.asList("47926784f90123ab058d36e12922a1ee"));
executeTest("testMultiSamplePilot2 - Joint Estimate", spec);
}