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.