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

Added GenotypeConcordance to shiva

parent 05bff3ab
......@@ -20,7 +20,7 @@ import java.io.File
import nl.lumc.sasc.biopet.core.summary.Summarizable
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import org.broadinstitute.gatk.utils.report.{GATKReportTable, GATKReport}
import org.broadinstitute.gatk.utils.report.{ GATKReportTable, GATKReport }
/**
* Extension for CombineVariants from GATK
......@@ -54,8 +54,7 @@ class GenotypeConcordance(val root: Configurable) extends Gatk with Summarizable
val samples = for (i <- 0 until genotypeSummary.getNumRows) yield genotypeSummary.get(i, "Sample").toString
def getMap(table: GATKReportTable, column: String) = samples.distinct.map(sample => sample -> {
(for (i <- 0 until table.getNumRows if table.get(i, "Sample") == sample) yield
s"${table.get(i, "Eval_Genotype")}__${table.get(i, "Comp_Genotype")}" -> table.get(i, column)).toMap
(for (i <- 0 until table.getNumRows if table.get(i, "Sample") == sample) yield s"${table.get(i, "Eval_Genotype")}__${table.get(i, "Comp_Genotype")}" -> table.get(i, column)).toMap
}).toMap
Map(
......
......@@ -20,7 +20,7 @@ import java.io.File
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{ Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.bcftools.{ BcftoolsCall, BcftoolsMerge }
import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants
import nl.lumc.sasc.biopet.extensions.gatk.{ GenotypeConcordance, CombineVariants }
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsMpileup
import nl.lumc.sasc.biopet.extensions.tools.{ MpileupToVcf, VcfFilter, VcfStats }
import nl.lumc.sasc.biopet.extensions.{ Bgzip, Tabix }
......@@ -38,6 +38,10 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
@Input(doc = "Bam files (should be deduped bams)", shortName = "BAM", required = true)
var inputBams: List[File] = Nil
var referenceVcf: Option[File] = config("reference_vcf")
var referenceVcfRegions: Option[File] = config("reference_vcf_regions")
/** Name prefix, can override this methods if neeeded */
def namePrefix: String = {
(sampleId, libId) match {
......@@ -85,6 +89,16 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
vcfStats.setOutputDir(new File(caller.outputDir, "vcfstats"))
add(vcfStats)
addSummarizable(vcfStats, namePrefix + "-vcfstats-" + caller.name)
referenceVcf.foreach(referenceVcfFile => {
val gc = new GenotypeConcordance(this)
gc.evalFile = caller.outputFile
gc.compFile = referenceVcfFile
gc.outputFile = new File(caller.outputDir, s"$namePrefix-genotype_concordance.${caller.name}.txt")
referenceVcfRegions.foreach(gc.intervals ::= _)
add(gc)
addSummarizable(gc, s"$namePrefix-genotype_concordance_${caller.name}")
})
}
add(cv)
......@@ -95,6 +109,16 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
add(vcfStats)
addSummarizable(vcfStats, namePrefix + "-vcfstats-final")
referenceVcf.foreach(referenceVcfFile => {
val gc = new GenotypeConcordance(this)
gc.evalFile = finalFile
gc.compFile = referenceVcfFile
gc.outputFile = new File(outputDir, s"$namePrefix-genotype_concordance.final.txt")
referenceVcfRegions.foreach(gc.intervals ::= _)
add(gc)
addSummarizable(gc, s"$namePrefix-genotype_concordance_final")
})
addSummaryJobs()
}
......
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