From 0e6dd38936164bdadab2f9cd5b10873bf2883936 Mon Sep 17 00:00:00 2001 From: asivache Date: Mon, 1 Nov 2010 20:37:38 +0000 Subject: [PATCH] In n-way-out mode, added printing names of all the output files into 'results.list' file git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4606 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/indels/IndelRealigner.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java index 3bba2239f..75bf9e4ed 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java @@ -54,6 +54,7 @@ import org.broadinstitute.sting.utils.collections.Pair; import java.io.File; import java.io.FileWriter; +import java.io.IOException; import java.util.*; /** @@ -132,10 +133,11 @@ public class IndelRealigner extends ReadWalker { @Hidden @Argument(fullName="nWayOut", shortName="nWayOut", required=false, doc="In this mode, there will be one output file for each input (-I) bam file. Reads from all input files "+ - "will be realigned together, but then each read wiil be saved in the output file corresponding to "+ + "will be realigned together, but then each read will be saved in the output file corresponding to "+ "the input file the read came from. The names of the output bam files will be constructed by "+ "stripping extensions (\".bam\" or \".sam\") from the input file names and pasting the value "+ - "of -nWayOut argument to the result.") + "of -nWayOut argument to the result. The names of all output files will be also saved in a "+ + "separate results.list file") protected String N_WAY_OUT = null; @@ -228,6 +230,13 @@ public class IndelRealigner extends ReadWalker { if ( writer != null ) throw new UserException.BadInput("-nWayOut and -o arguments are mutually exclusive"); + FileWriter fw; + try { + fw = new FileWriter("results.list"); + } catch (IOException e) { + throw new StingException("O/O error: Failed to create results.list file"); + } + nwayWriters = new HashMap(); for ( SAMReaderID rid : getToolkit().getDataSource().getReaderIDs() ) { @@ -248,9 +257,20 @@ public class IndelRealigner extends ReadWalker { SAMFileWriterImpl.setDefaultMaxRecordsInRam(MAX_RECORDS_IN_RAM); SAMFileWriter sw = new SAMFileWriterFactory().makeSAMOrBAMWriter(setupHeader(getToolkit().getSAMFileHeader(rid)), false,new File(prefix+N_WAY_OUT)); + try { + fw.append(prefix+N_WAY_OUT); + fw.append('\n'); + } catch (IOException e) { + throw new StingException("I/O error: write failed for results.list file"); //To change body of catch statement use File | Settings | File Templates. + } nwayWriters.put(rid,sw); } + try { + fw.close(); + } catch (IOException e) { + throw new StingException("I/O error: failed to close results.list file"); //To change body of catch statement use File | Settings | File Templates. + } }