Skip to content
Snippets Groups Projects
Commit a161a802 authored by Sander Bollen's avatar Sander Bollen
Browse files

fix merge request issues

parent 19bbb31c
No related branches found
No related tags found
No related merge requests found
Showing
with 153 additions and 111 deletions
......@@ -8,7 +8,7 @@ package nl.lumc.sasc.biopet.extensions.gatk.broad
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{Gather, Output}
import org.broadinstitute.gatk.utils.commandline.{ Gather, Output }
class GenotypeGVCFs(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.GenotypeGVCFs with GatkGeneral {
......
......@@ -17,10 +17,10 @@ class BcftoolsView(val root: Configurable) extends Bcftools {
var output: File = _
@Argument(doc = "drop individual genotypes", required = false)
var dropGenotype: Boolean = false
var dropGenotype: Boolean = config("drop_genotype", default = false)
@Argument(doc = "header only", required = false)
var headerOnly: Boolean = false
var headerOnly: Boolean = config("header_only", false)
@Argument(doc = "Compression level", required = false)
var compressionLevel: Int = 9
......@@ -29,88 +29,88 @@ class BcftoolsView(val root: Configurable) extends Bcftools {
var outputType: String = "z"
@Argument(doc = "regions", required = false)
var regions: String = _
var regions: Option[String] = config("r")
@Argument(doc = "region file", required = false)
var regionFile: File = _
var regionFile: Option[File] = config("R")
@Argument(doc = "targets", required = false)
var targets: String = _
var targets: Option[String] = config("t")
@Argument(doc = "targets file", required = false)
var targetFile: File = _
var targetFile: Option[File] = config("T")
@Argument(doc = "trim alt alleles", required = false)
var trimAltAlleles: Boolean = false
var trimAltAlleles: Boolean = config("trim_alt_allele", default = false)
@Argument(doc = "no update", required = false)
var noUpdate: Boolean = false
var noUpdate: Boolean = config("no_update", default = false)
@Argument(doc = "samples", required = false)
var samples: List[String] = Nil
var samples: List[String] = config("s", default = Nil)
@Argument(doc = "samples file", required = false)
var sampleFile: File = _
var sampleFile: Option[File] = config("S")
@Argument(doc = "minimum allele count", required = false)
var minAC: Option[Int] = _
var minAC: Option[Int] = config("c")
@Argument(doc = "max allele count", required = false)
var maxAC: Option[Int] = _
var maxAC: Option[Int] = config("C")
@Argument(doc = "exclude (expression)", required = false)
var exclude: String = _
var exclude: Option[String] = config("e")
@Argument(doc = "apply filters", required = false)
var applyFilters: List[String] = Nil
var applyFilters: List[String] = config("F", default = Nil)
@Argument(doc = "genotype", required = false)
var genotype: String = _
var genotype: Option[String] = config("g")
@Argument(doc = "include (expression)", required = false)
var include: String = _
var include: Option[String] = config("i")
@Argument(doc = "Known (ID field is not .) only", required = false)
var known: Boolean = false
var known: Boolean = config("k", default = false)
@Argument(doc = "min alleles", required = false)
var minAlleles: Option[Int] = _
var minAlleles: Option[Int] = config("m")
@Argument(doc = "max alleles", required = false)
var maxAlleles: Option[Int] = _
var maxAlleles: Option[Int] = config("M")
@Argument(doc = "novel (ID field is .) only", required = false)
var novel: Boolean = false
var novel: Boolean = config("n", false)
@Argument(doc = "phased only", required = false)
var phased: Boolean = false
var phased: Boolean = config("p", false)
@Argument(doc = "exclude phased (only)", required = false)
var excludePhased: Boolean = false
var excludePhased: Boolean = config("P", false)
@Argument(doc = "min allele frequency", required = false)
var minAF: Option[Int] = _
var minAF: Option[Int] = config("q")
@Argument(doc = "max allele frequency", required = false)
var maxAF: Option[Int] = _
var maxAF: Option[Int] = config("Q")
@Argument(doc = "uncalled only", required = false)
var uncalled: Boolean = false
var uncalled: Boolean = config("u", default = false)
@Argument(doc = "exclude uncalled (only)", required = false)
var excludeUncalled: Boolean = false
var excludeUncalled: Boolean = config("U", default = false)
@Argument(doc = "types", required = false)
var types: String = _
var types: Option[String] = config("v")
@Argument(doc = "exclude types", required = false)
var excludeTypes: String = _
var excludeTypes: Option[String] = config("V")
@Argument(doc = "private (requires samples)", required = false)
var onlyPrivate: Boolean = false
var onlyPrivate: Boolean = config("x", default = false)
@Argument(doc = "Exclude privates", required = false)
var excludePrivate: Boolean = false
var excludePrivate: Boolean = config("X", default = false)
override def beforeGraph() = {
super.beforeGraph()
......@@ -123,21 +123,39 @@ class BcftoolsView(val root: Configurable) extends Bcftools {
}
def baseCmd = {
executable + " view " + conditional(dropGenotype, "-G") + conditional(headerOnly, "-h") +
required("-l", compressionLevel) + required("-O", outputType) +
optional("-r", regions) + optional("-R", regionFile) +
optional("-t", targets) + optional("-T", targetFile) +
conditional(trimAltAlleles, "-a") + conditional(noUpdate, "-I") +
repeat("-s", samples) + optional("-S", sampleFile) +
optional("-c", minAC) + optional("-C", maxAC) +
optional("-e", exclude) + optional("-f", applyFilters) +
optional("-g", genotype) + optional("-i", include) +
conditional(known, "-k") + optional("-m", minAlleles) +
optional("-M", maxAlleles) + conditional(novel, "-n") +
conditional(phased, "-p") + conditional(excludePhased, "-P") +
optional("-q", minAF) + optional("-Q", maxAF) +
conditional(uncalled, "-u") + conditional(excludeUncalled, "-U") +
optional("-v", types) + conditional(onlyPrivate, "-x") +
executable +
required("view") +
conditional(dropGenotype, "-G") +
conditional(headerOnly, "-h") +
required("-l", compressionLevel) +
required("-O", outputType) +
optional("-r", regions) +
optional("-R", regionFile) +
optional("-t", targets) +
optional("-T", targetFile) +
conditional(trimAltAlleles, "-a") +
conditional(noUpdate, "-I") +
repeat("-s", samples) +
optional("-S", sampleFile) +
optional("-c", minAC) +
optional("-C", maxAC) +
optional("-e", exclude) +
optional("-f", applyFilters) +
optional("-g", genotype) +
optional("-i", include) +
conditional(known, "-k") +
optional("-m", minAlleles) +
optional("-M", maxAlleles) +
conditional(novel, "-n") +
conditional(phased, "-p") +
conditional(excludePhased, "-P") +
optional("-q", minAF) +
optional("-Q", maxAF) +
conditional(uncalled, "-u") +
conditional(excludeUncalled, "-U") +
optional("-v", types) +
optional("-V", excludeTypes) +
conditional(onlyPrivate, "-x") +
conditional(excludePrivate, "-X")
}
......
......@@ -14,7 +14,7 @@ class BedtoolsMerge(val root: Configurable) extends Bedtools {
var input: File = _
@Argument(doc = "Distance")
var dist: Int = 1 //default of tool is 1
var dist: Option[Int] = config("dist") //default of tool is 1
@Output(doc = "Output bed file")
var output: File = _
......
......@@ -13,9 +13,6 @@ import org.broadinstitute.gatk.utils.commandline.{ Output, Argument }
abstract class Manwe extends BiopetCommandLineFunction {
executable = config("exe", default = "manwe", submodule = "manwe")
override def defaultCoreMemory = 2.0
override def defaultThreads = 1
var manweConfig: File = createManweConfig(None)
@Output(doc = "the output file")
......@@ -58,31 +55,28 @@ abstract class Manwe extends BiopetCommandLineFunction {
val dataBufferSize: Option[Int] = config("varda_buffer_size", default = 1024 * 1024)
val taskPollWait: Option[Int] = config("varda_task_poll_wait", default = 2)
val urlString = s"API_ROOT = '${url.toString}'"
val tokenString = s"TOKEN = '${token.toString}'"
val sslSettingString = sslSettings match {
case Some("true") => "VERIFY_CERTIFICATE = True"
case Some("false") => "VERIFY_CERTIFICATE = False"
case Some(x) => s"VERIFY_CERTIFICATE = '$x'"
case _ => "VERIFY_CERTIFICATE = True"
}
val settingsMap: Map[String, Any] = Map(
"API_ROOT" -> s"'$url'",
"TOKEN" -> s"'$token'",
"VERIFY_CERTIFICATE" -> (sslSettings match {
case Some("true") => "True"
case Some("false") => "False"
case Some(x) => s"'$x'"
case _ => "True"
}),
"COLLECTION_CACHE_SIZE" -> collectionCacheSize.getOrElse(20),
"DATA_BUFFER_SIZE" -> dataBufferSize.getOrElse(1048576),
"TASK_POLL_WAIT" -> taskPollWait.getOrElse(2)
)
val collectionString = s"COLLECTION_CACHE_SIZE = ${collectionCacheSize.getOrElse(20)}"
val dataString = s"DATA_BUFFER_SIZE = ${dataBufferSize.getOrElse(1048576)}"
val taskString = s"TASK_POLL_WAIT = ${taskPollWait.getOrElse(2)}"
val file = directory match {
case Some(dir) => File.createTempFile("manwe_config", ".py", dir)
case None => File.createTempFile("manwe_config", ".py")
}
file.deleteOnExit()
val writer = new PrintWriter(file)
writer.println(urlString)
writer.println(tokenString)
writer.println(sslSettingString)
writer.println(collectionString)
writer.println(dataString)
writer.println(taskString)
settingsMap.foreach { case (key, value) => writer.println(s"$key = $value") }
writer.close()
file
}
......
......@@ -25,7 +25,8 @@ class ManweAnnotateBed(val root: Configurable) extends Manwe {
def subCommand = {
required("annotate-bed") + required(bed) +
conditional(alreadyUploaded, "-u") +
repeat("-q", queries) + conditional(waitToComplete, "--wait")
repeat("-q", queries) +
conditional(waitToComplete, "--wait")
}
}
......@@ -25,7 +25,8 @@ class ManweAnnotateVcf(val root: Configurable) extends Manwe {
def subCommand = {
required("annotate-vcf") + required(vcf) +
conditional(alreadyUploaded, "-u") +
repeat("-q", queries) + conditional(waitToComplete, "--wait")
repeat("-q", queries) +
conditional(waitToComplete, "--wait")
}
}
......@@ -19,7 +19,8 @@ class ManweDataSourcesAnnotate(val root: Configurable) extends Manwe {
def subCommand = {
required("data-sources") + required("annotate") +
required(uri) + repeat("-q", queries) +
required(uri) +
repeat("-q", queries) +
conditional(waitToComplete, "--wait")
}
......
......@@ -12,9 +12,8 @@ class ManweDataSourcesDownload(val root: Configurable) extends Manwe {
var uri: String = _
def subCommand = {
required("data-sources") + required("download") + required(uri)
required("data-sources") +
required("download") +
required(uri)
}
this.deps
}
......@@ -14,7 +14,8 @@ class ManweDataSourcesList(val root: Configurable) extends Manwe {
var user: Option[String] = _
def subCommand = {
required("data-sources") + required("list") +
required("data-sources") +
required("list") +
optional("-u", user)
}
......
......@@ -14,7 +14,8 @@ class ManweDataSourcesShow(val root: Configurable) extends Manwe {
var uri: Option[String] = _
def subCommand = {
required("data-sources") + required("show") +
required("data-sources") +
required("show") +
required(uri)
}
......
......@@ -14,7 +14,8 @@ class ManweSamplesActivate(val root: Configurable) extends Manwe {
var uri: String = _
def subCommand = {
required("samples") + required("activate") +
required("samples") +
required("activate") +
required(uri)
}
......
......@@ -20,8 +20,11 @@ class ManweSamplesAdd(val root: Configurable) extends Manwe {
var poolSize: Option[Int] = _
def subCommand = {
required("samples") + required("add") + required(name) +
optional("-s", poolSize) + repeat("-g", group)
required("samples") +
required("add") +
required(name) +
optional("-s", poolSize) +
repeat("-g", group)
}
}
......@@ -17,8 +17,10 @@ class ManweSamplesAnnotateVariations(val root: Configurable) extends Manwe {
var queries: List[String] = Nil
def subCommand = {
required("samples") + required("annotate-variations") +
required(uri) + repeat("-q", queries)
required("samples") +
required("annotate-variations") +
required(uri) +
repeat("-q", queries)
}
}
......@@ -45,10 +45,16 @@ class ManweSamplesImport(val root: Configurable) extends Manwe {
var waitToComplete: Boolean = false
def subCommand = {
required("samples") + required("import") + required(name) +
repeat("-g", group) + repeat("--vcf", vcfs) + repeat("--bed", beds) +
optional("-s", poolSize) + conditional(alreadyUploaded, "-u") +
conditional(public, "-p") + conditional(preferLikelihood, "-l") +
required("samples") +
required("import") +
required(name) +
repeat("-g", group) +
repeat("--vcf", vcfs) +
repeat("--bed", beds) +
optional("-s", poolSize) +
conditional(alreadyUploaded, "-u") +
conditional(public, "-p") +
conditional(preferLikelihood, "-l") +
conditional(noCoverage, "--no-coverage-profile") +
conditional(waitToComplete, "--wait")
}
......
......@@ -27,9 +27,12 @@ class ManweSamplesImportBed(val root: Configurable) extends Manwe {
var waitToComplete: Boolean = false
def subCommand = {
required("samples") + required("import-bed") +
required(uri) + required(bed) +
conditional(alreadyUploaded, "-u") + conditional(waitToComplete, "--wait")
required("samples") +
required("import-bed") +
required(uri) +
required(bed) +
conditional(alreadyUploaded, "-u") +
conditional(waitToComplete, "--wait")
}
}
......@@ -30,9 +30,11 @@ class ManweSamplesImportVcf(val root: Configurable) extends Manwe {
var waitToComplete: Boolean = false
def subCommand = {
required("samples") + required("import-vcf") +
required("samples") +
required("import-vcf") +
required(uri) + required(vcf) +
conditional(alreadyUploaded, "-u") + conditional(preferLikelihoods, "-l") +
conditional(alreadyUploaded, "-u") +
conditional(preferLikelihoods, "-l") +
conditional(waitToComplete, "--wait")
}
......
......@@ -19,8 +19,11 @@ class ManweSamplesList(val root: Configurable) extends Manwe {
var onlyPublic: Boolean = false
def subCommand = {
required("samples") + required("list") + optional("-u", user) +
repeat("-g", group) + conditional(onlyPublic, "-p")
required("samples") +
required("list") +
optional("-u", user) +
repeat("-g", group) +
conditional(onlyPublic, "-p")
}
}
......@@ -14,7 +14,9 @@ class ManweSamplesShow(val root: Configurable) extends Manwe {
var uri: Option[String] = _
def subCommand = {
required("samples") + required("show") + required(uri)
required("samples") +
required("show") +
required(uri)
}
}
......@@ -334,14 +334,17 @@ class ManweTest extends TestNGSuite with Matchers {
}
val file: File = manwe.createManweConfig(None)
val contents = Source.fromFile(file).getLines().mkString("\n")
val contents = Source.fromFile(file).getLines().toList
contents should equal("""API_ROOT = 'http://127.0.0.1:5000'
|TOKEN = 'QWERTYUIOPASDFGHJKLZXCVBNM'
|VERIFY_CERTIFICATE = True
|COLLECTION_CACHE_SIZE = 25
|DATA_BUFFER_SIZE = 200
|TASK_POLL_WAIT = 5""".stripMargin)
val supposedContent = List("API_ROOT = 'http://127.0.0.1:5000'",
"TOKEN = 'QWERTYUIOPASDFGHJKLZXCVBNM'",
"VERIFY_CERTIFICATE = True",
"COLLECTION_CACHE_SIZE = 25",
"DATA_BUFFER_SIZE = 200",
"TASK_POLL_WAIT = 5"
)
supposedContent.sorted should equal(contents.sorted)
val manwe2 = new ManweAnnotateBed(null) {
override def globalConfig = new Config(Map(
......@@ -354,15 +357,16 @@ class ManweTest extends TestNGSuite with Matchers {
}
val file2: File = manwe2.createManweConfig(None)
val contents2 = Source.fromFile(file2).getLines().mkString("\n")
contents2 should equal("""API_ROOT = 'http://127.0.0.1:5000'
|TOKEN = 'QWERTYUIOPASDFGHJKLZXCVBNM'
|VERIFY_CERTIFICATE = '/a/b/c/d.crt'
|COLLECTION_CACHE_SIZE = 25
|DATA_BUFFER_SIZE = 200
|TASK_POLL_WAIT = 5""".stripMargin)
val contents2 = Source.fromFile(file2).getLines().toList
val supposedContent2 = List("API_ROOT = 'http://127.0.0.1:5000'",
"TOKEN = 'QWERTYUIOPASDFGHJKLZXCVBNM'",
"VERIFY_CERTIFICATE = '/a/b/c/d.crt'",
"COLLECTION_CACHE_SIZE = 25",
"DATA_BUFFER_SIZE = 200",
"TASK_POLL_WAIT = 5"
)
supposedContent2.sorted should equal(contents2.sorted)
}
}
......@@ -186,7 +186,7 @@ class Toucan(val root: Configurable) extends QScript with BiopetQScript with Sum
*/
def varda(vcf: File, gVcf: File): File = {
val annotationQueries: List[String] = config("annotation_queries", default = Nil, submodule = "manwe")
val annotationQueries: List[String] = config("annotation_queries", default = List("GLOBAL *"), submodule = "manwe")
//TODO: add groups!!! Need sample-specific group tags for this
val annotate = new ManweAnnotateVcf(this)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment