diff --git a/src/components/Footer.astro b/src/components/Footer.astro index c4507d2d..57797850 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -93,7 +93,7 @@ import LogoSeqera from "../../public/img/assets/Logo_Seqera_white.svg";
1. Install Nextflow (version 25.10 or later)
diff --git a/src/pages/mixing-scripting-languages.md b/src/pages/mixing-scripting-languages.md index e296b20e..228bc1e8 100644 --- a/src/pages/mixing-scripting-languages.md +++ b/src/pages/mixing-scripting-languages.md @@ -1,44 +1,39 @@ --- -title: Multiple inputs +title: Mixed script pipeline layout: "@layouts/ExampleLayout.astro" ---- With Nextflow, you are not limited to Bash scripts -- you can use any scripting language! In other words, for each process you can use the language that best fits the specific task or that you simply prefer. +
+ This pipeline shows how to use different scripting languages in a single Nextflow pipeline. The first process uses a Perl script to generate random number pairs, and the second process uses a Python script to calculate the average of each pair.
```groovy -#!/usr/bin/env nextflow - +// Default parameter input params.range = 100 -/* - * A trivial Perl script that produces a list of number pairs - */ +// Perl process process perlTask { output: stdout - shell: - ''' + script: + """ #!/usr/bin/env perl use strict; use warnings; - my $count; - my $range = !{params.range}; - for ($count = 0; $count < 10; $count++) { - print rand($range) . ', ' . rand($range) . "\n"; + my \$count; + my \$range = ${params.range}; + for (\$count = 0; \$count < 10; \$count++) { + print rand(\$range) . ', ' . rand(\$range) . "\\n"; } - ''' + """ } -/* - * A Python script which parses the output of the previous script - */ +// Python process process pyTask { input: stdin @@ -46,6 +41,7 @@ process pyTask { output: stdout + script: """ #!/usr/bin/env python import sys @@ -63,6 +59,7 @@ process pyTask { """ } +// Workflow block workflow { perlTask | pyTask | view } @@ -72,9 +69,38 @@ workflow { ### Synopsis -In the above example we define a simple pipeline with two processes. +This pipeline defines two processes: + +• perlTask: executes a Perl script that generates 10 pairs of random numbers within a configurable range and prints them to standard output
• pyTask: executes a Python script that reads the pairs from standard input and calculates the average of each coordinate
1. Install Nextflow (version 25.10 or later)
+ +2. Create a new file named main.nf in your current directory
3. Copy and save the above script to your new file
+ +4. Run your pipeline:
+ +