From 0405afeab24e5ac24300cd8294575ad870ca2ae0 Mon Sep 17 00:00:00 2001 From: pdexheimer Date: Wed, 27 Nov 2013 10:47:04 -0500 Subject: [PATCH] Inherit BamGatherFunction from MergeSamFiles rather than PicardBamFunction - This change means that BamGatherFunction will now have an @Output field for the BAM index, which will allow the bai to be deleted for intermediate functions Signed-off-by: Khalid Shakir --- .../queue/extensions/gatk/BamGatherFunction.scala | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/public/queue-framework/src/main/scala/org/broadinstitute/sting/queue/extensions/gatk/BamGatherFunction.scala b/public/queue-framework/src/main/scala/org/broadinstitute/sting/queue/extensions/gatk/BamGatherFunction.scala index aaddeb28b..bfaebfb91 100644 --- a/public/queue-framework/src/main/scala/org/broadinstitute/sting/queue/extensions/gatk/BamGatherFunction.scala +++ b/public/queue-framework/src/main/scala/org/broadinstitute/sting/queue/extensions/gatk/BamGatherFunction.scala @@ -26,7 +26,7 @@ package org.broadinstitute.sting.queue.extensions.gatk import org.broadinstitute.sting.queue.function.scattergather.GatherFunction -import org.broadinstitute.sting.queue.extensions.picard.PicardBamFunction +import org.broadinstitute.sting.queue.extensions.picard.MergeSamFiles import org.broadinstitute.sting.queue.function.{RetryMemoryLimit, QFunction} import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor import org.broadinstitute.sting.queue.util.ClassFieldCache @@ -34,13 +34,17 @@ import org.broadinstitute.sting.queue.util.ClassFieldCache /** * Merges BAM files using net.sf.picard.sam.MergeSamFiles. */ -class BamGatherFunction extends GatherFunction with PicardBamFunction with RetryMemoryLimit { - this.javaMainClass = "net.sf.picard.sam.MergeSamFiles" +class BamGatherFunction extends MergeSamFiles with GatherFunction with RetryMemoryLimit { this.assumeSorted = Some(true) - protected def inputBams = gatherParts - protected def outputBam = originalOutput override def freezeFieldValues() { + this.input = this.gatherParts + this.output = this.originalOutput + //Left to its own devices (ie, MergeSamFiles.freezeFieldValues), outputIndex + //will be in the gather directory. Ensure that it actually matches this.output + if (output != null) + outputIndex = new File(output.getParentFile(), output.getName.stripSuffix(".bam") + ".bai") + val originalGATK = originalFunction.asInstanceOf[CommandLineGATK] // Whatever the original function can handle, merging *should* do less.