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:
parent
55abfcc52f
commit
4727bcda24
|
|
@ -104,7 +104,7 @@ public class BatchedCallsMerger extends LocusWalker<VariantContext, Integer> imp
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the engine
|
// 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;
|
UG_engine.samples = samples;
|
||||||
|
|
||||||
// initialize the header
|
// initialize the header
|
||||||
|
|
|
||||||
|
|
@ -167,24 +167,6 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
|
||||||
calls.put(sample, cg);
|
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;
|
return calls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ public abstract class GenotypeCalculationModel implements Cloneable {
|
||||||
protected Logger logger;
|
protected Logger logger;
|
||||||
protected GenotypeWriterFactory.GENOTYPE_FORMAT OUTPUT_FORMAT;
|
protected GenotypeWriterFactory.GENOTYPE_FORMAT OUTPUT_FORMAT;
|
||||||
protected PrintStream verboseWriter;
|
protected PrintStream verboseWriter;
|
||||||
protected PrintStream beagleWriter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new GenotypeCalculationModel object
|
* Create a new GenotypeCalculationModel object
|
||||||
|
|
@ -47,20 +46,17 @@ public abstract class GenotypeCalculationModel implements Cloneable {
|
||||||
* @param UAC unified arg collection
|
* @param UAC unified arg collection
|
||||||
* @param outputFormat output format
|
* @param outputFormat output format
|
||||||
* @param verboseWriter verbose writer
|
* @param verboseWriter verbose writer
|
||||||
* @param beagleWriter beagle writer
|
|
||||||
*/
|
*/
|
||||||
protected void initialize(Set<String> samples,
|
protected void initialize(Set<String> samples,
|
||||||
Logger logger,
|
Logger logger,
|
||||||
UnifiedArgumentCollection UAC,
|
UnifiedArgumentCollection UAC,
|
||||||
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
|
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
|
||||||
PrintStream verboseWriter,
|
PrintStream verboseWriter) {
|
||||||
PrintStream beagleWriter) {
|
|
||||||
this.UAC = UAC.clone();
|
this.UAC = UAC.clone();
|
||||||
this.samples = new TreeSet<String>(samples);
|
this.samples = new TreeSet<String>(samples);
|
||||||
OUTPUT_FORMAT = outputFormat;
|
OUTPUT_FORMAT = outputFormat;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.verboseWriter = verboseWriter;
|
this.verboseWriter = verboseWriter;
|
||||||
this.beagleWriter = beagleWriter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ public class GenotypeCalculationModelFactory {
|
||||||
* @param UAC the unified argument collection
|
* @param UAC the unified argument collection
|
||||||
* @param outputFormat the output format
|
* @param outputFormat the output format
|
||||||
* @param verboseWriter verbose writer
|
* @param verboseWriter verbose writer
|
||||||
* @param beagleWriter beagle writer
|
|
||||||
*
|
*
|
||||||
* @return model
|
* @return model
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,8 +59,7 @@ public class GenotypeCalculationModelFactory {
|
||||||
Logger logger,
|
Logger logger,
|
||||||
UnifiedArgumentCollection UAC,
|
UnifiedArgumentCollection UAC,
|
||||||
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
|
GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat,
|
||||||
PrintStream verboseWriter,
|
PrintStream verboseWriter) {
|
||||||
PrintStream beagleWriter) {
|
|
||||||
GenotypeCalculationModel gcm;
|
GenotypeCalculationModel gcm;
|
||||||
switch ( UAC.genotypeModel ) {
|
switch ( UAC.genotypeModel ) {
|
||||||
case JOINT_ESTIMATE:
|
case JOINT_ESTIMATE:
|
||||||
|
|
@ -78,7 +76,7 @@ public class GenotypeCalculationModelFactory {
|
||||||
default: throw new RuntimeException("Unexpected GenotypeCalculationModel " + UAC.genotypeModel);
|
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;
|
return gcm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -360,22 +360,9 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
|
||||||
if ( !UAC.ALL_BASES_MODE && !passesEmitThreshold(phredScaledConfidence, bestAFguess) )
|
if ( !UAC.ALL_BASES_MODE && !passesEmitThreshold(phredScaledConfidence, bestAFguess) )
|
||||||
return new VariantCallContext(passesCallThreshold(phredScaledConfidence));
|
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)
|
// populate the sample-specific data (output it to beagle also if requested)
|
||||||
Map<String, Genotype> genotypes = makeGenotypeCalls(ref, bestAlternateAllele, bestAFguess, contexts, loc);
|
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.)
|
// next, the variant context data (alleles, attributes, etc.)
|
||||||
ArrayList<Allele> alleles = new ArrayList<Allele>();
|
ArrayList<Allele> alleles = new ArrayList<Allele>();
|
||||||
alleles.add(Allele.create(ref, true));
|
alleles.add(Allele.create(ref, true));
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import net.sf.samtools.util.SequenceUtil;
|
|
||||||
|
|
||||||
public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
|
public class SimpleIndelCalculationModel extends GenotypeCalculationModel {
|
||||||
|
|
||||||
private int MIN_COVERAGE = 6;
|
private int MIN_COVERAGE = 6;
|
||||||
|
|
|
||||||
|
|
@ -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)
|
@Argument(fullName = "verbose_mode", shortName = "verbose", doc = "File to print all of the annotated and detailed debugging output", required = false)
|
||||||
public PrintStream verboseWriter = null;
|
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)
|
@Argument(fullName="annotation", shortName="A", doc="One or more specific annotations to apply to variant calls", required=false)
|
||||||
protected String[] annotationsToUse = {};
|
protected String[] annotationsToUse = {};
|
||||||
|
|
||||||
|
|
@ -106,7 +103,7 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
annotationEngine = new VariantAnnotatorEngine(getToolkit(), annotationClassesToUse, annotationsToUse);
|
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
|
// initialize the writers
|
||||||
if ( verboseWriter != null ) {
|
if ( verboseWriter != null ) {
|
||||||
|
|
@ -117,12 +114,6 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
|
||||||
}
|
}
|
||||||
verboseWriter.println(header);
|
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
|
// initialize the header
|
||||||
GenotypeWriterFactory.writeHeader(writer, GenomeAnalysisEngine.instance.getSAMFileHeader(), UG_engine.samples, getHeaderInfo());
|
GenotypeWriterFactory.writeHeader(writer, GenomeAnalysisEngine.instance.getSAMFileHeader(), UG_engine.samples, getHeaderInfo());
|
||||||
|
|
|
||||||
|
|
@ -75,27 +75,25 @@ public class UnifiedGenotyperEngine {
|
||||||
protected Logger logger = null;
|
protected Logger logger = null;
|
||||||
protected GenotypeWriter genotypeWriter = null;
|
protected GenotypeWriter genotypeWriter = null;
|
||||||
protected PrintStream verboseWriter = null;
|
protected PrintStream verboseWriter = null;
|
||||||
protected PrintStream beagleWriter = null;
|
|
||||||
|
|
||||||
// samples in input
|
// samples in input
|
||||||
protected Set<String> samples = new HashSet<String>();
|
protected Set<String> samples = new HashSet<String>();
|
||||||
|
|
||||||
|
|
||||||
public UnifiedGenotyperEngine(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC) {
|
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) {
|
public UnifiedGenotyperEngine(GenomeAnalysisEngine toolkit, UnifiedArgumentCollection UAC, Logger logger, GenotypeWriter genotypeWriter, PrintStream verboseWriter, VariantAnnotatorEngine engine) {
|
||||||
initialize(toolkit, UAC, logger, genotypeWriter, verboseWriter, beagleWriter, 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.UAC = UAC;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.genotypeWriter = genotypeWriter;
|
this.genotypeWriter = genotypeWriter;
|
||||||
this.verboseWriter = verboseWriter;
|
this.verboseWriter = verboseWriter;
|
||||||
this.beagleWriter = beagleWriter;
|
|
||||||
this.annotationEngine = engine;
|
this.annotationEngine = engine;
|
||||||
|
|
||||||
// deal with input errors
|
// deal with input errors
|
||||||
|
|
@ -153,7 +151,7 @@ public class UnifiedGenotyperEngine {
|
||||||
else
|
else
|
||||||
throw new StingException("Unsupported genotype format: " + genotypeWriter.getClass().getName());
|
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();
|
byte ref = refContext.getBase();
|
||||||
|
|
@ -212,7 +210,7 @@ public class UnifiedGenotyperEngine {
|
||||||
if ( stratifiedContexts == null )
|
if ( stratifiedContexts == null )
|
||||||
return 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);
|
call = gcm.get().callLocus(tracker, ref, rawContext.getLocation(), stratifiedContexts, priors);
|
||||||
|
|
||||||
// annotate the call, if possible
|
// annotate the call, if possible
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue