Commit 355126e2 authored by Peter van 't Hof's avatar Peter van 't Hof Committed by GitHub

Merge branch 'develop' into fix-BIOPET-618

parents 0f9eb9ec 492b52f0
......@@ -54,7 +54,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
writer.println("set -eubf")
writer.println("set -o pipefail")
lines.foreach(writer.println)
writer.println(this.commandLine)
jobDelayTime.foreach(x => writer.println(s"sleep $x"))
writer.close()
}
......@@ -99,6 +99,8 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
beforeGraph()
internalBeforeGraph()
this.commandDirectory = this.jobOutputFile.getParentFile
super.freezeFieldValues()
}
......
......@@ -38,17 +38,16 @@ class CleverCaller(val parent: Configurable) extends BiopetCommandLineFunction w
@Input(doc = "Reference")
var reference: File = _
protected def cleverOutputDir: File = new File(cleverWorkDir, "work")
var cleverWorkDir: File = _
@Output(doc = "Clever VCF output")
lazy val outputvcf: File = {
new File(cleverOutputDir, "predictions.vcf")
new File(cleverWorkDir, "predictions.vcf")
}
@Output(doc = "Clever raw output")
lazy val outputraw: File = {
new File(cleverOutputDir, "predictions.raw.txt")
new File(cleverWorkDir, "predictions.raw.txt")
}
// var T: Option[Int] = config("T", default = defaultThreads)
......@@ -60,13 +59,13 @@ class CleverCaller(val parent: Configurable) extends BiopetCommandLineFunction w
override def beforeGraph() {
super.beforeGraph()
if (cleverOutputDir == null) throw new Exception("Clever :: Workdirectory is not defined")
if (cleverWorkDir == null) throw new Exception("Clever :: Workdirectory is not defined")
if (reference == null) reference = referenceFasta()
}
def cmdLine = required(executable) +
" --sorted " +
" --use_xa " +
required("--sorted") +
required("--use_xa") +
optional("-T", threads) +
conditional(f, "-f") +
conditional(a, "-a") +
......@@ -74,7 +73,7 @@ class CleverCaller(val parent: Configurable) extends BiopetCommandLineFunction w
conditional(r, "-r") +
required(input) +
required(reference) +
required(cleverOutputDir)
required(cleverWorkDir)
}
object CleverCaller {
......
......@@ -70,9 +70,9 @@ In the `tags` key inside a sample or library users can supply tags that belong t
The settings config enables a user to alter the settings for almost all settings available in the tools used for a given pipeline.
This config file should be written in either JSON or YAML format. It can contain setup settings like:
* references,
* cut offs,
* program modes and memory limits (program specific),
* references
* cut offs
* program modes and memory limits (program specific)
* Whether chunking should be used
* set program executables (if for some reason the user does not want to use the systems default tools)
* One could set global variables containing settings for all tools used in the pipeline or set tool specific options one layer
......@@ -128,9 +128,13 @@ It is also possible to set the `"species"` flag. Again, we will default to `unkn
# More advanced use of config files.
### 4 levels of configuring settings
In biopet, a value of a ConfigNamespace (e.g., "reference_fasta") for a tool or a pipeline can be defined in 4 different levels.
* Level-4: As a fixed value hardcoded in biopet source code
* Level-3: As a user specified value in the user config file
* Level-2: As a system specified value in the global config files. On the LUMC's SHARK cluster, these global config files are located at /usr/local/sasc/config.
* Level-1: As a default value provided in biopet source code.
During execution, biopet framework will resolve the value for each ConfigNamespace following the order from level-4 to level-1. Hence, a value defined in the a higher level will overwrite a value define in a lower level for the same ConfigNamespace.
......@@ -172,4 +176,4 @@ biopet template Gentrap -o gentrap_config.yml -s gentrap_run.sh
| -o | --outputConfig | Path (**required**) | Name of the config file that gets generated.|
| -s | --outputScript | Path (optional) | Biopet can also output a script that can be directly used for running the pipeline, the call of the pipeline is generated with the config file as input. This parameter sets the name for the script file.|
| -t | --template | Path (optional) | A template file with 2 placeholders *%s* is required for generating the script. The first placeholder will be replaced with the name of the pipeline, the second with the paths to the sample and settings config files. When Biopet has been pre-configured to use the default template file, then setting this parameter is optional. |
| | --expert | | This flag enables the user to configure a more extensive list of parameters for the pipeline. |
\ No newline at end of file
| | --expert | | This flag enables the user to configure a more extensive list of parameters for the pipeline. |
......@@ -49,7 +49,7 @@ All other values should be provided in the config. Specific config values toward
| ---- | ---- | -------- |
| output_dir | Path (**required**) | directory for output files |
| reference_fasta | Path (**required**) | Path to indexed fasta file to be used as reference |
| aligner | String (optional) | Which aligner to use. Defaults to `bwa`. Choose from [`bwa`, `bwa-aln`, `bowtie`, `gsnap`, `tophat`, `stampy`, `star`, `star-2pass`, `hisat2`] |
| aligner | String (optional) | Which aligner to use. Defaults to `bwa`. Choose from [`bwa-mem`, `bwa-aln`, `bowtie`, `bowtie2`, `gsnap`, `tophat`, `stampy`, `star`, `star-2pass`, `hisat2`] |
| skip_flexiprep | Boolean (optional) | Whether to skip the flexiprep QC step (default = False) |
| skip_markduplicates | Boolean (optional) | Whether to skip the Picard Markduplicates step (default = False) |
| skip_metrics | Boolean (optional) | Whether to skip the metrics gathering step (default = False) |
......
This diff is collapsed.
# Introduction
# Invocation
# Example
Note that one should first create the appropriate [configs](../general/config.md).
# Testcase A
# Testcase B
# Examine results
## Result files
## Best practice
# References
......@@ -23,10 +23,10 @@ class Clever(val parent: Configurable) extends SvCaller {
def name = "clever"
def biopetScript() {
//TODO: check double directories
for ((sample, bamFile) <- inputBams) {
val cleverDir = new File(outputDir, sample)
val clever = CleverCaller(this, bamFile, cleverDir)
val clever = CleverCaller(this, bamFile, new File(cleverDir, "clever_output"))
clever.jobOutputFile = new File(cleverDir, ".CleverCaller.out")
add(clever)
val cleverVCF = new CleverFixVCF(this)
......
......@@ -25,15 +25,12 @@ import scala.io.Source
* Created by ahbbollen on 9-10-15.
* Wrapper for manwe activate after importing and annotating
*/
class ManweActivateAfterAnnotImport(root: Configurable,
annotate: ManweAnnotateVcf,
imported: ManweSamplesImport) extends ManweSamplesActivate(root) {
class ManweActivateAfterImport(root: Configurable,
imported: ManweSamplesImport) extends ManweSamplesActivate(root) {
override def beforeGraph: Unit = {
super.beforeGraph
require(annotate != null, "Annotate should be defined")
require(imported != null, "Imported should be defined")
this.deps :+= annotate.jobOutputFile
this.deps :+= imported.jobOutputFile
}
......
......@@ -170,11 +170,11 @@ class Toucan(val parent: Configurable) extends QScript with BiopetQScript with S
* @param sampleID the sampleID to be used
* @param inputVcf the input VCF
* @param gVCF the gVCF for coverage
* @param annotation: ManweDownloadAnnotateVcf object of annotated vcf
* @param annotation: Optional ManweDownloadAnnotateVcf object of annotated vcf
* @return
*/
def importAndActivateSample(sampleID: String, sampleGroups: List[String], inputVcf: File,
gVCF: File, annotation: ManweAnnotateVcf): ManweActivateAfterAnnotImport = {
gVCF: File, annotation: Option[ManweAnnotateVcf]): ManweActivateAfterImport = {
val minGQ: Int = config("minimum_genome_quality", default = 20, namespace = "manwe")
val isPublic: Boolean = config("varda_is_public", default = true, namespace = "manwe")
......@@ -228,7 +228,8 @@ class Toucan(val parent: Configurable) extends QScript with BiopetQScript with S
imported.output = swapExt(outputDir, intersected.output, ".vcf.gz", ".manwe.import")
add(imported)
val active = new ManweActivateAfterAnnotImport(this, annotation, imported)
val active = new ManweActivateAfterImport(this, imported)
annotation.foreach(a => active.deps :+= a.jobOutputFile)
active.output = swapExt(outputDir, imported.output, ".import", ".activated")
add(active)
active
......@@ -236,7 +237,7 @@ class Toucan(val parent: Configurable) extends QScript with BiopetQScript with S
}
/**
* Perform varda analysis
* Import to and optionally annotate with varda
*
* @param vcf input vcf
* @param gVcf The gVCF to be used for coverage calculations
......@@ -245,22 +246,9 @@ class Toucan(val parent: Configurable) extends QScript with BiopetQScript with S
def varda(vcf: File, gVcf: File): File = {
val annotationQueries: List[String] = config("annotation_queries", default = List("GLOBAL *"), namespace = "manwe")
val doAnnotate: Boolean = config("annotate", namespace = "varda", default = true)
val annotate = new ManweAnnotateVcf(this)
annotate.vcf = vcf
if (annotationQueries.nonEmpty) {
annotate.queries = annotationQueries
}
annotate.waitToComplete = true
annotate.output = swapExt(outputDir, vcf, ".vcf.gz", ".manwe.annot")
annotate.isIntermediate = true
add(annotate)
val annotatedVcf = new ManweDownloadAfterAnnotate(this, annotate)
annotatedVcf.output = swapExt(outputDir, annotate.output, ".manwe.annot", "manwe.annot.vcf.gz")
add(annotatedVcf)
val activates = sampleInfo map { x =>
val sampleGroups = sampleInfo map { x =>
val maybeSampleGroup = x._2.get("varda_group") match {
case None => Some(Nil)
case Some(vals) => vals match {
......@@ -271,17 +259,42 @@ class Toucan(val parent: Configurable) extends QScript with BiopetQScript with S
}
val sampleGroup = maybeSampleGroup
.getOrElse(throw new IllegalArgumentException("Sample tag 'varda_group' is not a list of strings"))
importAndActivateSample(x._1, sampleGroup, vcf, gVcf, annotate)
x._1 -> sampleGroup
}
val finalLn = new Ln(this)
activates.foreach(x => finalLn.deps :+= x.output)
finalLn.input = annotatedVcf.output
finalLn.output = swapExt(outputDir, annotatedVcf.output, "manwe.annot.vcf.gz", ".varda_annotated.vcf.gz")
finalLn.relative = true
add(finalLn)
if (doAnnotate) {
val annotate = new ManweAnnotateVcf(this)
annotate.vcf = vcf
if (annotationQueries.nonEmpty) {
annotate.queries = annotationQueries
}
annotate.waitToComplete = true
annotate.output = swapExt(outputDir, vcf, ".vcf.gz", ".manwe.annot")
annotate.isIntermediate = true
add(annotate)
val annotatedVcf = new ManweDownloadAfterAnnotate(this, annotate)
annotatedVcf.output = swapExt(outputDir, annotate.output, ".manwe.annot", "manwe.annot.vcf.gz")
add(annotatedVcf)
finalLn.output
val activates = sampleGroups map { x =>
importAndActivateSample(x._1, x._2, vcf, gVcf, Some(annotate))
}
val finalLn = new Ln(this)
activates.foreach(x => finalLn.deps :+= x.output)
finalLn.input = annotatedVcf.output
finalLn.output = swapExt(outputDir, annotatedVcf.output, "manwe.annot.vcf.gz", ".varda_annotated.vcf.gz")
finalLn.relative = true
add(finalLn)
finalLn.output
} else {
sampleGroups.foreach { x =>
importAndActivateSample(x._1, x._2, vcf, gVcf, None)
}
vcf
}
}
def summaryFiles = Map("input_vcf" -> inputVcf, "outputVcf" -> outputVcf)
......
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