Package: nf-core
A python package with helper tools for the nf-core community.Read this documentation on the nf-core website:https://nf-co.re/toolsTable of contentsnf-coretools installationnf-coretools updatenf-core list- List available pipelinesnf-core launch- Run a pipeline with interactive parameter promptsnf-core create-params-file- Create a parameter filenf-core download- Download a pipeline for offline usenf-core licences- List software licences in a pipelinenf-core create- Create a new pipeline with the nf-core templatenf-core lint- Check pipeline code against nf-core guidelinesnf-core schema- Work with pipeline schema filesnf-core bump-version- Update nf-core pipeline version numbernf-core sync- Synchronise pipeline TEMPLATE branchesnf-core create-logo- Create an nf-core pipeline logonf-core tui- Explore the nf-core command line graphicallynf-core modules- commands for dealing with DSL2 modulesmodules list- List available modulesmodules list remote- List remote modulesmodules list local- List installed modulesmodules info- Show information about a modulemodules install- Install modules in a pipelinemodules update- Update modules in a pipelinemodules remove- Remove a module from a pipelinemodules patch- Create a patch file for a modulemodules create- Create a module from the templatemodules lint- Check a module against nf-core guidelinesmodules test- Run the tests for a modulemodules bump-versions- Bump software versions of modulesnf-core subworkflows- commands for dealing with subworkflowssubworkflows list- List available subworkflowssubworkflows list remote- List remote subworkflowssubworkflows list local- List installed subworkflowssubworkflows info- Show information about a subworkflowsubworkflows install- Install subworkflows in a pipelinesubworkflows update- Update subworkflows in a pipelinesubworkflows remove- Remove a subworkflow from a pipelinesubworkflows create- Create a subworkflow from the templatesubworkflows lint- Check a subworkflow against nf-core guidelinessubworkflows test- Run the tests for a subworkflowCitationThe nf-core tools package is written in Python and can be imported and used within other packages.
For documentation of the internal Python functions, please refer to theTools Python API docs.InstallationBiocondaYou can installnf-core/toolsfrombioconda.First, install conda and configure the channels to use bioconda
(see thebioconda documentation).
Then, just run the conda installation command:condainstallnf-coreAlternatively, you can create a new environment with both nf-core/tools and nextflow:condacreate--namenf-corepython=3.11nf-corenextflow
condaactivatenf-corePython Package Indexnf-core/toolscan also be installed fromPyPIusing pip as follows:pipinstallnf-coreDocker imageThere is a docker image that you can use to runnf-core/toolsthat has all of the requirements packaged (including Nextflow) and so should work out of the box. It is callednfcore/tools(NB: no hyphen!)You can use this container on the command line as follows:dockerrun-itv`pwd`:`pwd`-w`pwd`-u$(id-u):$(id-g)nfcore/tools-iand-tare needed for the interactive cli prompts to work (this tells Docker to use a pseudo-tty with stdin attached)The-vargument tells Docker to bind your current working directory (pwd) to the same path inside the container, so that files created there will be saved to your local file system outside of the container.-wsets the working directory in the container to this path, so that it's the same as your working directory outside of the container.-usets your local user account as the user inside the container, so that any files created have the correct ownership permissionsAfter the above base command, you can use the regular command line flags that you would use with other types of installation.
For example, to launch theviralreconpipeline:dockerrun-itv`pwd`:`pwd`-w`pwd`-u$(id-u):$(id-g)nfcore/toolslaunchviralrecon-r1.1.0If you use$NXF_SINGULARITY_CACHEDIRfor downloads, you'll also need to make this folder and environment variable available to the continer:dockerrun-itv`pwd`:`pwd`-w`pwd`-u$(id-u):$(id-g)-v$NXF_SINGULARITY_CACHEDIR:$NXF_SINGULARITY_CACHEDIR-eNXF_SINGULARITY_CACHEDIRnfcore/toolslaunchviralrecon-r1.1.0Docker bash aliasThe above base command is a bit of a mouthful to type, to say the least.
To make it easier to use, we highly recommend adding the following bash alias to your~/.bashrcfile:aliasnf-core="docker run -itv `pwd`:`pwd` -w `pwd` -u$(id-u):$(id-g)nfcore/tools"Once applied (you may need to reload your shell) you can just use thenf-corecommand instead:nf-corelistDocker versionsYou can use docker image tags to specify the version you would like to use. For example,nfcore/tools:devfor the latest development version of the code, ornfcore/tools:1.14for version1.14of tools.
If you omit this, it will default to:latest, which should be the latest stable release.If you need a specific version of Nextflow inside the container, you can build an image yourself.
Clone the repo locally and check out whatever version of nf-core/tools that you need.
Then build using the--build-arg NXF_VERflag as follows:dockerbuild-tnfcore/tools:dev.--build-argNXF_VER=20.04.0Development versionIf you would like the latest development version of tools, the command is:pipinstall--upgrade--force-reinstallgit+https://github.com/nf-core/tools.git@devIf you intend to make edits to the code, first make a fork of the repository and then clone it locally.
Go to the cloned directory and install with pip (also installs development requirements):pipinstall--upgrade-rrequirements-dev.txt-e.Using a specific Python interpreterIf you prefer, you can also run tools with a specific Python interpreter.
The command line usage and flags are then exactly the same as if you ran with thenf-corecommand.
Note that the module isnf_corewith an underscore, not a hyphen like the console command.For example:python-mnf_core--help
python3-mnf_corelist
~/my_env/bin/python-mnf_corecreate--namemypipeline--description"This is a new skeleton pipeline"Using with your own Python scriptsThe tools functionality is written in such a way that you can import it into your own scripts.
For example, if you would like to get a list of all available nf-core pipelines:importnf_core.listwfs=nf_core.list.Workflows()wfs.get_remote_workflows()forwfinwfs.remote_workflows:print(wf.full_name)Please seehttps://nf-co.re/tools/docs/for the function documentation.Automatic version checknf-core/tools automatically checks the web to see if there is a new version of nf-core/tools available.
If you would prefer to skip this check, set the environment variableNFCORE_NO_VERSION_CHECK. For example:exportNFCORE_NO_VERSION_CHECK=1Update toolsIt is advisable to keep nf-core/tools updated to the most recent version. The command to update depends on the system used to install it, for example if you have installed it with conda you can use:condaupdatenf-coreif you used pip:pipinstall--upgradenf-corePlease refer to the respective documentation for further details to manage packages, as for examplecondaorpip.Activate shell completions for nf-core/toolsAuto-completion for thenf-corecommand is available for bash, zsh and fish. To activate it, add the following lines to the respective shell config files.shellshell config filecommandbash~/.bashrceval "$(_NF_CORE_COMPLETE=bash_source nf-core)"zsh~/.zshrceval "$(_NF_CORE_COMPLETE=zsh_source nf-core)"fish~/.config/fish/completions/nf-core.fisheval (env _NF_CORE_COMPLETE=fish_source nf-core)After a restart of the shell session you should have auto-completion for thenf-corecommand and all its sub-commands and options.[!NOTE]
The added line will run the commandnf-core(which will also slow down startup time of your shell). You should therefore either have the nf-core/tools installed globally.
You can also wrap it insideif type nf-core > /dev/null; then<YOUR EVAL CODE LINE>fifor bash and zsh orif command -v nf-core &> /dev/null eval (env _NF_CORE_COMPLETE=fish_source nf-core) endfor fish. You need to then source the config in your environment for the completions to be activated.[!TIP]
If you see the errorcommand not found compdef, be sure that your config file contains the lineautoload -Uz compinit && compinitbefore the eval line.Listing pipelinesThe commandnf-core listshows all available nf-core pipelines along with their latest version, when that was published and how recently the pipeline code was pulled to your local system (if at all).An example of the output from the command is as follows:To narrow down the list, supply one or more additional keywords to filter the pipelines based on matches in titles, descriptions and topics:You can sort the results by latest release (-s release, default),
when you last pulled a local copy (-s pulled),
alphabetically (-s name),
or number of GitHub stars (-s stars).To return results as JSON output for downstream use, use the--jsonflag.Archived pipelines are not returned by default. To include them, use the--show_archivedflag.Launch a pipelineSome nextflow pipelines have a considerable number of command line flags that can be used.
To help with this, you can use thenf-core launchcommand.
You can choose between a web-based graphical interface or an interactive command-line wizard tool to enter the pipeline parameters for your run.
Both interfaces show documentation alongside each parameter and validate your inputs.The tool uses thenextflow_schema.jsonfile from a pipeline to give parameter descriptions, defaults and grouping.
If no file for the pipeline is found, one will be automatically generated at runtime.Nextflowparamsvariables are saved in to a JSON file callednf-params.jsonand used by nextflow with the-params-fileflag.
This makes it easier to reuse these in the future.The command takes one argument - either the name of an nf-core pipeline which will be pulled automatically,
or the path to a directory containing a Nextflow pipeline(can be any pipeline, doesn't have to be nf-core).Once complete, the wizard will ask you if you want to launch the Nextflow run.
If not, you can copy and paste the Nextflow command with thenf-params.jsonfile of your inputs.INFO     [✓] Input parameters look validINFO     Nextflow command:nextflow run nf-core/rnaseq -params-file "nf-params.json"Do you want to run this command now?  [y/n]:Launch tool options-r,--revisionSpecify a pipeline release (or branch / git commit sha) of the project to run-i,--idYou can use the web GUI for nf-core pipelines by clicking"Launch"on the website. Once filled in you will be given an ID to use with this command which is used to retrieve your inputs.-c,--command-onlyIf you prefer not to save your inputs in a JSON file and use-params-file, this option will specify all entered params directly in the nextflow command.-p,--params-in PATHTo use values entered in a previous pipeline run, you can supply thenf-params.jsonfile previously generated.This will overwrite the pipeline schema defaults before the wizard is launched.-o,--params-out PATHPath to save parameters JSON file to. (Default:nf-params.json)-a,--save-allWithout this option the pipeline will ignore any values that match the pipeline schema defaults.This option savesallparameters found to the JSON file.-h,--show-hiddenA pipeline JSON schema can define some parameters as 'hidden' if they are rarely used or for internal pipeline use only.This option forces the wizard to show all parameters, including those labelled as 'hidden'.--urlChange the URL used for the graphical interface, useful for development work on the website.Create a parameter fileSometimes it is easier to manually edit a parameter file than to use the web interface or interactive commandline wizard
provided bynf-core launch, for example when running a pipeline with many options on a remote server without a graphical interface.You can create a parameter file with all parameters of a pipeline with thenf-core create-params-filecommand.
This file can then be passed tonextflowwith the-params-fileflag.This command takes one argument - either the name of a nf-core pipeline which will be pulled automatically,
or the path to a directory containing a Nextflow pipeline(can be any pipeline, doesn't have to be nf-core).The generated YAML file contains all parameters set to the pipeline default value along with their description in comments.
This template can then be used by uncommenting and modifying the value of parameters you want to pass to a pipline run.Hidden options are not included by default, but can be included using the-x/--show-hiddenflag.Downloading pipelines for offline useSometimes you may need to run an nf-core pipeline on a server or HPC system that has no internet connection.
In this case you will need to fetch the pipeline files first, then manually transfer them to your system.To make this process easier and ensure accurate retrieval of correctly versioned code and software containers, we have written a download helper tool.Thenf-core downloadcommand will download both the pipeline code and theinstitutional nf-core/configsfiles. It can also optionally download any singularity image files that are required.If run without any arguments, the download tool will interactively prompt you for the required information.
Each option has a flag, if all are supplied then it will run without any user input needed.Once downloaded, you will see something like the following file structure for the downloaded pipeline:You can run the pipeline by simply providing the directory path for theworkflowfolder to yournextflow runcommand:nextflowrun/path/to/download/nf-core-rnaseq-dev/workflow/--inputmydata.csv--outdirresults# usual parameters here[!NOTE]
If you downloaded Singularity container images, you will need to use-profile singularityor have it enabled in your config file.Downloaded nf-core configsThe pipeline files are automatically updated (params.custom_config_baseis set to../configs), so that the local copy of institutional configs are available when running the pipeline.
So using-profile <NAME>should work if available withinnf-core/configs.[!WARNING]
This option is not available when downloading a pipeline for use withNextflow Towerbecause the application manages all configurations separately.Downloading Apptainer containersIf you're usingSingularity(Apptainer), thenf-core downloadcommand can also fetch the required container images for you.
To do this, selectsingularityin the prompt or specify--container-system singularityin the command.
Your archive / target output directory will then also include a separate foldersingularity-containers.The downloaded workflow files are again edited to add the following line to the end of the pipeline'snextflow.configfile:singularity.cacheDir = "${projectDir}/../singularity-images/"This tells Nextflow to use thesingularity-containersdirectory relative to the workflow for the singularity image cache directory.
All images should be downloaded there, so Nextflow will use them instead of trying to pull from the internet.Singularity cache directoryWe highly recommend setting the$NXF_SINGULARITY_CACHEDIRenvironment variable on your system, even if that is a different system to where you will be running Nextflow.If found, the tool will fetch the Singularity images to this directory first before copying to the target output archive / directory.
Any images previously fetched will be found there and copied directly - this includes images that may be shared with other pipelines or previous pipeline version downloads or download attempts.If you are running the download on the same system where you will be running the pipeline (eg. a shared filesystem where Nextflow won't have an internet connection at a later date), you can choose toonlyuse the cache via a prompt or cli options--container-cache-utilisation amend. This instructsnf-core downloadto fetch all Singularity images to the$NXF_SINGULARITY_CACHEDIRdirectory but doesnotcopy them to the workflow archive / directory. The workflow config file isnotedited. This means that when you later run the workflow, Nextflow will just use the cache folder directly.If you are downloading a workflow for a different system, you can provide information about the contents of its image cache tonf-core download. To avoid unnecessary container image downloads, choose--container-cache-utilisation remoteand provide a list of already available images as plain text file to--container-cache-index my_list_of_remotely_available_images.txt. To generate this list on the remote system, runfind $NXF_SINGULARITY_CACHEDIR -name "*.img" > my_list_of_remotely_available_images.txt. The tool will then only download and copy images into your output directory, which are missing on the remote system.How the Singularity image downloads workThe Singularity image download finds containers using two methods:It runsnextflow configon the downloaded workflow to look for aprocess.containerstatement for the whole pipeline.
This is the typical method used for DSL1 pipelines.It scrapes any files it finds with a.nffile extension in the workflowmodulesdirectory for lines
that look likecontainer = "xxx". This is the typical method for DSL2 pipelines, which have one container per process.Some DSL2 modules have container addresses for docker (eg.biocontainers/fastqc:0.11.9--0) and also URLs for direct downloads of a Singularity container (eg.https://depot.galaxyproject.org/singularity/fastqc:0.11.9--0).
Where both are found, the download URL is preferred.Once a full list of containers is found, they are processed in the following order:If the target image already exists, nothing is done (eg. with$NXF_SINGULARITY_CACHEDIRand--container-cache-utilisation amendspecified)If found in$NXF_SINGULARITY_CACHEDIRand--container-cache-utilisation copyis specified, they are copied to the output directoryIf they start withhttpthey are downloaded directly within Python (default 4 at a time, you can customise this with--parallel-downloads)If they look like a Docker image name, they are fetched using asingularity pullcommand. Choose the container libraries (registries) queried by providing one or multiple--container-libraryparameter(s). For example, if you callnf-core downloadwith-l quay.io -l ghcr.io -l docker.io, every image will be pulled fromquay.iounless an error is encountered. Subsequently,ghcr.ioand thendocker.iowill be queried for any image that has failed before.This requires Singularity/Apptainer to be installed on the system and is substantially slowerNote that compressing many GBs of binary files can be slow, so specifying--compress noneis recommended when downloading Singularity images that are copied to the output directory.If the download speeds are much slower than your internet connection is capable of, you can set--parallel-downloadsto a large number to download loads of images at once.Adapting downloads to Nextflow Towerseqeralabs® Nextflow Towerprovides a graphical user interface to oversee pipeline runs, gather statistics and configure compute resources. While pipelines added toTowerare preferably hosted at a Git service, providing them as disconnected, self-reliant repositories is also possible for premises with restricted network access. Choosing the--towerflag will download the pipeline in an appropriate form.Subsequently, the*.gitfolder can be moved to it's final destination and linked with a pipeline inTowerusing thefile:/prefix.[!TIP]
Also without access to Tower, pipelines downloaded with the--towerflag can be run if theabsolutepath is specified:nextflow run -r 2.5 file:/path/to/pipelinedownload.git. Downloads in this format allow you to include multiple revisions of a pipeline in a single file, but require that the revision (e.g.-r 2.5) is always explicitly specified.Pipeline software licencesSometimes it's useful to see the software licences of the tools used in a pipeline.
You can use thelicencessubcommand to fetch and print the software licence from each conda / PyPI package used in an nf-core pipeline.[!WARNING]
This command does not currently work for newer DSL2 pipelines. This will hopefully be addressedsoon.Creating a new pipelineThecreatesubcommand makes a new pipeline using the nf-core base template.
With a given pipeline name, description and author, it makes a starter pipeline which follows nf-core best practices.After creating the files, the command initialises the folder as a git repository and makes an initial commit.
This first "vanilla" commit which is identical to the output from the templating tool is important, as it allows us to keep your pipeline in sync with the base template in the future.
See thenf-core syncing docsfor more information.Once you have run the command, create a new empty repository on GitHub under your username (not thenf-coreorganisation, yet) and push the commits from your computer using the example commands in the above log.
You can then continue to edit, commit and push normally as you build your pipeline.Please see thenf-core documentationfor a full walkthrough of how to create a new nf-core workflow.[!TIP]
As the log output says, remember to come and discuss your idea for a pipeline as early as possible!
See thedocumentationfor instructions.Note that if the required arguments fornf-core createare not given, it will interactively prompt for them. If you prefer, you can supply them as command line arguments. Seenf-core create --helpfor more information.Customizing the creation of a pipelineThenf-core createcommand comes with a number of options that allow you to customize the creation of a pipeline if you intend to not publish it as an
nf-core pipeline. This can be done in two ways: by using interactive prompts, or by supplying atemplate.ymlfile using the--template-yaml <file>option.
Both options allow you to specify a custom pipeline prefix to use instead of the commonnf-core, as well as selecting parts of the template to be excluded during pipeline creation.
The interactive prompts will guide you through the pipeline creation process. An example of atemplate.ymlfile is shown below.name:coolpipedescription:A cool pipelineauthor:meprefix:myorgskip:-github-ci-github_badges-igenomes-nf_core_configsThis will create a pipeline calledcoolpipein the directorymyorg-coolpipe(<prefix>-<name>) withmeas the author. It will exclude all possible parts of the template:github: removed all files required for GitHub hosting of the pipeline. Specifically, the.githubfolder and.gitignorefile.ci: removes the GitHub continuous integration tests from the pipeline. Specifically, the.github/workflows/folder.github_badges: removes GitHub badges from theREADME.mdfile.igenomes: removes pipeline options related to iGenomes. Including theconf/igenomes.configfile and all references to it.nf_core_configs: excludesnf_core/configsrepository options, which make multiple config profiles for various institutional clusters available.To run the pipeline creation silently (i.e. without any prompts) with the nf-core template, you can use the--plainoption.Linting a workflowThelintsubcommand checks a given pipeline for all nf-core community guidelines.
This is the same test that is used on the automated continuous integration tests.For example, the current version looks something like this:You can use the-k/--keyflag to run only named tests for faster debugging, eg:nf-core lint -k files_exist -k files_unchanged. Thenf-core lintcommand lints the current working directory by default, to specify another directory you can use--dir <directory>.Linting documentationEach test result name on the left is a terminal hyperlink.
In most terminals you canctrl+click(cmd+click) these
links to open documentation specific to this test in your browser.Alternatively visithttps://nf-co.re/tools/docs/latest/pipeline_lint_tests/index.htmland find your test to read more.Linting configIt's sometimes desirable to disable certain lint tests, especially if you're using nf-core/tools with your
own pipeline that is outside of nf-core.To help with this, you can add a tools config file to your pipeline called.nf-core.ymlin the pipeline root directory (previously:.nf-core-lint.yml).
Here you can list the names of any tests that you would like to disable and set them toFalse, for example:lint:actions_awsfulltest:Falsepipeline_todos:FalseSome lint tests allow greater granularity, for example skipping a test only for a specific file.
This is documented in the test-specific docs but generally involves passing a list, for example:lint:files_exist:-CODE_OF_CONDUCT.mdfiles_unchanged:-assets/email_template.html-CODE_OF_CONDUCT.mdNote that you have to list all configurations for thenf-core lintcommand under thelint:field in the.nf-core.ymlfile, as this file is also used for configuration of other commands.Automatically fix errorsSome lint tests can try to automatically fix any issues they find. To enable this functionality, use the--fixflag.
The pipeline must be agitrepository with no uncommitted changes for this to work.
This is so that any automated changes can then be reviewed and undone (git checkout .) if you disagree.Lint results outputThe output fromnf-core lintis designed to be viewed on the command line and is deliberately succinct.
You can view all passed tests with--show-passedor generate JSON / markdown results with the--jsonand--markdownflags.Pipeline schemanf-core pipelines have anextflow_schema.jsonfile in their root which describes the different parameters used by the workflow.
These files allow automated validation of inputs when running the pipeline, are used to generate command line help and can be used to build interfaces to launch pipelines.
Pipeline schema files are built according to theJSONSchema specification(Draft 7).To help developers working with pipeline schema, nf-core tools has threeschemasub-commands:nf-core schema validatenf-core schema buildnf-core schema docsnf-core schema lintValidate pipeline parametersNextflow can take input parameters in a JSON or YAML file when running a pipeline using the-params-fileoption.
This command validates such a file against the pipeline schema.Usage isnf-core schema validate <pipeline> <parameter file>. eg with the pipeline downloadedabove, you can run:Thepipelineoption can be a directory containing a pipeline, a path to a schema file or the name of an nf-core pipeline (which will be downloaded usingnextflow pull).Build a pipeline schemaManually building JSONSchema documents is not trivial and can be very error prone.
Instead, thenf-core schema buildcommand collects your pipeline parameters and gives interactive prompts about any missing or unexpected params.
If no existing schema is found it will create one for you.Once built, the tool can send the schema to the nf-core website so that you can use a graphical interface to organise and fill in the schema.
The tool checks the status of your schema on the website and once complete, saves your changes locally.Usage isnf-core schema build -d <pipeline_directory>, eg:There are four flags that you can use with this command:--dir <pipeline_dir>: Specify a pipeline directory other than the current working directory--no-prompts: Make changes without prompting for confirmation each time. Does not launch web tool.--web-only: Skips comparison of the schema against the pipeline parameters and only launches the web tool.--url <web_address>: Supply a custom URL for the online tool. Useful when testing locally.Display the documentation for a pipeline schemaTo get an impression about the current pipeline schema you can display the content of thenextflow_schema.jsonwithnf-core schema docs <pipeline-schema>. This will print the content of your schema in Markdown format to the standard output.There are four flags that you can use with this command:--output <filename>: Output filename. Defaults to standard out.--format [markdown|html]: Format to output docs in.--force: Overwrite existing files--columns <columns_list>: CSV list of columns to include in the parameter tablesAdd new parameters to the pipeline schemaIf you want to add a parameter to the schema, you first have to add the parameter and its default value to thenextflow.configfile with theparamsscope. Afterwards, you run the commandnf-core schema buildto add the parameters to your schema and open the graphical interface to easily modify the schema.The graphical interface is oganzised in groups and within the groups the single parameters are stored. For a better overview you can collapse all groups with theCollapse groupsbutton, then your new parameters will be the only remaining one at the bottom of the page. Now you can either create a new group with theAdd groupbutton or drag and drop the paramters in an existing group. Therefor the group has to be expanded. The group title will be displayed, if you run your pipeline with the--helpflag and its description apears on the parameter page of your pipeline.Now you can start to change the parameter itself. TheIDof a new parameter should be defined in small letters without whitespaces. The description is a short free text explanation about the parameter, that appears if you run your pipeline with the--helpflag. By clicking on the dictionary icon you can add a longer explanation for the parameter page of your pipeline. Usually, they contain a small paragraph about the parameter settings or a used datasource, like databases or references. If you want to specify some conditions for your parameter, like the file extension, you can use the nut icon to open the settings. This menu depends on thetypeyou assigned to your parameter. For integers you can define a min and max value, and for strings the file extension can be specified.Thetypefield is one of the most important points in your pipeline schema, since it defines the datatype of your input and how it will be interpreted. This allows extensive testing prior to starting the pipeline.The basic datatypes for a pipeline schema are:stringnumberintegerbooleanFor thestringtype you have three different options in the settings (nut icon):enumerated values,patternandformat. The first option,enumerated values, allows you to specify a list of specific input values. The list has to be separated with a pipe. Thepatternandformatsettings can depend on each other. Theformathas to be either a directory or a file path. Depending on theformatsetting selected, specifying thepatternsetting can be the most efficient and time saving option, especially forfile paths. Thenumberandintegertypes share the same settings. Similarly tostring, there is anenumerated valuesoption with the possibility of specifying aminandmaxvalue. For thebooleanthere is no further settings and the default value is usuallyfalse. Thebooleanvalue can be switched totrueby adding the flag to the command. This parameter type is often used to skip specific sections of a pipeline.After filling the schema, click on theFinishedbutton in the top right corner, this will automatically update yournextflow_schema.json. If this is not working, the schema can be copied from the graphical interface and pasted in yournextflow_schema.jsonfile.Update existing pipeline schemaIt's important to change the default value of a parameter in thenextflow.configfile first and then in the pipeline schema, because the value in the config file overwrites the value in the pipeline schema. To change any other parameter usenf-core schema build --web-onlyto open the graphical interface without rebuilding the pipeline schema. Now, the parameters can be changed as mentioned above but keep in mind that changing the parameter datatype depends on the default value specified in thenextflow.configfile.Linting a pipeline schemaThe pipeline schema is linted as part of the main pipelinenf-core lintcommand,
however sometimes it can be useful to quickly check the syntax of the JSONSchema without running a full lint run.Usage isnf-core schema lint <schema>(defaulting tonextflow_schema.json), eg:Bumping a pipeline version numberWhen releasing a new version of a nf-core pipeline, version numbers have to be updated in several different places. The helper commandnf-core bump-versionautomates this for you to avoid manual errors (and frustration!).The command uses results from the linting process, so will only work with workflows that pass these tests.Usage isnf-core bump-version <new_version>, eg:You can change the directory from the current working directory by specifying--dir <pipeline_dir>. To change the required version of Nextflow instead of the pipeline version number, use the flag--nextflow.Sync a pipeline with the templateOver time, the main nf-core pipeline template is updated. To keep all nf-core pipelines up to date,
we synchronise these updates automatically when new versions of nf-core/tools are released.
This is done by maintaining a specialTEMPLATEbranch, containing a vanilla copy of the nf-core template
with only the variables used when it first ran (name, description etc.). This branch is updated and a
pull-request can be made with just the updates from the main template code.Note that pipeline synchronisation happens automatically each time nf-core/tools is released, creating an automated pull-request on each pipeline.As such, you do not normally need to run this command yourself!This command takes a pipeline directory and attempts to run this synchronisation.
Usage isnf-core sync, eg:The sync command tries to check out theTEMPLATEbranch from theoriginremote or an existing local branch calledTEMPLATE.
It will fail if it cannot do either of these things.
Thenf-core createcommand should make this template automatically when you first start your pipeline.
Please see thenf-core website sync documentationif you have difficulties.To specify a directory to sync other than the current working directory, use the--dir <pipline_dir>.By default, the tool will collect workflow variables from the current branch in your pipeline directory.
You can supply the--from-branchflag to specific a different branch.Finally, if you give the--pull-requestflag, the command will push any changes to the remote and attempt to create a pull request using the GitHub API.
The GitHub username and repository name will be fetched from the remote url (seegit remote -v | grep origin), or can be supplied with--usernameand--github-repository.To create the pull request, a personal access token is required for API authentication.
These can be created athttps://github.com/settings/tokens.
Supply this using the--auth-tokenflag.Create an nf-core pipeline logoThenf-core create-logocommand creates a logo for your pipeline based on the nf-core template and the pipeline name. You can specify the width of the logo in pixels with the--widthflag. Additionally, you can specify the output format to be eitherpngorsvgwith the--formatflag. The default format ispng.Usage isnf-core create-logo <text>, eg:Tools CLI TUICLI:Command line interfaceTUI:Terminal user interfaceThenf-corecommand line interface is fairly large, with a lot of commands and options.
To make it easier to explore and use, runnf-core tuito launch a graphical terminal interface.This functionality works usingTextualize/trogonand is based on the underlying CLI implementation that usesClick.ModulesWith the advent ofNextflow DSL2, we are creating a centralised repository of modules.
These are software tool process definitions that can be imported into any pipeline.
This allows multiple pipelines to use the same code for share tools and gives a greater degree of granulairy and unit testing.The nf-core DSL2 modules repository is athttps://github.com/nf-core/modulesCustom remote modulesThe modules supercommand comes with two flags for specifying a custom remote:--git-remote <git remote url>: Specify the repository from which the modules should be fetched as a git URL. Defaults to the github repository ofnf-core/modules.--branch <branch name>: Specify the branch from which the modules should be fetched. Defaults to the default branch of your repository.For example, if you want to install thefastqcmodule from the repositorynf-core/modules-testhosted atgitlab.com, you can use the following command:nf-core modules --git-remote git@gitlab.com:nf-core/modules-test.git install fastqcNote that a custom remote must follow a similar directory structure to that ofnf-core/moduleśfor thenf-core modulescommands to work properly.The directory where modules are installed will be prompted or obtained fromorg_pathin the.nf-core.ymlfile if available. If your modules are located atmodules/my-folder/TOOL/SUBTOOLyour.nf-core.ymlshould have:org_path:my-folderPlease avoid installing the same tools from two different remotes, as this can lead to further errors.The modules commands will during initalisation try to pull changes from the remote repositories. If you want to disable this, for example
due to performance reason or if you want to run the commands offline, you can use the flag--no-pull. Note however that the commands will
still need to clone repositories that have previously not been used.Private remote repositoriesYou can use the modules command with private remote repositories. Make sure that your localgitis correctly configured with your private remote
and then specify the remote the same way you would do with a public remote repository.List modulesThenf-core modules listcommand provides the subcommandsremoteandlocalfor listing modules installed in a remote repository and in the local pipeline respectively. Both subcommands allow to use a pattern for filtering the modules by keywords eg:nf-core modules list <subcommand> <keyword>.List remote modulesTo list all modules available onnf-core/modules, you can usenf-core modules list remote, which will print all available modules to the terminal.List installed modulesTo list modules installed in a local pipeline directory you can usenf-core modules list local. This will list the modules install in the current working directory by default. If you want to specify another directory, use the--dir <pipeline_dir>flag.Show information about a moduleFor quick help about how a module works, usenf-core modules info <tool>.
This shows documentation about the module on the command line, similar to what's available on thenf-core website.Install modules in a pipelineYou can install modules fromnf-core/modulesin your pipeline usingnf-core modules install.
A module installed this way will be installed to the./modules/nf-core/modulesdirectory.You can pass the module name as an optional argument tonf-core modules installinstead of using the cli prompt, eg:nf-core modules install fastqc. You can specify a pipeline directory other than the current working directory by using the--dir <pipeline dir>.There are three additional flags that you can use when installing a module:--force: Overwrite a previously installed version of the module.--prompt: Select the module version using a cli prompt.--sha <commit_sha>: Install the module at a specific commit.Update modules in a pipelineYou can update modules installed from a remote repository in your pipeline usingnf-core modules update.You can pass the module name as an optional argument tonf-core modules updateinstead of using the cli prompt, eg:nf-core modules update fastqc. You can specify a pipeline directory other than the current working directory by using the--dir <pipeline dir>.There are five additional flags that you can use with this command:--force: Reinstall module even if it appears to be up to date--prompt: Select the module version using a cli prompt.--sha <commit_sha>: Install the module at a specific commit from thenf-core/modulesrepository.--preview/--no-preview: Show the diff between the installed files and the new version before installing.--save-diff <filename>: Save diffs to a file instead of updating in place. The diffs can then be applied withgit apply <filename>.--all: Use this flag to run the command on all modules in the pipeline.If you don't want to update certain modules or want to update them to specific versions, you can make use of the.nf-core.ymlconfiguration file. For example, you can prevent thestar/alignmodule installed fromnf-core/modulesfrom being updated by adding the following to the.nf-core.ymlfile:update:https://github.com/nf-core/modules.git:nf-core:star/align:FalseIf you want this module to be updated only to a specific version (or downgraded), you could instead specifiy the version:update:https://github.com/nf-core/modules.git:nf-core:star/align:"e937c7950af70930d1f34bb961403d9d2aa81c7"This also works at the repository level. For example, if you want to exclude all modules installed fromnf-core/modulesfrom being updated you could add:update:https://github.com/nf-core/modules.git:nf-core:Falseor if you want all modules innf-core/modulesat a specific version:update:https://github.com/nf-core/modules.git:nf-core:"e937c7950af70930d1f34bb961403d9d2aa81c7"Note that the module versions specified in the.nf-core.ymlfile has higher precedence than versions specified with the command line flags, thus aiding you in writing reproducible pipelines.Remove a module from a pipelineTo delete a module from your pipeline, runnf-core modules remove.You can pass the module name as an optional argument tonf-core modules removeinstead of using the cli prompt, eg:nf-core modules remove fastqc. To specify the pipeline directory, use--dir <pipeline_dir>.Create a patch file for a moduleIf you want to make a minor change to a locally installed module but still keep it up date with the remote version, you can create a patch file usingnf-core modules patch.The generated patches work withnf-core modules update: when you install a new version of the module, the command tries to apply
the patch automatically. The patch application fails if the new version of the module modifies the same lines as the patch. In this case,
the patch new version is installed but the old patch file is preserved.When linting a patched module, the linting command will check the validity of the patch. When running other lint tests the patch is applied in reverse, and the original files are linted.Create a new moduleThis command creates a new nf-core module from the nf-core module template.
This ensures that your module follows the nf-core guidelines.
The template contains extensiveTODOmessages to walk you through the changes you need to make to the template.You can create a new module usingnf-core modules create.This command can be used both when writing a module for the sharednf-core/modulesrepository,
and also when creating local modules for a pipeline.Which type of repository you are working in is detected by therepository_typeflag in a.nf-core.ymlfile in the root directory,
set to eitherpipelineormodules.
The command will automatically look through parent directories for this file to set the root path, so that you can run the command in a subdirectory.
It will start in the current working directory, or whatever is specified with--dir <directory>.Thenf-core modules createcommand will prompt you with the relevant questions in order to create all of the necessary module files.Check a module against nf-core guidelinesRun thenf-core modules lintcommand to check modules in the current working directory (pipeline or nf-core/modules clone) against nf-core guidelines.Use the--allflag to run linting on all modules found. Use--dir <pipeline_dir>to specify another directory than the current working directory.Create a test for a moduleAll modules onnf-core/moduleshave a strict requirement of being unit tested using minimal test data. We usenf-testas our testing framework.
Each module comes already with a template for the test file intest/main.nf.test. Replace the placeholder code in that file with your specific input, output and proces. In order to generate the corresponding snapshot after writing your test, you can use thenf-core modules testcommand. This command will runnf-test testtwice, to also check for snapshot stability, i.e. that the same snapshot is generated on multiple runs.You can specify the module name in the form TOOL/SUBTOOL in the command or provide it later through interactive prompts.In case you changed something in the test and want to update the snapshot, runnf-coremodulestest--updateIf you want to run the test only once without checking for snapshot stability, you can use the--onceflag.Bump bioconda and container versions of modules inIf you are contributing to thenf-core/modulesrepository and want to bump bioconda and container versions of certain modules, you can use thenf-core modules bump-versionshelper tool. This will bump the bioconda version of a single or all modules to the latest version and also fetch the correct Docker and Singularity container tags.If you don't want to update certain modules or want to update them to specific versions, you can make use of the.nf-core.ymlconfiguration file. For example, you can prevent thestar/alignmodule from being updated by adding the following to the.nf-core.ymlfile:bump-versions:star/align:FalseIf you want this module to be updated only to a specific version (or downgraded), you could instead specifiy the version:bump-versions:star/align:"2.6.1d"SubworkflowsAfter the launch of nf-core modules, we can provide now also nf-core subworkflows to fully utilize the power of DSL2 modularization.
Subworkflows are chains of multiple module definitions that can be imported into any pipeline.
This allows multiple pipelines to use the same code for a the same tasks, and gives a greater degree of reusability and unit testing.To allow us to test modules and subworkflows together we put the nf-core DSL2 subworkflows into thesubworkflowsdirectory of the modules repository is athttps://github.com/nf-core/modules.Custom remote subworkflowsThe subworkflows supercommand released in nf-core/tools version 2.7 comes with two flags for specifying a custom remote repository:--git-remote <git remote url>: Specify the repository from which the subworkflows should be fetched as a git URL. Defaults to the github repository ofnf-core/modules.--branch <branch name>: Specify the branch from which the subworkflows should be fetched. Defaults to the default branch of your repository.For example, if you want to install thebam_stats_samtoolssubworkflow from the repositorynf-core/modules-testhosted atgitlab.comin the branchsubworkflows, you can use the following command:nf-coresubworkflows--git-remotegit@gitlab.com:nf-core/modules-test.git--branchsubworkflowsinstallbam_stats_samtoolsNote that a custom remote must follow a similar directory structure to that ofnf-core/modulesfor thenf-core subworkflowscommands to work properly.The directory where subworkflows are installed will be prompted or obtained fromorg_pathin the.nf-core.ymlfile if available. If your subworkflows are located atsubworkflows/my-folder/SUBWORKFLOW_NAMEyour.nf-core.ymlfile should have:org_path:my-folderPlease avoid installing the same tools from two different remotes, as this can lead to further errors.The subworkflows commands will during initalisation try to pull changes from the remote repositories. If you want to disable this, for example due to performance reason or if you want to run the commands offline, you can use the flag--no-pull. Note however that the commands will still need to clone repositories that have previously not been used.Private remote repositoriesYou can use the subworkflows command with private remote repositories. Make sure that your localgitis correctly configured with your private remote
and then specify the remote the same way you would do with a public remote repository.List subworkflowsThenf-core subworkflows listcommand provides the subcommandsremoteandlocalfor listing subworkflows installed in a remote repository and in the local pipeline respectively. Both subcommands allow to use a pattern for filtering the subworkflows by keywords eg:nf-core subworkflows list <subworkflow_name> <keyword>.List remote subworkflowsTo list all subworkflows available onnf-core/modules, you can usenf-core subworkflows list remote, which will print all available subworkflows to the terminal.List installed subworkflowsTo list subworkflows installed in a local pipeline directory you can usenf-core subworkflows list local. This will list the subworkflows install in the current working directory by default. If you want to specify another directory, use the--dir <pipeline_dir>flag.Show information about a subworkflowFor quick help about how a subworkflow works, usenf-core subworkflows info <subworkflow_name>.
This shows documentation about the subworkflow on the command line, similar to what's available on thenf-core website.Install subworkflows in a pipelineYou can install subworkflows fromnf-core/modulesin your pipeline usingnf-core subworkflows install.
A subworkflow installed this way will be installed to the./subworkflows/nf-coredirectory.You can pass the subworkflow name as an optional argument tonf-core subworkflows installlike above or select it from a list of available subworkflows by only runningnf-core subworkflows install.There are four additional flags that you can use when installing a subworkflow:--dir: Pipeline directory, the default is the current working directory.--force: Overwrite a previously installed version of the subworkflow.--prompt: Select the subworkflow version using a cli prompt.--sha <commit_sha>: Install the subworkflow at a specific commit.Update subworkflows in a pipelineYou can update subworkflows installed from a remote repository in your pipeline usingnf-core subworkflows update.You can pass the subworkflow name as an optional argument tonf-core subworkflows updatelike above or select it from the list of available subworkflows by only runningnf-core subworkflows update.There are six additional flags that you can use with this command:--dir: Pipeline directory, the default is the current working directory.--force: Reinstall subworkflow even if it appears to be up to date--prompt: Select the subworkflow version using a cli prompt.--sha <commit_sha>: Install the subworkflow at a specific commit from thenf-core/modulesrepository.--preview/--no-preview: Show the diff between the installed files and the new version before installing.--save-diff <filename>: Save diffs to a file instead of updating in place. The diffs can then be applied withgit apply <filename>.--all: Use this flag to run the command on all subworkflows in the pipeline.--update-deps: Use this flag to automatically update all dependencies of a subworkflow.If you don't want to update certain subworkflows or want to update them to specific versions, you can make use of the.nf-core.ymlconfiguration file. For example, you can prevent thebam_rseqcsubworkflow installed fromnf-core/modulesfrom being updated by adding the following to the.nf-core.ymlfile:update:https://github.com/nf-core/modules.git:nf-core:bam_rseqc:FalseIf you want this subworkflow to be updated only to a specific version (or downgraded), you could instead specifiy the version:update:https://github.com/nf-core/modules.git:nf-core:bam_rseqc:"36a77f7c6decf2d1fb9f639ae982bc148d6828aa"This also works at the repository level. For example, if you want to exclude all modules and subworkflows installed fromnf-core/modulesfrom being updated you could add:update:https://github.com/nf-core/modules.git:nf-core:Falseor if you want all subworkflows innf-core/modulesat a specific version:update:https://github.com/nf-core/modules.git:nf-core:"e937c7950af70930d1f34bb961403d9d2aa81c7"Note that the subworkflow versions specified in the.nf-core.ymlfile has higher precedence than versions specified with the command line flags, thus aiding you in writing reproducible pipelines.Remove a subworkflow from a pipelineTo delete a subworkflow from your pipeline, runnf-core subworkflows remove.You can pass the subworkflow name as an optional argument tonf-core subworkflows removelike above or select it from the list of available subworkflows by only runningnf-core subworkflows remove. To specify the pipeline directory, use--dir <pipeline_dir>.Create a new subworkflowThis command creates a new nf-core subworkflow from the nf-core subworkflow template.
This ensures that your subworkflow follows the nf-core guidelines.
The template contains extensiveTODOmessages to walk you through the changes you need to make to the template.
See thesubworkflow documentationfor more details around creating a new subworkflow, including rules about nomenclature and a step-by-step guide.You can create a new subworkflow usingnf-core subworkflows create.This command can be used both when writing a subworkflow for the sharednf-core/modulesrepository,
and also when creating local subworkflows for a pipeline.Which type of repository you are working in is detected by therepository_typeflag in a.nf-core.ymlfile in the root directory,
set to eitherpipelineormodules.
The command will automatically look through parent directories for this file to set the root path, so that you can run the command in a subdirectory.
It will start in the current working directory, or whatever is specified with--dir <directory>.Thenf-core subworkflows createcommand will prompt you with the relevant questions in order to create all of the necessary subworkflow files.Create a test for a subworkflowAll subworkflows onnf-core/moduleshave a strict requirement of being unit tested using minimal test data. We usenf-testas our testing framework.
Each subworkflow comes already with a template for the test file intest/main.nf.test. Replace the placeholder code in that file with your specific input, output and proces. In order to generate the corresponding snapshot after writing your test, you can use thenf-core subworkflows testcommand. This command will runnf-test testtwice, to also check for snapshot stability, i.e. that the same snapshot is generated on multiple runs.You can specify the subworkflow name in the command or provide it later through interactive prompts.In case you changed something in the test and want to update the snapshot, runnf-coresubworkflowstest--updateIf you want to run the test only once without checking for snapshot stability, you can use the--onceflag.Check a subworkflow against nf-core guidelinesRun thenf-core subworkflows lintcommand to check subworkflows in the current working directory (a pipeline or a clone of nf-core/modules) against nf-core guidelines.Use the--allflag to run linting on all subworkflows found. Use--dir <pipeline_dir>to specify a different directory than the current working directory.CitationIf you usenf-core toolsin your work, please cite thenf-corepublication as follows:The nf-core framework for community-curated bioinformatics pipelines.Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.Nat Biotechnol.2020 Feb 13. doi:10.1038/s41587-020-0439-x.