Skip to content
Snippets Groups Projects
bamstats.wdl 1.33 KiB
Newer Older
Ruben Vorderman's avatar
Ruben Vorderman committed
version 1.0

# Copyright Sequencing Analysis Support Core - Leiden University Medical Center 2018

Peter van 't Hof's avatar
Peter van 't Hof committed
import "../common.wdl" as common

Ruben Vorderman's avatar
Ruben Vorderman committed
task Generate {
    input {
        String? preCommand
        File? toolJar
Peter van 't Hof's avatar
Peter van 't Hof committed
        IndexedBamFile bam
Ruben Vorderman's avatar
Ruben Vorderman committed
        File? bedFile
        Boolean scatterMode = false
        Boolean onlyUnmapped = false
        Boolean tsvOutputs = false
        String outputDir
Peter van 't Hof's avatar
Peter van 't Hof committed
        Reference? reference
Ruben Vorderman's avatar
Ruben Vorderman committed
        Int memory = 4
        Float memoryMultiplier = 2.0
    }

    String toolCommand = if defined(toolJar)
        then "java -Xmx" + memory + "G -jar " + toolJar
        else "biopet-bamstats -Xmx" + memory + "G"

Peter van 't Hof's avatar
Peter van 't Hof committed
    String refArg = if (defined(reference)) then "--reference " + select_first([reference]).fasta else ""

Ruben Vorderman's avatar
Ruben Vorderman committed
    command {
        set -e -o pipefail
        ~{preCommand}
        mkdir -p ~{outputDir}
        ~{toolCommand} Generate \
Peter van 't Hof's avatar
Peter van 't Hof committed
        --bam ~{bam.file} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ~{"--bedFile " + bedFile} \
Peter van 't Hof's avatar
Peter van 't Hof committed
        ~{refArg} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ~{true="--onlyUnmapped" false="" onlyUnmapped} \
        ~{true="--scatterMode" false="" scatterMode} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ~{true="--tsvOutputs" false="" tsvOutputs} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        --outputDir ~{outputDir}
    }

    output {
        File json = outputDir + "/bamstats.json"
        File summaryJson = outputDir + "/bamstats.summary.json"
    }

    runtime {
        memory: ceil(memory * memoryMultiplier)
    }
}