trivial code restructuing, and commented out failed attempt to support sample selection with VCF. VariantEval2 go go go

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2516 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-01-06 15:04:27 +00:00
parent f857159343
commit 1e462419da
1 changed files with 24 additions and 2 deletions

View File

@ -6,8 +6,11 @@ import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.genotype.Variation;
import org.broadinstitute.sting.utils.genotype.Genotype;
import org.broadinstitute.sting.utils.genotype.BasicGenotype;
import java.io.File;
import java.io.FileNotFoundException;
@ -55,6 +58,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
@Argument(fullName = "samplesFile", shortName="samples", doc="When running an analysis on one or more individuals with truth data, this field provides a filepath to the listing of which samples are used (and are used to name corresponding rods with -B)", required=false)
public String samplesFile = null;
@Argument(fullName = "sampleName", shortName="sampleName", doc="When running an analysis on one or more individuals with truth data, provide this parameter to only analyze the genotype of this sample", required=false)
public String sampleName = null;
String analysisFilenameBase = null;
final String knownSNPDBName = "dbSNP";
@ -248,8 +254,24 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> {
if (eval != null)
if (eval.getNegLog10PError() * 10.0 < minConfidenceScore) eval = null;
if ( eval != null && (eval instanceof RodVCF) && ((RodVCF)eval).mCurrentRecord.isFiltered() ) {
if ( ! includeFilteredRecords ) eval = null; // we are not including filtered records, so set eval to null
if ( eval != null && (eval instanceof RodVCF) ) {
if ( ((RodVCF)eval).mCurrentRecord.isFiltered() && ! includeFilteredRecords ) {
//System.out.printf("Rejecting filtered record %s%n", eval);
eval = null; // we are not including filtered records, so set eval to null
}
// } else if ( sampleName != null ) {
// // code to grab a particular sample from a VCF
// Variation evalOld = eval;
// Genotype evalG = ((RodVCF)evalOld).getGenotype(sampleName);
// if ( evalG == null ) throw new StingException("Unexpected null genotype for sample " + sampleName);
// BasicGenotype g = new BasicGenotype(evalG.getLocation(), evalG.getBases(), ref.getBase(), evalG.getNegLog10PError());
// if ( g.isVariant(ref.getBase()) ) {
// eval = g.toVariation(ref.getBase());
// System.out.printf("Replacing %s with %s%n", evalOld, eval);
// } else {
// eval = null;
// }
// }
}
// update stats about all of the SNPs