Repository to host tool-specific module files for the Nextflow DSL2 community!
Find a file
Harshil Patel f10b7810f1
Merge pull request #55 from drpatelh/master
Add module template
2020-08-06 15:35:11 +01:00
.github/workflows Update badge 2020-08-06 12:42:45 +01:00
deprecated Fix markdownlint 2020-08-05 17:46:23 +01:00
docs/images Move social preview image 2020-07-11 14:28:58 +02:00
lib Fix code format linting 2020-07-23 11:43:48 +02:00
software Add software requirements section 2020-08-06 15:22:32 +01:00
tests Merge pull request #42 from JoseEspinosa/bedtools_dev 2020-08-05 15:45:17 +01:00
.editorconfig Update .editorconfig 2020-06-15 16:47:42 +02:00
.gitattributes Fill out repo 2019-07-26 10:19:07 +01:00
.gitignore Add tests for fastqc module 2020-07-15 09:48:14 +02:00
.gitmodules Fix editor config styles 2020-07-11 13:42:13 +02:00
.markdownlint.yml Fix markdownlint 2020-07-14 12:21:33 +02:00
LICENSE Fill out repo 2019-07-26 10:19:07 +01:00
README.md Update README 2020-08-06 15:34:44 +01:00
test_import.nf Added empty test_import.nf file 2019-12-06 10:38:57 +01:00

nf-core/modules

GitHub Actions Coda Linting Get help on Slack

THIS REPOSITORY IS UNDER ACTIVE DEVELOPMENT. SYNTAX, ORGANISATION AND LAYOUT MAY CHANGE WITHOUT NOTICE!

A repository for hosting Nextflow DSL2 module files containing tool-specific process definitions and their associated documentation.

Table of contents

Using existing modules

The module files hosted in this repository define a set of processes for software tools such as fastqc, bwa, samtools etc. This allows you to share and add common functionality across multiple pipelines in a modular fashion.

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/ 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 the latest version of nf-core/tools (>=1.10.2)

  2. List the available modules:

    $ nf-core modules list
    
                                              ,--./,-.
              ___     __   __   __   ___     /,-._.--~\
        |\ | |__  __ /  ` /  \ |__) |__         }  {
        | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                              `._,._,'
    
        nf-core/tools version 1.10.2
    
    
    
    INFO      Modules available from nf-core/modules (master):                                                                                                                  modules.py:51
    
    bwa/index
    bwa/mem
    deeptools/computematrix
    deeptools/plotfingerprint
    deeptools/plotheatmap
    deeptools/plotprofile
    fastqc
    ..truncated..
    
  3. Install the module in your pipeline directory:

    $ nf-core modules install . fastqc
    
                                              ,--./,-.
              ___     __   __   __   ___     /,-._.--~\
        |\ | |__  __ /  ` /  \ |__) |__         }  {
        | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                              `._,._,'
    
        nf-core/tools version 1.10.2
    
    
    
    INFO      Installing fastqc                                                                                                                                                 modules.py:62
    INFO      Downloaded 3 files to ./modules/nf-core/software/fastqc                                                                                                           modules.py:97
    
  4. Import the module in your Nextflow script:

    #!/usr/bin/env nextflow
    
    nextflow.enable.dsl = 2
    
    include { FASTQC } from './modules/nf-core/software/fastqc/main'
    
  5. We have plans to add other utility commands to help developers install and maintain modules downloaded from this repository so watch this space!

    $ nf-core modules --help
    
    ...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)
    

Adding a new module file

NB: The definition and standards for module files are still under discussion but we are now gladly accepting submissions :)

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, and to everyone within the Nextflow community! See nf-core/modules/software for examples.

Current guidelines

The key words "MUST", "MUST NOT", "SHOULD", etc. are to be interpreted as described in RFC 2119.

General

  • Software that can be piped together SHOULD be added to separate module files unless there is a run-time, storage advantage in implementing in this way. For example, using a combination of bwa and samtools to output a BAM file instead of a SAM file:

    bwa mem | samtools view -B -T ref.fasta
    
  • Where applicable, the usage/generation of compressed files SHOULD be enforced as input/output e.g. *.fastq.gz and NOT *.fastq, *.bam and NOT *.sam etc.

  • A module MUST NOT contain a when statement.

  • Where applicable, each module command MUST emit a file <SOFTWARE>.version.txt containing a single line with the software's version in the format <VERSION_NUMBER> or 0.7.17:

    echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
    

If the software is unable to output a version number on the command-line then a variable called VERSION can be manually specified to create this file e.g. homer/annotatepeaks module.

Naming conventions

  • The directory structure for the module name must be all lowercase e.g. software/bwa/mem/. The name of the software (i.e. bwa) and tool (i.e. mem) MUST be all one word.
  • The process name in the module file MUST be all uppercase e.g. process BWA_MEM {. The name of the software (i.e. BWA) and tool (i.e. MEM) MUST be all one word separated by an underscore.
  • All parameter names MUST follow the snake_case convention.
  • All function names MUST follow the camelCase convention.

Module parameters

  • A module file SHOULD only define input and output files as command-line parameters to be executed within the process.
  • All other parameters MUST be provided as a string i.e. options.args where options is a Groovy Map that MUST be provided in the input section of the process.
  • If the tool supports multi-threading then you MUST provide the appropriate parameter using the Nextflow task variable e.g. --threads $task.cpus.
  • Any parameters that need to be evaluated in the context of a particular sample e.g. single-end/paired-end data MUST also be defined within the process.

Input/output options

  • Named file extensions MUST be emitted for ALL output channels e.g. path "*.txt", emit: txt.
  • Optional inputs are not currently supported by Nextflow. However, "fake files" MAY be used to work around this issue.

Resource requirements

  • An appropriate resource label MUST be provided for the module as listed in the nf-core pipeline template e.g. process_low, process_medium or process_high.
  • If the tool supports multi-threading then you MUST provide the appropriate parameter using the Nextflow task variable e.g. --threads $task.cpus.

Software requirements

BioContainers is a registry of Docker and Singularity containers automatically created from all of the software packages on Bioconda. 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 e.g. go to the BWA BioContainers webpage, click on the Pacakages and Containers tab, sort by Version and get the portion of the link after the docker pull command where Type is Docker. You may need to double-check that you are using the latest version of the software because you may find that containers for older versions have been rebuilt more recently.

  • If the software is available on Conda the software should also be defined using the Nextflow conda directive. Software MUST be pinned to the channel (i.e. bioconda) and version (i.e. 0.7.17) e.g. bioconda::bwa=0.7.17. Pinning the build too e.g. "bioconda::bwa=0.7.17=h9402c20_2" is not currently a requirement.

  • If required, multi-tool containers may also be available on BioContainers e.g. bwa and samtools. It is also possible for a multi-tool container to be built and added to BioContainers by submitting a pull request on their multi-package-containers repository.

  • If the software is not available on Bioconda a Dockerfile MUST be provided within the module directory. We will use GitHub Actions to auto-build the containers on the GitHub Packages registry.

Uploading to nf-core/modules

Fork the nf-core/modules repository to your own GitHub account. Within the local clone of your fork add the module file to the nf-core/modules/software directory.

Commit and push these changes to your local clone on GitHub, and then create a pull request 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:

  • Module: A process that can be used within different pipelines and is as atomic as possible i.e. cannot be split into another module. An example of this would be a module file containing the process definition for a single tool such as FastQC. At present, this repository has been created to only host atomic module files that should be added to the software/ directory along with the required documentation and tests.
  • Sub-workflow: A chain of multiple modules that offer a higher-level of functionality within the context of a pipeline. For example, a sub-workflow to run multiple QC tools with FastQ files as input. Sub-workflows should be shipped with the pipeline implementation and if required they should be shared amongst different pipelines directly from there. As it stands, this repository will not host sub-workflows although this may change in the future since well-written sub-workflows will be the most powerful aspect of DSL2.
  • 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.

Help

For further information or help, don't hesitate to get in touch on Slack #modules channel (you can join with this invite).

Citation

If you use the module files in this repository for your analysis please you can cite the nf-core publication 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. ReadCube: Full Access Link