Writing calls to standard out now works again (it got broken when we introduced parallelization)

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2446 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-12-27 04:36:45 +00:00
parent 12990c5e7a
commit d2770f380c
3 changed files with 13 additions and 0 deletions

View File

@ -130,6 +130,13 @@ public class UnifiedGenotyper extends LocusWalker<Pair<VariationCall, List<Genot
// logger.debug("SAMPLE: " + sample);
}
// set up the writer manually if it needs to use the output stream
if ( writer == null && out != null ) {
logger.warn("For technical reasons, VCF format must be used when writing to standard out.");
logger.warn("Specify an output file if you would like to use a different output format.");
writer = GenotypeWriterFactory.create(GenotypeWriterFactory.GENOTYPE_FORMAT.VCF, out);
}
// initialize the verbose writer
if ( VERBOSE != null ) {
try {

View File

@ -52,6 +52,7 @@ public class GeliTextWriter implements GeliGenotypeWriter {
public void writeHeader(final SAMFileHeader fileHeader) {
// ignore the SAM header; the geli text header is fixed.
mWriter.println(headerLine);
mWriter.flush(); // necessary so that writing to an output stream will work
}
/**
@ -102,10 +103,12 @@ public class GeliTextWriter implements GeliGenotypeWriter {
posteriors[7],
posteriors[8],
posteriors[9]));
mWriter.flush(); // necessary so that writing to an output stream will work
}
public void addGenotypeLikelihoods(GenotypeLikelihoods gl) {
mWriter.println(gl.toString());
mWriter.flush(); // necessary so that writing to an output stream will work
}
/**
@ -119,6 +122,7 @@ public class GeliTextWriter implements GeliGenotypeWriter {
/** finish writing, closing any open files. */
public void close() {
mWriter.flush();
mWriter.close();
}

View File

@ -71,6 +71,7 @@ public class VCFWriter {
for (String field : header.getGenotypeSamples()) b.append(field + FIELD_SEPERATOR);
}
mWriter.write(b.toString() + "\n");
mWriter.flush(); // necessary so that writing to an output stream will work
}
catch (IOException e) {
throw new RuntimeException("IOException writing the VCF header", e);
@ -89,6 +90,7 @@ public class VCFWriter {
String vcfString = record.toStringEncoding(mHeader);
try {
mWriter.write(vcfString + "\n");
mWriter.flush(); // necessary so that writing to an output stream will work
} catch (IOException e) {
throw new RuntimeException("Unable to write the VCF object to a file");
}