1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-24 19:29:56 +00:00
taxprofiler/modules/nf-core/diamond/blastx/main.nf

69 lines
2.2 KiB
Text
Raw Normal View History

2022-04-29 19:59:42 +00:00
process DIAMOND_BLASTX {
tag "$meta.id"
label 'process_medium'
conda "bioconda::diamond=2.0.15"
2022-04-29 19:59:42 +00:00
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/diamond:2.0.15--hb97b32f_0' :
'quay.io/biocontainers/diamond:2.0.15--hb97b32f_0' }"
2022-04-29 19:59:42 +00:00
input:
tuple val(meta), path(fasta)
path db
val out_ext
val blast_columns
2022-04-29 19:59:42 +00:00
output:
tuple val(meta), path('*.blast'), optional: true, emit: blast
tuple val(meta), path('*.xml') , optional: true, emit: xml
tuple val(meta), path('*.txt') , optional: true, emit: txt
tuple val(meta), path('*.daa') , optional: true, emit: daa
tuple val(meta), path('*.sam') , optional: true, emit: sam
tuple val(meta), path('*.tsv') , optional: true, emit: tsv
tuple val(meta), path('*.paf') , optional: true, emit: paf
tuple val(meta), path("*.log") , emit: log
path "versions.yml" , emit: versions
2022-04-29 19:59:42 +00:00
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def columns = blast_columns ? "${blast_columns}" : ''
switch ( out_ext ) {
2022-04-29 19:59:42 +00:00
case "blast": outfmt = 0; break
case "xml": outfmt = 5; break
case "txt": outfmt = 6; break
case "daa": outfmt = 100; break
case "sam": outfmt = 101; break
case "tsv": outfmt = 102; break
case "paf": outfmt = 103; break
default:
outfmt = '6';
out_ext = 'txt';
log.warn("Unknown output file format provided (${out_ext}): selecting DIAMOND default of tabular BLAST output (txt)");
break
2022-04-29 19:59:42 +00:00
}
"""
DB=`find -L ./ -name "*.dmnd" | sed 's/\\.dmnd\$//'`
2022-04-29 19:59:42 +00:00
diamond \\
blastx \\
--threads $task.cpus \\
--db \$DB \\
--query $fasta \\
--outfmt ${outfmt} ${columns} \\
2022-04-29 19:59:42 +00:00
$args \\
--out ${prefix}.${out_ext} \\
--log
mv diamond.log ${prefix}.log
2022-04-29 19:59:42 +00:00
cat <<-END_VERSIONS > versions.yml
"${task.process}":
diamond: \$(diamond --version 2>&1 | tail -n 1 | sed 's/^diamond version //')
END_VERSIONS
"""
}