Mercurial > repos > kkonganti > cfsan_cronology
comparison 0.1.0/modules/cat/unique/main.nf @ 0:c8597e9e1a97
"planemo upload"
author | kkonganti |
---|---|
date | Mon, 27 Nov 2023 12:37:44 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c8597e9e1a97 |
---|---|
1 process CAT_UNIQUE { | |
2 tag "${meta.id}" | |
3 label "process_pico" | |
4 | |
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}perl${params.fs}5.30.0" : null) | |
6 conda (params.enable_conda ? "conda-forge::perl conda-forge::coreutils bioconda::perl-bioperl=1.7.8" : null) | |
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
8 'https://depot.galaxyproject.org/singularity/perl-bioperl:1.7.8--hdfd78af_1' : | |
9 'quay.io/biocontainers/perl-bioperl:1.7.8--hdfd78af_1' }" | |
10 | |
11 input: | |
12 tuple val(meta), path(file) | |
13 | |
14 output: | |
15 path '*_uniq.txt' , emit: txt | |
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 skip = (meta.skip_header ?: 1) | |
24 prefix = (task.ext.prefix ?: meta.id) | |
25 """ | |
26 newfile=\$(echo "$file" | sed -e 's/_w_dups/_uniq/g') | |
27 | |
28 head -n$skip "$file" > \$newfile | |
29 tail -n+\$(($skip + 1)) "$file" | sort -n | uniq >> \$newfile | |
30 | |
31 uniqver="" | |
32 | |
33 if [ "${workflow.containerEngine}" != "null" ]; then | |
34 uniqver=\$( uniq --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) | |
35 | |
36 else | |
37 uniqver=\$( uniq --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) | |
38 fi | |
39 | |
40 cat <<-END_VERSIONS > versions.yml | |
41 "${task.process}": | |
42 head: \$uniqver | |
43 tail: \$uniqver | |
44 sort: \$uniqver | |
45 uniq: \$uniqver | |
46 END_VERSIONS | |
47 """ | |
48 } |