Update to AminoAcidTransition eval module
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3783 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
9cc1a411b2
commit
9d2a485532
|
|
@ -179,6 +179,15 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
|
||||
Set<String> rsIDsToExclude = null;
|
||||
|
||||
@Argument(shortName="aatk", fullName="aminoAcidTransitionKey", doc="required for the amino acid transition table; this is the key in the info field for the VCF for the transition", required = false)
|
||||
protected String aminoAcidTransitionKey = null;
|
||||
|
||||
@Argument(shortName="aats", fullName="aminoAcidTransitionSplit", doc="required for the amino acid transition table, this is the key on which to split the info field value to get the reference and alternate amino acids", required=false)
|
||||
protected String aminoAcidTransitionSplit = null;
|
||||
|
||||
@Argument(shortName="aatUseCodons", fullName="aminoAcidsRepresentedByCodons", doc="for the amino acid table, specifiy that the transitions are represented as codon changes, and not directly amino acid names", required = false)
|
||||
protected boolean aatUseCodons = false;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// private walker data
|
||||
|
|
@ -428,9 +437,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
|
|||
} catch (NoSuchMethodException e) {
|
||||
throw new StingException(String.format("Cannot find expected constructor for class '%s': must have constructor accepting a single VariantEval2Walker object", c.getSimpleName()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s':", c.getSimpleName()));
|
||||
throw new StingException(String.format("Cannot instantiate class '%s' (Illegal Access):", c.getSimpleName()));
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new StingException(String.format("Cannot instantiate class '%s':", c.getSimpleName()));
|
||||
throw new StingException(String.format("Cannot instantiate class '%s' (Invocation): %s", c.getSimpleName(), e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.varianteval;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
||||
|
|
@ -71,11 +72,11 @@ public class AminoAcidTransition extends VariantEvaluator {
|
|||
}
|
||||
|
||||
public double getRatio() {
|
||||
return ( (double) ti )/tv;
|
||||
return ( (double) ti )/(1.0+tv);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("%d:%d:%d:%f",getTotal(),ti,tv,getRatio());
|
||||
return String.format("%d:%d:%d:%.2f",getTotal(),ti,tv,getRatio());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,13 +133,22 @@ public class AminoAcidTransition extends VariantEvaluator {
|
|||
super(parent);
|
||||
getParsingInformation(parent);
|
||||
lookup = new AminoAcidTable();
|
||||
acidTable = new AminoAcidTiTvTable();
|
||||
}
|
||||
|
||||
private void getParsingInformation(VariantEvalWalker parent) {
|
||||
// todo -- allow me to be flexible
|
||||
infoKey = "something";
|
||||
infoValueSplit = "somethingElse";
|
||||
useCodons = false;
|
||||
if ( enabled() ) {
|
||||
infoKey = parent.aminoAcidTransitionKey;
|
||||
infoValueSplit = parent.aminoAcidTransitionSplit;
|
||||
useCodons = parent.aatUseCodons;
|
||||
if ( infoKey == null ) {
|
||||
throw new StingException("No info-field key provided for amino acid tabulation. Please provide the appropriate key with -aatk.");
|
||||
}
|
||||
|
||||
if ( infoValueSplit == null ) {
|
||||
throw new StingException("No split string provided for amino acid tabulation. Please provide the split string with -aats");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
@ -161,8 +171,14 @@ public class AminoAcidTransition extends VariantEvaluator {
|
|||
String interesting = null;
|
||||
if ( eval != null && eval.hasAttribute(infoKey) ) {
|
||||
String[] parsedNames = ( (String) eval.getAttribute(infoKey)).split(infoValueSplit);
|
||||
String first = parsedNames [0];
|
||||
String second = parsedNames [1];
|
||||
String first = "none";
|
||||
String second = "none";
|
||||
try {
|
||||
first = parsedNames [0];
|
||||
second = parsedNames [1];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
veWalker.getLogger().warn("Error prasing variant context with value "+eval.getAttribute(infoKey));
|
||||
}
|
||||
AminoAcid reference;
|
||||
AminoAcid alternate;
|
||||
if ( useCodons ) {
|
||||
|
|
@ -173,6 +189,8 @@ public class AminoAcidTransition extends VariantEvaluator {
|
|||
alternate = lookup.getAminoAcidByCode(second);
|
||||
}
|
||||
|
||||
//veWalker.getLogger().info(String.format("%s\t%s\t%s\t%s",first,second,reference,alternate));
|
||||
|
||||
if ( reference == null ) {
|
||||
interesting = "Unknown Reference Codon";
|
||||
} else if ( alternate == null ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue