(Slightly) better exception text when SAM/BAM output file can't be created.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4392 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-09-30 18:43:22 +00:00
parent 1fb8c86f6d
commit 14e19f4605
1 changed files with 11 additions and 5 deletions

View File

@ -30,6 +30,7 @@ import net.sf.samtools.util.CloseableIterator;
import java.io.*;
import net.sf.samtools.util.RuntimeIOException;
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub;
import org.broadinstitute.sting.utils.exceptions.UserException;
@ -62,11 +63,16 @@ public class SAMFileWriterStorage implements SAMFileWriter, Storage<SAMFileWrite
// during the week of 14 Sept 2010. Eliminate this check when they do.
if(stub.getSAMFile().getPath().equals("/dev/null"))
factory.setCreateIndex(false);
if( stub.getCompressionLevel() != null )
this.writer = factory.makeBAMWriter( stub.getFileHeader(), stub.isPresorted(), file, stub.getCompressionLevel() );
else
this.writer = factory.makeBAMWriter( stub.getFileHeader(), stub.isPresorted(), file );
try {
if( stub.getCompressionLevel() != null )
this.writer = factory.makeBAMWriter( stub.getFileHeader(), stub.isPresorted(), file, stub.getCompressionLevel() );
else
this.writer = factory.makeBAMWriter( stub.getFileHeader(), stub.isPresorted(), file );
}
catch(RuntimeIOException ex) {
throw new UserException.CouldNotCreateOutputFile(file,"file could not be created",ex);
}
}
else if(stub.getSAMOutputStream() != null){
this.writer = factory.makeSAMWriter( stub.getFileHeader(), stub.isPresorted(), stub.getSAMOutputStream());