Skip to content

Commit 12d8cde

Browse files
pinin4fjordsCopilotclaudebentsherman
authored
Add Scripting essentials module (#652)
* Add AI-assisted Groovy essentials * Refine section 1.1 * Add groovy essentials to nav * Fix list rendering * Emphasise departure to groovy * Shorten intro * Shorten intro * Fix highlight * Refine section 1.2 * messy updates up to section 4 * State after a good chat wiht Claude code * Tone down intro * Reset collect.nf to starting state * Tweaks * Reset collect.nf to starting state * Tweaks * Revert main.nf to starting point * Tweaks * backticks fix? * Reset fastp module to starting point * Fix fastp * tweaks * latest tweaks, simplify the variable interpretation part * Reorg subsections a bit * Fix highlights * Fix up dynamic resources * Fix up dynamic routing * Final tweaks * Language/ clarity improvements * Prettier * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Add teach time estimate for groovy * Fix formatting * Some section 2 fixes * Fix highlights * Fix tiny issues * More Groovy fixes * update time estimate * Refactor Groovy Essentials to Essential Scripting Patterns Address reviewer feedback to reframe content away from "Nextflow vs Groovy" and toward presenting Nextflow as a standalone language. Major changes: - Renamed from groovy_essentials to essential_scripting_patterns - Updated terminology: "dataflow vs scripting" instead of "Nextflow vs Groovy" - Reframed collect example as Channel vs Iterable types in Nextflow standard library - Added historical context about Groovy while emphasizing Nextflow language specification - Updated all code comments and examples to reference Nextflow standard library - Prioritized Nextflow documentation in resources section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Prettier * Update title to Essential Nextflow Scripting Patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Apply suggestions from code review Co-authored-by: Ben Sherman <[email protected]> * Easy fixes for Ben * Iterable -> List * Fixes up to handlers * Fix highlight * Tighten intro * Tiny fixes --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Ben Sherman <[email protected]>
1 parent bd44a0b commit 12d8cde

File tree

19 files changed

+2658
-10
lines changed

19 files changed

+2658
-10
lines changed

docs/side_quests/essential_scripting_patterns.md

Lines changed: 2315 additions & 0 deletions
Large diffs are not rendered by default.

docs/side_quests/index.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ Otherwise, select a side quest from the table below.
2828

2929
## Side Quests
3030

31-
| Side Quest | Time Estimate for Teaching |
32-
| ----------------------------------------------------------------- | -------------------------- |
33-
| [Nextflow development environment walkthrough](./ide_features.md) | 45 mins |
34-
| [Introduction to nf-core](./nf-core.md) | - |
35-
| [Metadata in workflows](./metadata.md) | 45 mins |
36-
| [Splitting and Grouping](./splitting_and_grouping.md) | 45 mins |
37-
| [Testing with nf-test](./nf-test.md) | 1 hour |
38-
| [Workflows of workflows](./workflows_of_workflows.md) | 30 mins |
39-
| [Working with files](./working_with_files.md) | 45 mins |
40-
| [Debugging workflows](./debugging.md) | 1 hour |
31+
| Side Quest | Time Estimate for Teaching |
32+
| -------------------------------------------------------------------------- | -------------------------- |
33+
| [Nextflow development environment walkthrough](./ide_features.md) | 45 mins |
34+
| [Essential Nextflow Scripting Patterns](./essential_scripting_patterns.md) | 90 mins |
35+
| [Introduction to nf-core](./nf-core.md) | - |
36+
| [Metadata in workflows](./metadata.md) | 45 mins |
37+
| [Splitting and Grouping](./splitting_and_grouping.md) | 45 mins |
38+
| [Testing with nf-test](./nf-test.md) | 1 hour |
39+
| [Workflows of workflows](./workflows_of_workflows.md) | 30 mins |
40+
| [Working with files](./working_with_files.md) | 45 mins |
41+
| [Debugging workflows](./debugging.md) | 1 hour |
4142

4243
Let us know what other domains and use cases you'd like to see covered here by posting in the [Training section](https://community.seqera.io/c/training/) of the community forum.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ nav:
6565
- side_quests/splitting_and_grouping.md
6666
- side_quests/workflows_of_workflows.md
6767
- side_quests/debugging.md
68+
- side_quests/essential_scripting_patterns.md
6869
- side_quests/nf-test.md
6970
- side_quests/nf-core.md
7071
- Archive:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def sample_ids = ['sample_001', 'sample_002', 'sample_003']
2+
3+
// channel.collect() - groups multiple channel emissions into one
4+
ch_input = channel.fromList(sample_ids)
5+
ch_input.view { sample -> "Individual channel item: ${sample}" }
6+
ch_collected = ch_input.collect()
7+
ch_collected.view { list -> "channel.collect() result: ${list} (${list.size()} items grouped into 1)" }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sample_id,organism,tissue_type,sequencing_depth,file_path,quality_score
2+
SAMPLE_001,human,liver,30000000,data/sequences/SAMPLE_001_S1_L001_R1_001.fastq,38.5
3+
SAMPLE_002,mouse,brain,25000000,data/sequences/SAMPLE_002_S2_L001_R1_001.fastq,35.2
4+
SAMPLE_003,human,kidney,45000000,data/sequences/SAMPLE_003_S3_L001_R1_001.fastq,42.1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@sample_001_read_1
2+
ATGCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATC
3+
+
4+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
5+
@sample_001_read_2
6+
GCATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGAT
7+
+
8+
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
9+
@sample_001_read_3
10+
TCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGA
11+
+
12+
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJH
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@sample_002_read_1
2+
CGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGAT
3+
+
4+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
5+
@sample_002_read_2
6+
ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG
7+
+
8+
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
9+
@sample_002_read_3
10+
GATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATC
11+
+
12+
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@sample_003_read_1
2+
GCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGC
3+
+
4+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
5+
@sample_003_read_2
6+
CGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCG
7+
+
8+
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
9+
@sample_003_read_3
10+
ATATATATATATATATATATATATATATATATATATATAT
11+
+
12+
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
workflow {
2+
ch_samples = channel.fromPath("./data/samples.csv")
3+
.splitCsv(header: true)
4+
.view()
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
process FASTP {
2+
container 'community.wave.seqera.io/library/fastp:0.24.0--62c97b06e8447690'
3+
4+
input:
5+
tuple val(meta), path(reads)
6+
7+
output:
8+
tuple val(meta), path("*_trimmed*.fastq.gz"), emit: reads
9+
10+
script:
11+
"""
12+
fastp \\
13+
--in1 ${reads[0]} \\
14+
--in2 ${reads[1]} \\
15+
--out1 ${meta.id}_trimmed_R1.fastq.gz \\
16+
--out2 ${meta.id}_trimmed_R2.fastq.gz \\
17+
--json ${meta.id}.fastp.json \\
18+
--html ${meta.id}.fastp.html \\
19+
--thread $task.cpus
20+
"""
21+
}

0 commit comments

Comments
 (0)