Skip to content
Snippets Groups Projects
Commit bf7aba3c authored by Cats's avatar Cats
Browse files

add fastp

parent 8c41db81
No related branches found
No related tags found
No related merge requests found
fastp.wdl 0 → 100644
verison 1.0
# MIT License
#
# Copyright (c) 2022 Leiden University Medical Center
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
task Fastp {
input {
File r1
File r2
String outputPathR1
String outputPathR2
String htmlPath
String jsonPath
Int compressionLevel = 1
Boolean correction = false
Int lengthRequired = 15
Int? split
Int threads = 4
String memory = "5GiB"
Int timeMinutes = 1 + ceil(size([read1, read2], "G") * 7.0 / cores)
String dockerImage = "quay.io/biocontainers/fastp:0.23.2--h5f740d0_3"
}
String outputDirR1 = sub(outputPathR1, basename(outputPathR1), "")
command {
set -e
mkdir -p $(dirname ~{outputPathR1} ~{outputPathR2} ~{htmlPath} ~{jsonPath})
# predict output paths
seq 1 ~{if defined(split) then split else "2"} | awk '{print "~{outputDirR1}/"$0".~{basename(outputPathR1)}"}' > r1_paths
seq 1 ~{if defined(split) then split else "2"} | awk '{print "~{outputDirR2}/"$0".~{basename(outputPathR2)}"}' > r2_paths
fastp \
-i ~{r1} \
~{"-I " + r2} \
-o ~{outputPathR1} \
~{"-O " + outputPathR2} \
-h ~{htmlPath} \
-j ~{jsonPath} \
-z ~{compressionLevel} \
~{if correction then "--correction" else ""} \
--length_required ~{lengthRequired} \
--threads ~{threads} \
~{"--split " + split} \
~{if defined(split) then "-d 0" else ""}
}
Array[String] r1Paths = read_lines("r1_paths")
Array[String] r2Paths = read_lines("r2_paths")
output {
File htmlReport = htmlPath
File jsonReport = jsonPath
Array[File] clippedR1 = if defined(split) then r1Paths else [outputPathR1]
Array[File] clippedR2 = if defined(split) then r2Paths else [outputPathR2]
}
runtime {
cpu: cores
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
r1: {description: "The R1 fastq file.", category: "required"}
r2: {description: "The R2 fastq file.", category: "required"}
outputPathR1: {description: "The output path for the R1 file.", category: "required"}
outputPathR2: {description: "The output path for the R2 file.", category: "required"}
htmlPath: {description: "The path to write the html report to.", category: "required"}
jsonPath: {description: "The path to write the json report to.", category: "required"}
compressionLevel: {description: "The compression level to use for the output.", category: "advanced"}
correction: {description: "Whether or not to apply overlap based correction.", category: "advanced"}
lengthRequired: {description: "The minimum read length.", category: "advanced"}
split: {description: "The number of chunks to split the files into.", category: "common"}
threads: {description: "The number of threads to use.", category: "advanced"}
memory: {description: "The amount of memory this job will use.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment