Skip to content

Commit b265dee

Browse files
committed
feat: Reorganize pipeline examples into clean directory structure
Restructure pipeline examples from flat files to organized subdirectories under /examples/, with colocated docs and code files. - Move examples.astro → examples/index.astro - Create subdirs: basic-pipeline/, blast-pipeline/, rna-seq-pipeline/, machine-learning-pipeline/, mixing-scripting-languages/ - Extract embedded Nextflow code from .md to separate main.nf files - Convert .md to .mdx with Expressive Code imports - Clean URLs without trailing slashes (/examples/basic-pipeline) - Update all navigation and links to new structure - Fix active page highlighting in side navigation - Add backward compatibility redirects Better organization, consistent patterns, maintainable structure.
1 parent 9ae2899 commit b265dee

File tree

16 files changed

+240
-202
lines changed

16 files changed

+240
-202
lines changed

netlify.toml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,41 @@
2323

2424
[[redirects]]
2525
from = "/example1.html"
26-
to = "/basic-pipeline.html"
26+
to = "/examples/basic-pipeline"
2727

2828
[[redirects]]
2929
from = "/example2.html"
30-
to = "/mixing-scripting-languages.html"
30+
to = "/examples/mixing-scripting-languages"
3131

3232
[[redirects]]
3333
from = "/example3.html"
34-
to = "/blast-pipeline.html"
34+
to = "/examples/blast-pipeline"
3535

3636
[[redirects]]
3737
from = "/example4.html"
38-
to = "/rna-seq-pipeline.html"
38+
to = "/examples/rna-seq-pipeline"
3939

4040
[[redirects]]
4141
from = "/example5.html"
42-
to = "/machine-learning-pipeline.html"
42+
to = "/examples/machine-learning-pipeline"
43+
44+
# Direct redirects from old .html files to new structure
45+
[[redirects]]
46+
from = "/basic-pipeline.html"
47+
to = "/examples/basic-pipeline"
48+
49+
[[redirects]]
50+
from = "/mixing-scripting-languages.html"
51+
to = "/examples/mixing-scripting-languages"
52+
53+
[[redirects]]
54+
from = "/blast-pipeline.html"
55+
to = "/examples/blast-pipeline"
56+
57+
[[redirects]]
58+
from = "/rna-seq-pipeline.html"
59+
to = "/examples/rna-seq-pipeline"
60+
61+
[[redirects]]
62+
from = "/machine-learning-pipeline.html"
63+
to = "/examples/machine-learning-pipeline"

src/components/Footer.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,28 @@ import LogoSeqera from "../../public/img/assets/Logo_Seqera_whote.svg";
8686
<ul class="examples-list pl-0">
8787
<li class="title text-white font-inter text-xs font-bold">Examples</li>
8888
<li>
89-
<a class="text-white font-inter text-xs font-normal leading-normal" href="/basic-pipeline.html"
89+
<a class="text-white font-inter text-xs font-normal leading-normal" href="/examples/basic-pipeline"
9090
>Basic pipeline</a
9191
>
9292
</li>
9393
<li>
9494
<a
9595
class="text-white font-inter text-xs font-normal leading-normal"
96-
href="/mixing-scripting-languages.html">Mixing scripting languages</a
96+
href="/examples/mixing-scripting-languages">Mixing scripting languages</a
9797
>
9898
</li>
9999
<li>
100-
<a class="text-white font-inter text-xs font-normal leading-normal" href="/blast-pipeline.html"
100+
<a class="text-white font-inter text-xs font-normal leading-normal" href="/examples/blast-pipeline"
101101
>BLAST pipeline</a
102102
>
103103
</li>
104104
<li>
105-
<a class="text-white font-inter text-xs font-normal leading-normal" href="/rna-seq-pipeline.html"
105+
<a class="text-white font-inter text-xs font-normal leading-normal" href="/examples/rna-seq-pipeline"
106106
>RNA-Seq pipeline</a
107107
>
108108
</li>
109109
<li>
110-
<a class="text-white font-inter text-xs font-normal leading-normal" href="/machine-learning-pipeline.html"
110+
<a class="text-white font-inter text-xs font-normal leading-normal" href="/examples/machine-learning-pipeline"
111111
>Machine Learning pipeline</a
112112
>
113113
</li>

src/components/Menu/Menu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,27 +192,27 @@ const Menu = ({}) => {
192192
</a>
193193
<ul className="dropdown-menu" role="menu" onClick={handleMenuItemClick}>
194194
<li>
195-
<a href="/basic-pipeline.html" tabIndex={0}>
195+
<a href="/examples/basic-pipeline" tabIndex={0}>
196196
Basic pipeline
197197
</a>
198198
</li>
199199
<li>
200-
<a href="/mixing-scripting-languages.html" tabIndex={0}>
200+
<a href="/examples/mixing-scripting-languages" tabIndex={0}>
201201
Mixing scripting languages
202202
</a>
203203
</li>
204204
<li>
205-
<a href="/blast-pipeline.html" tabIndex={0}>
205+
<a href="/examples/blast-pipeline" tabIndex={0}>
206206
BLAST pipeline
207207
</a>
208208
</li>
209209
<li>
210-
<a href="/rna-seq-pipeline.html" tabIndex={0}>
210+
<a href="/examples/rna-seq-pipeline" tabIndex={0}>
211211
RNA-Seq pipeline
212212
</a>
213213
</li>
214214
<li>
215-
<a href="/machine-learning-pipeline.html" tabIndex={0}>
215+
<a href="/examples/machine-learning-pipeline" tabIndex={0}>
216216
Machine Learning pipeline
217217
</a>
218218
</li>

src/components/SideNavigation/ExamplesSideNav.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ const ExamplesSideNav = () => {
77
useEffect(() => {
88
if (typeof window !== 'undefined') {
99
const path = window.location.pathname;
10-
const filename = path.split('/').pop();
11-
12-
if (filename) {
13-
const match = filename.match(/example(\d+)/);
14-
if (match && match[1]) {
15-
setActiveId(`example${match[1]}`);
16-
}
10+
11+
// Extract pipeline name from /examples/pipeline-name/ format
12+
const match = path.match(/\/examples\/([^\/]+)\/?$/);
13+
if (match && match[1]) {
14+
setActiveId(match[1]);
1715
}
1816
}
1917
}, []);
@@ -22,27 +20,27 @@ const ExamplesSideNav = () => {
2220
{
2321
id: 'basic-pipeline',
2422
title: 'Basic pipeline',
25-
href: 'basic-pipeline.html'
23+
href: '/examples/basic-pipeline'
2624
},
2725
{
2826
id: 'mixing-scripting-languages',
2927
title: 'Mixing scripting languages',
30-
href: 'mixing-scripting-languages.html'
28+
href: '/examples/mixing-scripting-languages'
3129
},
3230
{
3331
id: 'blast-pipeline',
3432
title: 'BLAST pipeline',
35-
href: 'blast-pipeline.html'
33+
href: '/examples/blast-pipeline'
3634
},
3735
{
3836
id: 'rna-seq-pipeline',
3937
title: 'RNA-Seq pipeline',
40-
href: 'rna-seq-pipeline.html'
38+
href: '/examples/rna-seq-pipeline'
4139
},
4240
{
4341
id: 'machine-learning-pipeline',
4442
title: 'Machine Learning pipeline',
45-
href: 'machine-learning-pipeline.html'
43+
href: '/examples/machine-learning-pipeline'
4644
}
4745
];
4846

src/pages/basic-pipeline.mdx renamed to src/pages/examples/basic-pipeline/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: "@layouts/ExampleLayout.astro"
44
---
55

66
import { Code } from 'astro-expressive-code/components'
7-
import pipelineCode from '../examples/basic-pipeline.nf?raw'
7+
import pipelineCode from './main.nf?raw'
88

99
<div class="blg-summary example">
1010
<h2>Basic pipeline</h2>
File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: BLAST pipeline
3+
layout: "@layouts/ExampleLayout.astro"
4+
---
5+
6+
import { Code } from 'astro-expressive-code/components'
7+
import pipelineCode from './main.nf?raw'
8+
9+
<div class="blg-summary example">
10+
<h2>BLAST pipeline</h2>
11+
12+
<p class="">
13+
This example splits a FASTA file into chunks and executes a BLAST query for each chunk in parallel. Then, all the sequences for the top hits are collected and merged into a single result file.
14+
</p>
15+
16+
<Code
17+
code={pipelineCode}
18+
lang="nextflow"
19+
/>
20+
21+
</div>
22+
23+
### Try it on your computer
24+
25+
To run this pipeline on your computer, you will need:
26+
27+
- Unix-like operating system
28+
- Java 17 (or higher)
29+
- Docker
30+
31+
Install Nextflow by entering the following command in the terminal:
32+
33+
$ curl -fsSL https://get.nextflow.io | bash
34+
35+
Then launch the pipeline with this command:
36+
37+
$ ./nextflow run blast-example -with-docker
38+
39+
It will automatically download the pipeline [GitHub repository](https://github.com/nextflow-io/blast-example) and the associated Docker images, thus the first execution may take a few minutes to complete depending on your network connection.
40+
41+
**NOTE**: To run this example with versions of Nextflow older than 22.04.0, you must include the `-dsl2` flag with `nextflow run`.

src/pages/blast-pipeline.md renamed to src/pages/examples/blast-pipeline/main.nf

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
---
2-
title: BLAST pipeline
3-
layout: "@layouts/ExampleLayout.astro"
4-
---
5-
6-
<div class="blg-summary example">
7-
<h2>BLAST pipeline</h2>
8-
9-
<p class="">
10-
This example splits a FASTA file into chunks and executes a BLAST query for each chunk in parallel. Then, all the sequences for the top hits are collected and merged into a single result file.
11-
</p>
12-
13-
```groovy
141
#!/usr/bin/env nextflow
152

163
/*
@@ -85,27 +72,4 @@ process extract {
8572
"""
8673
blastdbcmd -db $db/$db_name -entry_batch top_hits | head -n 10 > sequences
8774
"""
88-
}
89-
```
90-
91-
</div>
92-
93-
### Try it on your computer
94-
95-
To run this pipeline on your computer, you will need:
96-
97-
- Unix-like operating system
98-
- Java 17 (or higher)
99-
- Docker
100-
101-
Install Nextflow by entering the following command in the terminal:
102-
103-
$ curl -fsSL https://get.nextflow.io | bash
104-
105-
Then launch the pipeline with this command:
106-
107-
$ ./nextflow run blast-example -with-docker
108-
109-
It will automatically download the pipeline [GitHub repository](https://github.com/nextflow-io/blast-example) and the associated Docker images, thus the first execution may take a few minutes to complete depending on your network connection.
110-
111-
**NOTE**: To run this example with versions of Nextflow older than 22.04.0, you must include the `-dsl2` flag with `nextflow run`.
75+
}

src/pages/examples.astro renamed to src/pages/examples/index.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,33 @@ import ExamplesSideNav from "@components/SideNavigation/ExamplesSideNav";
2525
<p class="mb-4">
2626
Learn how to create a simple pipeline with two processes that communicate via channels.
2727
</p>
28-
<a href="basic-pipeline.html" class="text-nextflow-green hover:underline">View example →</a>
28+
<a href="/examples/basic-pipeline" class="text-nextflow-green hover:underline">View example →</a>
2929
</div>
3030

3131
<div class="border rounded-lg p-6 hover:shadow-md transition-shadow">
3232
<h3 class="text-xl font-medium mb-2">Multiple inputs</h3>
3333
<p class="mb-4">
3434
Discover how to manage multiple inputs and complex data dependencies in your workflows.
3535
</p>
36-
<a href="mixing-scripting-languages.html" class="text-nextflow-green hover:underline">View example →</a>
36+
<a href="/examples/mixing-scripting-languages" class="text-nextflow-green hover:underline">View example →</a>
3737
</div>
3838

3939
<div class="border rounded-lg p-6 hover:shadow-md transition-shadow">
4040
<h3 class="text-xl font-medium mb-2">Channel operators</h3>
4141
<p class="mb-4">Explore powerful channel operators for transforming and manipulating data streams.</p>
42-
<a href="blast-pipeline.html" class="text-nextflow-green hover:underline">View example →</a>
42+
<a href="/examples/blast-pipeline" class="text-nextflow-green hover:underline">View example →</a>
4343
</div>
4444

4545
<div class="border rounded-lg p-6 hover:shadow-md transition-shadow">
4646
<h3 class="text-xl font-medium mb-2">Processes and Channels</h3>
4747
<p class="mb-4">See advanced techniques for connecting processes through different channel types.</p>
48-
<a href="rna-seq-pipeline.html" class="text-nextflow-green hover:underline">View example →</a>
48+
<a href="/examples/rna-seq-pipeline" class="text-nextflow-green hover:underline">View example →</a>
4949
</div>
5050

5151
<div class="border rounded-lg p-6 hover:shadow-md transition-shadow">
5252
<h3 class="text-xl font-medium mb-2">Error strategies</h3>
5353
<p class="mb-4">Learn how to handle errors and implement robust error recovery strategies.</p>
54-
<a href="machine-learning-pipeline.html" class="text-nextflow-green hover:underline">View example →</a>
54+
<a href="/examples/machine-learning-pipeline" class="text-nextflow-green hover:underline">View example →</a>
5555
</div>
5656
</div>
5757
</div>

src/pages/machine-learning-pipeline.md renamed to src/pages/examples/machine-learning-pipeline/index.mdx

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,20 @@ title: Error strategies
33
layout: "@layouts/ExampleLayout.astro"
44
---
55

6+
import { Code } from 'astro-expressive-code/components'
7+
import pipelineCode from './main.nf?raw'
8+
69
<div class="blg-summary example">
710
<h2>Machine Learning pipeline</h2>
811

912
<p class="">
1013
This example shows how to put together a basic Machine Learning pipeline. It fetches a dataset from OpenML, trains a variety of machine learning models on a prediction target, and selects the best model based on some evaluation criteria.
1114
</p>
1215

13-
```groovy
14-
#!/usr/bin/env nextflow
15-
16-
params.dataset_name = 'wdbc'
17-
params.train_models = ['dummy', 'gb', 'lr', 'mlp', 'rf']
18-
params.outdir = 'results'
19-
20-
workflow {
21-
// fetch dataset from OpenML
22-
ch_datasets = fetch_dataset(params.dataset_name)
23-
24-
// split dataset into train/test sets
25-
(ch_train_datasets, ch_predict_datasets) = split_train_test(ch_datasets)
26-
27-
// perform training
28-
(ch_models, ch_train_logs) = train(ch_train_datasets, params.train_models)
29-
30-
// perform inference
31-
ch_predict_inputs = ch_models.combine(ch_predict_datasets, by: 0)
32-
(ch_scores, ch_predict_logs) = predict(ch_predict_inputs)
33-
34-
// select the best model based on inference score
35-
ch_scores
36-
| max {
37-
new JsonSlurper().parse(it[2])['value']
38-
}
39-
| subscribe { dataset_name, model_type, score_file ->
40-
def score = new JsonSlurper().parse(score_file)
41-
println "The best model for ${dataset_name} was ${model_type}, with ${score['name']} = ${score['value']}"
42-
}
43-
}
44-
45-
// view the entire code on GitHub ...
46-
47-
```
16+
<Code
17+
code={pipelineCode}
18+
lang="nextflow"
19+
/>
4820

4921
</div>
5022

@@ -66,4 +38,4 @@ Then launch the pipeline with this command:
6638

6739
It will automatically download the pipeline [GitHub repository](https://github.com/nextflow-io/ml-hyperopt) and build a Docker image on-the-fly using [Wave](https://seqera.io/wave/), thus the first execution may take a few minutes to complete depending on your network connection.
6840

69-
**NOTE**: Nextflow 22.10.0 or newer is required to run this pipeline with Wave.
41+
**NOTE**: Nextflow 22.10.0 or newer is required to run this pipeline with Wave.

0 commit comments

Comments
 (0)