Commit 9332161d authored by Peter van 't Hof's avatar Peter van 't Hof

Switch to multi metrics

parent 5933b5a1
......@@ -63,15 +63,12 @@ class BamMetrics(val root: Configurable) extends QScript with SummaryQScript wit
add(biopetFlagstat)
addSummarizable(biopetFlagstat, "biopet_flagstat")
add(CollectGcBiasMetrics(this, inputBam, outputDir))
val collectInsertSizeMetrics = CollectInsertSizeMetrics(this, inputBam, outputDir)
add(collectInsertSizeMetrics)
addSummarizable(collectInsertSizeMetrics, "insert_size_metrics")
val multiMetrics = new CollectMultipleMetrics(this)
multiMetrics.input = inputBam
multiMetrics.outputName = new File(outputDir, inputBam.getName.stripSuffix(".bam"))
add(multiMetrics)
val collectAlignmentSummaryMetrics = CollectAlignmentSummaryMetrics(this, inputBam, outputDir)
add(collectAlignmentSummaryMetrics)
addSummarizable(collectAlignmentSummaryMetrics, "alignment_metrics")
add(CollectGcBiasMetrics(this, inputBam, outputDir))
case class Intervals(bed: File, intervals: File)
......@@ -135,7 +132,7 @@ class BamMetrics(val root: Configurable) extends QScript with SummaryQScript wit
}
object BamMetrics extends PipelineCommand {
/** Make default implementation of BamMetrics */
/** Make default implementation of BamMetrics and runs script already */
def apply(root: Configurable, bamFile: File, outputDir: File): BamMetrics = {
val bamMetrics = new BamMetrics(root)
bamMetrics.inputBam = bamFile
......
package nl.lumc.sasc.biopet.extensions.picard
import java.io.File
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Output, Argument, Input }
/**
* Created by pjvan_thof on 4/16/15.
*/
class CollectMultipleMetrics(val root: Configurable) extends Picard {
import CollectMultipleMetrics._
javaMainClass = new picard.analysis.CollectMultipleMetrics().getClass.getName
@Input(doc = "The input SAM or BAM files to analyze", required = true)
var input: File = null
@Output(doc = "Base name of output files", required = true)
var outputName: File = null
@Argument(doc = "Base name of output files", required = true)
var program: List[String] = config("metrics_programs",
default = Programs.values.iterator.toList.map(_.toString))
@Argument(doc = "Assume alignment file is sorted by position", required = false)
var assumeSorted: Boolean = config("assume_sorted", default = false)
@Argument(doc = "Stop after processing N reads", required = false)
var stopAfter: Option[Long] = config("stop_after")
@Output
protected var outputFiles: List[File] = Nil
override def beforeGraph: Unit = {
program.foreach(p => p match {
case _ if p == Programs.CollectAlignmentSummaryMetrics.toString => {
outputFiles :+= new File(outputName + ".alignment_summary_metrics")
}
case _ if p == Programs.CollectInsertSizeMetrics.toString => {
outputFiles :+= new File(outputName + ".insert_size_metrics")
outputFiles :+= new File(outputName + ".insert_size_Histogram.pdf")
}
case _ if p == Programs.QualityScoreDistribution.toString => {
outputFiles :+= new File(outputName + ".quality_distribution_metrics")
outputFiles :+= new File(outputName + ".test.quality_distribution.pdf")
}
case _ if p == Programs.MeanQualityByCycle.toString => {
outputFiles :+= new File(outputName + ".quality_by_cycle_metrics")
outputFiles :+= new File(outputName + ".quality_by_cycle.pdf")
}
case _ if p == Programs.CollectBaseDistributionByCycle.toString => {
outputFiles :+= new File(outputName + ".base_distribution_by_cycle_metrics")
outputFiles :+= new File(outputName + ".base_distribution_by_cycle.pdf")
}
case _ => BiopetQScript.addError("Program '" + p + "' does not exist for 'CollectMultipleMetrics'")
})
}
override def commandLine = super.commandLine +
required("INPUT=", input, spaceSeparated = false) +
required("OUTPUT=", outputName, spaceSeparated = false) +
required("ASSUME_SORTED=", assumeSorted, spaceSeparated = false) +
required("STOP_AFTER=", stopAfter, spaceSeparated = false) +
repeat("PROGRAM=", program, spaceSeparated = false)
}
object CollectMultipleMetrics {
object Programs extends Enumeration {
val CollectAlignmentSummaryMetrics, CollectInsertSizeMetrics, QualityScoreDistribution, MeanQualityByCycle, CollectBaseDistributionByCycle = Value
}
}
\ No newline at end of file
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