Gentrap.scala 2.12 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1 2 3 4 5
package nl.lumc.sasc.biopet.pipelines.gentrap.template

import java.io.File

import nl.lumc.sasc.biopet.core.TemplateTool
Peter van 't Hof's avatar
Peter van 't Hof committed
6
import nl.lumc.sasc.biopet.pipelines.gentrap.Gentrap.{ ExpMeasures, StrandProtocol }
Peter van 't Hof's avatar
Peter van 't Hof committed
7 8 9 10 11 12 13 14 15
import nl.lumc.sasc.biopet.pipelines.mapping.template.MultiSampleMapping
import nl.lumc.sasc.biopet.pipelines.shiva.template.Shiva
import nl.lumc.sasc.biopet.utils._

/**
 * Created by pjvanthof on 17/12/2016.
 */
object Gentrap extends TemplateTool {

Peter van 't Hof's avatar
Peter van 't Hof committed
16 17 18
  def pipelineName = "Gentrap"

  override def sampleConfigs: List[File] = TemplateTool.askSampleConfigs()
Peter van 't Hof's avatar
Peter van 't Hof committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

  def pipelineMap(map: Map[String, Any], expert: Boolean): Map[String, Any] = {
    val aligner = Question.string("Aligner", posibleValues = MultiSampleMapping.possibleAligners,
      default = Some("gsnap"))

    val mappingConfig = MultiSampleMapping.pipelineMap(map ++ Map("aligner" -> aligner), expert)

    val expressionMeasures = Question.list("ExpressionMeasures",
      posibleValues = ExpMeasures.values.map(x => unCamelize(x.toString)).toList)

    val strandProtocol = Question.list("StrandProtocol",
      posibleValues = StrandProtocol.values.map(x => unCamelize(x.toString)).toList)

    val annotationRefFlat = Question.string("annotationRefFlat",
      validation = List(TemplateTool.isAbsolutePath, TemplateTool.mustExist))

    val annotationGtf = if (expressionMeasures.contains(unCamelize(ExpMeasures.FragmentsPerGene.toString)) ||
      expressionMeasures.exists(_.startsWith("cufflinks")))
      Some(Question.string("annotationGtf",
        validation = List(TemplateTool.isAbsolutePath, TemplateTool.mustExist)))
    else None

    mappingConfig ++ annotationGtf.map("annotation_gtf" -> _) ++ Map(
      "expression_measures" -> expressionMeasures,
      "strand_protocol" -> strandProtocol,
      "annotation_refflat" -> annotationRefFlat
    ) ++ (if (Question.boolean("Call variants")) {
Peter van 't Hof's avatar
Peter van 't Hof committed
46 47
        val variantCallers = Question.list("Variantcallers", posibleValues = Shiva.possibleVariantcallers,
          default = Some(List("varscan_cns_singlesample")))
Peter van 't Hof's avatar
Peter van 't Hof committed
48

Peter van 't Hof's avatar
Peter van 't Hof committed
49 50
        Map("call_variants" -> true, "variantcallers" -> variantCallers)
      } else Map("call_variants" -> false))
Peter van 't Hof's avatar
Peter van 't Hof committed
51 52
  }
}