Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions INSTALL_MAC.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/zsh
brew install openjdk@17
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
java -version

# Install Nextflow
export CAPSULE_LOG=none
curl -s https://get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
chmod +x /usr/local/bin/nextflow

# Check info
nextflow -version
nextflow info
149 changes: 149 additions & 0 deletions LEARN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Nextflow Command Reference

This is a tutorial [link][ref].

[ref]: https://training.nextflow.io/latest/ "Tutorial"

This is a container reg (seqera) [link][ref].

[ref]: https://seqera.io/containers/ "Container"

Searched container example (MAC arm) [link][ref].

[ref]: https://seqera.io/containers/?packages=conda-forge::cowpy=1.1.5 "Container Search cowpy"

## Check the Nextflow Version
```sh
nextflow -v
```

# Run a Nextflow Pipeline
```sh
nextflow run <File.nf>
```
# Resume a Previous Run
```sh
nextflow run hello-world.nf -resume
```
# View Nextflow Logs
```sh
nextflow log
```

# Dry Run (Preview):
```sh
nextflow clean -before <runnamefromlog> -n
```
-n is for a dry run (shows what would be deleted).

Force Clean (Delete):
```sh
nextflow clean -before <runnamefromlog> -f
```
-f is for force (actually deletes files).

# Passing a variabe
```sh
nextflow run hello-world.nf --greeting "Hek varlden"
```
---
# More options
Trace Report
Creates a tabular text file with detailed info about every process:
```sh
nextflow run pipeline.nf -with-trace
```

Execution Report (HTML)
Generates a report.html file with pipeline stats.
```sh
nextflow run pipeline.nf -with-report
```
Timeline Visualization (HTML)
Generates a timeline.html showing process flow and duration.
```sh
nextflow run pipeline.nf -with-timeline
```
Execution DAG
Creates a flow chart of your pipeline.
```sh
nextflow run pipeline.nf -with-dag flowchart.png
```
Input variables
Calling an input varibale with the value, we can also use the default value
```sh
nextflow run hello-world.nf --greeting "He Ali" -with-report
nextflow run hello-world.nf
```
Output
```
nextflow run hello-channels.nf -ansi-log false
```
Operators
```
#useed for array, ref ex 03
.flatten()

#Used to read file csv, ref ex 03
.splitCsv()

# view before and after, ref ex 03
.view()

# Concatinate all the output to single file, ref ex 04
.collect()

# Count the size of the input channel and assign it to the variable
.size()
```
Workflow
```
Pipeline run in parallel, till now we only check the single process workflow
1. How we will use channels to connect those steps
2. Multiple tasks, which can collapse into a single process
3. We also look the process with multiple inputs and multiple outputs
```
MultiInput, ref ex 05
```
# overriding the default value from input variable
nextflow run hello-workflow.nf --batch_name "demo-output"

```
Multiple Output, ref ex 06
```
# Using the emit to access them in positional manner, like a decorator
```
Nextflow Module Ex 07
```
Example NF Core Module repository
include { sayHello } from './modules/sayHello.nf'

```
Container
```
Community run container

Run the singularity

# Pull the singularity image
apptainer pull cowpy.sif https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/bd/bde91ba24078478208035944326ee69a6063ae0f29523e017840e863c42e0b93/data

Run the docker

# Pull the image from seqera
docker pull community.wave.seqera.io/library/cowpy:1.1.5--1a5414f41afdfd25

# run the image
docker run --rm community.wave.seqera.io/library/cowpy:1.1.5--1a5414f41afdfd25 cowpy

docker run -it community.wave.seqera.io/library/cowpy:1.1.5--1a5414f41afdfd25 /bin/bash

# mount a directory
docker run --rm -it -v .:/data community.wave.seqera.io/library/cowpy:1.1.5--1a5414f41afdfd25 /bin/bash

# run this CLI inside the container
cowpy "Hello Containers" -c tux
cowpy "Hello Containers" -c cheese
cowpy "Hello Containers" -c dragonandcow
Run the podman
```
29 changes: 29 additions & 0 deletions my_pipeline/01-hello-nextflow/hello-world.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env nextflow

/*
* Use echo to print 'Hello World!' to a file
*/
process sayHello {

publishDir 'results', mode: 'copy'

input:
val greeting

output:
path 'output.txt'

script:
"""
echo '$greeting' > output.txt
"""
}

/* * Passing default parameters to the workflow */
params.greeting = 'Hello World!'

workflow {

// emit a greeting
sayHello(params.greeting)
}
1,040 changes: 1,040 additions & 0 deletions my_pipeline/01-hello-nextflow/report-20250703-60504949.html

Large diffs are not rendered by default.

1,040 changes: 1,040 additions & 0 deletions my_pipeline/01-hello-nextflow/report-20250703-62225394.html

Large diffs are not rendered by default.

223 changes: 223 additions & 0 deletions my_pipeline/01-hello-nextflow/timeline-20250703-60738341.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions my_pipeline/01-hello-nextflow/trace-20250703-60404614.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
task_id hash native_id name status exit submit duration realtime %cpu peak_rss peak_vmem rchar wchar
1 d8/229586 86298 sayHello COMPLETED 0 2025-07-03 16:46:45.274 62ms 0ms - - - - -
35 changes: 35 additions & 0 deletions my_pipeline/02-hello-channel/hello-channels.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env nextflow

/*
* Use echo to print 'Hello World!' to a file
*/
process sayHello {

publishDir 'results', mode: 'copy'

input:
val greeting

output:
path "$greeting-output.txt"

script:
"""
echo '$greeting' > '$greeting-output.txt'
"""
}

/* * Passing default parameters to the workflow */
params.greeting = 'Hello World!'

workflow {
greetings_array = [params.greeting, 'Hello, Nextflow!', 'Greetings, NF!']
greeting_ch = channel.of(greetings_array)
.view{ greeting -> "Before flatten: $greeting" }
.flatten()
.view{ greeting -> "After flatten: $greeting" }

// emit a greeting
// nf created the channels automatically
sayHello(greeting_ch)
}
3 changes: 3 additions & 0 deletions my_pipeline/03-hello-channel-file-input/greetings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hello
Bonjour
Hola
37 changes: 37 additions & 0 deletions my_pipeline/03-hello-channel-file-input/hello-channels.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env nextflow

/*
* Use echo to print 'Hello World!' to a file
*/
process sayHello {

publishDir 'results', mode: 'copy'

input:
val greeting

output:
path "$greeting-output.txt"

script:
"""
echo '$greeting' > '$greeting-output.txt'
"""
}

/* * Passing default parameters to the workflow */
params.greeting = 'greetings.csv'

workflow {
// create a channel from the CSV file
greeting_ch = channel.fromPath(params.greeting)
.view{ csv -> "Before splitCsv: $csv" }
.splitCsv()
.view{ csv -> "After splitCsv: $csv" }
.map{ item -> item[0] }
.view{ csv -> "After map: $csv" }

// emit a greeting
// nf created the channels automatically
sayHello(greeting_ch)
}
3 changes: 3 additions & 0 deletions my_pipeline/04-hello-workflow/greetings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hello
Bonjour
Hola
80 changes: 80 additions & 0 deletions my_pipeline/04-hello-workflow/hello-workflow.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env nextflow

/*
* Use echo to print 'Hello World!' to a file
*/
process sayHello {

publishDir 'results', mode: 'copy'

input:
val greeting

output:
path "$greeting-output.txt"

script:
"""
echo '$greeting' > '$greeting-output.txt'
"""
}

process convertToUppercase {

publishDir 'results', mode: 'copy'

input:
path input_file

output:
path "UPPER-${input_file}-output.txt"

script:
"""
cat $input_file | tr '[a-z]' '[A-Z]' > "UPPER-${input_file}-output.txt"
"""
}

process collectGreetings {

publishDir 'results', mode: 'copy'

input:
path input_file

output:
path "COLLECTED-output.txt"

script:
"""
cat $input_file > "COLLECTED-output.txt"
"""
}

/* * Passing default parameters to the workflow */
params.greeting = 'greetings.csv'

workflow {
// create a channel from the CSV file
greeting_ch = channel.fromPath(params.greeting)
.view{ csv -> "Before splitCsv: $csv" }
.splitCsv()
.view{ csv -> "After splitCsv: $csv" }
.map{ item -> item[0] }
.view{ csv -> "After map: $csv" }

// emit a greeting
// nf created the channels automatically
sayHello(greeting_ch)

// Convert the output of sayHello to uppercase
convertToUppercase(sayHello.out)

// Collect all greetings into a single file
collectGreetings(sayHello.out.collect())
convertToUppercase.out.view{ greetings -> "Before collectGreetings: $greetings" }
convertToUppercase.out.collect()
.view{ greetings -> "After collectGreetings: $greetings" }


}
3 changes: 3 additions & 0 deletions my_pipeline/05-hello-workflow-multi-input/greetings.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hello
Bonjour
Hola
Loading