Commit 327e24b2 authored by Peter van 't Hof's avatar Peter van 't Hof

Disable insertsize metrics for single end

parent 2cfc8238
......@@ -42,6 +42,9 @@ class BamMetrics(val parent: Configurable)
@Input(doc = "Bam File", shortName = "BAM", required = true)
var inputBam: File = _
@Argument(required = false)
var paired: Boolean = true
override def defaults = Map("bedtoolscoverage" -> Map("sorted" -> true))
/** returns files to store in summary */
......@@ -87,6 +90,9 @@ class BamMetrics(val parent: Configurable)
val multiMetrics = new CollectMultipleMetrics(this)
multiMetrics.input = inputBam
multiMetrics.outputName = new File(outputDir, inputBam.getName.stripSuffix(".bam"))
if (!paired)
multiMetrics.program = multiMetrics.program
.filter(_ != CollectMultipleMetrics.Programs.CollectInsertSizeMetrics)
add(multiMetrics)
addSummarizable(multiMetrics, "multi_metrics")
......@@ -212,6 +218,7 @@ object BamMetrics extends PipelineCommand {
def apply(root: Configurable,
bamFile: File,
outputDir: File,
paired: Boolean,
sampleId: Option[String] = None,
libId: Option[String] = None): BamMetrics = {
val bamMetrics = new BamMetrics(root)
......@@ -219,6 +226,7 @@ object BamMetrics extends PipelineCommand {
bamMetrics.libId = libId
bamMetrics.inputBam = bamFile
bamMetrics.outputDir = outputDir
bamMetrics.paired = paired
bamMetrics.init()
bamMetrics.biopetScript()
......
......@@ -78,6 +78,7 @@ class Carp(val parent: Configurable) extends QScript with MultisampleMappingTrai
val bamMetricsFilter = BamMetrics(qscript,
preProcessBam.get,
new File(sampleDir, "metrics-filter"),
paired,
sampleId = Some(sampleId))
addAll(bamMetricsFilter.functions)
bamMetricsFilter.summaryName = "bammetrics-filter"
......
......@@ -305,7 +305,7 @@ class Mapping(val parent: Configurable)
}
if (chunking && numberChunks.getOrElse(1) > 1 && config("chunk_metrics", default = false))
addAll(
BamMetrics(this, outputBam, new File(chunkDir, "metrics"), sampleId, libId).functions)
BamMetrics(this, outputBam, new File(chunkDir, "metrics"), paired, sampleId, libId).functions)
}
if (!skipFlexiprep) {
......@@ -334,7 +334,7 @@ class Mapping(val parent: Configurable)
if (!skipMetrics) {
val bamMetrics =
BamMetrics(this, finalBamFile, new File(outputDir, "metrics"), sampleId, libId)
BamMetrics(this, finalBamFile, new File(outputDir, "metrics"), paired, sampleId, libId)
addAll(bamMetrics.functions)
addSummaryQScript(bamMetrics)
}
......
......@@ -236,6 +236,7 @@ trait MultisampleMappingTrait extends MultiSampleQScript with Reference { qscrip
bamMetrics.libId = Some(libId)
bamMetrics.inputBam = bamFile.get
bamMetrics.outputDir = new File(libDir, "metrics")
bamMetrics.paired = inputR2.isDefined
add(bamMetrics)
if (config("execute_bam2wig", default = true)) add(Bam2Wig(qscript, bamFile.get))
......@@ -340,6 +341,7 @@ trait MultisampleMappingTrait extends MultiSampleQScript with Reference { qscrip
bamMetrics.sampleId = Some(sampleId)
bamMetrics.inputBam = if (metricsPreprogressBam) preProcessBam.get else bamFile.get
bamMetrics.outputDir = new File(sampleDir, "metrics")
bamMetrics.paired = libraries.exists(_._2.inputR1.isDefined)
add(bamMetrics)
if (config("execute_bam2wig", default = true)) add(Bam2Wig(qscript, preProcessBam.get))
......
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