From ca48ea78df9ddcd7cbebd1487bf0a3d3ed5c9211 Mon Sep 17 00:00:00 2001 From: hanna Date: Tue, 7 Jun 2011 04:25:40 +0000 Subject: [PATCH] At Picard team's request, generate md5s for generated BAM files. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5954 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/io/storage/SAMFileWriterStorage.java | 7 +-- .../SAMFileWriterArgumentTypeDescriptor.java | 55 +++++++++++++++---- .../gatk/io/stubs/SAMFileWriterStub.java | 23 ++++++++ 3 files changed, 70 insertions(+), 15 deletions(-) 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.