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

Added summaries

parent 84775395
......@@ -9,6 +9,7 @@ import nl.lumc.sasc.biopet.core.MultiSampleQScript
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.core.config.Configurable
import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.pipelines.bamtobigwig.Bam2Wig
import scala.collection.JavaConversions._
import nl.lumc.sasc.biopet.extensions.gatk.{ CombineVariants, CombineGVCFs }
......@@ -19,7 +20,7 @@ import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.utils.commandline.{ Argument }
class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScript {
class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScript with SummaryQScript {
qscript =>
def this() = this(null)
......@@ -40,6 +41,12 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
var useAllelesOption: Boolean = config("use_alleles_option", default = false)
val externalGvcfs = config("external_gvcfs_files", default = Nil).asFileList
def summaryFile = new File(outputDir, "GatkPipeline.summary.json")
def summaryFiles = Map()
def summaryData = Map()
def makeSample(id: String) = new Sample(id)
class Sample(sampleId: String) extends AbstractSample(sampleId) {
def makeLibrary(id: String) = new Library(id)
......@@ -118,13 +125,15 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
gatkVariantcalling.biopetScript
addAll(gatkVariantcalling.functions)
}
addSummaryQScript(mapping)
}
}
/** sample variantcalling */
val gatkVariantcalling = new GatkVariantcalling(qscript)
gatkVariantcalling.sampleID = sampleId
gatkVariantcalling.outputDir = new File(sampleDir, "variantcalling/")
gatkVariantcalling.outputDir = new File(sampleDir, "variantcalling")
protected def addJobs(): Unit = {
addPerLibJobs()
......@@ -152,6 +161,8 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
def biopetScript(): Unit = {
addSamplesJobs()
addSummaryJobs
}
def addMultiSampleJobs(): Unit = {
......
......@@ -15,9 +15,10 @@
*/
package nl.lumc.sasc.biopet.pipelines.bammetrics
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.scripts.CoverageStats
import org.broadinstitute.gatk.queue.QScript
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.{ SampleLibraryTag, BiopetQScript, PipelineCommand }
import java.io.File
import nl.lumc.sasc.biopet.tools.{ BedToInterval, BiopetFlagstat }
import nl.lumc.sasc.biopet.core.config.Configurable
......@@ -25,7 +26,7 @@ import nl.lumc.sasc.biopet.extensions.bedtools.{ BedtoolsCoverage, BedtoolsInter
import nl.lumc.sasc.biopet.extensions.picard.{ CollectInsertSizeMetrics, CollectGcBiasMetrics, CalculateHsMetrics, CollectAlignmentSummaryMetrics }
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
class BamMetrics(val root: Configurable) extends QScript with SummaryQScript with SampleLibraryTag {
def this() = this(null)
@Input(doc = "Bam File", shortName = "BAM", required = true)
......@@ -40,6 +41,16 @@ class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
@Argument(doc = "", required = false)
var wholeGenome = false
def summaryFile = (sampleId, libId) match {
case (Some(sampleId), Some(libId)) => new File(outputDir, sampleId + "-" + libId + ".BamMetrics.summary.json")
case (Some(sampleId), _) => new File(outputDir, sampleId + ".BamMetrics.summary.json")
case _ => new File(outputDir, "BamMetrics.summary.json")
}
def summaryFiles = Map("input_bam" -> inputBam)
def summaryData = Map()
def init() {
if (config.contains("target_bed")) {
for (file <- config("target_bed").asList) {
......@@ -81,6 +92,8 @@ class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
add(BedtoolsCoverage(this, inputBam, bedFile, coverageFile, true), true)
add(CoverageStats(this, coverageFile, targetDir))
}
addSummaryJobs
}
}
......
......@@ -215,7 +215,11 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
bamFile = mergeSamFile.output
}
if (!skipMetrics) addAll(BamMetrics(this, bamFile, new File(outputDir, "metrics")).functions)
if (!skipMetrics) {
val bamMetrics = BamMetrics(this, bamFile, new File(outputDir, "metrics"))
addAll(bamMetrics.functions)
addSummaryQScript(bamMetrics)
}
add(Ln(this, swapExt(outputDir, bamFile, ".bam", ".bai"), swapExt(outputDir, finalBamFile, ".bam", ".bai")))
add(Ln(this, bamFile, finalBamFile))
......
Supports Markdown
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