mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Update docs in light of functionality being ported to nf-core modules subcommands (#281)
* Add docs for existing modules * Add new module checklist * Update adding modules section * Add links and spacing * Adjust spacing * Update pytest section * Add create-test-yml docs * Final updates * Add minimum NF version * Add some docs for Nextflow edge releases * Indent bulleted section
This commit is contained in:
parent
36593aa43e
commit
b85f331f82
1 changed files with 256 additions and 142 deletions
398
README.md
398
README.md
|
@ -20,12 +20,13 @@ A repository for hosting [Nextflow DSL2](https://www.nextflow.io/docs/latest/dsl
|
|||
|
||||
- [Using existing modules](#using-existing-modules)
|
||||
- [Adding a new module file](#adding-a-new-module-file)
|
||||
- [Module template](#module-template)
|
||||
- [Guidelines](#guidelines)
|
||||
- [Testing](#testing)
|
||||
- [Documentation](#documentation)
|
||||
- [Checklist](#checklist)
|
||||
- [nf-core modules create](#nf-core-modules-create)
|
||||
- [Test data](#test-data)
|
||||
- [Uploading to `nf-core/modules`](#uploading-to-nf-coremodules)
|
||||
- [Guidelines](#guidelines)
|
||||
- [Terminology](#terminology)
|
||||
- [Nextflow edge releases](#nextflow-edge-releases)
|
||||
- [Help](#help)
|
||||
- [Citation](#citation)
|
||||
|
||||
|
@ -35,51 +36,47 @@ The module files hosted in this repository define a set of processes for softwar
|
|||
|
||||
We have written a helper command in the `nf-core/tools` package that uses the GitHub API to obtain the relevant information for the module files present in the [`software/`](software/) directory of this repository. This includes using `git` commit hashes to track changes for reproducibility purposes, and to download and install all of the relevant module files.
|
||||
|
||||
1. [Install](https://github.com/nf-core/tools#installation) the latest version of `nf-core/tools` (`>=1.10.2`)
|
||||
1. Install the latest version of [`nf-core/tools`](https://github.com/nf-core/tools#installation) (`>=1.13`)
|
||||
2. List the available modules:
|
||||
|
||||
```console
|
||||
$ nf-core modules list
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
nf-core/tools version 1.13
|
||||
|
||||
nf-core/tools version 1.10.2
|
||||
INFO Modules available from nf-core/modules (master): pipeline_modules.py:164
|
||||
|
||||
|
||||
|
||||
INFO Modules available from nf-core/modules (master): modules.py:51
|
||||
|
||||
bwa/index
|
||||
bwa/mem
|
||||
deeptools/computematrix
|
||||
deeptools/plotfingerprint
|
||||
deeptools/plotheatmap
|
||||
deeptools/plotprofile
|
||||
fastqc
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ Module Name ┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ bandage/image │
|
||||
│ bcftools/consensus │
|
||||
│ bcftools/filter │
|
||||
│ bcftools/isec │
|
||||
..truncated..
|
||||
```
|
||||
|
||||
3. Install the module in your pipeline directory:
|
||||
|
||||
```console
|
||||
$ nf-core modules install . fastqc
|
||||
$ nf-core modules install . --tool fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 1.10.2
|
||||
nf-core/tools version 1.13
|
||||
|
||||
|
||||
|
||||
INFO Installing fastqc modules.py:62
|
||||
INFO Downloaded 3 files to ./modules/nf-core/software/fastqc modules.py:97
|
||||
INFO Installing fastqc pipeline_modules.py:213
|
||||
INFO Downloaded 3 files to ./modules/nf-core/software/fastqc pipeline_modules.py:236
|
||||
```
|
||||
|
||||
4. Import the module in your Nextflow script:
|
||||
|
@ -92,25 +89,59 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
include { FASTQC } from './modules/nf-core/software/fastqc/main' addParams( options: [:] )
|
||||
```
|
||||
|
||||
5. We have plans to add other utility commands to help developers install and maintain modules downloaded from this repository so watch this space!
|
||||
5. Remove the module from the pipeline repository if required:
|
||||
|
||||
```console
|
||||
$ nf-core modules --help
|
||||
$ nf-core modules remove . --tool fastqc
|
||||
|
||||
...truncated...
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
Commands:
|
||||
list List available software modules.
|
||||
install Add a DSL2 software wrapper module to a pipeline.
|
||||
update Update one or all software wrapper modules. (NOT YET IMPLEMENTED)
|
||||
remove Remove a software wrapper from a pipeline. (NOT YET IMPLEMENTED)
|
||||
check Check that imported module code has not been modified. (NOT YET IMPLEMENTED)
|
||||
nf-core/tools version 1.13
|
||||
|
||||
INFO Removing fastqc pipeline_modules.py:271
|
||||
INFO Successfully removed fastqc pipeline_modules.py:285
|
||||
```
|
||||
|
||||
## Adding a new module file
|
||||
6. Check that a locally installed nf-core module is up-to-date compared to the one hosted in this repo:
|
||||
|
||||
> **NB:** The definition and standards for module files are still under discussion
|
||||
but we are now gladly accepting submissions :)
|
||||
```console
|
||||
$ nf-core modules lint . --tool fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 1.13
|
||||
|
||||
INFO Linting pipeline: . lint.py:104
|
||||
INFO Linting module: fastqc lint.py:106
|
||||
|
||||
╭─────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ [!] 1 Test Warning │
|
||||
╰─────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────┬───────────────────────────────┬──────────────────────────────────╮
|
||||
│ Module name │ Test message │ File path │
|
||||
├──────────────┼───────────────────────────────┼──────────────────────────────────┤
|
||||
│ fastqc │ Local copy of module outdated │ modules/nf-core/software/fastqc/ │
|
||||
╰──────────────┴────────────────────────────── ┴──────────────────────────────────╯
|
||||
╭──────────────────────╮
|
||||
│ LINT RESULTS SUMMARY │
|
||||
├──────────────────────┤
|
||||
│ [✔] 15 Tests Passed │
|
||||
│ [!] 1 Test Warning │
|
||||
│ [✗] 0 Test Failed │
|
||||
╰──────────────────────╯
|
||||
```
|
||||
|
||||
We have plans to add other utility commands to help developers install and maintain modules downloaded from this repository so watch this space e.g. `nf-core modules update` command to automatically check and update modules installed within the pipeline.
|
||||
|
||||
## Adding a new module file
|
||||
|
||||
If you decide to upload a module to `nf-core/modules` then this will
|
||||
ensure that it will become available to all nf-core pipelines,
|
||||
|
@ -118,25 +149,166 @@ and to everyone within the Nextflow community! See
|
|||
[`software/`](software)
|
||||
for examples.
|
||||
|
||||
### Module template
|
||||
### Checklist
|
||||
|
||||
We have added a directory called [`software/TOOL/SUBTOOL/`](software/TOOL/SUBTOOL/) that serves as a template with which to create your own module and [`tests/software/TOOL/SUBTOOL/`](tests/software/TOOL/SUBTOOL/) as an example of how to add the required CI tests. Where applicable, we have added extensive `TODO` statements for general information, to help guide you as to where to make the appropriate changes, and how to make them. If in doubt, have a look at how we have done things for other modules.
|
||||
Please check that the module you wish to add isn't already on [`nf-core/modules`](https://github.com/nf-core/modules/tree/master/software):
|
||||
- Use the [`nf-core modules list`](https://github.com/nf-core/tools#list-modules) command
|
||||
- Check [open pull requests](https://github.com/nf-core/modules/pulls)
|
||||
- Search [open issues](https://github.com/nf-core/modules/issues)
|
||||
|
||||
```console
|
||||
.
|
||||
├── software
|
||||
│ └── TOOL
|
||||
│ └── SUBTOOL
|
||||
│ ├── functions.nf ## Utility functions imported in main module script
|
||||
│ ├── main.nf ## Main module script
|
||||
│ └── meta.yml ## Documentation for module, input, output, params, author
|
||||
├── tests
|
||||
│ └── software
|
||||
│ └── TOOL
|
||||
│ └── SUBTOOL
|
||||
│ ├── main.nf ## Minimal workflow to test module
|
||||
│ └── test.yml ## Pytest-workflow test file
|
||||
```
|
||||
If the module doesn't exist on `nf-core/modules`:
|
||||
- Please create a [new issue](https://github.com/nf-core/modules/issues/new/choose) before adding it
|
||||
- Set an appropriate subject for the issue e.g. `new module: fastqc`
|
||||
- Add yourself to the `Assignees` so we can track who is working on the module
|
||||
- Set the appropriate `Labels` for the issue e.g. `new module`
|
||||
|
||||
### nf-core modules create
|
||||
|
||||
We have implemented a number of commands in the `nf-core/tools` package to make it incredibly easy for you to create and contribute your own modules to nf-core/modules.
|
||||
|
||||
1. Install the latest version of [`nf-core/tools`](https://github.com/nf-core/tools#installation) (`>=1.13`)
|
||||
2. Install [`nextflow`](https://nf-co.re/usage/installation) (`>=20.11.0-edge`; see [Nextflow edge releases](#nextflow-edge-releases))
|
||||
3. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/) or [`Conda`](https://conda.io/miniconda.html)
|
||||
4. [Fork and clone this repo locally](#uploading-to-nf-coremodules)
|
||||
5. Create a module using the [nf-core DSL2 module template](https://github.com/nf-core/tools/blob/master/nf_core/module-template/software/main.nf):
|
||||
|
||||
```console
|
||||
$ nf-core modules create . --tool fastqc --author @joebloggs --label process_low --meta
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 1.13
|
||||
|
||||
INFO Using Bioconda package: 'bioconda::fastqc=0.11.9' create.py:130
|
||||
INFO Using Docker / Singularity container with tag: 'fastqc:0.11.9--0' create.py:140
|
||||
INFO Created / edited following files: create.py:218
|
||||
./software/fastqc/functions.nf
|
||||
./software/fastqc/main.nf
|
||||
./software/fastqc/meta.yml
|
||||
./tests/software/fastqc/main.nf
|
||||
./tests/software/fastqc/test.yml
|
||||
./tests/config/pytest_software.yml
|
||||
```
|
||||
|
||||
All of the files required to add the module to `nf-core/modules` will be created/edited in the appropriate places. The 4 files you will need to change are:
|
||||
|
||||
1. [`./software/fastqc/main.nf`](https://github.com/nf-core/modules/blob/master/software/fastqc/main.nf)
|
||||
|
||||
This is the main script containing the `process` definition for the module. You will see an extensive number of `TODO` statements to help guide you to fill in the appropriate sections and to ensure that you adhere to the guidelines we have set for module submissions.
|
||||
|
||||
2. [`./software/fastqc/meta.yml`](https://github.com/nf-core/modules/blob/master/software/fastqc/meta.yml)
|
||||
|
||||
This file will be used to store general information about the module and author details - the majority of which will already be auto-filled. However, you will need to add a brief description of the files defined in the `input` and `output` section of the main script since these will be unique to each module.
|
||||
|
||||
3. [`./tests/software/fastqc/main.nf`](https://github.com/nf-core/modules/blob/master/tests/software/fastqc/main.nf)
|
||||
|
||||
Every module MUST have a test workflow. This file will define one or more Nextflow `workflow` definitions that will be used to unit test the output files created by the module. By default, one `workflow` definition will be added but please feel free to add as many as possible so we can ensure that the module works on different data types / parameters e.g. separate `workflow` for single-end and paired-end data.
|
||||
|
||||
Minimal test data required for your module may already exist within this repository, in which case you may just have to change a couple of paths in this file - see the [Test data](#test-data) section for more info and guidelines for adding new standardised data if required.
|
||||
|
||||
4. [`./tests/software/fastqc/test.yml`](https://github.com/nf-core/modules/blob/master/tests/software/fastqc/test.yml)
|
||||
|
||||
This file will contain all of the details required to unit test the main script in the point above using [pytest-workflow](https://pytest-workflow.readthedocs.io/). If possible, any outputs produced by the test workflow(s) MUST be included and listed in this file along with an appropriate check e.g. md5sum. The different test options are listed in the [pytest-workflow docs](https://pytest-workflow.readthedocs.io/en/stable/#test-options).
|
||||
|
||||
As highlighted in the next point, we have added a command to make it much easier to test the workflow(s) defined for the module and to automatically create the `test.yml` with the md5sum hashes for all of the outputs generated by the module.
|
||||
|
||||
`md5sum` checks are the preferable choice of test to determine file changes, however, this may not be possible for all outputs generated by some tools e.g. if they include time stamps or command-related headers. Please do your best to avoid just checking for the file being present e.g. it may still be possible to check that the file contains the appropriate text snippets.
|
||||
|
||||
6. Create a yaml file containing information required for module unit testing
|
||||
|
||||
```console
|
||||
$ nf-core modules create-test-yml
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 1.13
|
||||
|
||||
|
||||
INFO Press enter to use default values (shown in brackets) or type your own responses test_yml_builder.py:51
|
||||
? Tool name: fastqc
|
||||
Test YAML output path (- for stdout) (tests/software/fastqc/test.yml):
|
||||
INFO Looking for test workflow entry points: 'tests/software/fastqc/main.nf' test_yml_builder.py:116
|
||||
INFO Building test meta for entry point 'test_fastqc_single_end' test_yml_builder.py:150
|
||||
Test name (fastqc test_fastqc_single_end):
|
||||
Test command (nextflow run tests/software/fastqc -entry test_fastqc_single_end -c tests/config/nextflow.config):
|
||||
Test tags (comma separated) (fastqc,fastqc_single_end):
|
||||
Test output folder with results (leave blank to run test):
|
||||
? Choose software profile Singularity
|
||||
INFO Setting env var '$PROFILE' to 'singularity' test_yml_builder.py:258
|
||||
INFO Running 'fastqc' test with command: test_yml_builder.py:263
|
||||
nextflow run tests/software/fastqc -entry test_fastqc_single_end -c tests/config/nextflow.config --outdir /tmp/tmpgbneftf5
|
||||
INFO Test workflow finished! test_yml_builder.py:276
|
||||
INFO Writing to 'tests/software/fastqc/test.yml' test_yml_builder.py:293
|
||||
```
|
||||
|
||||
7. Lint the module locally to check that it adheres to nf-core guidelines before submission
|
||||
|
||||
```console
|
||||
$ nf-core modules lint . --tool fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 1.13
|
||||
|
||||
INFO Linting modules repo: . lint.py:102
|
||||
INFO Linting module: fastqc lint.py:106
|
||||
|
||||
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ [!] 3 Test Warnings │
|
||||
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────┬──────────────────────────────────────────────────────────────┬──────────────────────────────────╮
|
||||
│ Module name │ Test message │ File path │
|
||||
├──────────────┼──────────────────────────────────────────────────────────────┼──────────────────────────────────┤
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description of the module... │ modules/nf-core/software/fastqc/ │
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description and other det... │ modules/nf-core/software/fastqc/ │
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description of all of the... │ modules/nf-core/software/fastqc/ │
|
||||
╰──────────────┴──────────────────────────────────────────────────────────────┴──────────────────────────────────╯
|
||||
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ [!] 1 Test Failed │
|
||||
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────┬──────────────────────────────────────────────────────────────┬──────────────────────────────────╮
|
||||
│ Module name │ Test message │ File path │
|
||||
├──────────────┼──────────────────────────────────────────────────────────────┼──────────────────────────────────┤
|
||||
│ fastqc │ 'meta' map not emitted in output channel(s) │ modules/nf-core/software/fastqc/ │
|
||||
╰──────────────┴──────────────────────────────────────────────────────────────┴──────────────────────────────────╯
|
||||
╭──────────────────────╮
|
||||
│ LINT RESULTS SUMMARY │
|
||||
├──────────────────────┤
|
||||
│ [✔] 38 Tests Passed │
|
||||
│ [!] 3 Test Warning │
|
||||
│ [✗] 1 Test Failed │
|
||||
╰──────────────────────╯
|
||||
```
|
||||
|
||||
### Test data
|
||||
|
||||
In order to test that each module added to `nf-core/modules` is actually working and to be able to track any changes to results files between module updates we have set-up a number of Github Actions CI tests to run each module on a minimal test dataset using Docker, Singularity and Conda.
|
||||
|
||||
- All test data for `nf-core/modules` MUST be added to [`tests/data/`](tests/data/) and organised by filename extension.
|
||||
|
||||
- In order to keep the size of this repository as minimal as possible, pre-existing files from [`tests/data/`](tests/data/) MUST be reused if at all possible.
|
||||
|
||||
- Test files MUST be kept as tiny as possible.
|
||||
|
||||
### Uploading to `nf-core/modules`
|
||||
|
||||
[Fork](https://help.github.com/articles/fork-a-repo/) the `nf-core/modules` repository to your own GitHub account. Within the local clone of your fork add the module file to the [`software/`](software) directory. Please try and keep PRs as atomic as possible to aid the reviewing process - ideally, one module addition/update per PR.
|
||||
|
||||
Commit and push these changes to your local clone on GitHub, and then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) on the `nf-core/modules` GitHub repo with the appropriate information.
|
||||
|
||||
We will be notified automatically when you have created your pull request, and providing that everything adheres to nf-core guidelines we will endeavour to approve your pull request as soon as possible.
|
||||
|
||||
### Guidelines
|
||||
|
||||
|
@ -202,10 +374,10 @@ using a combination of `bwa` and `samtools` to output a BAM file instead of a SA
|
|||
|
||||
[BioContainers](https://biocontainers.pro/#/) is a registry of Docker and Singularity containers automatically created from all of the software packages on [Bioconda](https://bioconda.github.io/). Where possible we will use BioContainers to fetch pre-built software containers and Bioconda to install software using Conda.
|
||||
|
||||
- Software requirements SHOULD be declared within the module file using the Nextflow `container` directive. For single-tool BioContainers, the simplest method to obtain the Docker container path is to replace `bwa` with your tool name in this [Quay.io link](https://quay.io/repository/biocontainers/bwa?tab=tags). You will see a list of tags sorted by the most recent. You can then use exactly the same name (e.g. `bwa`) version (e.g. `0.7.17`) and tag (e.g. `hed695b0_7`) to add all of the Conda, Docker and Singularity definitions in the module.
|
||||
- Software requirements SHOULD be declared within the module file using the Nextflow `container` directive. For single-tool BioContainers, the `nf-core modules create` command will automatically fetch and fill-in the appropriate Conda / Docker / Singularity definitions by parsing the information provided in the first part of the module name:
|
||||
|
||||
```nextflow
|
||||
conda (params.enable_conda ? "bioconda::bwa=0.7.17=hed695b0_7" : null) // Conda package
|
||||
conda (params.enable_conda ? "bioconda::bwa=0.7.17" : null) // Conda package
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bwa:0.7.17--hed695b0_7" // Singularity image
|
||||
} else {
|
||||
|
@ -213,7 +385,7 @@ using a combination of `bwa` and `samtools` to output a BAM file instead of a SA
|
|||
}
|
||||
```
|
||||
|
||||
- If the software is available on Conda it MUST also be defined using the Nextflow `conda` directive. Using `bioconda::bwa=0.7.17=hed695b0_7` as an example, software MUST be pinned to the channel (i.e. `bioconda`), version (i.e. `0.7.17`) and build (i.e. `hed695b0_7`). This allows us to perform file output integrity CI tests on the same input test data with Docker, Singularity and Conda.
|
||||
- If the software is available on Conda it MUST also be defined using the Nextflow `conda` directive. Using `bioconda::bwa=0.7.17` as an example, software MUST be pinned to the channel (i.e. `bioconda`) and version (i.e. `0.7.17`). Conda packages MUST not be pinned to a build because they can vary on different platforms.
|
||||
|
||||
- If required, multi-tool containers may also be available on BioContainers e.g. [`bwa` and `samtools`](https://biocontainers.pro/#/tools/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40). You can install and use the [`galaxy-tool-util`](https://anaconda.org/bioconda/galaxy-tool-util) package to search for both single- and multi-tool containers available in Conda, Docker and Singularity format. e.g. to search for Docker (hosted on Quay.io) and Singularity multi-tool containers with both `bowtie` and `samtools` installed you can use the following command:
|
||||
|
||||
|
@ -241,73 +413,6 @@ The `saveFiles` function can be found in the [`functions.nf`](software/fastqc/fu
|
|||
|
||||
We also use a standardised parameter called `params.publish_dir_mode` that can be used to alter the file publishing method (default: `copy`).
|
||||
|
||||
### Testing
|
||||
|
||||
In order to test that each module added to `nf-core/modules` is actually working and to be able to track any changes to results files between module updates we have set-up a number of Github Actions CI tests to run each module on a minimal test dataset using Docker, Singularity and Conda.
|
||||
|
||||
#### Test data
|
||||
|
||||
- All test data for `nf-core/modules` MUST be added to [`tests/data/`](tests/data/) and organised by filename extension.
|
||||
|
||||
- In order to keep the size of this repository as minimal as possible, pre-existing files from [`tests/data/`](tests/data/) MUST be reused if at all possible.
|
||||
|
||||
- Test files MUST be kept as tiny as possible.
|
||||
|
||||
#### Pytest workflow
|
||||
|
||||
- Every module MUST have a test workflow utilising test data added to the appropriate directory e.g. [`tests/software/fastqc/main.nf`](tests/software/fastqc/main.nf)
|
||||
|
||||
- Any outputs produced by the test workflow MUST be included in the [pytest-workflow](https://pytest-workflow.readthedocs.io/en/stable) for that tool e.g. [`tests/software/fastqc/test.yml`](tests/software/fastqc/test.yml). `md5sum` checks are the preferable choice of test to determine file changes, however, this may not be possible for all outputs generated by some tools e.g. if they include time stamps or command-related headers. Please do your best to avoid just checking for the file being present e.g. it may still be possible to check that the file contains the appropriate text snippets.
|
||||
|
||||
- A filter for the module must be created in [`.github/filters.yml`](.github/filters.yml). If the test workflow you have created invokes more than one tool please include any paths specific for those tool's too e.g. `bowtie build` is upstream of `bowtie align` and they have both been chained together to test the latter.
|
||||
|
||||
#### Running Tests Locally
|
||||
|
||||
1. Install [`nextflow`](https://nf-co.re/usage/installation)
|
||||
|
||||
2. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/) or [`Conda`](https://conda.io/miniconda.html)
|
||||
|
||||
3. Install [`pytest-workflow`](https://pytest-workflow.readthedocs.io/en/stable/#installation)
|
||||
|
||||
4. Start running your own tests!
|
||||
|
||||
- Typical command with Docker:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=docker pytest --tag bowtie --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Singularity:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
TMPDIR=~ PROFILE=singularity pytest --tag bowtie --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Conda:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=conda pytest --tag bowtie --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- See [docs on running pytest-workflow](https://pytest-workflow.readthedocs.io/en/stable/#running-pytest-workflow) for more info.
|
||||
|
||||
### Documentation
|
||||
|
||||
- A module MUST be documented in the [`meta.yml`](software/TOOL/SUBTOOL/meta.yml) file. It MUST document `params`, `input` and `output`. `input` and `output` MUST be a nested list.
|
||||
|
||||
We are aware that there is very little documentation, documenting the (`Documentation`)[#documentation] section. Writing more code and tests is so much cooooler! Please bear with us, we will get here eventually...
|
||||
|
||||
### Uploading to `nf-core/modules`
|
||||
|
||||
[Fork](https://help.github.com/articles/fork-a-repo/) the `nf-core/modules` repository to your own GitHub account. Within the local clone of your fork add the module file to the [`software/`](software) directory. Please try and keep PRs as atomic as possible to aid the reviewing process - ideally, one module addition/update per PR.
|
||||
|
||||
Commit and push these changes to your local clone on GitHub, and then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) on the `nf-core/modules` GitHub repo with the appropriate information.
|
||||
|
||||
We will be notified automatically when you have created your pull request, and providing that everything adheres to nf-core guidelines we will endeavour to approve your pull request as soon as possible.
|
||||
|
||||
## Terminology
|
||||
|
||||
The features offered by Nextflow DSL2 can be used in various ways depending on the granularity with which you would like to write pipelines. Please see the listing below for the hierarchy and associated terminology we have decided to use when referring to DSL2 components:
|
||||
|
@ -318,6 +423,25 @@ The features offered by Nextflow DSL2 can be used in various ways depending on t
|
|||
|
||||
- *Workflow*: What DSL1 users would consider an end-to-end pipeline. For example, from one or more inputs to a series of outputs. This can either be implemented using a large monolithic script as with DSL1, or by using a combination of DSL2 individual modules and sub-workflows.
|
||||
|
||||
## Nextflow edge releases
|
||||
|
||||
Stable releases will be becoming more infrequent as Nextflow shifts its development model to becoming more dynamic via the usage of plugins. This will allow functionality to be added as an extension to the core codebase with a release cycle that could potentially be independent to that of Nextflow itself. As a result of the reduction in stable releases, some pipelines may be required to use Nextflow `edge` releases in order to be able to exploit cutting "edge" features e.g. version 3.0 of the nf-core/rnaseq pipeline requires Nextflow `>=20.11.0-edge` in order to be able to directly download Singularity containers over `http` (see [nf-core/rnaseq#496](https://github.com/nf-core/rnaseq/issues/496)).
|
||||
|
||||
There are a number of ways you can install Nextflow `edge` releases, the main difference with stable releases being that you have to `export` the version you would like to install before issuing the appropriate installation/execution commands as highlighted below.
|
||||
|
||||
- If you would like to download and install a Nextflow `edge` release from scratch with minimal fuss:
|
||||
|
||||
```bash
|
||||
export NXF_VER="20.11.0-edge"
|
||||
wget -qO- get.nextflow.io | bash
|
||||
sudo mv nextflow /usr/local/bin/
|
||||
nextflow run nf-core/rnaseq -profile test,docker -r 3.0
|
||||
```
|
||||
|
||||
> Note if you don't have `sudo` privileges required for the last command above then you can move the `nextflow` binary to somewhere else and export that directory to `$PATH` instead. One way of doing that on Linux would be to add `export PATH=$PATH:/path/to/nextflow/binary/` to your `~/.bashrc` file so that it is available every time you login to your system.
|
||||
|
||||
- Manually download and install Nextflow from the available [assets](https://github.com/nextflow-io/nextflow/releases) on Github. See [Nextflow installation docs](https://www.nextflow.io/docs/latest/getstarted.html#installation).
|
||||
|
||||
## Help
|
||||
|
||||
For further information or help, don't hesitate to get in touch on [Slack `#modules` channel](https://nfcore.slack.com/channels/modules) (you can join with [this invite](https://nf-co.re/join/slack)).
|
||||
|
@ -334,16 +458,6 @@ If you use the module files in this repository for your analysis please you can
|
|||
|
||||
<!---
|
||||
|
||||
- The module MUST accept a parameter `params.publish_results` accepting at least
|
||||
- `"none"`, to publish no files at all,
|
||||
- a glob pattern which is initalized to a sensible default value.
|
||||
|
||||
### Configuration and parameters
|
||||
|
||||
The module files hosted in this repository define a set of processes for software tools such as `fastqc`, `trimgalore`, `bwa` etc. This allows you to share and add common functionality across multiple pipelines in a modular fashion.
|
||||
|
||||
> The definition and standards for module files are still under discussion amongst the community but hopefully, a description should be added here soon!
|
||||
|
||||
### Offline usage
|
||||
|
||||
If you want to use an existing module file available in `nf-core/modules`, and you're running on a system that has no internet connection, you'll need to download the repository (e.g. `git clone https://github.com/nf-core/modules.git`) and place it in a location that is visible to the file system on which you are running the pipeline. Then run the pipeline by creating a custom config file called e.g. `custom_module.conf` containing the following information:
|
||||
|
|
Loading…
Reference in a new issue