comparison 0.5.0/modules/fastp/main.nf @ 1:365849f031fd

"planemo upload"
author kkonganti
date Mon, 05 Jun 2023 18:48:51 -0400
parents
children
comparison
equal deleted inserted replaced
0:a4b1ee4b68b1 1:365849f031fd
1 process FASTP {
2 tag "$meta.id"
3 label 'process_low'
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}fastp${params.fs}0.23.2" : null)
6 conda (params.enable_conda ? "bioconda::fastp=0.23.2 conda-forge::isa-l" : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/fastp:0.23.2--h79da9fb_0' :
9 'quay.io/biocontainers/fastp:0.23.2--h79da9fb_0' }"
10
11 input:
12 tuple val(meta), path(reads)
13
14 output:
15 tuple val(meta), path('*.fastp.fastq.gz') , emit: passed_reads, optional: true
16 tuple val(meta), path('*.fail.fastq.gz') , emit: failed_reads, optional: true
17 tuple val(meta), path('*.merged.fastq.gz'), emit: merged_reads, optional: true
18 tuple val(meta), path('*.json') , emit: json
19 tuple val(meta), path('*.html') , emit: html
20 tuple val(meta), path('*.log') , emit: log
21 path "versions.yml" , emit: versions
22
23 when:
24 task.ext.when == null || task.ext.when
25
26 script:
27 def args = task.ext.args ?: ''
28 def prefix = task.ext.prefix ?: "${meta.id}"
29 def fail_fastq = params.fastp_failed_out && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : params.fastp_failed_out && !meta.single_end ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : ''
30 // Added soft-links to original fastqs for consistent naming in MultiQC
31 // Use single ended for interleaved. Add --interleaved_in in config.
32 if ( task.ext.args?.contains('--interleaved_in') ) {
33 """
34 [ ! -f ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz
35
36 fastp \\
37 --stdout \\
38 --in1 ${prefix}.fastq.gz \\
39 --thread $task.cpus \\
40 --json ${prefix}.fastp.json \\
41 --html ${prefix}.fastp.html \\
42 $fail_fastq \\
43 $args \\
44 2> ${prefix}.fastp.log \\
45 | gzip -c > ${prefix}.fastp.fastq.gz
46
47 cat <<-END_VERSIONS > versions.yml
48 "${task.process}":
49 fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
50 END_VERSIONS
51 """
52 } else if (meta.single_end) {
53 """
54 [ ! -f ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz
55
56 fastp \\
57 --in1 ${prefix}.fastq.gz \\
58 --out1 ${prefix}.fastp.fastq.gz \\
59 --thread $task.cpus \\
60 --json ${prefix}.fastp.json \\
61 --html ${prefix}.fastp.html \\
62 $fail_fastq \\
63 $args \\
64 2> ${prefix}.fastp.log
65
66 cat <<-END_VERSIONS > versions.yml
67 "${task.process}":
68 fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
69 END_VERSIONS
70 """
71 } else {
72 def merge_fastq = params.fastp_merged_out ? "-m --merged_out ${prefix}.merged.fastq.gz" : ''
73 """
74 [ ! -f ${prefix}_1.fastq.gz ] && ln -sf ${reads[0]} ${prefix}_1.fastq.gz
75 [ ! -f ${prefix}_2.fastq.gz ] && ln -sf ${reads[1]} ${prefix}_2.fastq.gz
76 fastp \\
77 --in1 ${prefix}_1.fastq.gz \\
78 --in2 ${prefix}_2.fastq.gz \\
79 --out1 ${prefix}_1.fastp.fastq.gz \\
80 --out2 ${prefix}_2.fastp.fastq.gz \\
81 --json ${prefix}.fastp.json \\
82 --html ${prefix}.fastp.html \\
83 $fail_fastq \\
84 $merge_fastq \\
85 --thread $task.cpus \\
86 --detect_adapter_for_pe \\
87 $args \\
88 2> ${prefix}.fastp.log
89
90 cat <<-END_VERSIONS > versions.yml
91 "${task.process}":
92 fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
93 END_VERSIONS
94 """
95 }
96 }