Skip to content
Snippets Groups Projects
biopet.wdl 6.62 KiB
Newer Older
Ruben Vorderman's avatar
Ruben Vorderman committed
# PLEASE ADD TASKS IN ALPHABETIC ORDER.
# This makes searching a lot easier.
Ruben Vorderman's avatar
Ruben Vorderman committed
task BaseCounter {
    String? preCommand
    File toolJar
Ruben Vorderman's avatar
Ruben Vorderman committed
    File bam
Cats's avatar
Cats committed
    File bamIndex
Ruben Vorderman's avatar
Ruben Vorderman committed
    File refFlat
    String outputDir
    String prefix

    Float? memory
    Float? memoryMultiplier
    Int mem = ceil(select_first([memory, 12.0]))
Pappas's avatar
Pappas committed

Ruben Vorderman's avatar
Ruben Vorderman committed
    command {
        set -e -o pipefail
        mkdir -p ${outputDir}
Cats's avatar
Cats committed
        ${preCommand}
        java -Xmx${mem}G -jar ${toolJar} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        -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, 3.0]))
Peter van 't Hof's avatar
Peter van 't Hof committed
task FastqSplitter {
Peter van 't Hof's avatar
Peter van 't Hof committed
    String? preCommand
Peter van 't Hof's avatar
Peter van 't Hof committed
    File inputFastq
    String outputPath
    Int numberChunks
Pappas's avatar
Pappas committed
    File toolJar
Peter van 't Hof's avatar
Peter van 't Hof committed
    Array[Int] chunks = range(numberChunks)
Peter van 't Hof's avatar
Peter van 't Hof committed

    command {
Peter van 't Hof's avatar
Peter van 't Hof committed
        set -e -o pipefail
        ${preCommand}
        mkdir -p ${sep=' ' prefix(outputPath + "/chunk_", chunks)}
        if [ ${numberChunks} -gt 1 ]; then
            SEP="/${basename(inputFastq)} -o "
Pappas's avatar
Pappas committed
            java -jar ${toolJar} -I ${inputFastq} -o ${sep='$SEP' prefix(outputPath + "/chunk_", chunks)}/${basename(inputFastq)}
Peter van 't Hof's avatar
Peter van 't Hof committed
        else
            ln -sf ${inputFastq} ${outputPath}/chunk_0/${basename(inputFastq)}
        fi
Peter van 't Hof's avatar
Peter van 't Hof committed
    }

    output {
        Array[File] outputFastqFiles = glob(outputPath + "/chunk_*/" + basename(inputFastq))
    }
}

Ruben Vorderman's avatar
Ruben Vorderman committed
task FastqSync {
Peter van 't Hof's avatar
Peter van 't Hof committed
    String? preCommand
Ruben Vorderman's avatar
Ruben Vorderman committed
    File ref1
    File ref2
    File in1
    File in2
    String out1path
    String out2path
Pappas's avatar
Pappas committed
    File toolJar

Peter van 't Hof's avatar
Peter van 't Hof committed
    command {
Peter van 't Hof's avatar
Peter van 't Hof committed
        set -e -o pipefail
        ${preCommand}
Ruben Vorderman's avatar
Ruben Vorderman committed
        mkdir -p $(dirname ${out1path}) $(dirname ${out2path})
Pappas's avatar
Pappas committed
        java -jar ${toolJar} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        --in1 ${in1} \
        --in2 ${in2} \
        --ref1 ${ref1} \
        --ref2 ${ref2} \
        --out1 ${out1path} \
        --out2 ${out2path}
Peter van 't Hof's avatar
Peter van 't Hof committed
    }
Pappas's avatar
Pappas committed

Peter van 't Hof's avatar
Peter van 't Hof committed
    output {
Ruben Vorderman's avatar
Ruben Vorderman committed
        File out1 = out1path
        File out2 = out2path
Cats's avatar
Cats committed
    }
Peter van 't Hof's avatar
Peter van 't Hof committed
}

task SampleConfig {
Peter van 't Hof's avatar
Peter van 't Hof committed
    String? preCommand
Pappas's avatar
Pappas committed
    File toolJar
Peter van 't Hof's avatar
Peter van 't Hof committed
    Array[File]+ inputFiles
Cats's avatar
Cats committed
    String keyFilePath
Peter van 't Hof's avatar
Peter van 't Hof committed
    String? sample
    String? library
    String? readgroup
    String? jsonOutputPath
    String? tsvOutputPath

Cats's avatar
Cats committed
    Float? memory
    Float? memoryMultiplier
Cats's avatar
Cats committed
    Int mem = ceil(select_first([memory, 4.0]))
Pappas's avatar
Pappas committed

Peter van 't Hof's avatar
Peter van 't Hof committed
    command {
Peter van 't Hof's avatar
Peter van 't Hof committed
        set -e -o pipefail
        ${preCommand}
Cats's avatar
Cats committed
        mkdir -p . ${"$(dirname " + jsonOutputPath + ")"} ${"$(dirname " + tsvOutputPath + ")"}
Pappas's avatar
Pappas committed
        java -Xmx${mem}G -jar ${toolJar} \
Peter van 't Hof's avatar
Peter van 't Hof committed
        -i ${sep="-i " inputFiles} \
        ${"--sample " + sample} \
        ${"--library " + library} \
        ${"--readgroup " + readgroup} \
        ${"--jsonOutput " + jsonOutputPath} \
Cats's avatar
Cats committed
        ${"--tsvOutput " + tsvOutputPath} \
        > ${keyFilePath}
Peter van 't Hof's avatar
Peter van 't Hof committed
    }

    output {
Cats's avatar
Cats committed
        File keysFile = keyFilePath
Peter van 't Hof's avatar
Peter van 't Hof committed
        File? jsonOutput = jsonOutputPath
        File? tsvOutput = tsvOutputPath
    }
Cats's avatar
Cats committed

    runtime {
Cats's avatar
Cats committed
        memory: ceil(mem * select_first([memoryMultiplier, 2.0]))
Cats's avatar
Cats committed
    }
Peter van 't Hof's avatar
Peter van 't Hof committed
}
Cats's avatar
Cats committed

Ruben Vorderman's avatar
Ruben Vorderman committed
task ScatterRegions {
Cats's avatar
Cats committed
    String? preCommand
Pappas's avatar
Pappas committed
    File refFasta
    File refDict
Ruben Vorderman's avatar
Ruben Vorderman committed
    String outputDirPath
Pappas's avatar
Pappas committed
    File toolJar
Ruben Vorderman's avatar
Ruben Vorderman committed
    Int? scatterSize
    File? regions
Cats's avatar
Cats committed

Cats's avatar
Cats committed
    Float? memory
    Float? memoryMultiplier
Ruben Vorderman's avatar
Ruben Vorderman committed
    Int mem = ceil(select_first([memory, 4.0]))
Pappas's avatar
Pappas committed

Cats's avatar
Cats committed
    command {
        set -e -o pipefail
        ${preCommand}
Ruben Vorderman's avatar
Ruben Vorderman committed
        mkdir -p ${outputDirPath}
Pappas's avatar
Pappas committed
        java -Xmx${mem}G -jar ${toolJar} \
          -R ${refFasta} \
Ruben Vorderman's avatar
Ruben Vorderman committed
          -o ${outputDirPath} \
          ${"-s " + scatterSize} \
          ${"-L " + regions}
Cats's avatar
Cats committed
    }

    output {
Ruben Vorderman's avatar
Ruben Vorderman committed
        Array[File] scatters = glob(outputDirPath + "/scatter-*.bed")
Cats's avatar
Cats committed
    }
Cats's avatar
Cats committed

    runtime {
        memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
Cats's avatar
Cats committed
    }
Cats's avatar
Cats committed
}