Commit 12da2fa8 authored by akaljuvee's avatar akaljuvee
Browse files

gatk.tools.CatVariants outputs an empty file when input files don't contain...

gatk.tools.CatVariants outputs an empty file when input files don't contain anything, added a script that writes 2 VCF-file header lines to that empty output file
parent 1b34e7ea
......@@ -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 "")
}
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