Hey @mribeirodantas ,
I’ve accidentally copied version of the code which did not include the output block since I’ve already tried different versions to resolve the problem described. Sorry for that, here’s the code with the output block, using the workflow outputs.
#! /usr/bin/env nextflow
process run_irma {
conda './envs/IRMA_env.yml'
tag "$sample_id"
input:
tuple val(sample_id), path(fastqs), val(mode), val(seq_type)
output:
path("${sample_id}"), emit: out
script:
"""
sample_dir="${sample_id}"
if [ $seq_type == 'minion' ] ; then
conda run -n IRMA IRMA ${mode} ${fastqs[0]} \$sample_dir
elif [ $seq_type == 'nextseq' ] || [ $seq_type == 'miseq' ]; then
conda run -n IRMA IRMA ${mode} ${fastqs[0]} ${fastqs[1]} \$sample_dir
fi
"""
}
and the main.nf
nextflow.preview.output = true
params.now = new Date().format("yyyy-MM-dd_HH-mm")
params.input_dir = null
params.output_dir = "irma_results_${params.now}"
params.input_type = null // 'nextseq', 'miseq', or 'minion'
/*
Import modules
*/
include { run_irma } from './modules/runIrma.nf'
workflow {
main:
if (!params.input_dir) {
error "Please provide a folder path using --input_dir"
}
if (params.input_type == 'nextseq') {
println "Processing NextSeq data"
def mode = 'FLU'
println "Mode is set to $mode "
sample_files = Channel
.fromFilePairs("${params.input_dir}/*_{R1,R2}*.fastq.gz")
.ifEmpty { error "No sample fastqs found in: ${params.input_dir}" }
irma_inputs = sample_files
.map { sample_id, fastqs ->
sample_id = sample_id.tokenize('_')[0]
tuple(sample_id, fastqs, mode, params.input_type)
}
} else {
error "Unsupported input type: ${params.input_type}. Supported types are: nextseq"
}
run_irma(irma_inputs)
publish:
irma_results = run_irma.out
}
output {
irma_results {
path { _path -> "${params.output_dir}" }
}
}
These produce following folders for two test samples
/results/irma_results_2025-09-01_13-54/test_sample1/
/results/irma_results_2025-09-01_13-54/test_sample2/
in these folders are IRMA’s results.
However, the FASTA files in the amended_consensus/ subfolder are misnamed.
Running IRMA directly on the command line / or with conda produces segment-specific names:
/results/irma_results_2025-09-01_13-54/test_sample1/amended_consensus/test_sample1_HA.fa
/results/irma_results_2025-09-01_13-54/test_sample1/amended_consensus/test_sample1_NA.fa
Running IRMA via Nextflow produces generic numbered names:
amended_consensus/test_sample1_1.fa
amended_consensus/test_sample1_2.fa
The segment names (_HA, _NA) are lost in the Nextflow run. This naming is important for downstream analyses, because these suffixes indicate the viral segment in each FASTA file.