Commit fa2c04f0 authored by Pappas's avatar Pappas
Browse files

Merge branch 'fix-BIOPET-685' of github.com:biopet/biopet into fix-BIOPET-685

parents 812a1440 ea6c3213
......@@ -39,7 +39,7 @@ class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction
override def defaultCoreMemory = 9.0
def cmdLine =
def cmdLine: String =
getPythonCommand +
(if (inputAsStdin) " - " else required(input)) +
required("--plot", plot) +
......
......@@ -35,11 +35,13 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
*/
def setPythonScript(script: String) {
pythonScript = new File(script).getAbsoluteFile
if (!PythonCommandLineFunction.alreadyCopied.contains(script)) {
if (!PythonCommandLineFunction.alreadyCopied.contains((this.getClass, script))) {
setPythonScript(script, "")
PythonCommandLineFunction.alreadyCopied += script
this.getClass
PythonCommandLineFunction.alreadyCopied += (this.getClass, script) -> pythonScript
} else {
pythonScriptName = script
pythonScript = PythonCommandLineFunction.alreadyCopied((this.getClass, script))
}
}
......@@ -71,5 +73,5 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
}
object PythonCommandLineFunction {
private val alreadyCopied: mutable.Set[String] = mutable.Set()
private val alreadyCopied: mutable.Map[(Class[_], String), File] = mutable.Map()
}
......@@ -16,14 +16,12 @@ package nl.lumc.sasc.biopet.extensions.tools
import java.io.File
import nl.lumc.sasc.biopet.core.summary.{Summarizable}
import nl.lumc.sasc.biopet.core.summary.Summarizable
import nl.lumc.sasc.biopet.core.{Reference, ToolCommandFunction}
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.{ConfigUtils}
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.utils.commandline.{Input, Output}
import scala.io.Source
/**
* This tool will generate statistics from a vcf file
*
......@@ -41,10 +39,10 @@ class VcfStats(val parent: Configurable)
var input: File = _
@Input
protected var index: File = null
protected var index: File = _
@Output
protected var statsFile: File = null
protected var statsFile: File = _
override def defaultCoreMemory = 3.0
override def defaultThreads = 3
......@@ -59,6 +57,8 @@ class VcfStats(val parent: Configurable)
var intervals: Option[File] = None
override def beforeGraph(): Unit = {
super.beforeGraph()
if (intervals.isEmpty) intervals = config("intervals")
reference = referenceFasta()
index = new File(input.getAbsolutePath + ".tbi")
}
......@@ -71,7 +71,7 @@ class VcfStats(val parent: Configurable)
}
/** Creates command to execute extension */
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
required("-I", input) +
required("-o", outputDir) +
......
......@@ -78,7 +78,7 @@ class MarkDuplicates(val parent: Configurable) extends Picard with Summarizable
}
/** Returns command to execute */
override def cmdLine =
override def cmdLine: String =
super.cmdLine +
repeat("INPUT=", input, spaceSeparated = false) +
required("OUTPUT=", output, spaceSeparated = false) +
......@@ -108,7 +108,7 @@ class MarkDuplicates(val parent: Configurable) extends Picard with Summarizable
def summaryFiles: Map[String, File] = Map()
/** Returns stats for summary */
def summaryStats = Picard.getMetrics(outputMetrics).getOrElse(Map())
def summaryStats: Any = Picard.getMetrics(outputMetrics).getOrElse(Map())
}
object MarkDuplicates {
......
......@@ -204,6 +204,7 @@ class Mapping(val parent: Configurable)
require(inputR1 != null, "Missing inputR1 on mapping module")
require(sampleId.isDefined, "Missing sample ID on mapping module")
require(libId.isDefined, "Missing library ID on mapping module")
if (readgroupLibrary.isEmpty) readgroupLibrary = libId
if (inputR1.exists() && inputR1.length() == 0)
logger.warn(s"Input R1 is a empty file: $inputR1")
inputR2.foreach(r =>
......
......@@ -49,11 +49,6 @@ class HaplotypeCallerGvcf(val parent: Configurable) extends Variantcaller {
override def fixedValues = Map("haplotypecaller" -> Map("emitRefConfidence" -> "GVCF"))
override def defaults =
Map(
"haplotypecaller" -> Map("variant_index_type" -> "LINEAR",
"variant_index_parameter" -> 128000))
override def init(): Unit = {
super.init()
if (genderAwareCalling && haploidRegions.isEmpty && haploidRegionsMale.isEmpty && haploidRegionsFemale.isEmpty)
......@@ -85,7 +80,7 @@ class HaplotypeCallerGvcf(val parent: Configurable) extends Variantcaller {
val haploidGvcf = if (haploidBedFiles.nonEmpty) {
val hc = gatk.HaplotypeCaller(this,
List(inputBam),
new File(outputDir, sample + ".haploid.gvcf.vcf.gz"))
new File(outputDir, sample + ".haploid.g.vcf.gz"))
hc.BQSR = inputBqsrFiles.get(sample)
hc.intervals = haploidBedFiles
hc.scatterCount = (hc.scatterCount * fraction).toInt
......@@ -97,7 +92,7 @@ class HaplotypeCallerGvcf(val parent: Configurable) extends Variantcaller {
val hcDiploid = gatk.HaplotypeCaller(this,
List(inputBam),
new File(outputDir, sample + ".diploid.gvcf.vcf.gz"))
new File(outputDir, sample + ".diploid.g.vcf.gz"))
hcDiploid.BQSR = inputBqsrFiles.get(sample)
hcDiploid.excludeIntervals = haploidBedFiles
hcDiploid.scatterCount = (hcDiploid.scatterCount * (1 - fraction)).toInt
......@@ -108,14 +103,14 @@ class HaplotypeCallerGvcf(val parent: Configurable) extends Variantcaller {
case Some(file) =>
val combine = new gatk.CombineGVCFs(this)
combine.variant = Seq(hcDiploid.out, file)
combine.out = new File(outputDir, sample + ".gvcf.vcf.gz")
combine.out = new File(outputDir, sample + ".g.vcf.gz")
add(combine)
sample -> combine.out
case _ => sample -> hcDiploid.out
}
} else {
val hc =
gatk.HaplotypeCaller(this, List(inputBam), new File(outputDir, sample + ".gvcf.vcf.gz"))
gatk.HaplotypeCaller(this, List(inputBam), new File(outputDir, sample + ".g.vcf.gz"))
hc.BQSR = inputBqsrFiles.get(sample)
add(hc)
genotypeGvcfs.inputGvcfs :+= hc.out
......
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