diff --git a/bwa.wdl b/bwa.wdl index 0a8b37fa8ad3fec1d7d3400f6e9b4b5d342dba0a..5839a9c0c968891cdc523a361deee796fcebe30f 100644 --- a/bwa.wdl +++ b/bwa.wdl @@ -3,6 +3,7 @@ task BwaMem { File inputR1 File? inputR2 String referenceFasta + Array[File] indexFiles # These indexFiles need to be added, otherwise cromwell will not find them. String outputPath String? readgroup @@ -26,3 +27,36 @@ task BwaMem { memory: if defined(memory) then memory else 8 } } + +task index { + File fasta + String? preCommand + String? constructionAlgorithm + Int? blockSize + String? outputDir + String fastaFilename = basename(fasta) + + command { + set -e -o pipefail + ${"mkdir -p " + outputDir} + ${preCommand} + ln -sf ${fasta} ${outputDir + "/"}${fastaFilename} + bwa index \ + ${"-a " + constructionAlgorithm} \ + ${"-b" + blockSize} \ + ${outputDir + "/"}${fastaFilename} + } + + output { + File indexBase = if (defined(outputDir)) then select_first([outputDir]) + "/" + fastaFilename else fastaFilename + File indexedFasta = indexBase + Array[File] indexFiles = [indexBase + ".bwt",indexBase + ".pac",indexBase + ".sa",indexBase + ".amb",indexBase + ".ann"] + } + parameter_meta { + fasta: "Fasta file to be indexed" + constructionAlgorithm: "-a STR BWT construction algorithm: bwtsw, is or rb2 [auto]" + blockSize: "-b INT block size for the bwtsw algorithm (effective with -a bwtsw) [10000000]" + outputDir: "index will be created in this output directory" + } +} + diff --git a/samtools.wdl b/samtools.wdl index f425d2e6d7806bc60c5e89d28fb0eaff3db5bce8..c9207d3e89df3b598c55e1268bdb81afb3cc2b21 100644 --- a/samtools.wdl +++ b/samtools.wdl @@ -97,6 +97,11 @@ task fastq { ${"--threads " + totalThreads} \ } + output { + File read1 = outputRead1 + File? read2 = outputRead2 + File? read0 = outputRead0 + } runtime { cpu: totalThreads memory: select_first([memory, 1])