Newer
Older
then "java -Xmx" + picardMemory + "G -jar " + picardJar
else "picard -Xmx" + picardMemory + "G"
# Post alt script from bwa
String altCommand = if (defined(bwaIndex.altIndex)) then "| bwa-postalt " + bwaIndex.altIndex else ""
# setNmMdAndUqTags is only required if alt sequences are added
String setNmMdAndUqTagsCommand = picardPrefix + " SetNmMdAndUqTags " +
" INPUT=/dev/stdin OUTPUT=" + outputPath +
" CREATE_INDEX=true" +
" R=" + bwaIndex.fastaFile
String sortSamCommand = picardPrefix + " SortSam " +
if(defined(bwaIndex.altIndex)) then " OUTPUT=/dev/stdout "
else " OUTPUT=" + outputPath + " CREATE_INDEX=true "
String picardCommand = if (defined(bwaIndex.altIndex)) then sortSamCommand + " | " + setNmMdAndUqTagsCommand
else sortSamCommand
String readgroupArg = if (defined(readgroup)) then "-R '" + readgroup + "'" else ""
mkdir -p $(dirname ~{outputPath})
~{preCommand}
bwa mem ~{"-t " + threads} \
IndexedBamFile bamFile = object {
file: outputPath,
index: sub(outputPath, ".bam$", ".bai")
input {
File fasta
String? preCommand
String? constructionAlgorithm
Int? blockSize
String? outputDir
}
String fastaFilename = basename(fasta)
String outputFile = if (defined(outputDir)) then outputDir + "/" + fastaFilename else fasta
~{"mkdir -p " + outputDir}
~{preCommand}
if [[ ! '~{outputDir}' = '' ]]
~{"-a " + constructionAlgorithm} \
~{"-b" + blockSize} \
~{outputFile}
BwaIndex outputIndex = object {
fastaFile: outputFile,
indexFiles: [outputFile + ".bwt",outputFile + ".pac",outputFile + ".sa",outputFile + ".amb",outputFile + ".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"
}
}
struct BwaIndex {
File fastaFile
Array[File] indexFiles