Skip to content
Snippets Groups Projects
Commit 0f8dafb1 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Tests

parent c774f02c
No related branches found
No related tags found
No related merge requests found
package nl.lumc.sasc.biopet.pipelines.gwastest package nl.lumc.sasc.biopet.pipelines.gwastest
import java.io.File import java.io.File
import java.util
import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, BiopetQScript } import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, BiopetQScript }
import nl.lumc.sasc.biopet.extensions.gatk.{ SelectVariants, CombineVariants } import nl.lumc.sasc.biopet.extensions.gatk.{ SelectVariants, CombineVariants }
...@@ -9,29 +10,36 @@ import nl.lumc.sasc.biopet.utils.config.Configurable ...@@ -9,29 +10,36 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.intervals.BedRecordList import nl.lumc.sasc.biopet.utils.intervals.BedRecordList
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
import scala.collection.JavaConversions._
/** /**
* Created by pjvanthof on 16/03/16. * Created by pjvanthof on 16/03/16.
*/ */
class GwasTest(val root: Configurable) extends QScript with BiopetQScript with Reference { class GwasTest(val root: Configurable) extends QScript with BiopetQScript with Reference {
def this() = this(null) def this() = this(null)
lazy val inputVcf: Option[File] = config("input_vcf") val inputVcf: Option[File] = config("input_vcf")
lazy val phenotypeFile: File = config("phenotype_file") val phenotypeFile: File = config("phenotype_file")
case class GensInput(genotypes: File, info: Option[File], contig: String) case class GensInput(genotypes: File, info: Option[File], contig: String)
lazy val inputGens: Option[List[GensInput]] = if (inputVcf.isDefined) None
val inputBlaGens: List[GensInput] = if (inputVcf.isDefined) List[GensInput]()
else { else {
if (config.contains("input_gens")) { println("blabla")
val gens: List[Any] = configValue2list(config("input_gens")) config("input_gens", default = Nil).asList.map(x => x match {
Some(gens.map {
case value: Map[String, Any] => case value: Map[String, Any] =>
GensInput(new File(value("genotypes").toString), GensInput(new File(value("genotypes").toString),
value.get("info").map(x => new File(x.toString)), value.get("info").map(x => new File(x.toString)),
value("contig").toString) value("contig").toString)
case value: util.LinkedHashMap[_, _] =>
GensInput(new File(value("genotypes").toString),
value.toMap.get("info").map(x => new File(x.toString)),
value("contig").toString)
case _ => throw new IllegalArgumentException
}) })
} else None List[GensInput]()
} }
/** Init for pipeline */ /** Init for pipeline */
def init(): Unit = { def init(): Unit = {
...@@ -40,12 +48,12 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R ...@@ -40,12 +48,12 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R
/** Pipeline itself */ /** Pipeline itself */
def biopetScript(): Unit = { def biopetScript(): Unit = {
val vcfFile: File = inputVcf.getOrElse { val vcfFile: File = inputVcf.getOrElse {
val gens = inputGens.getOrElse(throw new IllegalArgumentException("No vcf file or gens files defined in config")) require(inputBlaGens.nonEmpty, "No vcf file or gens files defined in config")
val outputDirGens = new File(outputDir, "gens_to_vcf") val outputDirGens = new File(outputDir, "gens_to_vcf")
val cv = new CombineVariants(this) val cv = new CombineVariants(this)
cv.outputFile = new File(outputDirGens, "merge.gens.vcf.gz") cv.outputFile = new File(outputDirGens, "merge.gens.vcf.gz")
cv.setKey = "null" cv.setKey = "null"
gens.foreach { gen => inputBlaGens.foreach { gen =>
val gensToVcf = new GensToVcf(this) val gensToVcf = new GensToVcf(this)
gensToVcf.inputGens = gen.genotypes gensToVcf.inputGens = gen.genotypes
gensToVcf.inputInfo = gen.info gensToVcf.inputInfo = gen.info
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment