-VCF writer now checks whether the allele frequency has been set before trying to write it out.
-Renamed methods to be more consistent. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2214 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
6231637615
commit
2838629724
|
|
@ -78,7 +78,7 @@ public abstract class EMGenotypeCalculationModel extends GenotypeCalculationMode
|
|||
|
||||
((SLODBacked)locusdata).setSLOD(strandScore);
|
||||
}
|
||||
locusdata.setAlleleFrequency(overall.getMAF());
|
||||
locusdata.setNonRefAlleleFrequency(overall.getMAF());
|
||||
}
|
||||
return new Pair<List<Genotype>, GenotypeLocusData>(genotypeCallsFromGenotypeLikelihoods(overall, ref, contexts), locusdata);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
|
|||
GenotypeLocusData locusdata = GenotypeWriterFactory.createSupportedGenotypeLocusData(OUTPUT_FORMAT, ref, loc, VARIANT_TYPE.SNP);
|
||||
if ( locusdata != null ) {
|
||||
locusdata.addAlternateAllele(bestAlternateAllele.toString());
|
||||
locusdata.setAlleleFrequency((double)bestAFguess / (double)(frequencyEstimationPoints-1));
|
||||
locusdata.setNonRefAlleleFrequency((double)bestAFguess / (double)(frequencyEstimationPoints-1));
|
||||
if ( locusdata instanceof ConfidenceBacked ) {
|
||||
((ConfidenceBacked)locusdata).setConfidence(phredScaledConfidence);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,16 @@ public interface GenotypeLocusData extends Variation {
|
|||
*/
|
||||
public void addAlternateAllele(String alt);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if the allele frequency has been set
|
||||
*/
|
||||
public boolean hasNonRefAlleleFrequency();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param frequency the allele frequency for this genotype
|
||||
*/
|
||||
public void setAlleleFrequency(double frequency);
|
||||
public void setNonRefAlleleFrequency(double frequency);
|
||||
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class VCFGenotypeLocusData implements GenotypeLocusData, ConfidenceBacked
|
|||
private Double mSLOD = null;
|
||||
|
||||
// the allele frequency field
|
||||
private double mAlleleFrequency = 0.0;
|
||||
private double mAlleleFrequency = -1.0;
|
||||
|
||||
// the location
|
||||
private GenomeLoc mLoc;
|
||||
|
|
@ -97,6 +97,10 @@ public class VCFGenotypeLocusData implements GenotypeLocusData, ConfidenceBacked
|
|||
return mType;
|
||||
}
|
||||
|
||||
public boolean hasNonRefAlleleFrequency() {
|
||||
return mAlleleFrequency >= 0.0;
|
||||
}
|
||||
|
||||
public double getNonRefAlleleFrequency() {
|
||||
return mAlleleFrequency;
|
||||
}
|
||||
|
|
@ -171,7 +175,7 @@ public class VCFGenotypeLocusData implements GenotypeLocusData, ConfidenceBacked
|
|||
*
|
||||
* @param frequency the allele frequency for this genotype
|
||||
*/
|
||||
public void setAlleleFrequency(double frequency) {
|
||||
public void setNonRefAlleleFrequency(double frequency) {
|
||||
mAlleleFrequency = frequency;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
|
|||
if ( locusdata != null ) {
|
||||
if ( locusdata.getSLOD() != null )
|
||||
infoFields.put("SB", String.format("%.2f", locusdata.getSLOD()));
|
||||
infoFields.put("AF", String.format("%.2f", locusdata.getNonRefAlleleFrequency()));
|
||||
if ( locusdata.hasNonRefAlleleFrequency() )
|
||||
infoFields.put("AF", String.format("%.2f", locusdata.getNonRefAlleleFrequency()));
|
||||
Map<String, String> otherFields = locusdata.getFields();
|
||||
if ( otherFields != null ) {
|
||||
infoFields.putAll(otherFields);
|
||||
|
|
|
|||
Loading…
Reference in New Issue