samtools merge requires indexed files, so added them as implicit inputs.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5962 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kshakir 2011-06-08 15:02:51 +00:00
parent a331e13721
commit d784dac495
1 changed files with 13 additions and 0 deletions

View File

@ -42,6 +42,19 @@ class SamtoolsMergeFunction extends SamtoolsCommandLineFunction {
@Argument(doc="region", required=false)
var region: String = _
@Input(doc="BAM file input indexes")
var inputBamIndexes: List[File] = Nil
override def freezeFieldValues = {
super.freezeFieldValues
inputBamIndexes ++= inputBams
.filter(orig => orig != null && orig.getName.endsWith(".bam"))
.flatMap(orig => Array(
new File(orig.getPath + ".bai"),
new File(orig.getPath.stripSuffix(".bam") + ".bai")
))
}
def commandLine = "%s merge%s %s%s".format(
samtools, optional(" -R ", region),
outputBam, repeat(" ", inputBams))