Commit 04b80825 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Make variantcaller public

parent 99f18f74
...@@ -82,6 +82,11 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -82,6 +82,11 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
case _ => (None, None, None) case _ => (None, None, None)
} }
val variantcalling = if (config("library_variantcalling", default = false).asBoolean &&
(bamFile.isDefined || preProcessBam.isDefined)) {
Some(makeVariantcalling(multisample = false))
} else None
def addJobs(): Unit = { def addJobs(): Unit = {
(config.contains("R1"), config.contains("bam")) match { (config.contains("R1"), config.contains("bam")) match {
case (true, _) => mapping.foreach(mapping => { case (true, _) => mapping.foreach(mapping => {
...@@ -146,8 +151,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -146,8 +151,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
addSummaryQScript(mapping) addSummaryQScript(mapping)
}) })
if (config("library_variantcalling", default = false).asBoolean && (bamFile.isDefined || preProcessBam.isDefined)) { variantcalling.foreach(vc => {
val vc = makeVariantcalling(multisample = false)
vc.sampleId = Some(libId) vc.sampleId = Some(libId)
vc.libId = Some(sampleId) vc.libId = Some(sampleId)
vc.outputDir = new File(libDir, "variantcalling") vc.outputDir = new File(libDir, "variantcalling")
...@@ -157,11 +161,11 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -157,11 +161,11 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
vc.biopetScript vc.biopetScript
addAll(vc.functions) addAll(vc.functions)
addSummaryQScript(vc) addSummaryQScript(vc)
} })
} }
} }
def doublePreProcess(input: List[File], isIntermediate: Boolean = false): Option[File] = { protected def addDoublePreProcess(input: List[File], isIntermediate: Boolean = false): Option[File] = {
if (input == Nil) None if (input == Nil) None
else if (input.tail == Nil) { else if (input.tail == Nil) {
val bamFile = new File(sampleDir, input.head.getName) val bamFile = new File(sampleDir, input.head.getName)
...@@ -186,7 +190,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -186,7 +190,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
} }
} }
lazy val preProcessBam: Option[File] = doublePreProcess(libraries.map(lib => { lazy val preProcessBam: Option[File] = addDoublePreProcess(libraries.map(lib => {
(lib._2.bamFile, lib._2.preProcessBam) match { (lib._2.bamFile, lib._2.preProcessBam) match {
case (_, Some(file)) => Some(file) case (_, Some(file)) => Some(file)
case (Some(file), _) => Some(file) case (Some(file), _) => Some(file)
...@@ -194,6 +198,10 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -194,6 +198,10 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
} }
}).flatten.toList) }).flatten.toList)
val variantcalling = if (config("multisample_sample_variantcalling", default = true).asBoolean) {
Some(makeVariantcalling(multisample = true))
} else None
def addJobs(): Unit = { def addJobs(): Unit = {
addPerLibJobs() addPerLibJobs()
...@@ -207,8 +215,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -207,8 +215,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
addAll(bamMetrics.functions) addAll(bamMetrics.functions)
addSummaryQScript(bamMetrics) addSummaryQScript(bamMetrics)
if (config("single_sample_variantcalling", default = false).asBoolean) { variantcalling.foreach(vc => {
val vc = makeVariantcalling(multisample = false)
vc.sampleId = Some(sampleId) vc.sampleId = Some(sampleId)
vc.outputDir = new File(sampleDir, "variantcalling") vc.outputDir = new File(sampleDir, "variantcalling")
vc.inputBams = preProcessBam.get :: Nil vc.inputBams = preProcessBam.get :: Nil
...@@ -216,21 +223,24 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript { ...@@ -216,21 +223,24 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
vc.biopetScript vc.biopetScript
addAll(vc.functions) addAll(vc.functions)
addSummaryQScript(vc) addSummaryQScript(vc)
} })
} }
} }
} }
val variantcalling = if (config("multisample_sample_variantcalling", default = true).asBoolean) {
Some(makeVariantcalling(multisample = true))
} else None
def addMultiSampleJobs(): Unit = { def addMultiSampleJobs(): Unit = {
if (config("multisample_sample_variantcalling", default = true).asBoolean) { variantcalling.foreach(vc => {
val vc = makeVariantcalling(multisample = true)
vc.outputDir = new File(outputDir, "variantcalling") vc.outputDir = new File(outputDir, "variantcalling")
vc.inputBams = samples.map(_._2.preProcessBam).flatten.toList vc.inputBams = samples.map(_._2.preProcessBam).flatten.toList
vc.init vc.init
vc.biopetScript vc.biopetScript
addAll(vc.functions) addAll(vc.functions)
addSummaryQScript(vc) addSummaryQScript(vc)
} })
} }
def summaryFile = new File(outputDir, "Shiva.summary.json") def summaryFile = new File(outputDir, "Shiva.summary.json")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment