Mercurial > repos > kkonganti > cfsan_bettercallsal
comparison 0.5.0/modules/cat/fastq/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 CAT_FASTQ { | |
2 tag "$meta.id" | |
3 label 'process_micro' | |
4 | |
5 conda (params.enable_conda ? "conda-forge::sed=4.7 conda-forge::gzip" : null) | |
6 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
7 'https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv1/biocontainers_v1.2.0_cv1.img' : | |
8 'biocontainers/biocontainers:v1.2.0_cv1' }" | |
9 | |
10 input: | |
11 tuple val(meta), path(reads, stageAs: "input*/*") | |
12 | |
13 output: | |
14 tuple val(meta), path("*.merged.fastq.gz"), emit: catted_reads | |
15 path "versions.yml" , emit: versions | |
16 | |
17 when: | |
18 task.ext.when == null || task.ext.when | |
19 | |
20 script: | |
21 def args = task.ext.args ?: '' | |
22 def prefix = task.ext.prefix ?: "${meta.id}" | |
23 def readList = reads.collect{ it.toString() } | |
24 def is_in_gz = readList[0].endsWith('.gz') | |
25 def gz_or_ungz = (is_in_gz ? '' : ' | gzip') | |
26 def pigz_or_ungz = (is_in_gz ? '' : " | pigz -p ${task.cpus}") | |
27 if (meta.single_end) { | |
28 if (readList.size > 1) { | |
29 """ | |
30 zcmd="gzip" | |
31 zver="" | |
32 | |
33 if type pigz > /dev/null 2>&1; then | |
34 cat ${readList.join(' ')} ${pigz_or_ungz} > ${prefix}.merged.fastq.gz | |
35 zcmd="pigz" | |
36 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed -e '1!d' | sed "s/\$zcmd //" ) | |
37 else | |
38 cat ${readList.join(' ')} ${gz_or_ungz} > ${prefix}.merged.fastq.gz | |
39 zcmd="gzip" | |
40 | |
41 if [ "${workflow.containerEngine}" != "null" ]; then | |
42 zver=\$( echo \$( \$zcmd --help 2>&1 ) | sed -e '1!d; s/ (.*\$//' ) | |
43 else | |
44 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed "s/^.*(\$zcmd) //; s/\$zcmd //; s/ Copyright.*\$//" ) | |
45 fi | |
46 fi | |
47 | |
48 cat <<-END_VERSIONS > versions.yml | |
49 "${task.process}": | |
50 cat: \$( echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//' ) | |
51 \$zcmd: \$zver | |
52 END_VERSIONS | |
53 """ | |
54 } | |
55 } else { | |
56 if (readList.size > 2) { | |
57 def read1 = [] | |
58 def read2 = [] | |
59 readList.eachWithIndex{ v, ix -> ( ix & 1 ? read2 : read1 ) << v } | |
60 """ | |
61 zcmd="gzip" | |
62 zver="" | |
63 | |
64 if type pigz > /dev/null 2>&1; then | |
65 cat ${read1.join(' ')} ${pigz_or_ungz} > ${prefix}_1.merged.fastq.gz | |
66 cat ${read2.join(' ')} ${pigz_or_ungz} > ${prefix}_2.merged.fastq.gz | |
67 zcmd="pigz" | |
68 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed -e '1!d' | sed "s/\$zcmd //" ) | |
69 else | |
70 cat ${read1.join(' ')} ${gz_or_ungz} > ${prefix}_1.merged.fastq.gz | |
71 cat ${read2.join(' ')} ${gz_or_ungz} > ${prefix}_2.merged.fastq.gz | |
72 zcmd="gzip" | |
73 | |
74 if [ "${workflow.containerEngine}" != "null" ]; then | |
75 zver=\$( echo \$( \$zcmd --help 2>&1 ) | sed -e '1!d; s/ (.*\$//' ) | |
76 else | |
77 zver=\$( echo \$( \$zcmd --version 2>&1 ) | sed "s/^.*(\$zcmd) //; s/\$zcmd //; s/ Copyright.*\$//" ) | |
78 fi | |
79 fi | |
80 | |
81 cat <<-END_VERSIONS > versions.yml | |
82 "${task.process}": | |
83 cat: \$( echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//' ) | |
84 \$zcmd: \$zver | |
85 END_VERSIONS | |
86 """ | |
87 } | |
88 } | |
89 } |