Commit 01fbae99 authored by Sander Bollen's avatar Sander Bollen

Merge branch 'fix-BIOPET-489' into 'develop'

Fix biopet 489



See merge request !509
parents 4cecab46 4bd9f01e
......@@ -136,7 +136,7 @@ class BamMetrics(val root: Configurable) extends QScript
ampBedToInterval.isIntermediate = true
add(ampBedToInterval)
val chsMetrics = CalculateHsMetrics(this, inputBam,
val chsMetrics = CollectHsMetrics(this, inputBam,
List(ampIntervals), ampIntervals :: roiIntervals.map(_.intervals), outputDir)
add(chsMetrics)
addSummarizable(chsMetrics, "hs_metrics")
......
......@@ -75,7 +75,7 @@ class BamMetricsTest extends TestNGSuite with Matchers {
bammetrics.functions.count(_.isInstanceOf[CollectRnaSeqMetrics]) shouldBe (if (rna) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectWgsMetrics]) shouldBe (if (wgs) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectMultipleMetrics]) shouldBe 1
bammetrics.functions.count(_.isInstanceOf[CalculateHsMetrics]) shouldBe (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectHsMetrics]) shouldBe (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectTargetedPcrMetrics]) shouldBe (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[BamStats]) shouldBe 1
}
......
......@@ -22,8 +22,8 @@ import nl.lumc.sasc.biopet.core.summary.Summarizable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
/** Extension for picard CalculateHsMetrics */
class CalculateHsMetrics(val root: Configurable) extends Picard with Summarizable with Reference {
javaMainClass = new picard.analysis.directed.CalculateHsMetrics().getClass.getName
class CollectHsMetrics(val root: Configurable) extends Picard with Summarizable with Reference {
javaMainClass = new picard.analysis.directed.CollectHsMetrics().getClass.getName
@Input(doc = "The input SAM or BAM files to analyze. Must be coordinate sorted.", required = true)
var input: File = _
......@@ -72,14 +72,14 @@ class CalculateHsMetrics(val root: Configurable) extends Picard with Summarizabl
def summaryStats: Any = Picard.getMetrics(output).getOrElse(Map())
}
object CalculateHsMetrics {
object CollectHsMetrics {
/** Returns default CalculateHsMetrics */
def apply(root: Configurable,
input: File,
baitIntervals: List[File],
targetIntervals: List[File],
outputDir: File): CalculateHsMetrics = {
val calculateHsMetrics = new CalculateHsMetrics(root)
outputDir: File): CollectHsMetrics = {
val calculateHsMetrics = new CollectHsMetrics(root)
calculateHsMetrics.input = input
calculateHsMetrics.baitIntervals = baitIntervals
calculateHsMetrics.targetIntervals = targetIntervals
......
......@@ -16,11 +16,10 @@ package nl.lumc.sasc.biopet.extensions.tools
import java.io.File
import nl.lumc.sasc.biopet.core.summary.{ Summarizable, SummaryQScript }
import nl.lumc.sasc.biopet.core.summary.{ Summarizable }
import nl.lumc.sasc.biopet.core.{ Reference, ToolCommandFunction }
import nl.lumc.sasc.biopet.tools.vcfstats.VcfStats
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.{ ConfigUtils, tryToParseNumber }
import nl.lumc.sasc.biopet.utils.{ ConfigUtils }
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import scala.io.Source
......@@ -31,7 +30,7 @@ import scala.io.Source
* Created by pjvan_thof on 1/10/15.
*/
class VcfStats(val root: Configurable) extends ToolCommandFunction with Summarizable with Reference {
def toolObject = VcfStats
def toolObject = nl.lumc.sasc.biopet.tools.vcfstats.VcfStats
mainFunction = false
......
......@@ -39,14 +39,16 @@ class Impute2Vcf(val root: Configurable) extends QScript with BiopetQScript with
val phenotypeFile: File = config("phenotype_file")
val inputGens: List[GensInput] = config("input_gens", default = Nil).asList.map {
case value: Map[String, Any] =>
GensInput(new File(value("genotypes").toString),
value.get("info").map(x => new File(x.toString)),
value("contig").toString)
case value: util.LinkedHashMap[String, _] =>
GensInput(new File(value.get("genotypes").toString),
value.toMap.get("info").map(x => new File(x.toString)),
value.get("contig").toString)
case value: Map[_, _] =>
val map = value.map(x => x._1.toString -> x._2)
GensInput(new File(map("genotypes").toString),
map.get("info").map(x => new File(x.toString)),
map("contig").toString)
case value: util.LinkedHashMap[_, _] =>
val map = value.map(x => x._1.toString -> x._2)
GensInput(new File(map("genotypes").toString),
map.get("info").map(x => new File(x.toString)),
map("contig").toString)
case _ => throw new IllegalArgumentException
} ++ (specsFile match {
case Some(file) => Impute2Vcf.imputeSpecsToGensInput(file, config("validate_specs", default = true))
......
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