From 5b4448109d43ce537bef3485e6b40c7aef943afc Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Thu, 18 Feb 2021 12:19:43 +0100
Subject: [PATCH] fastp: add fastp 0.20.1

---
 src/.docker_modules/fastp/0.20.1/Dockerfile   |  2 +
 .../fastp/0.20.1/docker_init.sh               |  4 ++
 src/nf_modules/fastp/main.nf                  | 55 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 src/.docker_modules/fastp/0.20.1/Dockerfile
 create mode 100755 src/.docker_modules/fastp/0.20.1/docker_init.sh
 create mode 100644 src/nf_modules/fastp/main.nf

diff --git a/src/.docker_modules/fastp/0.20.1/Dockerfile b/src/.docker_modules/fastp/0.20.1/Dockerfile
new file mode 100644
index 00000000..0461d5ea
--- /dev/null
+++ b/src/.docker_modules/fastp/0.20.1/Dockerfile
@@ -0,0 +1,2 @@
+FROM quay.io/biocontainers/fastp:0.20.1--h8b12597_0
+MAINTAINER Laurent Modolo
diff --git a/src/.docker_modules/fastp/0.20.1/docker_init.sh b/src/.docker_modules/fastp/0.20.1/docker_init.sh
new file mode 100755
index 00000000..2b1f3bee
--- /dev/null
+++ b/src/.docker_modules/fastp/0.20.1/docker_init.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+docker pull lbmc/fastp:0.20.1
+docker build src/.docker_modules/fastp/0.20.1 -t 'lbmc/fastp:0.20.1'
+docker push lbmc/fastp:0.20.1
diff --git a/src/nf_modules/fastp/main.nf b/src/nf_modules/fastp/main.nf
new file mode 100644
index 00000000..c69412e4
--- /dev/null
+++ b/src/nf_modules/fastp/main.nf
@@ -0,0 +1,55 @@
+version = "0.20.1"
+container_url = "lbmc/fastp:${version}"
+
+
+process fastp_pairedend {
+  container = "${container_url}"
+  label "big_mem_multi_cpus"
+  tag "$pair_id"
+
+  input:
+  tuple val(pair_id), path(reads)
+
+  output:
+    tuple val(pair_id), path("*.fastq.gz"), emit: fastq
+    tuple val(pair_id), path("*.{zip,html}"), emit: report
+
+  script:
+"""
+fastp --thread ${task.cpus} \
+--qualified_quality_phred 20 \
+--disable_length_filtering \
+--detect_adapter_for_pe \
+--in1 ${reads[0]} \
+--in2 ${reads[1]} \
+--out1 ${pair_id}_R1_trim.fastq.gz \
+--out2 ${pair_id}_R2_trim.fastq.gz \
+--html ${pair_id}.html \
+--report_title ${pair_id}
+"""
+}
+
+process fastp_singleend {
+  container = "${container_url}"
+  label "big_mem_multi_cpus"
+  tag "$pair_id"
+
+  input:
+  tuple val(pair_id), path(reads)
+
+  output:
+    tuple val(pair_id), path("*.fastq.gz"), emit: fastq
+    tuple val(pair_id), path("*.{zip,html}"), emit: report
+
+  script:
+"""
+fastp --thread ${task.cpus} \
+--qualified_quality_phred 20 \
+--disable_length_filtering \
+--detect_adapter_for_pe \
+--in1 ${reads} \
+--out1 ${pair_id}_trim.fastq.gz \
+--html ${pair_id}.html \
+--report_title ${pair_id}
+"""
+}
-- 
GitLab