BamGatherFunction.scala 1.08 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
package nl.lumc.sasc.biopet.extensions.gatk
2
3
4

import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.extensions.picard.MergeSamFiles
Peter van 't Hof's avatar
Peter van 't Hof committed
5
import org.broadinstitute.gatk.queue.function.scattergather.GatherFunction
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/**
 * Merges BAM files using htsjdk.samtools.MergeSamFiles.
 */
class BamGatherFunction extends MergeSamFiles(null) with GatherFunction {

  override val root = originalFunction match {
    case b: BiopetCommandLineFunction => b
    case _                            => null
  }

  this.assumeSorted = true

  override def freezeFieldValues() {
    this.input = this.gatherParts.toList
    this.output = this.originalOutput
    this.sortOrder = "coordinate"
    //Left to its own devices (ie, MergeSamFiles.freezeFieldValues), outputIndex
    //will be in the gather directory.  Ensure that it actually matches this.output

    val originalGATK = originalFunction.asInstanceOf[CommandLineGATK]

    // Whatever the original function can handle, merging *should* do less.
    this.createIndex = !originalGATK.disable_bam_indexing

    super.freezeFieldValues()
  }
}