Mercurial > repos > kkonganti > cfsan_centriflaken
comparison 0.4.2/modules/seqkit/grep/main.nf @ 130:04f6ac8ca13c
planemo upload
author | kkonganti |
---|---|
date | Wed, 03 Jul 2024 15:16:39 -0400 |
parents | 52045ea4679d |
children |
comparison
equal
deleted
inserted
replaced
129:1bb0dacefa6d | 130:04f6ac8ca13c |
---|---|
1 process SEQKIT_GREP { | |
2 tag "$meta.id" | |
3 label 'process_low' | |
4 | |
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}seqkit${params.fs}2.2.0" : null) | |
6 conda (params.enable_conda ? "bioconda::seqkit=2.2.0 conda-forge::sed=4.7 conda-forge::coreutils" : null) | |
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
8 'https://depot.galaxyproject.org/singularity/seqkit:2.1.0--h9ee0642_0': | |
9 'quay.io/biocontainers/seqkit:2.1.0--h9ee0642_0' }" | |
10 | |
11 input: | |
12 tuple val(meta), path(reads), path(pattern_file) | |
13 | |
14 output: | |
15 tuple val(meta), path("*.gz"), emit: fastx | |
16 path "versions.yml" , emit: versions | |
17 | |
18 when: | |
19 task.ext.when == null || task.ext.when | |
20 | |
21 script: | |
22 def args = task.ext.args ?: '' | |
23 def prefix = task.ext.prefix ?: "${meta.id}" | |
24 | |
25 def extension = "fastq" | |
26 if ("$reads" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz/) { | |
27 extension = "fasta" | |
28 } | |
29 | |
30 if (meta.single_end) { | |
31 """ | |
32 pattern_file_contents=\$(sed '1!d' $pattern_file) | |
33 if [ "\$pattern_file_contents" != "DuMmY" ]; then | |
34 additional_args="-f $pattern_file $args" | |
35 else | |
36 additional_args="$args" | |
37 fi | |
38 | |
39 seqkit \\ | |
40 grep \\ | |
41 -j $task.cpus \\ | |
42 -o ${prefix}.seqkit-grep.${extension}.gz \\ | |
43 \$additional_args \\ | |
44 $reads | |
45 | |
46 cat <<-END_VERSIONS > versions.yml | |
47 "${task.process}": | |
48 seqkit: \$( seqkit | sed '3!d; s/Version: //' ) | |
49 END_VERSIONS | |
50 """ | |
51 } else { | |
52 """ | |
53 pattern_file_contents=\$(sed '1!d' $pattern_file) | |
54 if [ "\$pattern_file_contents" != "DuMmY" ]; then | |
55 additional_args="-f $pattern_file $args" | |
56 else | |
57 additional_args="$args" | |
58 fi | |
59 | |
60 seqkit \\ | |
61 grep \\ | |
62 -j $task.cpus \\ | |
63 -o ${prefix}.R1.seqkit-grep.${extension}.gz \\ | |
64 \$additional_args \\ | |
65 ${reads[0]} | |
66 | |
67 seqkit \\ | |
68 grep \\ | |
69 -j $task.cpus \\ | |
70 -o ${prefix}.R2.seqkit-grep.${extension}.gz \\ | |
71 \$additional_args \\ | |
72 ${reads[1]} | |
73 | |
74 seqkit \\ | |
75 pair \\ | |
76 -j $task.cpus \\ | |
77 -1 ${prefix}.R1.seqkit-grep.${extension}.gz \\ | |
78 -2 ${prefix}.R2.seqkit-grep.${extension}.gz | |
79 | |
80 rm ${prefix}.R1.seqkit-grep.${extension}.gz | |
81 rm ${prefix}.R2.seqkit-grep.${extension}.gz | |
82 | |
83 cat <<-END_VERSIONS > versions.yml | |
84 "${task.process}": | |
85 seqkit: \$( seqkit | sed '3!d; s/Version: //' ) | |
86 END_VERSIONS | |
87 """ | |
88 } | |
89 } |