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

For for BIOPET-389

parent e6199e01
...@@ -166,11 +166,15 @@ class BamMetrics(val root: Configurable) extends QScript ...@@ -166,11 +166,15 @@ class BamMetrics(val root: Configurable) extends QScript
addSummarizable(biopetFlagstatLoose, targetName + "_biopet_flagstat_loose") addSummarizable(biopetFlagstatLoose, targetName + "_biopet_flagstat_loose")
add(new BiopetFifoPipe(this, List(biLoose, biopetFlagstatLoose))) add(new BiopetFifoPipe(this, List(biLoose, biopetFlagstatLoose)))
val sorter = new BedtoolsSort(this) val sortedBed = BamMetrics.sortedbedCache.getOrElse(intervals.bed, {
sorter.input = intervals.bed val sorter = new BedtoolsSort(this)
sorter.output = swapExt(targetDir, intervals.bed, ".bed", ".sorted.bed") sorter.input = intervals.bed
add(sorter) sorter.output = swapExt(targetDir, intervals.bed, ".bed", ".sorted.bed")
val bedCov = BedtoolsCoverage(this, sorter.output, inputBam, depth = true) add(sorter)
BamMetrics.sortedbedCache += intervals.bed -> sorter.output
sorter.output
})
val bedCov = BedtoolsCoverage(this, sortedBed, inputBam, depth = true)
val covStats = CoverageStats(this, targetDir, inputBam.getName.stripSuffix(".bam") + ".coverage") val covStats = CoverageStats(this, targetDir, inputBam.getName.stripSuffix(".bam") + ".coverage")
covStats.title = Some("Coverage Plot") covStats.title = Some("Coverage Plot")
covStats.subTitle = Some(s"for file '$targetName.bed'") covStats.subTitle = Some(s"for file '$targetName.bed'")
...@@ -198,4 +202,6 @@ object BamMetrics extends PipelineCommand { ...@@ -198,4 +202,6 @@ object BamMetrics extends PipelineCommand {
bamMetrics.biopetScript() bamMetrics.biopetScript()
bamMetrics bamMetrics
} }
private var sortedbedCache: Map[File, File] = Map()
} }
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