VariantsToTableFix

This commit is contained in:
Guillermo del Angel 2011-06-29 21:33:41 -04:00
parent 6382232279
commit 9b134f3b96
1 changed files with 25 additions and 0 deletions

View File

@ -24,6 +24,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
@ -169,6 +170,30 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
throw new UserException(String.format("Missing field %s in vc %s at %s", field, vc.getSource(), vc));
}
if (field.equals("AF")) {
String afo = val;
double af;
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
af = Double.valueOf(afo);
val = Double.toString(af);
}
vals.add(val);
}