Lab 03 — Nextflow Practice
Key concepts and tools
Channel.fromPathparams,$projectDirset { channel_name }- Process
input,output,scriptblocks publishDirsplit,tr— Unix text utilities
A short, open-ended lab that reinforces core Nextflow concepts through a minimal example. You first perform the task manually in the shell — splitting a file into chunks and uppercasing the contents — then rebuild the same logic as a Nextflow workflow.
Part 1 — Manual (cli_workflow/)
cat starting_file.txt | split -l 1 - chunk_
cat chunk_aa | tr '[a-z]' '[A-Z]' > new_chunk_aa.txt
cat chunk_ab | tr '[a-z]' '[A-Z]' > new_chunk_ab.txt
Part 2 — Nextflow (nextflow/)
module load miniconda
conda activate nextflow_latest
- Run
channel.nfto see howChannel.fromPathandparams.starting_filework together.$projectDirresolves to the directory containingmain.nf, keeping paths portable. - Copy the channel code into
main.nf, replacing the finalview()withset { file_ch }. - Write a process that takes the channel as input, runs
splitandtr, and publishes the results withpublishDir. - Run:
nextflow run main.nf
The emphasis is on constructing a channel from a file param, passing it through a process, and collecting output — without the distraction of bioinformatics tool flags.