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

Merge pull request #26 from biopet/fix-BIOPET-582

Fix biopet 582
parents c7340695 5bca8e5c
......@@ -42,8 +42,19 @@ class DellyCaller(val root: Configurable) extends BiopetCommandLineFunction with
var analysistype: String = _
def cmdLine = required(executable) +
"-t" + required(analysistype) +
"-o" + required(outputvcf) +
required(input)
required("-t", analysistype) +
required("-o", outputvcf) +
required(input) +
createEmptyOutputIfNeeded
// when no variants are found then the tool doesn't generate the output file either, in Biopet it's needed that the empty file would be there
private def createEmptyOutputIfNeeded =
s"""
|c=$$?
|if [ $$c -eq 0 ] && [ ! -f $outputvcf ]; then
| echo '##fileformat=VCFv4.2' > $outputvcf
| echo '#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO' >> $outputvcf
|fi
|exit $$c""".stripMargin
}
......@@ -37,6 +37,9 @@ class CatVariants(val root: Configurable) extends BiopetJavaCommandLineFunction
@Gather(classOf[org.broadinstitute.gatk.queue.function.scattergather.SimpleTextGatherFunction])
var outputFile: File = _
/** When Gatk's CatVariants has been called with empty VCF-files, then it also outputs an empty file. When this parameter is set to true, then the empty file gets added a valid VCF-file header.*/
var writeHeaderToEmptyOutput: Boolean = false
/** assumeSorted should be true if the input files are already sorted (based on the position of the variants) */
@Argument(fullName = "assumeSorted", shortName = "assumeSorted", doc = "assumeSorted should be true if the input files are already sorted (based on the position of the variants)", required = false, exclusiveOf = "", validation = "")
var assumeSorted: Boolean = _
......@@ -73,5 +76,14 @@ class CatVariants(val root: Configurable) extends BiopetJavaCommandLineFunction
optional("--variant_index_type", variant_index_type, spaceSeparated = true, escape = true, format = "%s") +
optional("--variant_index_parameter", variant_index_parameter, spaceSeparated = true, escape = true, format = "%s") +
optional("-l", logging_level, spaceSeparated = true, escape = true, format = "%s") +
optional("-log", log_to_file, spaceSeparated = true, escape = true, format = "%s")
optional("-log", log_to_file, spaceSeparated = true, escape = true, format = "%s") +
(if (writeHeaderToEmptyOutput) s"""
|c=$$?
|if [ $$c -eq 0 ] && [ ! -s $outputFile ]; then
| echo '##fileformat=VCFv4.2' > $outputFile
| echo '#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO' >> $outputFile
|fi
|exit $$c""".stripMargin
else "")
}
......@@ -36,6 +36,7 @@ class Delly(val root: Configurable) extends SvCaller {
val catVariants = new CatVariants(this)
catVariants.outputFile = new File(dellyDir, sample + ".delly.vcf")
catVariants.isIntermediate = true
catVariants.writeHeaderToEmptyOutput = true
if (del) {
val delly = new DellyCaller(this)
......
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