Skip to content
Snippets Groups Projects
Commit c078fe7c authored by Cats's avatar Cats
Browse files

Merge branch 'master' into BIOWDL-25

parents d4c5ec42 306d5ec0
No related branches found
No related tags found
1 merge request!15Biowdl 25
# PLEASE ADD TASKS IN ALPHABETIC ORDER.
# This makes searching a lot easier.
task BaseCounter {
String? preCommand
String tool_jar #Should this be of type File?
File bam
File refFlat
String outputDir
String prefix
Float? memory
Float? memoryMultiplier
Int mem = ceil(select_first([memory, 12.0]))
command {
set -e -o pipefail
${preCommand}
mkdir -p ${outputDir}
java -Xmx${mem}G -jar ${tool_jar} \
-b ${bam} \
-r ${refFlat} \
-o ${outputDir} \
-p ${prefix}
}
output {
File exonAntisense = outputDir + "/" + prefix + ".base.exon.antisense.counts"
File exon = outputDir + "/" + prefix + ".base.exon.counts"
File exonMergeAntisense = outputDir + "/" + prefix + ".base.exon.merge.antisense.counts"
File exonMerge = outputDir + "/" + prefix + ".base.exon.merge.counts"
File exonMergeSense = outputDir + "/" + prefix + ".base.exon.merge.sense.counts"
File exonSense = outputDir + "/" + prefix + ".base.exon.sense.counts"
File geneAntisense = outputDir + "/" + prefix + ".base.gene.antisense.counts"
File gene = outputDir + "/" + prefix + ".base.gene.counts"
File geneExonicAntisense = outputDir + "/" + prefix + ".base.gene.exonic.antisense.counts"
File geneExonic = outputDir + "/" + prefix + ".base.gene.exonic.counts"
File geneExonicSense = outputDir + "/" + prefix + ".base.gene.exonic.sense.counts"
File geneIntronicAntisense = outputDir + "/" + prefix + ".base.gene.intronic.antisense.counts"
File geneIntronic = outputDir + "/" + prefix + ".base.gene.intronic.counts"
File geneIntronicSense = outputDir + "/" + prefix + ".base.gene.intronic.sense.counts"
File geneSense = outputDir + "/" + prefix + ".base.gene.sense.counts"
File intronAntisense = outputDir + "/" + prefix + ".base.intron.antisense.counts"
File intron = outputDir + "/" + prefix + ".base.intron.counts"
File intronMergeAntisense = outputDir + "/" + prefix + ".base.intron.merge.antisense.counts"
File intronMerge = outputDir + "/" + prefix + ".base.intron.merge.counts"
File intronMergeSense = outputDir + "/" + prefix + ".base.intron.merge.sense.counts"
File intronSense = outputDir + "/" + prefix + ".base.intron.sense.counts"
File metaExonsNonStranded = outputDir + "/" + prefix + ".base.metaexons.non_stranded.counts"
File metaExonsStrandedAntisense = outputDir + "/" + prefix + ".base.metaexons.stranded.antisense.counts"
File metaExonsStranded = outputDir + "/" + prefix + ".base.metaexons.stranded.counts"
File metaExonsStrandedSense = outputDir + "/" + prefix + ".base.metaexons.stranded.sense.counts"
File transcriptAntisense = outputDir + "/" + prefix + ".base.transcript.antisense.counts"
File transcript = outputDir + "/" + prefix + ".base.transcript.counts"
File transcriptExonicAntisense = outputDir + "/" + prefix + ".base.transcript.exonic.antisense.counts"
File transcriptExonic = outputDir + "/" + prefix + ".base.transcript.exonic.counts"
File transcriptExonicSense = outputDir + "/" + prefix + ".base.transcript.exonic.sense.counts"
File transcriptIntronicAntisense = outputDir + "/" + prefix + ".base.transcript.intronic.antisense.counts"
File transcriptIntronic = outputDir + "/" + prefix + ".base.transcript.intronic.counts"
File transcriptIntronicSense = outputDir + "/" + prefix + ".base.transcript.intronic.sense.counts"
File transcriptSense = outputDir + "/" + prefix + ".base.transcript.sense.counts"
}
runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5]))
}
}
task FastqSplitter { task FastqSplitter {
String? preCommand String? preCommand
File inputFastq File inputFastq
...@@ -23,36 +90,30 @@ task FastqSplitter { ...@@ -23,36 +90,30 @@ task FastqSplitter {
} }
} }
task ScatterRegions { task FastqSync {
String? preCommand String? preCommand
File ref_fasta File ref1
File ref_dict File ref2
String outputDirPath File in1
String tool_jar File in2
Int? scatterSize String out1path
File? regions String out2path
File tool_jar
Float? memory
Float? memoryMultiplier
Int mem = ceil(select_first([memory, 4.0]))
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ${preCommand}
mkdir -p ${outputDirPath} mkdir -p $(dirname ${out1path}) $(dirname ${out2path})
java -Xmx${mem}G -jar ${tool_jar} \ java -jar ${tool_jar} \
-R ${ref_fasta} \ --in1 ${in1} \
-o ${outputDirPath} \ --in2 ${in2} \
${"-s " + scatterSize} \ --ref1 ${ref1} \
${"-L " + regions} --ref2 ${ref2} \
--out1 ${out1path} \
--out2 ${out2path}
} }
output { output {
Array[File] scatters = glob(outputDirPath + "/scatter-*.bed") File out1 = out1path
} File out2 = out2path
runtime {
memory: ceil(mem * select_first([memoryMultiplier, 2.0]))
} }
} }
...@@ -96,67 +157,36 @@ task SampleConfig { ...@@ -96,67 +157,36 @@ task SampleConfig {
} }
} }
task BaseCounter { task ScatterRegions {
String? preCommand String? preCommand
String tool_jar #Should this be of type File? File ref_fasta
File bam File ref_dict
File refFlat String outputDirPath
String outputDir String tool_jar
String prefix Int? scatterSize
File? regions
Float? memory Float? memory
Float? memoryMultiplier Float? memoryMultiplier
Int mem = ceil(select_first([memory, 12.0])) Int mem = ceil(select_first([memory, 4.0]))
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ${preCommand}
mkdir -p ${outputDir} mkdir -p ${outputDirPath}
java -Xmx${mem}G -jar ${tool_jar} \ java -Xmx${mem}G -jar ${tool_jar} \
-b ${bam} \ -R ${ref_fasta} \
-r ${refFlat} \ -o ${outputDirPath} \
-o ${outputDir} \ ${"-s " + scatterSize} \
-p ${prefix} ${"-L " + regions}
} }
output { output {
File exonAntisense = outputDir + "/" + prefix + ".base.exon.antisense.counts" Array[File] scatters = glob(outputDirPath + "/scatter-*.bed")
File exon = outputDir + "/" + prefix + ".base.exon.counts"
File exonMergeAntisense = outputDir + "/" + prefix + ".base.exon.merge.antisense.counts"
File exonMerge = outputDir + "/" + prefix + ".base.exon.merge.counts"
File exonMergeSense = outputDir + "/" + prefix + ".base.exon.merge.sense.counts"
File exonSense = outputDir + "/" + prefix + ".base.exon.sense.counts"
File geneAntisense = outputDir + "/" + prefix + ".base.gene.antisense.counts"
File gene = outputDir + "/" + prefix + ".base.gene.counts"
File geneExonicAntisense = outputDir + "/" + prefix + ".base.gene.exonic.antisense.counts"
File geneExonic = outputDir + "/" + prefix + ".base.gene.exonic.counts"
File geneExonicSense = outputDir + "/" + prefix + ".base.gene.exonic.sense.counts"
File geneIntronicAntisense = outputDir + "/" + prefix + ".base.gene.intronic.antisense.counts"
File geneIntronic = outputDir + "/" + prefix + ".base.gene.intronic.counts"
File geneIntronicSense = outputDir + "/" + prefix + ".base.gene.intronic.sense.counts"
File geneSense = outputDir + "/" + prefix + ".base.gene.sense.counts"
File intronAntisense = outputDir + "/" + prefix + ".base.intron.antisense.counts"
File intron = outputDir + "/" + prefix + ".base.intron.counts"
File intronMergeAntisense = outputDir + "/" + prefix + ".base.intron.merge.antisense.counts"
File intronMerge = outputDir + "/" + prefix + ".base.intron.merge.counts"
File intronMergeSense = outputDir + "/" + prefix + ".base.intron.merge.sense.counts"
File intronSense = outputDir + "/" + prefix + ".base.intron.sense.counts"
File metaExonsNonStranded = outputDir + "/" + prefix + ".base.metaexons.non_stranded.counts"
File metaExonsStrandedAntisense = outputDir + "/" + prefix + ".base.metaexons.stranded.antisense.counts"
File metaExonsStranded = outputDir + "/" + prefix + ".base.metaexons.stranded.counts"
File metaExonsStrandedSense = outputDir + "/" + prefix + ".base.metaexons.stranded.sense.counts"
File transcriptAntisense = outputDir + "/" + prefix + ".base.transcript.antisense.counts"
File transcript = outputDir + "/" + prefix + ".base.transcript.counts"
File transcriptExonicAntisense = outputDir + "/" + prefix + ".base.transcript.exonic.antisense.counts"
File transcriptExonic = outputDir + "/" + prefix + ".base.transcript.exonic.counts"
File transcriptExonicSense = outputDir + "/" + prefix + ".base.transcript.exonic.sense.counts"
File transcriptIntronicAntisense = outputDir + "/" + prefix + ".base.transcript.intronic.antisense.counts"
File transcriptIntronic = outputDir + "/" + prefix + ".base.transcript.intronic.counts"
File transcriptIntronicSense = outputDir + "/" + prefix + ".base.transcript.intronic.sense.counts"
File transcriptSense = outputDir + "/" + prefix + ".base.transcript.sense.counts"
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 2.0]))
} }
} }
task BwaMem { task mem {
String? preCommand String? preCommand
File inputR1 File inputR1
File? inputR2 File? inputR2
String referenceFasta File referenceFasta
Array[File] indexFiles # These indexFiles need to be added, otherwise cromwell will not find them. Array[File] indexFiles # These indexFiles need to be added, otherwise cromwell will not find them.
String outputPath String outputPath
String? readgroup String? readgroup
...@@ -10,6 +10,7 @@ task BwaMem { ...@@ -10,6 +10,7 @@ task BwaMem {
Int? threads Int? threads
Int? memory Int? memory
command { command {
set -e -o pipefail set -e -o pipefail
mkdir -p $(dirname ${outputPath}) mkdir -p $(dirname ${outputPath})
...@@ -23,8 +24,8 @@ task BwaMem { ...@@ -23,8 +24,8 @@ task BwaMem {
File bamFile = outputPath File bamFile = outputPath
} }
runtime{ runtime{
cpu: if defined(threads) then threads else 1 cpu: select_first([threads,1])
memory: if defined(memory) then memory else 8 memory: select_first([memory,8])
} }
} }
...@@ -35,6 +36,7 @@ task index { ...@@ -35,6 +36,7 @@ task index {
Int? blockSize Int? blockSize
String? outputDir String? outputDir
String fastaFilename = basename(fasta) String fastaFilename = basename(fasta)
String outputFile = if (defined(outputDir)) then outputDir + "/" + fastaFilename else fasta
command { command {
set -e -o pipefail set -e -o pipefail
...@@ -47,13 +49,12 @@ task index { ...@@ -47,13 +49,12 @@ task index {
bwa index \ bwa index \
${"-a " + constructionAlgorithm} \ ${"-a " + constructionAlgorithm} \
${"-b" + blockSize} \ ${"-b" + blockSize} \
${outputDir + "/"}${fastaFilename} ${outputFile}
} }
output { output {
File indexBase = if (defined(outputDir)) then select_first([outputDir]) + "/" + fastaFilename else fastaFilename File indexedFasta = outputFile
File indexedFasta = indexBase Array[File] indexFiles = [outputFile + ".bwt",outputFile + ".pac",outputFile + ".sa",outputFile + ".amb",outputFile + ".ann"]
Array[File] indexFiles = [indexBase + ".bwt",indexBase + ".pac",indexBase + ".sa",indexBase + ".amb",indexBase + ".ann"]
} }
parameter_meta { parameter_meta {
fasta: "Fasta file to be indexed" fasta: "Fasta file to be indexed"
......
...@@ -147,6 +147,41 @@ task MergeVCFs { ...@@ -147,6 +147,41 @@ task MergeVCFs {
File output_vcf_index = output_vcf_path + ".tbi" File output_vcf_index = output_vcf_path + ".tbi"
} }
runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5]))
}
}
task SamToFastq {
String? preCommand
File inputBam
String outputRead1
String? outputRead2
String? outputUnpaired
String picard_jar
Float? memory
Float? memoryMultiplier
Int mem = ceil(select_first([memory, 16.0])) # High memory default to avoid crashes.
command {
set -e -o pipefail
${preCommand}
java \
-Xmx${mem}G \
-jar ${picard_jar} \
SamToFastq \
I=${inputBam} \
${"FASTQ=" + outputRead1} \
${"SECOND_END_FASTQ=" + outputRead2} \
${"UNPAIRED_FASTQ=" + outputUnpaired}
}
output {
File read1 = outputRead1
File? read2 = outputRead2
File? unpairedRead = outputUnpaired
}
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 1.5]))
} }
......
...@@ -118,3 +118,40 @@ task fastq { ...@@ -118,3 +118,40 @@ task fastq {
} }
} }
task view {
String? preCommand
File inFile
File? referenceFasta
String outputFileName
Boolean? outputBam
Boolean? uncompressedBamOutput
Int? includeFilter
Int? excludeFilter
Int? excludeSpecificFilter
Int? threads
Int? memory
command {
set -e -o pipefail
${preCommand}
samtools view \
${"-T " + referenceFasta} \
${"-o " + outputFileName} \
${true="-b " false="" outputBam} \
${true="-u " false="" uncompressedBamOutput} \
${"-f " + includeFilter} \
${"-F " + excludeFilter} \
${"-G " + excludeSpecificFilter} \
${"--threads " + threads - 1} \
${inFile}
}
output {
File outputFile = outputFileName
}
runtime {
cpu: select_first([threads, 1])
memory: select_first([memory, 1])
}
}
...@@ -22,14 +22,15 @@ task spades { ...@@ -22,14 +22,15 @@ task spades {
Boolean? disableRepeatResolution Boolean? disableRepeatResolution
File? dataset File? dataset
Int? threads Int? threads
Int? memoryGb Float? memoryGb
File? tmpDir File? tmpDir
String? k String? k
Float? covCutoff Float? covCutoff
Int? phredOffset Int? phredOffset
Int finalThreads = select_first([threads,1]) Int finalThreads = select_first([threads,1])
Int totalMemory = select_first([memoryGb, finalThreads * 16]) Float totalMemory = select_first([memoryGb, finalThreads * 16.0])
Int clusterMemory = totalMemory / finalThreads Int finalMemory = ceil(totalMemory)
Int clusterMemory = ceil(totalMemory / finalThreads)
command { command {
set -e -o pipefail set -e -o pipefail
...@@ -57,7 +58,7 @@ task spades { ...@@ -57,7 +58,7 @@ task spades {
${true="--disable-rr" false="" disableRepeatResolution } \ ${true="--disable-rr" false="" disableRepeatResolution } \
${"--dataset " + dataset } \ ${"--dataset " + dataset } \
${"--threads " + finalThreads} \ ${"--threads " + finalThreads} \
${"--memory " + totalMemory } \ ${"--memory " + finalMemory } \
${"-k " + k } \ ${"-k " + k } \
${"--cov-cutoff " + covCutoff } \ ${"--cov-cutoff " + covCutoff } \
${"--phred-offset " + phredOffset } ${"--phred-offset " + phredOffset }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment