Hi everyone,
I’m working on integrating a simple ‘Hello World’ Nextflow script into Galaxy by wrapping it in an XML tool definition. My goal is to execute the script by clicking the run button in Galaxy, have it run in the background, and then bring the output text file into the history section.
I’m using a local Galaxy instance on a server. I’ve created both the .nf
and .xml
files and tested the tool with Planemo (both with update-test-data
and test
), and everything worked fine. However, when I attempt to run the tool within Galaxy, it stalls indefinitely without producing any output.
I believe the issue might lie in how I’m handling the output file between Nextflow and Galaxy. Since both generate outputs to dynamic paths, I’m using the publishDir
parameter in Nextflow to publish the output to the working directory. The challenge arises because Nextflow expects a specific filename in the run
command. If I specify --output_file '$hello_output'
, Planemo update-test-data
produces an empty test output. On the other hand, if I specify --output_file 'hello_output.txt'
, the test passes but the tool stalls in Galaxy.
As a beginner with Nextflow and programming in general, I may be missing some crucial details. Could someone help me bridge this gap and connect the dots to ensure the output gets properly captured in Galaxy?
Below are my scripts for reference. Any guidance would be greatly appreciated!
Thank you in advance for your help.
~/galaxy/tools/nextflow_pipelines/hello/hello.nf
#!/usr/bin/env nextflow
/*
* Use echo to print 'Hello World!' to standard out
*/
params.output_file = 'hello_output.txt' // Keep this as a file name, not a path
params.greeting = 'Bonjour, World!'
process sayHello {
publishDir '.', mode: 'copy' // Use the current directory for Galaxy to detect the file
input:
val greeting
output:
path params.output_file // Output the file to the current working directory
script:
"""
echo '$greeting' > $params.output_file
"""
}
workflow {
// create a channel for inputs
greeting_ch = Channel.of(params.greeting)
// run the process with the input channel
sayHello(greeting_ch)
}
~/galaxy/tools/nextflow_pipelines/hello/hello_nextflow.xml
<?xml version="1.0" encoding="UTF-8"?>
<tool id="nextflow_hello" name="Hello World via Nextflow" version="1.0">
<description>Simple Hello World using Nextflow</description>
<requirements>
<requirement type="package" version="24.04.4">nextflow</requirement>
<requirement type="package" version="11">openjdk</requirement>
</requirements>
<command><![CDATA[
nextflow run /home/refgen/galaxy/tools/nextflow_pipelines/hello/hello.nf --greeting '$greeting' --output_file 'hello_output.txt'
]]></command>
<inputs>
<param name="greeting" type="text" label="Greeting Message" value="Bonjour, Galaxy!"/>
</inputs>
<outputs>
<data name="hello_output" format="txt" label="Hello World Output" from_work_dir="hello_output.txt"/>
</outputs>
<tests>
<test>
<param name="greeting" value="Hello, Planemooo!"/>
<output name="hello_output" file="hello_output.txt"/>
</test>
</tests>
<help><![CDATA[
This tool runs a simple Nextflow pipeline that outputs a message to a text file.
**Inputs**
- **Message to say**: The message that will be written to the output file.
**Outputs**
- **Hello World Output**: A text file containing the message.
**Dependencies**
This tool requires:
- Nextflow 24.04.4
- OpenJDK 11
These dependencies are managed via Conda.
]]></help>
<citations>
<citation type="doi">10.1038/nbt.3820</citation>
</citations>
</tool>