Commit f418cc1a authored by Peter van 't Hof's avatar Peter van 't Hof

Moving flagstats from bamstats to summary

parent a2d728c3
...@@ -82,10 +82,6 @@ class BamMetrics(val root: Configurable) extends QScript ...@@ -82,10 +82,6 @@ class BamMetrics(val root: Configurable) extends QScript
def biopetScript() { def biopetScript() {
add(SamtoolsFlagstat(this, inputBam, outputDir)) add(SamtoolsFlagstat(this, inputBam, outputDir))
val biopetFlagstat = BiopetFlagstat(this, inputBam, outputDir)
add(biopetFlagstat)
addSummarizable(biopetFlagstat, "biopet_flagstat")
val bamStats = new BamStats(this) val bamStats = new BamStats(this)
bamStats.bamFile = inputBam bamStats.bamFile = inputBam
bamStats.outputDir = new File(outputDir, "bamstats") bamStats.outputDir = new File(outputDir, "bamstats")
......
...@@ -2,14 +2,18 @@ package nl.lumc.sasc.biopet.extensions.tools ...@@ -2,14 +2,18 @@ package nl.lumc.sasc.biopet.extensions.tools
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.core.summary.Summarizable
import nl.lumc.sasc.biopet.core.{Reference, ToolCommandFunction} import nl.lumc.sasc.biopet.core.{Reference, ToolCommandFunction}
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.Input import org.broadinstitute.gatk.utils.commandline.Input
import scala.collection.JavaConversions._
/** /**
* Created by pjvanthof on 18/11/2016. * Created by pjvanthof on 18/11/2016.
*/ */
class BamStats(val root: Configurable) extends ToolCommandFunction with Reference { class BamStats(val root: Configurable) extends ToolCommandFunction with Reference with Summarizable {
def toolObject = nl.lumc.sasc.biopet.tools.bamstats.BamStats def toolObject = nl.lumc.sasc.biopet.tools.bamstats.BamStats
@Input(required = true) @Input(required = true)
...@@ -27,6 +31,13 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc ...@@ -27,6 +31,13 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
override def defaultCoreMemory = 5.0 override def defaultCoreMemory = 5.0
override def dictRequired = true override def dictRequired = true
def flagstatSummaryFile(implicit contig: Option[String] = None): File = {
contig match {
case Some(contig) => new File(outputDir, "contigs" + File.separator + contig + File.separator + "flagstats.summary.json")
case _ => new File(outputDir, "flagstats.summary.json")
}
}
override def beforeGraph() { override def beforeGraph() {
super.beforeGraph() super.beforeGraph()
jobOutputFile = new File(outputDir, ".bamstats.out") jobOutputFile = new File(outputDir, ".bamstats.out")
...@@ -41,4 +52,13 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc ...@@ -41,4 +52,13 @@ class BamStats(val root: Configurable) extends ToolCommandFunction with Referenc
optional("--binSize", binSize) + optional("--binSize", binSize) +
optional("--threadBinSize", threadBinSize) optional("--threadBinSize", threadBinSize)
def summaryFiles: Map[String, File] = Map()
def summaryStats: Map[String, Any] = Map(
"flagstats" -> ConfigUtils.fileToConfigMap(flagstatSummaryFile),
"flagstats_per_contig" -> referenceDict.getSequences.map {
c => c.getSequenceName -> ConfigUtils.fileToConfigMap(flagstatSummaryFile(Some(c.getSequenceName)))
}.toMap
)
} }
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