Skip to content

Repository files navigation

Jacquemont's Lab Header

Git Repository ShortVariants-Annotation

DOI

ShortVariants-Annotation

A Nextflow pipeline for annotating short variants (SNVs and Indels) on large dataset (>100k gVCFs) using Ensembl’s Variant Effect Predictor (VEP).

Overview

This workflow is designed to run on different infrastructures. However, since these environments differ significantly in terms of write permissions, architecture, and security settings, we had to rewrite the workflow and some of the initial scripts, whether using Cromwell or Snakemake.

As a result, three other pipelines are available (see the setup directory for details):

  • snakemake — runs on a HPC cluster using Snakemake.
  • ukbb_dnanexusUK Biobank (UKBB) — uses the UKB-RAP platform.
  • allofus_workbenchAll of Us — uses the All of Us Researcher Workbench platform - the pipeline closely resembles the UKBB version but skips the first three steps.

Requirements

Refer to the template config files and adjust them to match your infrastructure.

Required software:

  • Nextflow – workflow engine (nextflow version 25.10.2)
  • Docker (Apptainer or Singularity) – to run containers

You might need to pull the following containers if working offline (see templates nextflow.config or to use slurm setup/nextflow_HPC_slurm.config):

  • docker://ghcr.io/jacquemontlab/ensembl_vep_113:latest
  • docker://ghcr.io/jacquemontlab/pyspark:latest
  • docker://ghcr.io/jacquemontlab/genomics_tools:latest
  • docker://ghcr.io/jacquemontlab/duckdb_python:latest

Download resources

All required pipeline resources for the selected genome build (GRCh37 and GRCh38 only) can be downloaded using the provided setup script: ⚠️ This process can take more than 1 hour.

It will require tabix and samtools installed on the system. The BaseSpace CLI will be installed automatically for downloading SpliceAI resources. From the root directory of the repository, run the following command (tabix and requirement should be provided by the Docker image):

docker run --rm -it \
-v "$PWD":/ShortVariants-Annotation \
-w /ShortVariants-Annotation \
ghcr.io/jacquemontlab/install_sv:latest \
bash INSTALL.sh GRCh38

This script performs the following tasks:

  • Downloads the reference genome
  • Retrieves necessary annotation resources:
    • VEP cache
    • AlphaMissense data
    • LoFTEE plugin
    • SpliceAI scores

Inputs

ParameterDescriptionDefault
--genome_versionHuman genome assembly version. (accepted: GRCh38|GRCh37)GRCh38
--dataset_nameName of the dataset, used for directory and report naming.dataset_default
--file_gvcf_pathA gzip-compressed, tab-separated file that maps each sampleID to its corresponding file path, see Parameter Details.Required
--ref_genome_dirThe directory containing fasta reference genome.${projectDir}/resources/reference_genome
--vep_cacheThe downloaded directory resources/vep_cache/.${projectDir}/resources/vep_cache
--batch_sizeNumber of samples call in a single batch.64

Parameter Details

The pipeline works with compressed gVCF files (*gvcf.gz).

sample_to_gvcf.tsv.gz

A gzip-compressed, tab-separated file that maps each sampleID to its corresponding file path. The gVCF files listed in Path must contain the FORMAT fields GT, DP, AD, and GQ for each variant. Variants missing any of these fields will be excluded during processing. CHROM should be formatted as "chr1""chr22", "chrX", or "chrY"

Example:

sampleID	Path
AXXXXX /absolute/path/to/sample_A.gvcf.gz
BXXXXX /absolute/path/to/sample_B.gvcf.gz
CXXXXX /absolute/path/to/sample_C.gvcf.gz
DXXXXX /absolute/path/to/sample_D.gvcf.gz

Usage

Testing

The pipeline can be tested using the test profile and the images hosted on github using the container platform of your choice (10min for 64 CPUs). Unfortunately, the test will fail at the Curated steps because it uses a small test dataset. Those, allele frequency (AF) filtering will remove all the short variants.

container=docker # or apptainer or singularity
genome_version=GRCh38 # or GRCh37
nextflow run main.nf -profile test_${genome_version},${container}

Example

genome_version=GRCh38
file_gvcf_path=$PWD/tests/sample_to_gvcf.tsv.gz
ref_genome_dir=$PWD/resources/reference_genome
vep_cache=$PWD/resources/vep_cache
container=docker # or apptainer or singularity
nextflow run main.nf \
--dataset_name Dataset \
--file_gvcf_path "$file_gvcf_path" \
--ref_genome_dir "$ref_genome_dir" \
--vep_cache "$vep_cache" \
--genome_version "$genome_version" \
--batch_size 16 \
-profile ${container}

Here’s a corrected and cleaner version of your section:

Running on Compute Canada (CCDB, lab)

Users on CCDB can run the pipeline offline, since the required resources and Docker/Apptainer containers are already available on Rorqual:

export NXF_OFFLINE=true
module load nextflow
module load apptainer
file_gvcf_path=$PWD/tests/sample_to_gvcf.tsv.gz
nextflow run main.nf \
--dataset_name Dataset \
--file_gvcf_path "$file_gvcf_path" \
-c setup/nextflow_HPC_slurm.config

Outputs

There are two output tables:

Output format of ShortVariantsDB_curated.parquet

Column nameLabelDescription
SampleIDSample IDUnique identifier for the sample.
CHROMChromosomeChromosome where the variant is located.
POSPositionGenomic position of the variant.
REFReference alleleReference allele at the variant position.
ALTAlternate alleleAlternate allele observed at the variant position.
GTGenotypeGenotype of the individual for the variant.
DPRead depthRead depth supporting the variant call.
GQGenotype qualityGenotype quality score.
REF_ADReference allele read depthRead count supporting the reference allele.
ALT_ADAlternate allele read depthRead count supporting the alternate allele.
AC_ratioAllele count ratioAllele count ratio of the alternate allele. ALT_AD / DP
GeneGene Ensembl stable IDEnsembl stable ID of affected gene.
FeatureTranscript Ensembl stable IDEnsembl stable ID of feature.
CANONICALCanonical transcriptIndicates whether the transcript is the canonical transcript.
MANEMane TranscriptTranscript is the MANE Select or MANE Plus Clinical transcript for the gene. ⚠️Only available in GRCh38
dataset_AFDataset Allele FrequencyNumber of individual having the short variant (after QC filter) / 2 × the total number of individuals in the dataset.
gnomAD_max_AFMaximum allele frequency across gnomADMaximum AF across all available gnomAD exome and genome populations (gnomADe_* and gnomADg_*). ⚠️ Genome frequencies are only available for GRCh38 datasets.
MAX_AFMaximum allele frequency across populationsMaximum observed allele frequency in 1000 Genomes, ESP and gnomAD.
MAX_AF_POPSPopulations with maximum allele frequencyPopulation in which was found MAX_AF.
Variant_TypeType of variantFunctional impact classification of the variant.
am_pathogenicityAlphaMissense pathogenicity scoreA continuous score between 0 and 1 which can be interpreted as the predicted probability of the variant being pathogenic, from AlphaMissense plugin.
Max_DS_SpliceAIMaximum SpliceAI Delta ScoreMaximum SpliceAI delta score for splicing impact.

Output format of ShortVariantsDB_unfiltered.parquet

Column nameLabelDescription
IDVariant IDUnique identifier of the short variant.
SampleIDSample IDUnique identifier for the sample.
CHROMChromosomeChromosome where the variant is located.
POSPositionGenomic position of the variant.
REFReference alleleReference allele at the variant position.
ALTAlternate alleleAlternate allele observed at the variant position.
GTGenotypeGenotype of the individual for the variant.
DPRead depthRead depth supporting the variant call.
GQGenotype qualityGenotype quality score.
REF_ADReference allele read depthRead count supporting the reference allele.
ALT_ADAlternate allele read depthRead count supporting the alternate allele.
GeneGene Ensembl stable IDEnsembl stable ID of affected gene.
FeatureTranscript Ensembl stable IDEnsembl stable ID of feature.
ConsequenceVariant consequencePredicted functional consequence of the variant from VEP.
CANONICALCanonical transcriptIndicates whether the transcript is the canonical transcript.
MANEMANE transcriptIndicates whether the transcript is a MANE Select or MANE Plus Clinical transcript. ⚠️Only available in GRCh38
MAX_AFMaximum allele frequency across populationsMaximum observed allele frequency in 1000 Genomes, ESP and gnomAD.
MAX_AF_POPSPopulations with maximum allele frequencyPopulation in which was found MAX_AF.
gnomAD_max_AFMaximum allele frequency across gnomADMaximum AF across all available gnomAD exome and genome populations (gnomADe_* and gnomADg_*). ⚠️ Genome frequencies are only available for GRCh38 datasets.
SYMBOLSpliceAI SYMBOLHGNC gene symbol.
DS_AGSpliceAI DS_AGSpliceAI delta score for acceptor gain.
DS_ALSpliceAI DS_ALSpliceAI delta score for acceptor loss.
DS_DGSpliceAI DS_DGSpliceAI delta score for donor gain.
DS_DLSpliceAI DS_DLSpliceAI delta score for donor loss.
DP_AGSpliceAI DP_AGSpliceAI delta position for acceptor gain.
DP_ALSpliceAI DP_ALSpliceAI delta position for acceptor loss.
DP_DGSpliceAI DP_DGSpliceAI delta position for donor gain.
DP_DLSpliceAI DP_DLSpliceAI delta position for donor loss.
am_classAlphaMissense classAlphaMissense predicted variant class.
am_pathogenicityAlphaMissense pathogenicity scoreA continuous score between 0 and 1 which can be interpreted as the predicted probability of the variant being pathogenic, from AlphaMissense plugin.
LoFLoss-of-function statusLOFTEE loss-of-function annotation.
LoF_filterLOFTEE filterLOFTEE filtering status.
LoF_flagsLOFTEE flagsLOFTEE flags providing additional annotation context.
LoF_infoLOFTEE informationAdditional LOFTEE annotation details.

Different Steps of the Pipeline

This repository provides a workflow implemented in Nextflow (with alternative implementations in Cromwell and Snakemake under setup) for processing and annotating short variants (SNVs and Indels) on the human reference genome GRCh38.

Prerequisite to run the pipeline: Downloading the Raw Data

gVCF files need to be available. We do not use the pVCF files as they contain excessive information that is unnecessary for our purposes.

1. Filtering gVCF and taking intersection between callers if multiple are available (e.g., in the case of SPARK)

⚠️This step may need to be adapted depending on the dataset you are working with⚠️. For UKBB, it processes a single gVCF file per sample, by default in the pipeline. In contrast, for SPARK, it processes two gVCF files per sample and retains only their intersection.

The gVCF files are filtered to retain only:

  • Canonical Chromosomes (1-22, X, Y)

  • Records containing all required FORMAT fields: GT, DP, AD, and GQ

  • Non Homozygous reference sites — Removing 0/0 or ./. to keep only variant sites.

Some SNPs appear as 1/0 because they were originally multiallelic (e.g., GT=2/3) in the raw gVCF. After normalization, each alternate allele is represented separately, resulting in genotypes like 0/1 and 1/0. As a result, the total depth (DP) may differ from the sum of REF_AD and ALT_AD.

  • Indels

  • SNPs

This corresponds to the ProduceTSVPerSample process. (The produce_tsv_per_sample_SPARK step in the Snakemake workflow, or to ProduceTSVPerSampleUKBB in the UKBB Nextflow pipeline.)

3. Merging TSV to Parquet

The merging is done in two steps:

1. Batch merge (MergeTSVParquetByBatch)

2. Merge of batches (MergeBatches)

This approach enables parallelization and significantly increases speed. The output file is Unannotated_ShortVariants.parquet.

4. Identifying Unique short variants (SNVs and Indels)

Unique short variants are extracted to avoid redundant annotation during the VEP step. The output consists of VCF files per chromosome, used for VEP annotation (FindUniqShortVariantsVCF step).

5. VEP Annotation

Each chromosome's unique short variants (SNVs and Indels) are annotated using VEP. Different annotations:

  • Default VEP annotation: Consequence, CANONICAL, MANE, MAX_AF, MAX_AF_POPS, gnomADe_, gnomADg_ (RunVEPDefault)

  • LoFtee plugin: LoF, LoF_filter, LoF_flags, LoF_info (RunVEPLoftee)

  • AlphaMissense plugin: am_class, am_pathogenicity scores (RunVEPAlphamissense)

  • SpliceAI plugin: SpliceAI_pred including SYMBOL|DS_AG|DS_AL|DS_DG|DS_DL|DP_AG|DP_AL|DP_DG|DP_DL (RunVEPSpliceAI)

6. Reformatting VEP Output

The VEP output is reformatted per plugin, for example SpliceAI_pred is split into separate columns, the maximum AF across gnomAD population is computed. Only unique short variants (SNVs and Indels) with an annotation of the given plugin are retained, reducing file size and computation time (ConvertVEPOutParquet process).

7. Creating an Unfiltered Annotation

This is the most resources consuming step, it merges Unannotated_ShortVariants.parquet with plugin annotations. The output is ShortVariantsDB_unfiltered.parquet, partitioned by chromosome (UnFilteredAnnotation process).

To optimize the database size, we retained only the primary transcripts by filtering out variants where both MANE and Canonical annotations were null

8. Curating Annotation

This step filters data to generate a more relevant downstream dataset (CuratedAnnotation process). The dataset correspond to ShortVariantsDB_curated.parquet.

Key processing steps:

  • Compute Allele Count Ratio: AC_ratio = ALT_AD / DP

  • Compute Max_DS_SpliceAI: max(DS_AG, DS_AL, DS_DG, DS_DL)

  • Filter short variants: - DP \≥ 20 - GQ \≥ 30 - 0.2 \≤ AC_ratio \≤ 0.8

  • Filter short variants with Allele Frequency below 0.001: - gnomAD_max_AF \≤ 0.001 (and, if the number of samples ≥ 5000: dataset_AF ≤ 0.001)

  • Identify Variant Types:

if Consequence is synonymous_variantSynonymous

if the first consequence is stop_gainedStop_Gained

if the first consequence is frameshift_variantFrameshift

if the first consequence is splice_acceptor_variant or splice_donor_variantSplice_variants

if the first consequence is missense_variantMissense

  • Retain Variants Based on Criteria:

Synonymous

Stop_Gained (LoF = HC , high-confidence LoF variants)

Frameshift (LoF = HC , high-confidence LoF variants)

Splice_variants (Max_DS_SpliceAI ≥ 0.8 , 'high precision')

Missense (am_pathogenicity ≥ 0.564 , 'likely_pathogenic')

Workflow DAG

Below is a graphical representation of the workflow:

Workflow DAG

More Documentation

Here are some useful links about the plugins used in this pipeline, provided by VEP (Variant Effect Predictor).

DOCKER

We used several Docker containers; the corresponding Dockerfiles are available in the resources/ directory.

VEP

Ensembl VEP Options
Ensembl VEP Plugins
Ensembl VEP Consequences

We used the VEP docker: ensembl-vep release_113.3

Current Limitations of the pipeline

  • Works well with GRCh38 and GRCh37 .

  • Resource requirements of each step must be adjusted depending on the quantity of data analyzed.

  • The workflow might differ regarding the different platform

About

Optimized workflow for short variants (SNVs and Indels) annotation in large cohorts.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages