Hi All,
I’ve created a process that uses a Python script to iterate over a directory of results per sample to determine the best reference fasta for that sample for downstream analysis. The final output of the script is the fasta name. The inputs to the process are the sample results and a path to possible fastas. The goal of this process is to only emit the fasta that was outputted by the Python script. I think I’m having a disconnect between how to use the text outputted by the Python script and have nextflow register that as the file name to output as the path. Below is my code and output. Thanks!
process GETBESTREF {
tag "$meta.id"
label 'process_medium'
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pandas%3A1.5.2':
'quay.io/biocontainers/pandas%3A1.5.2' }"
input:
tuple val(meta) , path(results)
path(fastas)
output:
tuple val(meta), path("\${best_ref_path}") , emit: sample_ref
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
#ls
best_ref_path="\$(find_best_ref.py $results)"
echo "\${best_ref_path}"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
getbestref: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
END_VERSIONS
"""
}```
ERROR ~ Error executing process > 'NFCORE_HEPATITISCDENOVO:HEPATITISCDENOVO:GETBESTREF (Sample_1)'
Caused by:
Missing output file(s) `${best_ref_path}` expected by process `NFCORE_HEPATITISCDENOVO:HEPATITISCDENOVO:GETBESTREF (Sample_1)`
Command executed:
#ls
best_ref_path="$(find_best_ref.py Sample_1)"
echo "${best_ref_path}"
cat <<-END_VERSIONS > versions.yml
"NFCORE_HEPATITISCDENOVO:HEPATITISCDENOVO:GETBESTREF":
getbestref: $(echo $(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*$//' ))
END_VERSIONS
Command exit status:
0
Command output:
D17763.fasta
Work dir:
/nf-core-hepatitiscdenovo/work/1b/b0e4a0e47332954a851dc79c5204eb
Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line
-- Check '.nextflow.log' file for details