diff --git a/docs/hello_nextflow/01_hello_world.md b/docs/hello_nextflow/01_hello_world.md index a9403ceea..7e6740f78 100644 --- a/docs/hello_nextflow/01_hello_world.md +++ b/docs/hello_nextflow/01_hello_world.md @@ -697,3 +697,95 @@ More generally, you know how to interpret a simple Nextflow workflow, manage its Take a little break, you've earned it! When you're ready, move on to Part 2 to learn how to use channels to feed inputs into your workflow, which will allow you to take advantage of Nextflow's built-in dataflow parallelism and other powerful features. + +## Quiz + +Test your knowledge of the concepts covered in Part 1 with this short quiz: + +!!! info + + + + +What is the minimum requirement for a Nextflow process? + +- [ ] Input and output blocks +- [x] Output and script blocks +- [ ] Only a script block +- [ ] Input block + + + + +What does the output block in a process do? + +- [ ] Creates the output files automatically +- [x] Declares what output files to expect from the process +- [ ] Determines the format of the output +- [ ] Publishes outputs to a directory + + + + +What command is used to run a Nextflow workflow? + +- [ ] `nextflow execute script.nf` +- [x] `nextflow run script.nf` +- [ ] `nextflow start script.nf` +- [ ] `nextflow launch script.nf` + + + + +What is stored in the `work/` directory? + +- [ ] Only the final output files +- [ ] Configuration files +- [x] Temporary files for each process execution +- [x] Execution metadata like `.command.sh` and `.exitcode` +- [x] Output files from processes +- [ ] Container images + + + + +What does the `-resume` flag do? + +- [ ] Restarts the entire workflow from scratch +- [x] Skips processes that already ran with the same code, settings, and inputs +- [ ] Resumes only failed processes +- [ ] Saves the workflow state for later + + + + +What is the default mode for the `publishDir` directive? + +- [ ] copy +- [x] symlink +- [ ] move +- [ ] hardlink + + + + +How do you pass a parameter to a Nextflow workflow from the command line? + +- [ ] `-parameter value` +- [x] `--parameter value` +- [ ] `params.parameter = value` +- [ ] `-p parameter=value` + + + + +Which quote type is required for variable interpolation in Nextflow? + +- [x] Double quotes `"` +- [ ] Single quotes `'` +- [ ] Backticks `` ` `` +- [ ] Triple quotes `"""` + + + + diff --git a/docs/hello_nextflow/02_hello_channels.md b/docs/hello_nextflow/02_hello_channels.md index 2d0fda933..12c1bfd2f 100644 --- a/docs/hello_nextflow/02_hello_channels.md +++ b/docs/hello_nextflow/02_hello_channels.md @@ -904,3 +904,93 @@ More generally, you have a basic understanding of how Nextflow uses **channels** Take a big break, you worked hard in this one! When you're ready, move on to Part 3 to learn how to add more steps and connect them together into a proper workflow. + +## Quiz + +Test your knowledge of the concepts covered in Part 2 with this short quiz: + +!!! info + + + + +What is a channel in Nextflow? + +- [ ] A file directory +- [x] A queue-based mechanism for passing data between processes +- [ ] A configuration parameter +- [ ] A container registry + + + + +Which channel factory creates a simple queue channel with values? + +- [ ] `channel.fromPath()` +- [x] `channel.of()` +- [ ] `channel.from()` +- [ ] `channel.create()` + + + + +What happens when you pass a channel with multiple values to a process? + +- [ ] Only the first value is processed +- [x] The process is called once for each value in the channel +- [ ] All values are processed together in a single call +- [ ] The workflow fails with an error + + + + +What does the `flatten()` operator do? + +- [x] Unpacks array contents into individual items +- [ ] Removes duplicate items from a channel +- [ ] Sorts channel contents alphabetically +- [ ] Converts items to lowercase + + + + +What is the purpose of the `view()` operator? + +- [ ] To visualize the workflow structure +- [x] To inspect and print channel contents for debugging +- [ ] To create graphical output +- [ ] To validate channel data types + + + + +What does the `splitCsv()` operator do? + +- [ ] Creates a CSV file from channel data +- [x] Parses CSV-formatted content, reading each line into an array +- [ ] Splits a channel into multiple channels +- [ ] Validates CSV formatting + + + + +Which operator transforms channel contents element-by-element? + +- [ ] `transform()` +- [ ] `apply()` +- [x] `map()` +- [ ] `modify()` + + + + +Why do you need dynamic filenames when processing multiple inputs? + +- [ ] To save disk space +- [ ] To improve performance +- [x] To prevent output files from overwriting each other +- [ ] To make resume work correctly + + + + diff --git a/docs/hello_nextflow/03_hello_workflow.md b/docs/hello_nextflow/03_hello_workflow.md index d5bcd340c..34aaffaf9 100644 --- a/docs/hello_nextflow/03_hello_workflow.md +++ b/docs/hello_nextflow/03_hello_workflow.md @@ -867,3 +867,83 @@ More generally, you understand the key principles involved in connecting process Take an extra long break, you've earned it. When you're ready, move on to Part 4 to learn how to modularize your code for better maintainability and code efficiency. + +## Quiz + +Test your knowledge of the concepts covered in Part 3 with this short quiz: + +!!! info + + + + +How do you access the output of a process in Nextflow? + +- [ ] `processName.output` +- [x] `processName.out` +- [ ] `processName.result` +- [ ] `output.processName` + + + + +What determines the execution order of processes in a workflow? + +- [ ] The order they are defined in the file +- [ ] Alphabetical order by process name +- [x] The dependencies between processes (output → input) +- [ ] The order they are called in the workflow block + + + + +What does the `collect()` operator do? + +- [ ] Unpacks arrays into individual items +- [x] Packages many channel items into a single array element +- [ ] Removes null values from a channel +- [ ] Collects error messages + + + + +When should you use the `collect()` operator? + +- [ ] Before processing items individually in parallel +- [x] Before a process that needs all results at once +- [ ] To speed up channel operations +- [ ] When publishing outputs + + + + +How do you access named outputs from a process? + +- [ ] `processName.out[outputname]` +- [x] `processName.out.outputname` +- [ ] `processName.outputname` +- [ ] `output.processName.outputname` + + + + +What is the syntax for naming a process output? + +- [x] `output: path "file.txt", emit: myoutput` +- [ ] `output: path "file.txt", name: myoutput` +- [ ] `output: path "file.txt" as myoutput` +- [ ] `output: path "file.txt" -> myoutput` + + + + +When passing multiple inputs to a process, what must match? + +- [x] The order of inputs in the workflow call must match the input block order +- [ ] The data types must all be the same +- [ ] The variable names must match exactly +- [ ] The number of inputs must equal the number of outputs + + + + diff --git a/docs/hello_nextflow/04_hello_modules.md b/docs/hello_nextflow/04_hello_modules.md index cc2476a6b..563144134 100644 --- a/docs/hello_nextflow/04_hello_modules.md +++ b/docs/hello_nextflow/04_hello_modules.md @@ -382,3 +382,75 @@ This is better than just copy-pasting the code, because if later you decide to i Take a short break if you feel like it. When you're ready, move on to Part 5 to learn how to use containers to manage software dependencies more conveniently and reproducibly. + +## Quiz + +Test your knowledge of the concepts covered in Part 4 with this short quiz: + +!!! info + + + + +What is a Nextflow module? + +- [ ] A configuration file +- [ ] A workflow definition +- [x] A standalone file containing a single process definition +- [ ] A container image + + + + +What is the recommended filename convention for modules? + +- [ ] `module_processName.nf` +- [x] `processName.nf` +- [ ] `processName.module` +- [ ] `processName_module.nf` + + + + +Where should module files typically be stored? + +- [ ] In the root directory +- [ ] In the `lib/` directory +- [x] In the `modules/` directory +- [ ] In the `processes/` directory + + + + +What is the correct syntax to import a module? + +- [ ] `import { processName } from './modules/processName.nf'` +- [x] `include { processName } from './modules/processName.nf'` +- [ ] `require { processName } from './modules/processName.nf'` +- [ ] `use { processName } from './modules/processName.nf'` + + + + +What happens to resume functionality when you convert processes to modules? + +- [ ] Resume stops working +- [ ] Resume only works for the main workflow +- [x] Resume continues to work normally +- [ ] Resume works but cache is reset + + + + +What are key benefits of using modules? + +- [ ] Faster execution time +- [ ] Reduced memory usage +- [x] Reuse processes in multiple workflows without duplication +- [x] Easier maintenance - improve module once, all workflows benefit +- [x] Better code organization +- [ ] Automatic parallelization + + + + diff --git a/docs/hello_nextflow/05_hello_containers.md b/docs/hello_nextflow/05_hello_containers.md index eaaade723..4a87361b5 100644 --- a/docs/hello_nextflow/05_hello_containers.md +++ b/docs/hello_nextflow/05_hello_containers.md @@ -679,3 +679,86 @@ You know how to use containers in Nextflow to run processes. Take a break! When you're ready, move on to Part 6 to learn how to configure the execution of your pipeline to fit your infrastructure as well as manage configuration of inputs and parameters. It's the very last part and then you're done! + +## Quiz + +Test your knowledge of the concepts covered in Part 5 with this short quiz: + +!!! info + + + + +What is a container? + +- [ ] A directory structure for organizing code +- [x] A lightweight, standalone executable unit with application and dependencies +- [ ] A Nextflow configuration file +- [ ] A type of channel + + + + +What is the difference between a container image and instance? + +- [ ] They are the same thing +- [x] Image is a template; instance is a running container created from the image +- [ ] Image is local; instance is remote +- [ ] Instance is smaller than image + + + + +What does the `-v` flag do in Docker? + +- [ ] Enables verbose output +- [ ] Sets the Docker version +- [x] Mounts a volume to share directories between host and container +- [ ] Validates the container image + + + + +Why do you need to mount volumes when using containers? + +- [ ] To improve performance +- [ ] To reduce disk space usage +- [x] Because containers are isolated from the host filesystem by default +- [ ] To enable networking + + + + +How do you specify a container for a Nextflow process? + +- [ ] `docker 'image_uri'` directive +- [x] `container 'image_uri'` directive +- [ ] `image 'image_uri'` directive +- [ ] `containerImage 'image_uri'` directive + + + + +How do you enable Docker in a Nextflow workflow? + +- [ ] Use the `-with-docker` flag only +- [x] Set `docker.enabled = true` in the config file +- [ ] Docker is enabled by default +- [ ] Use the `--docker` parameter + + + + +What does Nextflow automatically do when using containers? + +- [ ] Builds the container from a Dockerfile +- [x] Pulls the image if not already local +- [x] Mounts the work directory into the container +- [x] Runs the process script inside the container +- [x] Handles cleanup after execution +- [ ] Installs Docker on the system +- [ ] Creates a new container image + + + + diff --git a/docs/hello_nextflow/06_hello_config.md b/docs/hello_nextflow/06_hello_config.md index a8c722581..701b60868 100644 --- a/docs/hello_nextflow/06_hello_config.md +++ b/docs/hello_nextflow/06_hello_config.md @@ -623,3 +623,135 @@ You know how to use profiles to select a preset configuration at runtime with mi Celebrate and give yourself a big pat on the back! You have completed your very first Nextflow developer course. Next, we ask you to complete a very short survey about your experience with this training course, then we'll take you to a page with links to further training resources and helpful links. + +## Quiz + +Test your knowledge of the concepts covered in Part 6 with this short quiz: + +!!! info + + + + +What file does Nextflow automatically load for configuration? + +- [ ] `config.nf` +- [ ] `workflow.config` +- [x] `nextflow.config` +- [ ] `settings.config` + + + + +What is the configuration precedence in Nextflow? + +- [ ] Config file overrides CLI arguments +- [x] CLI arguments override config file values +- [ ] Default values override everything +- [ ] Profile settings always take precedence + + + + +Can you enable both Docker and Conda in the same configuration? + +- [ ] No, only one can be enabled at a time +- [x] Yes, both can be enabled simultaneously +- [ ] Only if using different profiles +- [ ] Only on certain operating systems + + + + +What happens when both Docker and Conda are enabled for a process that has both directives? + +- [ ] Conda is prioritized +- [x] Docker is prioritized +- [ ] The workflow fails with an error +- [ ] The first one defined is used + + + + +What is the default memory allocation for a Nextflow process? + +- [ ] 1.GB +- [x] 2.GB +- [ ] 4.GB +- [ ] It depends on the system + + + + +How do you set resources for a specific process in the config? + +- [x] `process { withName: 'processName' { cpus = 4 } }` +- [ ] `process.processName.cpus = 4` +- [ ] `processName { cpus = 4 }` +- [ ] `resources.processName.cpus = 4` + + + + +What command generates a resource profiling report? + +- [ ] `nextflow run script.nf -profile` +- [ ] `nextflow run script.nf -report` +- [x] `nextflow run script.nf -with-report filename.html` +- [ ] `nextflow run script.nf --resource-report` + + + + +What is the purpose of `resourceLimits` in the configuration? + +- [ ] To set minimum resource requirements +- [x] To cap the maximum resources that can be requested +- [ ] To automatically allocate optimal resources +- [ ] To track resource usage over time + + + + +What is the default executor in Nextflow? + +- [ ] `slurm` +- [x] `local` +- [ ] `cloud` +- [ ] `batch` + + + + +How do you use a parameter file with Nextflow? + +- [ ] `nextflow run script.nf -config file.json` +- [x] `nextflow run script.nf -params-file file.json` +- [ ] `nextflow run script.nf --parameters file.json` +- [ ] Parameter files are loaded automatically + + + + +What can profiles be used for in Nextflow? + +- [ ] User account settings +- [x] Grouping infrastructure settings (executor, container technology) +- [x] Setting different resource limits for different environments +- [x] Providing test parameter values +- [ ] Performance benchmarking +- [ ] Container registry authentication + + + + +How do you use multiple profiles simultaneously? + +- [ ] You can only use one profile at a time +- [ ] `nextflow run script.nf -profile profile1 -profile profile2` +- [x] `nextflow run script.nf -profile profile1,profile2` +- [ ] Profiles are automatically merged + + + + diff --git a/mkdocs.yml b/mkdocs.yml index 3f27c7c0c..926d31952 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -282,3 +282,5 @@ plugins: reconfigure_material: true reconfigure_search: true - search + - mkdocs_quiz: + progress_sidebar_position: bottom diff --git a/requirements.txt b/requirements.txt index f2c84e49e..deec230ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ pillow cairosvg mkdocs-enumerate-headings-plugin>=0.6.0 mike +mkdocs-quiz>=1