|
| 1 | +process SAVONT_ASV { |
| 2 | + tag "$meta.id" |
| 3 | + label 'process_medium' |
| 4 | + label 'process_long' |
| 5 | + |
| 6 | + conda "bioconda::savont=0.6.1c" |
| 7 | + container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ? |
| 8 | + 'https://depot.galaxyproject.org/singularity/savont:0.6.1c--hec9b1f2_0' : |
| 9 | + 'biocontainers/savont:0.6.1c--hec9b1f2_0' }" |
| 10 | + |
| 11 | + input: |
| 12 | + tuple val(meta), path(reads), val(sample_string) |
| 13 | + |
| 14 | + output: |
| 15 | + path("*_feature-table.tsv") , emit: asv |
| 16 | + path("*_final_asvs.fasta") , emit: fasta |
| 17 | + path("*_final_clusters.tsv"), emit: clusters |
| 18 | + path("savont_asv_*/temp/*") , emit: temp |
| 19 | + tuple val(meta), path("savont_asv_*"), emit: output_folder |
| 20 | + path("*_savont.log") , emit: log |
| 21 | + tuple val("${task.process}"), val('savont'), eval("savont --version 2>&1 | cut -d ' ' -f 2"), topic: versions, emit: versions_savont |
| 22 | + |
| 23 | + script: |
| 24 | + def prefix = task.ext.prefix ?: "$meta.id" |
| 25 | + def args = task.ext.args ?: '' |
| 26 | + def reads_cmd = reads instanceof List ? "--pooled-samples ${reads.join(' ')}" : "${reads}" |
| 27 | + """ |
| 28 | + savont asv \\ |
| 29 | + -t $task.cpus \\ |
| 30 | + $args \\ |
| 31 | + -o savont_asv_${prefix} \\ |
| 32 | + $reads_cmd |
| 33 | +
|
| 34 | + # adjust the naming of the samples: |
| 35 | + sed '1s/.*/${sample_string}/' savont_asv_${prefix}/feature-table.tsv > ${prefix}_feature-table.tsv |
| 36 | +
|
| 37 | + # copy other files to include the prefix |
| 38 | + cp savont_asv_${prefix}/final_asvs.fasta ${prefix}_final_asvs.fasta |
| 39 | + cp savont_asv_${prefix}/final_clusters.tsv ${prefix}_final_clusters.tsv |
| 40 | + cp savont_asv_${prefix}/savont_*.log ${prefix}_savont.log |
| 41 | + """ |
| 42 | +} |
0 commit comments