Skip to content
Snippets Groups Projects
fastqc.wdl 3.06 KiB
Newer Older
Ruben Vorderman's avatar
Ruben Vorderman committed
task fastqc {
    File seqFile
    String outdirPath
Ruben Vorderman's avatar
Ruben Vorderman committed
    String? preCommand
Ruben Vorderman's avatar
Ruben Vorderman committed
    Boolean? casava
    Boolean? nano
    Boolean? noFilter
    Boolean? extract = true
    Boolean? nogroup
    Int? minLength
    String? format
    Int? threads = 1
    File? contaminants
    File? adapters
    File? limits
    Int? kmers
    String? dir

    command {
    set -e -o pipefail
Ruben Vorderman's avatar
Ruben Vorderman committed
    ${preCommand}
Ruben Vorderman's avatar
Ruben Vorderman committed
    mkdir -p ${outdirPath}
    fastqc \
Ruben Vorderman's avatar
Ruben Vorderman committed
    ${"--outdir " + outdirPath} \
Ruben Vorderman's avatar
Ruben Vorderman committed
    ${true="--casava" false="" casava} \
    ${true="--nano" false="" nano} \
    ${true="--nofilter" false="" noFilter} \
    ${true="--extract" false="" extract} \
    ${true="--nogroup" false="" nogroup} \
    ${"--min_length " + minLength } \
    ${"--format " + format} \
    ${"--threads " + threads} \
    ${"--contaminants " + contaminants} \
    ${"--adapters " + adapters} \
    ${"--limits " + limits} \
    ${"--kmers " + kmers} \
    ${"--dir " + dir} \
    ${seqFile}
Ruben Vorderman's avatar
Ruben Vorderman committed
    }

    output {
Peter van 't Hof's avatar
Peter van 't Hof committed
        File rawReport = select_first(glob(outdirPath + "/*/fastqc_data.txt"))
        File htmlReport = select_first(glob(outdirPath + "/*/fastqc_report.html"))
        File summary = select_first(glob(outdirPath + "/*/summary.txt"))
pjvan_thof's avatar
pjvan_thof committed
        Array[File] images = glob(outdirPath + "/*/Images/*.png")
Ruben Vorderman's avatar
Ruben Vorderman committed
    }

    runtime {
Ruben Vorderman's avatar
Ruben Vorderman committed
        cpu: select_first([threads])

task extractAdapters {
    File extractAdaptersFastqcJar
    File inputFile
Ruben Vorderman's avatar
Ruben Vorderman committed
    String outputDir
    String? adapterOutputFilePath = outputDir + "/adapter.list"
    String? contamsOutputFilePath = outputDir + "/contaminations.list"
    Boolean? skipContams
    File? knownContamFile
    File? knownAdapterFile
    Float? adapterCutoff
    Boolean? outputAsFasta
    command {
Ruben Vorderman's avatar
Ruben Vorderman committed
    set -e
    mkdir -p ${outputDir}
    java -Xmx4G -jar ${extractAdaptersFastqcJar} \
    --inputFile ${inputFile} \
    ${"--adapterOutputFile " + adapterOutputFilePath } \
    ${"--contamsOutputFile " + contamsOutputFilePath } \
    ${"--knownContamFile " + knownContamFile} \
    ${"--knownAdapterFile " + knownAdapterFile} \
    ${"--adapterCutoff " + adapterCutoff} \
    ${true="--skipContams" false="" skipContams} \
    ${true="--outputAsFasta" false="" outputAsFasta}
    }

    output {
Ruben Vorderman's avatar
Ruben Vorderman committed
        File adapterOutputFile = select_first([adapterOutputFilePath])
        File contamsOutputFile = select_first([contamsOutputFilePath])
        Array[String] adapterList = read_lines(select_first([adapterOutputFilePath]))
        Array[String] contamsList = read_lines(select_first([contamsOutputFilePath]))

    runtime {
        memory: 6
    }
Ruben Vorderman's avatar
Ruben Vorderman committed
}

task getConfiguration {
    String? preCommand
    String? fastqcDirFile = "fastqcDir.txt"
Cats's avatar
Cats committed

Ruben Vorderman's avatar
Ruben Vorderman committed
    command {
        set -e -o pipefail
        ${preCommand}
        echo $(dirname $(readlink -f $(which fastqc))) > ${fastqcDirFile}
    }
Cats's avatar
Cats committed

Ruben Vorderman's avatar
Ruben Vorderman committed
    output {
        String fastqcDir = read_string(fastqcDirFile)
        File adapterList = fastqcDir + "/Configuration/adapter_list.txt"
        File contaminantList = fastqcDir + "/Configuration/contaminant_list.txt"
        File limits = fastqcDir + "/Configuration/limits.txt"
    }
Cats's avatar
Cats committed

    runtime {
        memory: 1
    }