CnmopsMethod.scala 1.12 KB
Newer Older
1
2
package nl.lumc.sasc.biopet.pipelines.kopisu.methods

3
import htsjdk.samtools.{ SAMSequenceDictionary, SamReaderFactory }
Sander Bollen's avatar
Sander Bollen committed
4
import nl.lumc.sasc.biopet.core.Reference
5
6
7
import nl.lumc.sasc.biopet.extensions.Cnmops
import nl.lumc.sasc.biopet.utils.config.Configurable

8
9
import scala.collection.JavaConversions._

10
11
12
/**
 * Created by wyleung on 2-6-16.
 */
Sander Bollen's avatar
Sander Bollen committed
13
class CnmopsMethod(val root: Configurable) extends CnvMethod with Reference {
14
15
16
17
  def name = "cnmops"

  def biopetScript: Unit = {

18
    // we repeat running cnmops for all chromosomes
Sander Bollen's avatar
Sander Bollen committed
19
    val cnmopsJobs = referenceDict.getSequences.map(contig => {
20
21
22
23
24
25
      val cnmops = new Cnmops(this)
      cnmops.chromosome = contig.getSequenceName
      cnmops.input = inputBams.flatMap {
        case (sampleName, bamFile) => Some(bamFile)
        case _                     => None
      }.toList
26
      cnmops.outputDir = Some(new File(outputDir, contig.getSequenceName))
27
28
29
30
31
      cnmops.beforeGraph
      cnmops
    }).toList

    addAll(cnmopsJobs)
32
33
34
35
    // adding output files to the outputSummary
    cnmopsJobs.foreach(job => {
      addOutput(job.chromosome, job.rawOutput)
    })
36
37
38
39

    addSummaryJobs()
  }
}