a) Misc fixes in Phase1 indel vqsr script,

b) More R-friendly VariantsToTable printing of AC in case of multiple alt alleles
c) Rename FixPLOrderingWalker to FixGenotypesWalker and rewrote: no longer need older code, replaced with code to replace genotypes with all-zero PL's with a no-call.
This commit is contained in:
Guillermo del Angel 2011-08-22 20:39:06 -04:00
parent 782453235a
commit 8ae24912f4
2 changed files with 12 additions and 25 deletions

View File

@ -99,22 +99,24 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
// This is really not correct. What we really want here is a polymorphic vs. monomorphic count (i.e. on the Genotypes).
// So in order to maintain consistency with the previous implementation (and the intention of the original author), I've
// added in a proxy check for monomorphic status here.
if ( !vc1.isVariant() || (vc1.hasGenotypes() && vc1.getHomRefCount() == vc1.getNSamples()) ) {
if ( !vc1.isVariant() || (vc1.hasGenotypes() && vc1.getHomRefCount() + vc1.getNoCallCount() == vc1.getNSamples()) ) {
nRefLoci++;
} else {
nVariantLoci++;
switch (vc1.getType()) {
switch (vc1.getType()) {
case NO_VARIATION:
break;
case SNP:
nVariantLoci++;
nSNPs++;
if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++;
break;
case MNP:
nVariantLoci++;
nMNPs++;
if (vc1.getAttributeAsBoolean("ISSINGLETON")) nSingletons++;
break;
case INDEL:
nVariantLoci++;
if (vc1.isSimpleInsertion())
nInsertions++;
else if (vc1.isSimpleDeletion())
@ -123,6 +125,7 @@ public class CountVariants extends VariantEvaluator implements StandardEval {
nComplex++;
break;
case MIXED:
nVariantLoci++;
nMixed++;
break;
default:

View File

@ -206,28 +206,12 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
}
if (field.equals("AF") || field.equals("AC")) {
String afo = val;
double af=0;
if (afo.contains(",")) {
String[] afs = afo.split(",");
afs[0] = afs[0].substring(1,afs[0].length());
afs[afs.length-1] = afs[afs.length-1].substring(0,afs[afs.length-1].length()-1);
double[] afd = new double[afs.length];
for (int k=0; k < afd.length; k++)
afd[k] = Double.valueOf(afs[k]);
af = MathUtils.arrayMax(afd);
//af = Double.valueOf(afs[0]);
}
else
if (!afo.equals("NA"))
af = Double.valueOf(afo);
val = Double.toString(af);
if (val.contains(",")) {
// strip [,] and spaces
val = val.replace("[","");
val = val.replace("]","");
val = val.replace(" ","");
}
}
vals.add(val);