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 <kshakir@broadinstitute.org>
This commit is contained in:
pdexheimer 2013-11-27 10:47:04 -05:00 committed by Khalid Shakir
parent 504c125c26
commit 0405afeab2
1 changed files with 9 additions and 5 deletions

View File

@ -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.