Skip to main content Svelte Highlight v7.23.1

WDL language preview

1. A GATK/Broad style task

a command heredoc with ~{} interpolation, typed inputs, and a runtime block
horizon-dark
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}
atom-one-dark
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}
github-dark
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}
dracula
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}
nord
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}
github
task BwaMem {
    input {
        File reads_fastq
        File reference_fasta
        Int threads = 4
    }

    command <<<
        bwa mem -t ~{threads} ~{reference_fasta} ~{reads_fastq} \
            | samtools sort -o aligned.sorted.bam
    >>>

    output {
        File sorted_bam = "aligned.sorted.bam"
    }

    runtime {
        docker: "broadinstitute/gatk:4.5.0.0"
        memory: "8 GB"
        cpu: threads
    }
}

2. A workflow with scatter

fanning a task out over an array of inputs and collecting outputs
horizon-dark
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}
atom-one-dark
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}
github-dark
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}
dracula
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}
nord
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}
github
workflow AlignSamples {
    input {
        Array[File] fastq_files
        File reference_fasta
    }

    scatter (fastq in fastq_files) {
        call BwaMem {
            input:
                reads_fastq = fastq,
                reference_fasta = reference_fasta
        }
    }

    output {
        Array[File] sorted_bams = BwaMem.sorted_bam
    }
}

3. A conditional call

an if block guarding an optional call, plus an if/then/else expression
horizon-dark
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}
atom-one-dark
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}
github-dark
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}
dracula
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}
nord
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}
github
workflow MaybeDownsample {
    input {
        File bam
        Boolean should_downsample
    }

    if (should_downsample) {
        call Downsample { input: bam = bam }
    }

    File final_bam = if should_downsample then Downsample.out_bam else bam

    output {
        File result = final_bam
    }
}