Commit 500d864f authored by Peter van 't Hof's avatar Peter van 't Hof

Added autodetect fileformat paired

parent ece09a76
......@@ -24,6 +24,7 @@ import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsView
import nl.lumc.sasc.biopet.pipelines.bammetrics.BamMetrics
import nl.lumc.sasc.biopet.pipelines.bamtobigwig.Bam2Wig
import nl.lumc.sasc.biopet.pipelines.mapping.MultisampleMappingTrait
import nl.lumc.sasc.biopet.utils.Logging
import nl.lumc.sasc.biopet.utils.config._
import org.broadinstitute.gatk.queue.QScript
......@@ -49,7 +50,8 @@ class Carp(val root: Configurable) extends QScript with MultisampleMappingTrait
"samtoolsview" -> Map(
"h" -> true,
"b" -> true
)
),
"macs2callpeak" -> Map("fileformat" -> "")
)
def summaryFile = new File(outputDir, "Carp.summary.json")
......@@ -91,6 +93,7 @@ class Carp(val root: Configurable) extends QScript with MultisampleMappingTrait
macs2.treatment = preProcessBam.get
macs2.name = Some(sampleId)
macs2.outputdir = sampleDir + File.separator + "macs2" + File.separator + sampleId + File.separator
macs2.fileformat = if (paired) Some("BAMPE") else Some("BAM")
add(macs2)
}
}
......@@ -102,6 +105,13 @@ class Carp(val root: Configurable) extends QScript with MultisampleMappingTrait
Some(carp)
}
lazy val paired: Boolean = {
val notPaired = samples.forall(_._2.libraries.forall(_._2.inputR2.isEmpty))
val p = samples.forall(_._2.libraries.forall(_._2.inputR2.isDefined))
if (!notPaired && !p) Logging.addError("Combination of Paired-end and Single-end detected, this is not allowed in Carp")
p
}
override def init() = {
super.init()
// ensure that no samples are called 'control' since that is our reserved keyword
......@@ -119,6 +129,7 @@ class Carp(val root: Configurable) extends QScript with MultisampleMappingTrait
macs2.treatment = sample.preProcessBam.get
macs2.control = samples(controlId).preProcessBam.get
macs2.name = Some(sampleId + "_VS_" + controlId)
macs2.fileformat = if (paired) Some("BAMPE") else Some("BAM")
macs2.outputdir = sample.sampleDir + File.separator + "macs2" + File.separator + macs2.name.get + File.separator
add(macs2)
}
......
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