Removing Beagle output from UG. Use ProduceBeagleInput walker instead (since it can be run post-filtration and respects the FILTER column).

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3607 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-06-22 16:56:37 +00:00
parent 55abfcc52f
commit 4727bcda24
8 changed files with 11 additions and 61 deletions

View File

@ -104,7 +104,7 @@ public class BatchedCallsMerger extends LocusWalker<VariantContext, Integer> imp
}
// update the engine
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, writer, null, null, null);
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, writer, null, null);
UG_engine.samples = samples;
// initialize the header

View File

@ -167,24 +167,6 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
calls.put(sample, cg);
}
// output to beagle file if requested
if ( beagleWriter != null ) {
for ( String sample : samples ) {
GenotypeLikelihoods gl = GLs.get(sample);
if ( gl == null ) {
beagleWriter.print(" 0.0 0.0 0.0");
continue;
}
double[] likelihoods = gl.getLikelihoods();
beagleWriter.print(' ');
beagleWriter.print(String.format("%.6f", Math.pow(10, likelihoods[refGenotype.ordinal()])));
beagleWriter.print(' ');
beagleWriter.print(String.format("%.6f", Math.pow(10, likelihoods[hetGenotype.ordinal()])));
beagleWriter.print(' ');
beagleWriter.print(String.format("%.6f", Math.pow(10, likelihoods[homGenotype.ordinal()])));
}
}
return calls;
}

View File

@ -31,7 +31,6 @@ public abstract class GenotypeCalculationModel implements Cloneable {
protected Logger logger;
protected GenotypeWriterFactory.GENOTYPE_FORMAT OUTPUT_FORMAT;
protected PrintStream verboseWriter;
protected PrintStream beagleWriter;
/**
* Create a new GenotypeCalculationModel object
@ -47,20 +46,17 @@ public abstract class GenotypeCalculationModel implements Cloneable {
* @param UAC unified arg collection
* @param outputFormat output format
* @param verboseWriter verbose writer
* @param beagleWriter beagle writer
*/
protected void initialize(Set<String> samples,
Logger logger,
UnifiedArgumentCollection UAC,
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
PrintStream verboseWriter,
PrintStream beagleWriter) {
PrintStream verboseWriter) {
this.UAC = UAC.clone();
this.samples = new TreeSet<String>(samples);
OUTPUT_FORMAT = outputFormat;
this.logger = logger;
this.verboseWriter = verboseWriter;
this.beagleWriter = beagleWriter;
}
/**

View File

@ -52,7 +52,6 @@ public class GenotypeCalculationModelFactory {
* @param UAC the unified argument collection
* @param outputFormat the output format
* @param verboseWriter verbose writer
* @param beagleWriter beagle writer
*
* @return model
*/
@ -60,8 +59,7 @@ public class GenotypeCalculationModelFactory {
Logger logger,
UnifiedArgumentCollection UAC,
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
PrintStream verboseWriter,
PrintStream beagleWriter) {
PrintStream verboseWriter) {
GenotypeCalculationModel gcm;
switch ( UAC.genotypeModel ) {
case JOINT_ESTIMATE:
@ -78,7 +76,7 @@ public class GenotypeCalculationModelFactory {
default: throw new RuntimeException("Unexpected GenotypeCalculationModel " + UAC.genotypeModel);
}
gcm.initialize(samples, logger, UAC, outputFormat, verboseWriter, beagleWriter);
gcm.initialize(samples, logger, UAC, outputFormat, verboseWriter);
return gcm;
}
}

View File

@ -360,22 +360,9 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
if ( !UAC.ALL_BASES_MODE && !passesEmitThreshold(phredScaledConfidence, bestAFguess) )
return new VariantCallContext(passesCallThreshold(phredScaledConfidence));
// output to beagle file if requested
if ( beagleWriter != null ) {
beagleWriter.print(loc);
beagleWriter.print(' ');
beagleWriter.print((char)ref);
beagleWriter.print(' ');
beagleWriter.print((char)((byte)bestAlternateAllele));
}
// populate the sample-specific data (output it to beagle also if requested)
Map<String, Genotype> genotypes = makeGenotypeCalls(ref, bestAlternateAllele, bestAFguess, contexts, loc);
// close beagle record (if requested)
if ( beagleWriter != null )
beagleWriter.println();
// next, the variant context data (alleles, attributes, etc.)
ArrayList<Allele> alleles = new ArrayList<Allele>();
alleles.add(Allele.create(ref, true));

View File

@ -9,8 +9,6 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
import java.util.*;
import net.sf.samtools.util.SequenceUtil;
public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
private int MIN_COVERAGE = 6;

View File

@ -57,9 +57,6 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
@Argument(fullName = "verbose_mode", shortName = "verbose", doc = "File to print all of the annotated and detailed debugging output", required = false)
public PrintStream verboseWriter = null;
@Argument(fullName = "beagle_file", shortName = "beagle", doc = "File to print BEAGLE-specific data for use with imputation", required = false)
public PrintStream beagleWriter = null;
@Argument(fullName="annotation", shortName="A", doc="One or more specific annotations to apply to variant calls", required=false)
protected String[] annotationsToUse = {};
@ -106,7 +103,7 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
public void initialize() {
annotationEngine = new VariantAnnotatorEngine(getToolkit(), annotationClassesToUse, annotationsToUse);
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, writer, verboseWriter, beagleWriter, annotationEngine);
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, writer, verboseWriter, annotationEngine);
// initialize the writers
if ( verboseWriter != null ) {
@ -117,12 +114,6 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
}
verboseWriter.println(header);
}
if ( beagleWriter != null ) {
beagleWriter.print("marker alleleA alleleB");
for ( String sample : UG_engine.samples )
beagleWriter.print(String.format(" %s %s %s", sample, sample, sample));
beagleWriter.println();
}
// initialize the header
GenotypeWriterFactory.writeHeader(writer, GenomeAnalysisEngine.instance.getSAMFileHeader(), UG_engine.samples, getHeaderInfo());

View File

@ -75,27 +75,25 @@ public class UnifiedGenotyperEngine {
protected Logger logger = null;
protected GenotypeWriter genotypeWriter = null;
protected PrintStream verboseWriter = null;
protected PrintStream beagleWriter = null;
// samples in input
protected Set<String> samples = new HashSet<String>();
public UnifiedGenotyperEngine(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC) {
initialize(toolkit, UAC, null, null, null, null, null);
initialize(toolkit, UAC, null, null, null, null);
}
public UnifiedGenotyperEngine(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC, Logger logger, GenotypeWriter genotypeWriter, PrintStream verboseWriter, PrintStream beagleWriter, VariantAnnotatorEngine engine) {
initialize(toolkit, UAC, logger, genotypeWriter, verboseWriter, beagleWriter, engine);
public UnifiedGenotyperEngine(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC, Logger logger, GenotypeWriter genotypeWriter, PrintStream verboseWriter, VariantAnnotatorEngine engine) {
initialize(toolkit, UAC, logger, genotypeWriter, verboseWriter, engine);
}
private void initialize(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC, Logger logger, GenotypeWriter genotypeWriter, PrintStream verboseWriter, PrintStream beagleWriter, VariantAnnotatorEngine engine) {
private void initialize(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC, Logger logger, GenotypeWriter genotypeWriter, PrintStream verboseWriter, VariantAnnotatorEngine engine) {
this.UAC = UAC;
this.logger = logger;
this.genotypeWriter = genotypeWriter;
this.verboseWriter = verboseWriter;
this.beagleWriter = beagleWriter;
this.annotationEngine = engine;
// deal with input errors
@ -153,7 +151,7 @@ public class UnifiedGenotyperEngine {
else
throw new StingException("Unsupported genotype format: " + genotypeWriter.getClass().getName());
}
gcm.set(GenotypeCalculationModelFactory.makeGenotypeCalculation(samples, logger, UAC, format, verboseWriter, beagleWriter));
gcm.set(GenotypeCalculationModelFactory.makeGenotypeCalculation(samples, logger, UAC, format, verboseWriter));
}
byte ref = refContext.getBase();
@ -212,7 +210,7 @@ public class UnifiedGenotyperEngine {
if ( stratifiedContexts == null )
return null;
DiploidGenotypePriors priors = new DiploidGenotypePriors((byte)ref, UAC.heterozygosity, DiploidGenotypePriors.PROB_OF_REFERENCE_ERROR);
DiploidGenotypePriors priors = new DiploidGenotypePriors(ref, UAC.heterozygosity, DiploidGenotypePriors.PROB_OF_REFERENCE_ERROR);
call = gcm.get().callLocus(tracker, ref, rawContext.getLocation(), stratifiedContexts, priors);
// annotate the call, if possible