stick headers on the output tables

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@782 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
jmaguire 2009-05-21 20:35:50 +00:00
parent 83e1454a11
commit b5ad5176f7
3 changed files with 16 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.cmdLine.Argument; import org.broadinstitute.sting.utils.cmdLine.Argument;
import java.util.*; import java.util.*;
import java.util.zip.*;
import java.io.*; import java.io.*;
// Draft iterative pooled caller // Draft iterative pooled caller
@ -45,7 +46,8 @@ public class PoolCaller extends LocusWalker<AlleleFrequencyEstimate, String>
try try
{ {
discovery_output_file = new PrintStream(DISCOVERY_OUTPUT); discovery_output_file = new PrintStream(DISCOVERY_OUTPUT);
individual_output_file = new PrintStream(INDIVIDUAL_OUTPUT); individual_output_file = new PrintStream(new GZIPOutputStream(new FileOutputStream(INDIVIDUAL_OUTPUT)));
individual_output_file.println(AlleleFrequencyEstimate.asTabularStringHeader());
} }
catch (Exception e) catch (Exception e)
{ {
@ -324,6 +326,7 @@ public class PoolCaller extends LocusWalker<AlleleFrequencyEstimate, String>
public String reduceInit() public String reduceInit()
{ {
discovery_output_file.printf("loc ref alt EM_alt_freq discovery_posterior discovery_null discovery_lod\n");
for (int i = 0; i < callers.size(); i++) for (int i = 0; i < callers.size(); i++)
{ {
callers.get(i).reduceInit(); callers.get(i).reduceInit();
@ -333,8 +336,14 @@ public class PoolCaller extends LocusWalker<AlleleFrequencyEstimate, String>
public String reduce(AlleleFrequencyEstimate alleleFreq, String sum) public String reduce(AlleleFrequencyEstimate alleleFreq, String sum)
{ {
if (calls == null) { return ""; }
for (int i = 0; i < callers.size(); i++) for (int i = 0; i < callers.size(); i++)
{ {
if (calls == null) { System.err.printf("calls == null\n"); }
if (calls[i] == null) { System.err.printf("calls[%d] == null\n", i); }
if (caller_sums == null) { System.err.printf("caller_sums == null\n"); }
if (callers.get(i) == null) { System.err.printf("callers[%d] == null\n", i); }
if (caller_sums.get(i) == null) { System.err.printf("caller_sums[%d] == null\n", i); }
caller_sums.set(i, callers.get(i).reduce(calls[i], caller_sums.get(i))); caller_sums.set(i, callers.get(i).reduce(calls[i], caller_sums.get(i)));
} }
return ""; return "";

View File

@ -49,7 +49,11 @@ public class SingleSampleGenotyper extends LocusWalker<AlleleFrequencyEstimate,
{ {
sample_name = null; sample_name = null;
if (metricsFileName != null) { metrics = new AlleleMetrics(metricsFileName, lodThreshold); } if (metricsFileName != null) { metrics = new AlleleMetrics(metricsFileName, lodThreshold); }
if (callsFileName != null) { calls_file = new PrintStream(callsFileName); } if (callsFileName != null)
{
calls_file = new PrintStream(callsFileName);
calls_file.println(AlleleFrequencyEstimate.asTabularStringHeader());
}
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -147,7 +147,7 @@ public class AlleleFrequencyEstimate {
return s; return s;
} }
public String asTabularStringHeader() public static String asTabularStringHeader()
{ {
return "location sample_name ref alt genotype qhat qstar lodVsRef lodVsNextBest depth bases"; return "location sample_name ref alt genotype qhat qstar lodVsRef lodVsNextBest depth bases";
} }