nf-core_modules/modules/vsearch/usearchglobal/main.nf

68 lines
2.7 KiB
Text
Raw Normal View History

2022-05-23 08:01:55 +00:00
process VSEARCH_USEARCHGLOBAL {
2022-05-26 18:16:45 +00:00
tag "${meta.id}"
2022-05-23 08:01:55 +00:00
label 'process_low'
conda (params.enable_conda ? "bioconda::vsearch=2.21.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
2022-05-26 18:16:45 +00:00
'https://depot.galaxyproject.org/singularity/vsearch:2.21.1--h95f258a_0':
2022-05-23 08:01:55 +00:00
'quay.io/biocontainers/vsearch:2.21.1--h95f258a_0' }"
input:
2022-05-30 11:01:06 +00:00
tuple val(meta), path(queryfasta)
2022-05-23 08:01:55 +00:00
path db
2022-05-26 18:16:45 +00:00
val idcutoff
2022-05-23 12:02:10 +00:00
val outoption
val user_columns
2022-05-23 08:01:55 +00:00
output:
2022-05-26 18:16:45 +00:00
tuple val(meta), path('*.aln') , optional: true, emit: aln
tuple val(meta), path('*.biom') , optional: true, emit: biom
tuple val(meta), path('*.lca') , optional: true, emit: lca
tuple val(meta), path('*.mothur') , optional: true, emit: mothur
tuple val(meta), path('*.otu') , optional: true, emit: otu
tuple val(meta), path('*.sam') , optional: true, emit: sam
tuple val(meta), path('*.tsv') , optional: true, emit: tsv
tuple val(meta), path('*.txt') , optional: true, emit: txt
tuple val(meta), path('*.uc') , optional: true, emit: uc
path "versions.yml" , emit: versions
2022-05-30 07:57:05 +00:00
2022-05-23 08:01:55 +00:00
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
2022-05-23 12:02:10 +00:00
def prefix = task.ext.prefix ?: "${meta.id}"
def columns = user_columns ? "--userfields ${user_columns}" : ''
switch ( outoption ) {
case "alnout": outfmt = "--alnout"; out_ext = 'aln'; break
case "biomout": outfmt = "--biomout"; out_ext = 'biom'; break
2022-05-26 18:16:45 +00:00
case "blast6out": outfmt = "--blast6out"; out_ext = 'txt'; break
case "mothur_shared_out": outfmt = "--mothur_shared_out"; out_ext = 'mothur'; break
case "otutabout": outfmt = "--otutabout"; out_ext = 'otu'; break
case "samout": outfmt = "--samout"; out_ext = 'sam'; break
case "uc": outfmt = "--uc"; out_ext = 'uc'; break
case "userout": outfmt = "--userout"; out_ext = 'tsv'; break
case "lcaout": outfmt = "--lcaout"; out_ext = 'lca'; break
2022-05-23 12:02:10 +00:00
default:
outfmt = "--alnout";
out_ext = 'aln';
log.warn("Unknown output file format provided (${outoption}): selecting pairwise alignments (alnout)");
2022-05-23 12:02:10 +00:00
break
}
2022-05-23 08:01:55 +00:00
"""
vsearch \\
--usearch_global $queryfasta \\
--db $db \\
2022-05-26 18:16:45 +00:00
--id $idcutoff \\
2022-05-23 08:01:55 +00:00
--threads $task.cpus \\
$args \\
2022-05-23 12:02:10 +00:00
${columns} \\
${outfmt} ${prefix}.${out_ext}
2022-05-23 08:01:55 +00:00
cat <<-END_VERSIONS > versions.yml
"${task.process}":
vsearch: \$(vsearch --version 2>&1 | head -n 1 | sed 's/vsearch //g' | sed 's/,.*//g' | sed 's/^v//' | sed 's/_.*//')
END_VERSIONS
"""
}