diff --git a/java/src/org/broadinstitute/sting/gatk/io/storage/SAMFileWriterStorage.java b/java/src/org/broadinstitute/sting/gatk/io/storage/SAMFileWriterStorage.java index a3da3156c..610db1d76 100644 --- a/java/src/org/broadinstitute/sting/gatk/io/storage/SAMFileWriterStorage.java +++ b/java/src/org/broadinstitute/sting/gatk/io/storage/SAMFileWriterStorage.java @@ -60,16 +60,13 @@ public class SAMFileWriterStorage implements SAMFileWriter, Storage, StingSAMFileWrite */ private boolean indexOnTheFly = false; + /** + * Should the GATK generate an md5 for the output BAM? + */ + private boolean generateMD5 = false; + /** * Should this BAM be presorted? */ @@ -198,6 +203,24 @@ public class SAMFileWriterStub implements Stub, StingSAMFileWrite this.indexOnTheFly = indexOnTheFly; } + /** + * Gets whether to generate an md5 on-the-fly for this BAM. + * @return True generates the md5. False means skip writing the file. + */ + public Boolean getGenerateMD5() { + return generateMD5; + } + + /** + * Gets whether to generate an md5 on-the-fly for this BAM. + * @return True generates the md5. False means skip writing the file. + */ + public void setGenerateMD5(boolean generateMD5) { + if(writeStarted) + throw new UserException("Attempted to turn on md5 generation for BAM file with alignments already in it."); + this.generateMD5 = generateMD5; + } + /** * Whether the BAM file to create is actually presorted. * @return True if the BAM file is presorted. False otherwise.