VariantEval can now see the EvaluationContext group objects, so they can decide if/when to print interesting sites. GenotypeConcordance has a hard-coded option to print FNs that is on the way to being generally useful. VCFWriter now uses the US locale for formatting floating point numbers; I believe this fixes a long-standing annoyance. Italian guys will check on this.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3864 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
77cace3aff
commit
33090629ea
|
|
@ -25,7 +25,10 @@
|
|||
|
||||
package org.broad.tribble.vcf;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public final class VCFConstants {
|
||||
public static final Locale VCF_LOCALE = Locale.US;
|
||||
|
||||
// standard INFO/FORMAT field keys
|
||||
public static final String ANCESTRAL_ALLELE_KEY = "AA";
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import java.util.*;
|
|||
|
||||
@Analysis(name = "Genotype Concordance", description = "Determine the genotype concordance between the genotypes in difference tracks")
|
||||
public class GenotypeConcordance extends VariantEvaluator {
|
||||
private static final boolean PRINT_INTERESTING_SITES = false;
|
||||
|
||||
protected final static Logger logger = Logger.getLogger(GenotypeConcordance.class);
|
||||
|
||||
// a mapping from allele count to stats
|
||||
|
|
@ -58,6 +60,7 @@ public class GenotypeConcordance extends VariantEvaluator {
|
|||
|
||||
private static final int MAX_MISSED_VALIDATION_DATA = 100;
|
||||
|
||||
private VariantEvalWalker.EvaluationContext group = null;
|
||||
|
||||
static class FrequencyStats implements TableType {
|
||||
class Stats {
|
||||
|
|
@ -229,7 +232,9 @@ public class GenotypeConcordance extends VariantEvaluator {
|
|||
|
||||
private boolean warnedAboutValidationData = false;
|
||||
|
||||
public String update2(VariantContext eval, VariantContext validation, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
public String update2(VariantContext eval, VariantContext validation, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context, VariantEvalWalker.EvaluationContext group) {
|
||||
this.group = group;
|
||||
|
||||
String interesting = null;
|
||||
|
||||
// sanity check that we at least have either eval or validation data
|
||||
|
|
@ -287,7 +292,6 @@ public class GenotypeConcordance extends VariantEvaluator {
|
|||
truth = Genotype.Type.NO_CALL;
|
||||
} else {
|
||||
truth = validation.getGenotype(sample).getType();
|
||||
// TODO -- capture "interesting" sites here, for example:
|
||||
// interesting = "ConcordanceStatus=FP";
|
||||
}
|
||||
|
||||
|
|
@ -301,6 +305,9 @@ public class GenotypeConcordance extends VariantEvaluator {
|
|||
for (final String sample : validation.getSampleNames()) {
|
||||
final Genotype.Type truth = validation.getGenotype(sample).getType();
|
||||
sampleStats.incrValue(sample, truth, called);
|
||||
if ( (truth == Genotype.Type.HOM_VAR || truth == Genotype.Type.HET) && called == Genotype.Type.NO_CALL ) {
|
||||
if ( PRINT_INTERESTING_SITES ) System.out.printf("%s: HM3 FN => %s%n", group, validation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
// --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** private class holding all of the information about a single evaluation group (e.g., for eval ROD) */
|
||||
private class EvaluationContext implements Comparable<EvaluationContext> {
|
||||
public class EvaluationContext implements Comparable<EvaluationContext> {
|
||||
// useful for typing
|
||||
public String evalTrackName, compTrackName, novelty, filtered;
|
||||
public boolean enableInterestingSiteCaptures = false;
|
||||
|
|
@ -221,6 +221,8 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
return Utils.join(CONTEXT_SEPARATOR, Arrays.asList(evalTrackName, compTrackName, selectExp == null ? "all" : selectExp.name, filtered, novelty));
|
||||
}
|
||||
|
||||
public String toString() { return getDisplayName(); }
|
||||
|
||||
public int compareTo(EvaluationContext other) {
|
||||
return this.getDisplayName().compareTo(other.getDisplayName());
|
||||
}
|
||||
|
|
@ -495,7 +497,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
switch ( evaluation.getComparisonOrder() ) {
|
||||
case 1:
|
||||
if ( evalWantsVC && vc != null ) {
|
||||
String interesting = evaluation.update1(vc, tracker, ref, context);
|
||||
String interesting = evaluation.update1(vc, tracker, ref, context, group);
|
||||
if ( interesting != null ) interestingReasons.add(interesting);
|
||||
}
|
||||
break;
|
||||
|
|
@ -506,7 +508,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
comp.hasNegLog10PError() &&
|
||||
comp.getNegLog10PError() < (minCompQualScore / 10.0) )
|
||||
comp = null;
|
||||
String interesting = evaluation.update2( evalWantsVC ? vc : null, comp, tracker, ref, context );
|
||||
String interesting = evaluation.update2( evalWantsVC ? vc : null, comp, tracker, ref, context, group );
|
||||
if ( interesting != null ) interestingReasons.add(interesting);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -59,10 +59,20 @@ abstract class VariantEvaluator {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String update1(VariantContext vc1, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context, VariantEvalWalker.EvaluationContext group) {
|
||||
return update1(vc1, tracker, ref, context);
|
||||
}
|
||||
|
||||
|
||||
public String update2(VariantContext vc1, VariantContext vc2, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String update2(VariantContext vc1, VariantContext vc2, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context, VariantEvalWalker.EvaluationContext group) {
|
||||
return update2(vc1, vc2, tracker, ref, context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* override this method for any finalization of calculations after the analysis is completed
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ public class VCFWriter {
|
|||
}
|
||||
|
||||
private String getQualValue(double qual) {
|
||||
String s = String.format(VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, qual);
|
||||
String s = String.format(VCFConstants.VCF_LOCALE, VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, qual);
|
||||
if ( s.endsWith(VCFConstants.DOUBLE_PRECISION_INT_SUFFIX) )
|
||||
s = s.substring(0, s.length() - VCFConstants.DOUBLE_PRECISION_INT_SUFFIX.length());
|
||||
return s;
|
||||
|
|
@ -387,7 +387,7 @@ public class VCFWriter {
|
|||
if ( val == null )
|
||||
result = VCFConstants.MISSING_VALUE_v4;
|
||||
else if ( val instanceof Double )
|
||||
result = String.format(VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, (Double)val);
|
||||
result = String.format(VCFConstants.VCF_LOCALE, VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, (Double)val);
|
||||
else if ( val instanceof Boolean )
|
||||
result = (Boolean)val ? "" : null; // empty string for true, null for false
|
||||
else if ( val instanceof List ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue