Commit e0e53ed2 authored by Peter van 't Hof's avatar Peter van 't Hof

Fix BIOPET-396

parent e6199e01
......@@ -53,7 +53,7 @@ class BastyTest extends TestNGSuite with Matchers {
var m: Map[String, Any] = BastyTest.config
if (sample1) m = ConfigUtils.mergeMaps(BastyTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(BastyTest.sample2, m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp" -> "test.vcf.gz"), m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp_vcf" -> "test.vcf.gz"), m)
ConfigUtils.mergeMaps(Map(
"multisample_variantcalling" -> multisampleCalling,
"single_sample_variantcalling" -> sampleCalling,
......
......@@ -54,6 +54,13 @@ trait Reference extends Configurable {
referenceConfigPath ::: super.subPath
}
lazy val geneAnnotationVersion: Option[String] = config("gene_annotation_name")
lazy val geneAnnotationSubPath = geneAnnotationVersion.map(x => List("gene_annotations", x)).getOrElse(Nil)
lazy val dbsnpVersion: Option[Int] = config("dbsnp_version")
lazy val dbsnpSubPath: List[String] = dbsnpVersion.map(x => List("dbsnp_annotations", x.toString)).getOrElse(Nil)
def dbsnpVcfFile: Option[File] = config("dbsnp_vcf", extraSubPath = dbsnpSubPath)
lazy val vepConfig: Option[String] = config("vep_config")
/** Returns the reference config path */
def referenceConfigPath = {
List("references", referenceSpecies, referenceName)
......
......@@ -14,7 +14,7 @@
*/
package nl.lumc.sasc.biopet.core.annotations
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.core.{BiopetQScript, Reference}
import nl.lumc.sasc.biopet.core.BiopetQScript.InputFile
import nl.lumc.sasc.biopet.utils.LazyCheck
import org.broadinstitute.gatk.queue.QScript
......@@ -22,38 +22,38 @@ import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvan_thof on 1/12/16.
*/
trait AnnotationGtf extends BiopetQScript { qscript: QScript =>
trait AnnotationGtf extends BiopetQScript with Reference { qscript: QScript =>
/** GTF reference file */
lazy val annotationGtf: File = {
val file: File = config("annotation_gtf", freeVar = true)
inputFiles :+ InputFile(file, config("annotation_gtf_md5", freeVar = true))
val file: File = config("annotation_gtf", freeVar = true, extraSubPath = geneAnnotationSubPath)
inputFiles :+ InputFile(file, config("annotation_gtf_md5", freeVar = true, extraSubPath = geneAnnotationSubPath))
file
}
}
trait AnnotationGff extends BiopetQScript { qscript: QScript =>
trait AnnotationGff extends BiopetQScript with Reference { qscript: QScript =>
/** GFF reference file in GFF3 format */
lazy val annotationGff: File = {
val file: File = config("annotation_gff", freeVar = true)
inputFiles :+ InputFile(file, config("annotation_gff_md5", freeVar = true))
val file: File = config("annotation_gff", freeVar = true, extraSubPath = geneAnnotationSubPath)
inputFiles :+ InputFile(file, config("annotation_gff_md5", freeVar = true, extraSubPath = geneAnnotationSubPath))
file
}
}
trait AnnotationRefFlat extends BiopetQScript { qscript: QScript =>
trait AnnotationRefFlat extends BiopetQScript with Reference { qscript: QScript =>
/** GTF reference file */
lazy val annotationRefFlat = new LazyCheck({
val file: File = config("annotation_refflat", freeVar = true)
inputFiles :+ InputFile(file, config("annotation_refflat_md5", freeVar = true))
val file: File = config("annotation_refflat", freeVar = true, extraSubPath = geneAnnotationSubPath)
inputFiles :+ InputFile(file, config("annotation_refflat_md5", freeVar = true, extraSubPath = geneAnnotationSubPath))
file
})
}
trait RibosomalRefFlat extends BiopetQScript { qscript: QScript =>
trait RibosomalRefFlat extends BiopetQScript with Reference { qscript: QScript =>
/** GTF reference file */
lazy val ribosomalRefFlat = new LazyCheck({
val file: Option[File] = config("ribosome_refflat", freeVar = true)
val file: Option[File] = config("ribosome_refflat", freeVar = true, extraSubPath = geneAnnotationSubPath)
file match {
case Some(f) => inputFiles :+ InputFile(f, config("ribosome_refflat_md5", freeVar = true))
case Some(f) => inputFiles :+ InputFile(f, config("ribosome_refflat_md5", freeVar = true, extraSubPath = geneAnnotationSubPath))
case _ =>
}
file
......
......@@ -149,7 +149,7 @@ class BaseRecalibrator(val root: Configurable) extends CommandLineGATK with Scat
@Argument(fullName = "filter_bases_not_stored", shortName = "filterNoBases", doc = "Filter out reads with no stored bases (i.e. '*' where the sequence should be), instead of failing with an error", required = false, exclusiveOf = "", validation = "")
var filter_bases_not_stored: Boolean = config("filter_bases_not_stored", default = false)
if (config.contains("dbsnp")) knownSites :+= new File(config("dbsnp").asString)
knownSites ::= dbsnpVcfFile
override def beforeGraph() {
super.beforeGraph()
......
......@@ -37,7 +37,7 @@ class CombineGVCFs(val root: Configurable) extends CommandLineGATK with ScatterG
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** One or more input gVCF files */
@Input(fullName = "variant", shortName = "V", doc = "One or more input gVCF files", required = true, exclusiveOf = "", validation = "")
......
......@@ -102,7 +102,7 @@ class GenotypeGVCFs(val root: Configurable) extends CommandLineGATK with Scatter
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** Filter out reads with CIGAR containing the N operator, instead of failing with an error */
@Argument(fullName = "filter_reads_with_N_cigar", shortName = "filterRNC", doc = "Filter out reads with CIGAR containing the N operator, instead of failing with an error", required = false, exclusiveOf = "", validation = "")
......
......@@ -42,7 +42,7 @@ class HaplotypeCaller(val root: Configurable) extends CommandLineGATK with Scatt
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** If specified, we will not trim down the active region from the full region (active + extension) to just the active interval for genotyping */
@Argument(fullName = "dontTrimActiveRegions", shortName = "dontTrimActiveRegions", doc = "If specified, we will not trim down the active region from the full region (active + extension) to just the active interval for genotyping", required = false, exclusiveOf = "", validation = "")
......
......@@ -68,7 +68,7 @@ class RealignerTargetCreator(val root: Configurable) extends CommandLineGATK wit
@Argument(fullName = "filter_bases_not_stored", shortName = "filterNoBases", doc = "Filter out reads with no stored bases (i.e. '*' where the sequence should be), instead of failing with an error", required = false, exclusiveOf = "", validation = "")
var filter_bases_not_stored: Boolean = config("", default = false)
if (config.contains("dbsnp")) known :+= new File(config("dbsnp").asString)
known ::= dbsnpVcfFile
override def beforeGraph() {
super.beforeGraph()
......
......@@ -213,7 +213,7 @@ class UnifiedGenotyper(val root: Configurable) extends CommandLineGATK with Scat
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** Comparison VCF file */
@Input(fullName = "comp", shortName = "comp", doc = "Comparison VCF file", required = false, exclusiveOf = "", validation = "")
......
......@@ -37,7 +37,7 @@ class VariantAnnotator(val root: Configurable) extends CommandLineGATK with Scat
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** Comparison VCF file */
@Input(fullName = "comp", shortName = "comp", doc = "Comparison VCF file", required = false, exclusiveOf = "", validation = "")
......
......@@ -39,7 +39,7 @@ class VariantEval(val root: Configurable) extends CommandLineGATK {
/** dbSNP file */
@Input(fullName = "dbsnp", shortName = "D", doc = "dbSNP file", required = false, exclusiveOf = "", validation = "")
var dbsnp: Option[File] = config("dbsnp")
var dbsnp: Option[File] = dbsnpVcfFile
/** Evaluations that count calls at sites of true variation (e.g., indel calls) will use this argument as their gold standard for comparison */
@Input(fullName = "goldStandard", shortName = "gold", doc = "Evaluations that count calls at sites of true variation (e.g., indel calls) will use this argument as their gold standard for comparison", required = false, exclusiveOf = "", validation = "")
......
......@@ -103,11 +103,12 @@ trait Configurable extends ImplicitConversions {
freeVar: Boolean = true,
sample: String = null,
library: String = null,
extraSubPath: List[String] = Nil,
path: List[String] = null): ConfigValue = {
val s = if (sample != null || defaultSample.isEmpty) sample else defaultSample.get
val l = if (library != null || defaultLibrary.isEmpty) library else defaultLibrary.get
val m = if (namespace != null) namespace else configNamespace
val p = if (path == null) getConfigPath(s, l, namespace) ::: subPath else path
val p = if (path == null) getConfigPath(s, l, namespace) ::: subPath ::: extraSubPath else path ::: extraSubPath
val d = {
val value = Config.getValueFromMap(internalDefaults, ConfigValueIndex(m, p, key, freeVar))
if (value.isDefined) value.get.value else default
......@@ -130,11 +131,12 @@ trait Configurable extends ImplicitConversions {
freeVar: Boolean = true,
sample: String = null,
library: String = null,
extraSubPath: List[String] = Nil,
path: List[String] = null) = {
val s = if (sample != null || defaultSample.isEmpty) sample else defaultSample.get
val l = if (library != null || defaultLibrary.isEmpty) library else defaultLibrary.get
val m = if (namespace != null) namespace else configNamespace
val p = if (path == null) getConfigPath(s, l, namespace) ::: subPath else path
val p = if (path == null) getConfigPath(s, l, namespace) ::: subPath ::: extraSubPath else path ::: extraSubPath
globalConfig.contains(m, p, key, freeVar, internalFixedValues) || Config.getValueFromMap(internalDefaults, ConfigValueIndex(m, p, key, freeVar)).isDefined
}
......
......@@ -69,7 +69,7 @@ trait ShivaTestTrait extends TestNGSuite with Matchers {
var m: Map[String, Any] = ShivaTest.config
if (sample1) m = ConfigUtils.mergeMaps(ShivaTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(ShivaTest.sample2, m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp" -> "test.vcf.gz"), m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp_vcf" -> "test.vcf.gz"), m)
ConfigUtils.mergeMaps(Map(
"multisample_variantcalling" -> multisampleCalling,
"single_sample_variantcalling" -> sampleCalling,
......
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