Commit 9869bfcd authored by Sander Bollen's avatar Sander Bollen Committed by GitHub
Browse files

Merge pull request #21 from biopet/fix-BIOPET-563

Fixing dependency issue
parents cdbe8460 2b9de137
......@@ -41,11 +41,6 @@ class DellyCaller(val root: Configurable) extends BiopetCommandLineFunction with
@Argument(doc = "What kind of analysis to run: DEL,DUP,INV,TRA")
var analysistype: String = _
override def beforeGraph(): Unit = {
super.beforeGraph()
deps ::= new File(input.getParentFile, input.getName + ".bai")
}
def cmdLine = required(executable) +
"-t" + required(analysistype) +
"-o" + required(outputvcf) +
......
......@@ -62,7 +62,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
var fastqcR1After: Fastqc = _
var fastqcR2After: Fastqc = _
override def reportClass = {
override def reportClass: Some[FlexiprepReport] = {
val flexiprepReport = new FlexiprepReport(this)
flexiprepReport.outputDir = new File(outputDir, "report")
flexiprepReport.summaryFile = summaryFile
......@@ -74,6 +74,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
/** Function that's need to be executed before the script is accessed */
def init() {
paired = inputR2.isDefined
if (inputR1 == null) Logging.addError("Missing input R1 on flexiprep module")
if (sampleId == null || sampleId.isEmpty) Logging.addError("Missing sample ID on flexiprep module")
if (libId == null || libId.isEmpty) Logging.addError("Missing library ID on flexiprep module")
......@@ -147,10 +148,10 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
}
}
def fastqR1Qc = if (paired)
def fastqR1Qc: File = if (paired)
new File(outputDir, s"${sampleId.getOrElse("x")}-${libId.getOrElse("x")}.R1.qc.sync.fq.gz")
else new File(outputDir, s"${sampleId.getOrElse("x")}-${libId.getOrElse("x")}.R1.qc.fq.gz")
def fastqR2Qc = if (paired)
def fastqR2Qc: Option[File] = if (paired)
Some(new File(outputDir, s"${sampleId.getOrElse("x")}-${libId.getOrElse("x")}.R2.qc.sync.fq.gz"))
else None
......@@ -225,7 +226,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
/** Must returns stats to store into summary */
def summaryStats: Any = Map()
override def summaryDeps = qcCmdR1.summaryDeps ::: qcCmdR2.summaryDeps ::: super.summaryDeps
override def summaryDeps: List[File] = qcCmdR1.summaryDeps ::: qcCmdR2.summaryDeps ::: super.summaryDeps
}
pipe.deps ::= fastqcR1.output
......
......@@ -84,13 +84,13 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
protected def executeFlexiprep(r1: List[File], r2: List[File]): (File, Option[File]) = {
val read1: File = if (r1.size == 1) r1.head else {
val outputFile = new File(outputDir, "merged.R1.fq.gz")
Zcat(this, r1) | new Gzip(this) > outputFile
add(Zcat(this, r1) | new Gzip(this) > outputFile)
outputFile
}
val read2: Option[File] = if (r2.size <= 1) r2.headOption else {
val outputFile = new File(outputDir, "merged.R2.fq.gz")
Zcat(this, r2) | new Gzip(this) > outputFile
add(Zcat(this, r2) | new Gzip(this) > outputFile)
Some(outputFile)
}
......
......@@ -31,7 +31,7 @@ import nl.lumc.sasc.biopet.pipelines.bamtobigwig.Bam2Wig
import nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep
import nl.lumc.sasc.biopet.pipelines.gears.GearsSingle
import nl.lumc.sasc.biopet.pipelines.mapping.scripts.TophatRecondition
import nl.lumc.sasc.biopet.utils.{ Logging, textToSize }
import nl.lumc.sasc.biopet.utils.textToSize
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -127,7 +127,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
})
/** Settings to add to summary */
def summarySettings = Map(
def summarySettings: Map[String, Any] = Map(
"skip_metrics" -> skipMetrics,
"skip_flexiprep" -> skipFlexiprep,
"skip_markduplicates" -> skipMarkduplicates,
......@@ -137,7 +137,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
"number_of_chunks" -> (if (chunking) numberChunks.getOrElse(1) else None)
) ++ (if (root == null) Map("reference" -> referenceSummary) else Map())
override def reportClass = {
override def reportClass: Some[MappingReport] = {
val mappingReport = new MappingReport(this)
mappingReport.outputDir = new File(outputDir, "report")
mappingReport.summaryFile = summaryFile
......@@ -178,6 +178,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
}
}
logger.debug("Chunks: " + numberChunks.getOrElse(1))
if (numberChunks.getOrElse(1) <= 1) chunking = false
}
}
......@@ -295,7 +296,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
addSummaryJobs()
}
protected lazy val bam2wig = if (config("generate_wig", default = false)) {
protected lazy val bam2wig: Option[Bam2Wig] = if (config("generate_wig", default = false)) {
Some(Bam2Wig(this, finalBamFile))
} else None
......
......@@ -67,7 +67,10 @@ trait MultisampleMappingTrait extends MultiSampleQScript
Some(report)
}
override def defaults: Map[String, Any] = super.defaults ++ Map("reordersam" -> Map("allow_incomplete_dict_concordance" -> true))
override def defaults: Map[String, Any] = super.defaults ++ Map(
"reordersam" -> Map("allow_incomplete_dict_concordance" -> true),
"gears" -> Map("skip_flexiprep" -> true)
)
override def fixedValues: Map[String, Any] = super.fixedValues ++ Map("gearssingle" -> Map("skip_flexiprep" -> true))
......@@ -99,6 +102,8 @@ trait MultisampleMappingTrait extends MultiSampleQScript
lazy val inputR1: Option[File] = MultisampleMapping.fileMustBeAbsolute(config("R1"))
lazy val inputR2: Option[File] = MultisampleMapping.fileMustBeAbsolute(config("R2"))
lazy val qcFastqR1 = mapping.map(_.flexiprep.fastqR1Qc)
lazy val qcFastqR2 = mapping.flatMap(_.flexiprep.fastqR2Qc)
lazy val inputBam: Option[File] = MultisampleMapping.fileMustBeAbsolute(if (inputR1.isEmpty) config("bam") else None)
lazy val bamToFastq: Boolean = config("bam_to_fastq", default = false)
lazy val correctReadgroups: Boolean = config("correct_readgroups", default = false)
......@@ -274,8 +279,8 @@ trait MultisampleMappingTrait extends MultiSampleQScript
add(gears)
case "all" =>
val gears = new GearsSingle(qscript)
gears.fastqR1 = libraries.flatMap(_._2.inputR1).toList
gears.fastqR2 = libraries.flatMap(_._2.inputR2).toList
gears.fastqR1 = libraries.flatMap(_._2.qcFastqR1).toList
gears.fastqR2 = libraries.flatMap(_._2.qcFastqR2).toList
gears.sampleId = Some(sampleId)
gears.outputDir = new File(sampleDir, "gears")
add(gears)
......
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