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
import java.io.File
import java.util
import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, BiopetQScript }
import nl.lumc.sasc.biopet.extensions.gatk.{ SelectVariants, CombineVariants }
......@@ -9,29 +10,36 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.intervals.BedRecordList
import org.broadinstitute.gatk.queue.QScript
import scala.collection.JavaConversions._
/**
* Created by pjvanthof on 16/03/16.
*/
class GwasTest(val root: Configurable) extends QScript with BiopetQScript with Reference {
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)
lazy val inputGens: Option[List[GensInput]] = if (inputVcf.isDefined) None
val inputBlaGens: List[GensInput] = if (inputVcf.isDefined) List[GensInput]()
else {
if (config.contains("input_gens")) {
val gens: List[Any] = configValue2list(config("input_gens"))
Some(gens.map {
println("blabla")
config("input_gens", default = Nil).asList.map(x => x match {
case value: Map[String, Any] =>
GensInput(new File(value("genotypes").toString),
value.get("info").map(x => new File(x.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 */
def init(): Unit = {
......@@ -40,12 +48,12 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R
/** Pipeline itself */
def biopetScript(): Unit = {
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 cv = new CombineVariants(this)
cv.outputFile = new File(outputDirGens, "merge.gens.vcf.gz")
cv.setKey = "null"
gens.foreach { gen =>
inputBlaGens.foreach { gen =>
val gensToVcf = new GensToVcf(this)
gensToVcf.inputGens = gen.genotypes
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