From 02e23e2d9cf9c6496f5681b39a288334cf3dbb47 Mon Sep 17 00:00:00 2001 From: hanna Date: Wed, 13 Jan 2010 02:42:16 +0000 Subject: [PATCH] Threading support for beagle output files. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2569 348d0f76-0448-11de-a6fe-93d51630548a --- .../genotyper/GenotypeCalculationModel.java | 23 ++------- .../GenotypeCalculationModelFactory.java | 6 +-- ...JointEstimateGenotypeCalculationModel.java | 10 ---- .../walkers/genotyper/UnifiedGenotyper.java | 49 +++++++++---------- 4 files changed, 29 insertions(+), 59 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java index c8173b03b..d85bbd6bc 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java @@ -35,8 +35,8 @@ public abstract class GenotypeCalculationModel implements Cloneable { protected double CONFIDENCE_THRESHOLD; protected double MINIMUM_ALLELE_FREQUENCY; protected boolean REPORT_SLOD; - protected PrintWriter verboseWriter; - protected PrintWriter beagleWriter; + protected PrintStream verboseWriter; + protected PrintStream beagleWriter; /** * Create a new GenotypeCalculationModel object @@ -58,8 +58,8 @@ public abstract class GenotypeCalculationModel implements Cloneable { Logger logger, UnifiedArgumentCollection UAC, GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat, - PrintWriter verboseWriter, - PrintWriter beagleWriter) { + PrintStream verboseWriter, + PrintStream beagleWriter) { this.samples = new TreeSet(samples); this.logger = logger; baseModel = UAC.baseModel; @@ -73,22 +73,7 @@ public abstract class GenotypeCalculationModel implements Cloneable { MINIMUM_ALLELE_FREQUENCY = UAC.MINIMUM_ALLELE_FREQUENCY; REPORT_SLOD = ! UAC.NO_SLOD; this.verboseWriter = verboseWriter; - if ( verboseWriter != null ) - initializeVerboseWriter(verboseWriter); this.beagleWriter = beagleWriter; - if ( beagleWriter != null ) - initializeBeagleWriter(beagleWriter); - } - - protected void initializeVerboseWriter(PrintWriter writer) { } - - protected void initializeBeagleWriter(PrintWriter writer) { - writer.print("marker alleleA alleleB"); - for ( String sample : samples ) { - writer.print(' '); - writer.print(sample); - } - writer.println(); } /** diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModelFactory.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModelFactory.java index 33e6c21e3..5713a7c13 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModelFactory.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModelFactory.java @@ -30,7 +30,7 @@ import org.broadinstitute.sting.utils.genotype.GenotypeWriterFactory; import org.apache.log4j.Logger; import java.util.Set; -import java.io.PrintWriter; +import java.io.PrintStream; public class GenotypeCalculationModelFactory { @@ -60,8 +60,8 @@ public class GenotypeCalculationModelFactory { Logger logger, UnifiedArgumentCollection UAC, GenotypeWriterFactory.GENOTYPE_FORMAT outputFormat, - PrintWriter verboseWriter, - PrintWriter beagleWriter) { + PrintStream verboseWriter, + PrintStream beagleWriter) { GenotypeCalculationModel gcm; switch ( UAC.genotypeModel ) { case EM_POINT_ESTIMATE: diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java index a7a5297d5..5d5e8bc16 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java @@ -107,16 +107,6 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc } } - protected void initializeVerboseWriter(PrintWriter verboseWriter) { - StringBuilder header = new StringBuilder("AFINFO\tLOC\tMAF\tF\tNullAFpriors\t"); - for ( char altAllele : BaseUtils.BASES ) { - char base = Character.toLowerCase(altAllele); - header.append("POfDGivenAFFor" + base + "\t"); - header.append("PosteriorAFFor" + base + "\t"); - } - verboseWriter.println(header); - } - protected void initialize(char ref, Map contexts, StratifiedAlignmentContext.StratifiedContextType contextType) { // by default, no initialization is done return; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java index 8d2da6302..fc54b7fe1 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java @@ -39,8 +39,7 @@ import org.broadinstitute.sting.utils.genotype.glf.GLFGenotypeWriter; import org.broadinstitute.sting.utils.genotype.vcf.*; import java.util.*; -import java.io.PrintWriter; -import java.io.FileNotFoundException; +import java.io.PrintStream; /** @@ -57,15 +56,10 @@ public class UnifiedGenotyper extends LocusWalker gcm = new ThreadLocal(); @@ -109,7 +103,7 @@ public class UnifiedGenotyper extends LocusWalker