Nextflow Command Examples (with examples)
Running a pipeline with cached results from previous runs
nextflow run main.nf -resume
Motivation: This command allows you to run your pipeline using cached results from previous executions. It can significantly speed up pipeline execution time by avoiding the re-computation of intermediate results that have not changed.
Explanation:
nextflow run
: This is the command to run a pipeline using Nextflow.main.nf
: Replace this with the main script file of your pipeline.-resume
: This flag tells Nextflow to use cached results from previous runs.
Example Output:
N E X T F L O W ~ version 20.10.0
Launching main.nf [angry_keller] - revision: 12ca4f6095
...
Running a specific release of a remote workflow from GitHub
nextflow run user/repo -revision release_tag
Motivation: This command allows you to run a specific release of a remote workflow from GitHub. It is useful when you want to ensure reproducibility by using a specific version of the workflow.
Explanation:
nextflow run
: This is the command to run a pipeline using Nextflow.user/repo
: Replace this with the GitHub repository name in the formatusername/repository
.-revision release_tag
: This flag specifies the specific release tag to run.
Example Output:
N E X T F L O W ~ version 20.10.0
Launching user/repo [adoring_nightingale] - revision: v1.2.3
...
Running with a given work directory for intermediate files and saving execution report
nextflow run workflow -work-dir path/to/directory -with-report report.html
Motivation: This command allows you to specify a custom work directory for storing intermediate files generated by the pipeline. It also enables you to save an execution report for later analysis.
Explanation:
nextflow run
: This is the command to run a pipeline using Nextflow.workflow
: Replace this with the name of your workflow.-work-dir path/to/directory
: This flag sets the directory for storing intermediate files.-with-report report.html
: This flag saves an HTML execution report with the specified name.
Example Output:
N E X T F L O W ~ version 20.10.0
Launching workflow [vibrant_kilby] - revision: 1a2b3c4d5e
Work dir: path/to/directory
...
Showing details of previous runs in the current directory
nextflow log
Motivation: This command allows you to view the details of previous pipeline runs in the current directory. It provides valuable information for troubleshooting and understanding the execution history.
Explanation:
nextflow log
: This command displays the details of previous pipeline runs.
Example Output:
Pipeline name: workflow
[List of previous run details]
Run name : run1
Launch dir : /path/to/launch/dir/run1
Launch time : 2021-01-01 10:00:00
Exit status : COMPLETED
... (more details)
Removing cache and intermediate files for a specific run
nextflow clean -force run_name
Motivation: This command allows you to remove the cache and intermediate files generated by a specific pipeline run. It is helpful when you want to start fresh or reclaim disk space.
Explanation:
nextflow clean
: This command removes cache and intermediate files.-force
: This flag forces the removal without asking for confirmation.run_name
: Replace this with the name of the run for which you want to clean the files.
Example Output:
Cleaned cache and files for run 'run1'
Listing all downloaded projects
nextflow list
Motivation: This command provides a list of all downloaded projects, which includes workflows and tools. It helps you keep track of the projects you have previously downloaded.
Explanation:
nextflow list
: This command lists all downloaded projects.
Example Output:
Downloaded projects:
1. workflow1
2. workflow2
...
Pulling the latest version of a remote workflow from Bitbucket
nextflow pull user/repo -hub bitbucket
Motivation: This command allows you to pull the latest version of a remote workflow from Bitbucket. It ensures that you have the most up-to-date version of the workflow before running it.
Explanation:
nextflow pull
: This command pulls the latest version of the workflow.user/repo
: Replace this with the Bitbucket repository name in the formatusername/repository
.-hub bitbucket
: This flag specifies the workflow repository is from Bitbucket.
Example Output:
Fetching changes for repository 'bitbucket:user/repo'
Pull complete.
Updating Nextflow
nextflow self-update
Motivation: This command allows you to update Nextflow to the latest version. It ensures that you have the most recent features, bug fixes, and improvements.
Explanation:
nextflow self-update
: This command updates Nextflow to the latest version.
Example Output:
N E X T F L O W ~ version 21.04.0
With these examples and explanations, you now have a solid understanding of how to use the Nextflow command and its various options. Whether you want to run pipelines with cached results, specify a work directory, clean up files, or update Nextflow itself, you have the commands at your fingertips. Happy pipeline building and executing!