Solution:
1) Add output name as dir/filename after qualifier in the process taxonomy:
`process taxonomy{
publishDir params.outdir, mode:'copy'
input:
file "table-denoised.qza"
file "sklearn-taxonomyITS.qza"
file "vsearch-taxonomyITS.qza"
file "blast-taxonomyITS.qza"
output:
path ("feature-table/feature-table.biom"), emit: feature_table_biom
path ("sklearn-taxonomy/taxonomy.tsv"), emit: sklearn_taxonomy_tsv
path ("vsearch-taxonomy/taxonomy.tsv"), emit: vsearch_taxonomy_tsv
path ("blast-taxonomy/taxonomy.tsv"), emit: blast_taxonomy_tsv
script:
"""
qiime tools export \
--input-path table-denoised.qza \
--output-path feature-table
qiime tools export \
--input-path sklearn-taxonomyITS.qza \
--output-path sklearn-taxonomy
qiime tools export \
--input-path vsearch-taxonomyITS.qza \
--output-path vsearch-taxonomy
qiime tools export \
--input-path blast-taxonomyITS.qza \
--output-path blast-taxonomy
"""
}
`
2) process replace_header: define the paths in output chunck as the names of the files; In the script chunck provide full path to the file to be edited and redirect the output into a new file.
process REPLACE_HEADER {
publishDir params.outdir, mode:'copy'
input:
path "vsearch-taxonomy/taxonomy.tsv"
path "sklearn-taxonomy/taxonomy.tsv"
path "blast-taxonomy/taxonomy.tsv"
output:
path ("vsearch_taxonomy.tsv"), emit: file_vsearch_taxonomy_tsv
path ("sklearn_taxonomy.tsv"), emit: file_sklearn_taxonomy_tsv
path ("blast_taxonomy.tsv"), emit: file_blast_taxonomy_tsv
script:
"""
sed 's/Feature ID/#otu-id/g' vsearch-taxonomy/taxonomy.tsv > vsearch_taxonomy.tsv
sed 's/Feature ID/#otu-id/g' sklearn-taxonomy/taxonomy.tsv > sklearn_taxonomy.tsv
sed 's/Feature ID/#otu-id/g' blast-taxonomy/taxonomy.tsv > blast_taxonomy.tsv
"""
}
Please use the formatting bar (especially the

codeoption) to present your post better. You can use backticks for inline code (`text` becomestext), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.please validate/comment the answers to your previous questions: How to install non conda software ; Age nodes in R