2022-04-29 19:59:42 +00:00
|
|
|
process DIAMOND_BLASTX {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
2022-05-07 03:22:35 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::diamond=2.0.15" : null)
|
2022-04-29 19:59:42 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-05-07 03:22:35 +00:00
|
|
|
'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
|
2022-05-07 03:22:35 +00:00
|
|
|
val out_ext
|
|
|
|
val blast_columns
|
2022-04-29 19:59:42 +00:00
|
|
|
|
|
|
|
output:
|
2022-05-07 03:22:35 +00:00
|
|
|
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
|
2022-07-15 14:28:07 +00:00
|
|
|
tuple val(meta), path("*.log") , emit: log
|
2022-05-07 03:22:35 +00:00
|
|
|
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}"
|
2022-05-07 03:22:35 +00:00
|
|
|
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
|
2022-05-07 03:22:35 +00:00
|
|
|
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//'`
|
|
|
|
|
|
|
|
diamond \\
|
|
|
|
blastx \\
|
|
|
|
--threads $task.cpus \\
|
|
|
|
--db \$DB \\
|
|
|
|
--query $fasta \\
|
2022-05-07 03:22:35 +00:00
|
|
|
--outfmt ${outfmt} ${columns} \\
|
2022-04-29 19:59:42 +00:00
|
|
|
$args \\
|
2022-07-15 14:28:07 +00:00
|
|
|
--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
|
|
|
|
"""
|
|
|
|
}
|