Introduction

nf-core/raredisease is a bioinformatics best-practice analysis pipeline to call, annotate and score variants from WGS/WES of rare disease patients. The pipeline is built using Nextflow.

Prerequisites

  1. Install Nextflow (>=22.10.1) using the instructions here.
  2. Install one of the following technologies for full pipeline reproducibility: Docker, Singularity, Podman, Shifter or Charliecloud.

    Almost all nf-core pipelines give you the option to use conda as well. However, some tools used in the raredisease pipeline do not have a conda package so we do not support conda at the moment.

Run nf-core/raredisease with test data

Before running the pipeline with your data, we recommend running it with the test dataset available here. You do not need to download the data as the pipeline is configured to fetch that data automatically for you when you use the test profile.

Run the following command, where YOURPROFILE is the package manager you installed on your machine. For example, -profile test,docker or -profile test,singularity:

nextflow run nf-core/raredisease \
    -revision dev -profile test,<YOURPROFILE> \
    --outdir <OUTDIR>

Check nf-core/configs to see if a custom config file to run nf-core pipelines already exists for your institute. If so, you can simply use -profile test,<institute> in your command. This enables the appropriate package manager and sets the appropriate execution settings for your machine. NB: The order of profiles is important! They are loaded in sequence, so later profiles can overwrite earlier profiles.

Running the command creates the following files in your working directory:

work                # Directory containing the Nextflow working files
<OUTDIR>            # Finished results in specified location (defined with --outdir)
.nextflow_log       # Log file from Nextflow
# Other Nextflow hidden files, like history of pipeline logs.

Test profile runs the pipeline with a case containing three samples, but if you would like to test the pipeline with one sample, use -profile test_one_sample,<YOURPROFILE>.

Updating the pipeline

The above command downloads the pipeline from GitHub, caches it, and tests it on the test dataset. When you run the command again, it will fetch the pipeline from cache even if a more recent version of the pipeline is available. To make sure that you’re running the latest version of the pipeline, update the cached version of the pipeline by including -latest in the command.

Run nf-core/raredisease with your data

Running the pipeline involves three steps:

  1. Prepare a samplesheet
  2. Gather all required references
  3. Supply samplesheet and references, and run the command

Samplesheet

A samplesheet is used to pass the information about the sample(s), such as the path to the FASTQ files and other meta data (sex, phenotype, etc.,) to the pipeline in csv format.

nf-core/raredisease will auto-detect whether a sample is single- or paired-end using the information provided in the samplesheet. The pedigree information in the samplesheet (sex and phenotype) should be provided as they would be for a ped file (i.e. 1 for male, 2 for female, other for unknown).

FieldsDescription
sampleCustom sample name. This entry will be identical for multiple sequencing libraries/runs from the same sample. Spaces in sample names are automatically converted to underscores (_).
laneUsed to generate separate channels during the alignment step.
fastq_1Absolute path to FASTQ file for Illumina short reads 1. File has to be gzipped and have the extension “.fastq.gz” or “.fq.gz”.
fastq_2Absolute path to FASTQ file for Illumina short reads 2. File has to be gzipped and have the extension “.fastq.gz” or “.fq.gz”.
sexSex (1=male; 2=female; other=unknown).
phenotypeAffected status of patient (0 = missing; 1=unaffected; 2=affected).
paternal_idSample ID of the father, can be blank if the father isn’t part of the analysis or for samples other than the proband.
maternal_idSample ID of the mother, can be blank if the mother isn’t part of the analysis or for samples other than the proband.
case_idCase ID, for the analysis used when generating a family VCF.

It is also possible to include multiple runs of the same sample in a samplesheet. For example, when you have re-sequenced the same sample more than once to increase sequencing depth. In that case, the sample identifiers in the samplesheet have to be the same. The pipeline will align the raw read/read-pairs independently before merging the alignments belonging to the same sample. Below is an example for a trio with the proband sequenced across two lanes:

samplelanefastq_1fastq_2sexphenotypepaternal_idmaternal_idcase_id
AEG588A12AEG588A1_S1_L002_R1_001.fastq.gzAEG588A1_S1_L002_R2_001.fastq.gz12AEG588A3AEG588A2fam_1
AEG588A13AEG588A1_S1_L003_R1_001.fastq.gzAEG588A1_S1_L003_R2_001.fastq.gz12AEG588A3AEG588A2fam_1
AEG588A24AEG588A2_S1_L004_R1_001.fastq.gzAEG588A2_S1_L004_R2_001.fastq.gz21fam_1
AEG588A34AEG588A3_S1_L004_R1_001.fastq.gzAEG588A3_S1_L004_R2_001.fastq.gz11fam_1

If you would like to see more examples of what a typical samplesheet looks like for a singleton and a trio, follow these links, singleton and trio.

Reference files and parameters

In nf-core/raredisease, references can be supplied using parameters listed here.

Note that the pipeline is modular in architecture. It offers you the flexibility to choose between different tools. For example, you can align with either bwamem2 or Sentieon BWA mem and call SNVs with either DeepVariant or Sentieon DNAscope. You also have the option to turn off sections of the pipeline if you do not want to run the. For example, snv annotation can be turned off by adding --skip_snv_annotation flag in the command line, or by setting it to true in a parameter file. This flexibility means that in any given analysis run, a combination of tools included in the pipeline will not be executed. So the pipeline is written in a way that can account for these differences while working with reference parameters. If a tool is not going to be executed during the course of a run, parameters used only by that tool need not be provided. For example, for SNV calling if you use DeepVariant as your variant caller, you need not provide the parameter --ml_model, which is only used by Sentieon DNAscope.

nf-core/raredisease consists of several tools used for various purposes. For convenience, we have grouped those tools under the following categories:

  1. Alignment (bwamem2/Sentieon BWA mem)
  2. QC stats from the alignment files
  3. Repeat expansions (ExpansionsHunter & Stranger)
  4. Variant calling - SNV (DeepVariant/Sentieon DNAscope)
  5. Variant calling - Structural variants (SV) (Tiddit & Manta)
  6. SNV annotation & ranking (rohcall, vcfanno, ensembl VEP, GENMOD)
  7. SV annotation & ranking (SVDB query, ensembl VEP, GENMOD)
  8. Mitochondrial analysis

We have only listed the groups that require at least one input from the user. For example, the pipeline also runs SMNCopyNumberCaller, but it does not require any input other than the bam files passed by the pipeline. Hence, it is not mentioned in the list above. To know more about the tools used in the pipeline check the README.

The mandatory and optional parameters for each category are tabulated below.

Alignment, QC stats, repeat expansions, SNV & SV variant calling are run by default. Hence, the mandatory parameters used by those features will always have to be provided to the pipeline.

1. Alignment
MandatoryOptional
aligner1fasta_fai2
fastabwamem22
platformknown_dbsnp3
known_dbsnp_tbi3

1Default value is bwamem2, but if you have a valid license for Sentieon, you have the option to use Sentieon as well.
2fasta_fai and bwamem2, if not provided by the user, will be generated by the pipeline when necessary.
3Used only by Sentieon.

2. QC stats from the alignment files
MandatoryOptional
intervals_wgs1
intervals_y1
target_bed / (bait_intervals & target_intervals)2

1These files are Picard’s style interval list files, comprising the entire genome or only the chromosome Y. A version of these files for GRCh37 and for GRCh38 is supplied in the pipeline assets. These files are not necessary if you are using Sentieon.
2 If a target_bed file is provided, bait_intervals and target_intervals can be generated by the pipeline.

3. Repeat expansions
MandatoryOptional
variant_catalog
4. Variant calling - SNV
MandatoryOptional
variant_caller1known_dbsnp2
ml_model2known_dbsnp_tbi2
analysis_type3call_interval2
known_dbsnp_tbi2

1Default variant caller is DeepVariant, but you have the option to use Sentieon as well.
2These parameters are only used by Sentieon.
3Default is WGS, but you have the option to choose WES as well.

5. Variant calling - Structural variants
MandatoryOptional
target_bed
bwa
6. SNV annotation & Ranking
MandatoryOptional
genome1reduced_penetrance7
vcfanno_resources2vcfanno_lua
vcfanno_toml3vep_filters8
vep_cache_version
vep_cache4
gnomad_af5
score_config_snv6

1Genome version is used by VEP. You have the option to choose between GRCh37 and GRCh38.
2Path to VCF files and their indices used by vcfanno. Sample file here.
3Path to a vcfanno configuration file. Sample file here.
4 VEP caches can be downloaded here. VEP plugins and associated files may be installed in the cache directory, and the plugin pLI is mandatory to install. See example cache here.
5 GnomAD VCF files can be downloaded from here. The option gnomad_af expects a tab-delimited file with no header and the following columns: CHROM POS REF_ALLELE ALT_ALLELE AF. Sample file here.
6Used by GENMOD for ranking the variants. Sample file here.
7Used by GENMOD while modeling the variants. Contains a list of loci that show reduced penetrance in people. Sample file here.
8 This file contains a list of candidate genes (with HGNC IDs) that is used to split the variants into canditate variants and research variants. Research variants contain all the variants, while candidate variants are a subset of research variants and are associated with candidate genes. Sample file here.

7. SV annotation & Ranking
MandatoryOptional
genomereduced_penetrance
svdb_query_dbs1
vep_cache_versionvep_filters
vep_cache
score_config_sv

1 A CSV file that describes the databases (VCFs) used by SVDB for annotating structural variants. Sample file here. Information about the column headers can be found here.

8. Mitochondrial analysis
MandatoryOptional
genome
mt_backchain_shift1
mito_name
mt_fasta_shift
mt_intervals
mt_intervals_shift
vcfanno_resources
vcfanno_toml
vep_cache_version
vep_cache

1Can be generated by GATK’s ShiftFasta. Sample file here.

Run the pipeline

You can directly supply the parameters in the command line (CLI) or use a config file from which the pipeline can import the parameters.

Direct input in CLI

All of the pipeline parameters listed here can be passed using the CLI. For example, you can provide the samplesheet, reference FASTA, and turn off annotations for SNVs and SVs by running,

nextflow run nf-core/raredisease \
    -revision dev \
    -profile test,<YOURPROFILE> \
    --input samplesheet.csv \
    --fasta reference.fasta \
    --skip_snv_annotation \
    --skip_sv_annotation \
    --outdir <OUTDIR>

To input or change the default parameters, we recommend using a config file instead. Create a config file that contains all the parameters and supply that file as shown below.

nextflow run nf-core/raredisease \
    -revision dev \
    -profile test,<YOURPROFILE> \
    -c <YOURCONFIG> \
    --outdir <OUTDIR>

A sample config file can be found here.

Best practices

  • Singularity cache: If you are using singularity, use the nf-core download command to download images first, before running the pipeline. Define NXF_SINGULARITY_CACHEDIR or singularity.cacheDir Nextflow options to store and re-use the images from a central location for future pipeline runs.

  • Save references: While the pipeline can generate indices for the FASTA and some VCF files when they are not provided, it can be benficial to supply them to the pipeline as it saves computing resources. You can use the --save_reference parameter to publish those files, and then update your config file with the paths to these files for your subsequent runs.

  • Update pipeline: If you would like to update the pipeline code stored in cache, in addition to running the command with -latest option, you can also run the command below:

nextflow pull nf-core/raredisease
  • Reproducibility: Specify a pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you’ll be running the same version of the pipeline, even if there have been changes to the code since. First, go to the nf-core/raredisease releases page and find the latest pipeline version - numeric only (e.g. 1.3.1). Then specify this when running the pipeline with -r, for example, -r 1.3.1. You can switch to another version by changing the number after the -r flag. The version number will be logged in reports when you run the pipeline. For example, you can view the version number at the bottom of the MultiQC reports.

To further assist in reproducbility, you can use share and re-use parameter files to repeat pipeline runs with the same settings without having to write out a command with every single parameter.

💡 If you wish to share such profile (such as upload as supplementary material for academic publications), make sure to NOT include cluster specific paths to files, nor institutional specific profiles.

  • Restart a previous run: Add -resume to your command when restarting a pipeline. Nextflow will use cached results from any pipeline steps where inputs are the same, and resume the run from where it terminated previously. For input to be considered the same, names and the files’ contents must be identical. For more info about -resume, see this blog post. You can also supply a run name to resume a specific run: -resume [run-name]. Use the nextflow log command to show previous run names.

  • Reusing parameters: If you wish to repeatedly use the same parameters for multiple runs, rather than specifying each flag in the command, you can specify these in a params file.

Pipeline settings can be provided in a yaml or json file via -params-file <file>.

⚠️ Do not use -c <file> to specify parameters as this will result in errors. Custom config files specified with -c must only be used for tuning process resource specifications, other infrastructural tweaks (such as output directories), or module arguments (args). The above pipeline run specified with a params file in yaml format:

nextflow run nf-core/raredisease -profile docker -params-file params.yaml

with params.yaml containing:

input: './samplesheet.csv'
outdir: './results/'
genome: 'GRCh37'
input: 'data'
<...>

You can also generate such YAML/JSON files via nf-core/launch.

Custom configuration

Changing resources

To change the resource requests, please see the max resources and tuning workflow resources section of the nf-core website.

Custom Containers

In some cases you may wish to change which container or conda environment a step of the pipeline uses for a particular tool. By default nf-core pipelines use containers and software from the biocontainers or bioconda projects. However in some cases the pipeline specified version maybe out of date.

To use a different container from the default container or conda environment specified in a pipeline, please see the updating tool versions section of the nf-core website.

Custom Tool Arguments

A pipeline might not always support every possible argument or option of a particular tool used in pipeline. Fortunately, nf-core pipelines provide some freedom to users to insert additional parameters that the pipeline does not include by default.

To learn how to provide additional arguments to a particular tool of the pipeline, please see the customising tool arguments section of the nf-core website.

nf-core/configs

In most cases, you will only need to create a custom config as a one-off but if you and others within your organisation are likely to be running nf-core pipelines regularly and need to use the same settings regularly it may be a good idea to request that your custom config file is uploaded to the nf-core/configs git repository. Before you do this test that the config file works with your pipeline of choice using the -c parameter. You can then create a pull request to the nf-core/configs repository with the addition of your config file, associated documentation file (see examples in nf-core/configs/docs), and amending nfcore_custom.config to include your custom profile.

See the main Nextflow documentation for more information about creating your own configuration files.

If you have any questions or issues please send us a message on Slack on the #configs channel.

Run Sentieon

To use Sentieon you have to:

  1. Ensure that Sentieon executable is in path.
  2. If necessary, store license information as a secret in Nextflow’s local store.
  3. Set environmental variable NXF_ENABLE_SECRETS to an appropriate value.

To elaborate more on item #2 in the list above, if you are running nf-core/raredisease with Sentieon on AWS or on a local machine and you do not want other users to know your license details, we recommend that you use Nextflow’s secrets feature to pass the that information. To do that run the command below after replacing LICENSE with the value corresponding to your license server (for example, 1.1.1.1:4000)

nextflow secrets set SENTIEON_LICENSE_BASE64 <LICENSE>

If you are using Nextflow secrets, you have to set the environment variable NXF_ENABLE_SECRETS to true. This will see to it that the pipeline can retrieve the secret from Nextflow’s secrets store during the pipeline execution. Keep in mind that versions of Nextflow Version 22.09.2-edge and onwards have NXF_ENABLE_SECRETS to true by default. If you are not using secrets set NXF_ENABLE_SECRETS to false, but make sure that the environment variable SENTIEON_LICENSE is set to reflect the value of your license server on your machine.

Azure Resource Requests

To be used with the azurebatch profile by specifying the -profile azurebatch. We recommend providing a compute params.vm_type of Standard_D16_v3 VMs by default but these options can be changed if required.

Note that the choice of VM size depends on your quota and the overall workload during the analysis. For a thorough list, please refer the Azure Sizes for virtual machines in Azure.

Running in the background

Nextflow handles job submissions and supervises the running jobs. The Nextflow process must run until the pipeline is finished.

The Nextflow -bg flag launches Nextflow in the background, detached from your terminal so that the workflow does not stop if you log out of your session. The logs are saved to a file.

Alternatively, you can use screen / tmux or similar tool to create a detached session which you can log back into at a later time. Some HPC setups also allow you to run Nextflow within a cluster job submitted to your job scheduler (from where it submits more jobs).

Nextflow memory requirements

In some cases, the Nextflow Java virtual machines can start to request a large amount of memory. We recommend adding the following line to your environment to limit this (typically in ~/.bashrc or ~./bash_profile):

NXF_OPTS='-Xms1g -Xmx4g'