Commit 36333df3 authored by Sander Bollen's avatar Sander Bollen Committed by GitHub

Merge pull request #10 from biopet/fix-BIOPET-534

Fix biopet 534
parents 2467bc10 51f0b19d
......@@ -19,7 +19,6 @@ import java.io.File
import nl.lumc.sasc.biopet.core.summary.{ SummaryQScript, WriteSummary }
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.workaround.BiopetQCommandLine
import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.queue.{ QScript, QSettings }
import org.broadinstitute.gatk.queue.function.QFunction
......@@ -118,11 +117,10 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
}
functions.filter(_.jobOutputFile == null).foreach(f => {
try {
val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName
f.jobOutputFile = new File(f.firstOutput.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out")
} catch {
case e: NullPointerException => logger.warn(s"Can't generate a jobOutputFile for $f")
val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName
BiopetQScript.safeOutputs(f) match {
case Some(o) => f.jobOutputFile = new File(o.head.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out")
case _ => f.jobOutputFile = new File("./stdout") // Line is here for test backup
}
})
......@@ -159,7 +157,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
case that: BiopetQScript =>
that.init()
that.biopetScript()
case _ => subPipeline.script
case _ => subPipeline.script()
}
addAll(subPipeline.functions)
}
......
......@@ -101,6 +101,9 @@ object WriteDependencies extends Logging with Configurable {
file.addOutputJob(function)
files += output -> file
}
val file = files.getOrElse(function.jobOutputFile, QueueFile(function.jobOutputFile))
file.addOutputJob(function)
files += function.jobOutputFile -> file
}
val jobs = functionNames.par.map {
......@@ -116,7 +119,7 @@ object WriteDependencies extends Logging with Configurable {
"depends_on_intermediate" -> BiopetQScript.safeOutputs(f).getOrElse(Seq()).exists(files(_).isIntermediate),
"depends_on_jobs" -> BiopetQScript.safeOutputs(f).getOrElse(Seq()).toList.flatMap(files(_).outputJobNames).distinct,
"output_used_by_jobs" -> BiopetQScript.safeOutputs(f).getOrElse(Seq()).toList.flatMap(files(_).inputJobNames).distinct,
"outputs" -> BiopetQScript.safeOutputs(f).getOrElse(Seq()).toList,
"outputs" -> (f.jobOutputFile :: BiopetQScript.safeOutputs(f).getOrElse(Seq()).toList),
"inputs" -> BiopetQScript.safeOutputs(f).getOrElse(Seq()).toList,
"done_files" -> BiopetQScript.safeDoneFiles(f).getOrElse(Seq()).toList,
"fail_files" -> BiopetQScript.safeFailFiles(f).getOrElse(Seq()).toList,
......
......@@ -40,10 +40,10 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
var vepScript: String = config("vep_script")
@Input(doc = "input VCF", required = true)
var input: File = null
var input: File = _
@Output(doc = "output file", required = true)
var output: File = null
var output: File = _
override def subPath = {
if (vepVersion.isSet) super.subPath ++ List("vep_settings") ++ vepVersion()
......@@ -160,7 +160,7 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
override def defaultCoreMemory = 4.0
@Output
private var _summary: File = null
private var _summary: File = _
override def beforeGraph(): Unit = {
super.beforeGraph()
......@@ -312,11 +312,11 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
(for ((header, headerIndex) <- headers) yield {
val name = header.stripPrefix("[").stripSuffix("]")
name.replaceAll(" ", "_") -> (contents.drop(headerIndex + 1).takeWhile(!isHeader(_)).flatMap { line =>
name.replaceAll(" ", "_") -> contents.drop(headerIndex + 1).takeWhile(!isHeader(_)).flatMap { line =>
val values = line.split("\t", 2)
if (values.last.isEmpty || values.last == "-") None
else Some(values.head.replaceAll(" ", "_") -> tryToParseNumber(values.last).getOrElse(values.last))
}.toMap)
}.toMap
}).toMap
}
}
......@@ -6,6 +6,7 @@ import org.testng.annotations.Test
/**
* Created by Sander Bollen on 12-10-16.
* Here we test utils
*/
class UtilsTest extends TestNGSuite with Matchers {
......
import htsjdk.variant.variantcontext.{ Allele, Genotype, GenotypeBuilder }
package nl.lumc.sasc.biopet.utils
import htsjdk.variant.variantcontext.{ Allele, GenotypeBuilder }
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
import scala.collection.JavaConversions._
import nl.lumc.sasc.biopet.utils.VcfUtils
/**
* Created by Sander Bollen on 4-10-16.
*/
......
......@@ -50,7 +50,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
val wgsExecuted = summary.getSampleValues("bammetrics", "stats", "wgs").values.exists(_.isDefined)
val rnaExecuted = summary.getSampleValues("bammetrics", "stats", "rna").values.exists(_.isDefined)
val insertsizeExecuted = summary.getSampleValues("bammetrics", "stats", "CollectInsertSizeMetrics", "metrics").values.exists(_ != Some(None))
val mappingExecuted = summary.getLibraryValues("mapping").nonEmpty
val mappingExecuted = summary.getLibraryValues("mapping").exists(_._2.isDefined)
val pairedFound = !mappingExecuted || summary.getLibraryValues("mapping", "settings", "paired").exists(_._2 == Some(true))
val flexiprepExecuted = summary.getLibraryValues("flexiprep")
.exists { case ((sample, lib), value) => value.isDefined }
......
Markdown is supported
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