Skip to content

Commit

Permalink
more process updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cjfields committed Dec 4, 2023
1 parent 7008f11 commit 35aded0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions _episodes/05-processes-part1.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To add the process to a workflow add a `workflow` block, and call the process li
**Note:** As we are using DSL2 we need to include `nextflow.enable.dsl=2` in the script.

~~~
//process_index.nf
// process/process_index.nf
nextflow.enable.dsl=2
process INDEX {
Expand Down Expand Up @@ -118,10 +118,10 @@ Tip: you can try to figure out what's wrong by changing to the process work dir

What happened? Well, in our case we can't see the `salmon` executable; the error indicates it is not found.

How do we address this? There are a number of options, but the general 'best practice' way would be to use a __directive__ which loads the software into the environment when the script is run. For example, this could be done by using the `module` directive and the appropriate [environment module](https://modules.sourceforge.net):
How do we address this? There are a number of options, but the general 'best practice' way would be to use a __directive__ which loads the software into the environment when the script is run. For example, this could be done by using the `module` directive and the appropriate [environment module](https://modules.sourceforge.net). Below is a modified version of the script in `./process/process_index.nf` which includes such a directive:

~~~
//process_index.nf
nextflow.enable.dsl=2
process INDEX {
Expand Down Expand Up @@ -244,8 +244,6 @@ For example:
nextflow.enable.dsl=2

process PROCESSBAM {
module "SAMtools/1.17-IGB-gcc-8.2.0"

script:
"""
samtools sort -o ref1.sorted.bam ${projectDir}/data/yeast/bams/ref1.bam
Expand Down Expand Up @@ -313,7 +311,7 @@ workflow {
~~~
{: .language-groovy }
This allows the use of a different programming languages which may better fit a particular job. However, for large chunks of code it is suggested to save them into separate files and invoke them from the process script.
This allows the use of a different programming languages which may better fit a particular job. However, for large chunks of code it is suggested to save them into separate files and invoke them from the process script.
~~~
nextflow.enable.dsl=2
Expand All @@ -332,6 +330,8 @@ workflow {
~~~
{: .language-groovy }
Note that you will need to ensure any libraries are also loaded in if they are needed (e.g, Python libraries like `pandas`, or R libraries like `ggplot2`).
> ## Associated scripts
> Scripts such as the one in the example above, `myscript.py`, can be stored in a `bin` folder at the same directory level as the Nextflow workflow script that invokes them, and given execute permission. Nextflow will automatically add this folder to the `PATH` environment variable. To invoke the script in a Nextflow process, simply use its filename on its own rather than invoking the interpreter e.g. `myscript.py` instead of `python myscript.py`.
{: .callout }
Expand Down

0 comments on commit 35aded0

Please sign in to comment.