Skip to content
Snippets Groups Projects
spades.wdl 2.7 KiB
Newer Older
Ruben Vorderman's avatar
Ruben Vorderman committed
task spades {
    String outputDir
    String? preCommand
    File read1
Ruben Vorderman's avatar
Ruben Vorderman committed
    File? read2
    File? interlacedReads
    File? sangerReads
    File? pacbioReads
    File? nanoporeReads
    File? tslrContigs
    File? trustedContigs
    File? untrustedContigs
    Boolean? singleCell
    Boolean? metagenomic
    Boolean? rna
    Boolean? plasmid
    Boolean? ionTorrent
    Boolean? onlyErrorCorrection
    Boolean? onlyAssembler
    Boolean? careful
    Boolean? disableGzipOutput
    Boolean? disableRepeatResolution
    File? dataset
    Int? threads
    Int? memoryGb
Ruben Vorderman's avatar
Ruben Vorderman committed
    File? tmpDir
    String? k
    Float? covCutoff
    Int? phredOffset
    Int finalThreads = select_first([threads,1])
    Int totalMemory = select_first([memoryGb, finalThreads * 16])
    Int clusterMemory = totalMemory / finalThreads
Ruben Vorderman's avatar
Ruben Vorderman committed

    command {
        set -e -o pipefail
        ${preCommand}
        spades.py \
        ${"-o " + outputDir} \
        ${true="--sc" false="" singleCell} \
        ${true="--meta" false="" metagenomic} \
        ${true="--rna" false="" rna} \
        ${true="--plasmid" false="" plasmid} \
        ${true="--iontorrent" false="" ionTorrent} \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ${"--12 " + interlacedReads } \
        ${true="-1" false="-s" defined(read2)} ${read1}  \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ${"-2 " + read2 } \
        ${"--sanger " + sangerReads } \
        ${"--pacbio " + pacbioReads } \
        ${"--nanopore " + nanoporeReads } \
        ${"--tslr " + tslrContigs } \
        ${"--trusted-contigs " + trustedContigs } \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ${"--untrusted-contigs " + untrustedContigs } \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ${true="--only-error-correction" false="" onlyErrorCorrection } \
        ${true="--only-assembler" false="" onlyAssembler } \
        ${true="--careful" false="" careful } \
        ${true="--disable-gzip-output" false="" disableGzipOutput} \
        ${true="--disable-rr" false="" disableRepeatResolution } \
        ${"--dataset " + dataset } \
        ${"--threads " + finalThreads} \
        ${"--memory " + totalMemory } \
Ruben Vorderman's avatar
Ruben Vorderman committed
        ${"-k " + k } \
        ${"--cov-cutoff " + covCutoff } \
        ${"--phred-offset " + phredOffset }
    }
    output {
Ruben Vorderman's avatar
Ruben Vorderman committed
        Array[File] correctedReads = glob(outputDir + "/corrected/*.fastq*")
Ruben Vorderman's avatar
Ruben Vorderman committed
        File scaffolds = outputDir + "/scaffolds.fasta"
        File contigs = outputDir + "/contigs.fasta"
Ruben Vorderman's avatar
Ruben Vorderman committed
        File assemblyGraphWithScaffoldsGfa = outputDir + "/assembly_graph_with_scaffolds.gfa"
        File assemblyGraphFastg = outputDir + "/assembly_graph.fastg"
Ruben Vorderman's avatar
Ruben Vorderman committed
        File contigsPaths = outputDir + "/contigs.paths"
        File scaffoldsPaths = outputDir + "/scaffolds.paths"
        File params = outputDir + "/params.txt"
Ruben Vorderman's avatar
Ruben Vorderman committed
        File log = outputDir + "/spades.log"
Ruben Vorderman's avatar
Ruben Vorderman committed
    }
    runtime {
        cpu: finalThreads
        memory: clusterMemory
Ruben Vorderman's avatar
Ruben Vorderman committed
    }
}