GATK4 RNA-seq Best Practice
TL;DR
The RNA-seq variant calling pipeline differs slightly from the genomic sequence pipeline. The workflow is largely the same, but there are three key differences:
- Use STAR two-pass mapping for alignment
- Apply SplitNCigarReads
- Skip VQSR processing
These steps are based on the gatk4-rnaseq-germline-snps-indels workflow. Let's walk through them step by step.
Overall Workflow
The overall workflow is as follows:
- Prepare required files
- Map reads to the genome
- Remove PCR duplicates
- SplitNCigarReads
- Calculate and apply BQSR
- Call variants
- Convert GVCF to VCF
- Filter variants
Environment
GATK provides an official Docker image, so we will use that (reference).
1. Preparing Required Files
We will use hg38 as an example.
The required files are as follows:
- FASTA
- FASTA index (fasta.fai)
- FASTA dictionary (.dict)
- GTF/GFF file (optional)
- STAR index
- Known SNPs
You can download most of these from the Broad Institute's Google Cloud Platform, which provides resources for GATK (reference). The STAR index is the only one you need to build yourself.
Let's prepare everything.
Downloading Required Files
- Homo_sapiens_assembly38.fasta
- Homo_sapiens_assembly38.dict
- Homo_sapiens_assembly38.fasta.fai
- Homo_sapiens_assembly38.dbsnp138.vcf.gz
- Homo_sapiens_assembly38.known_indels.vcf.gz
- Mills_and_1000G_gold_standard.indels.hg38.vcf.gz
Make sure to also download the corresponding idx files for each vcf.gz file.
For the GTF/GFF file, you can download it from UCSC's TableBrowser.
Creating the FAI File
Creating the Dict File
2. Mapping with STAR
Preparing the Index
Including a GFF file when building the index reportedly helps STAR handle intronic regions more effectively. It is not strictly required.
Two-Pass Mapping
Recent versions of STAR support two-pass mapping simply by setting twopassMode to Basic. Also, since GATK requires RG tags, we add them here with arbitrary values. The important one is ID, so make sure to change it for each sample. We also create an index while we are at it.
3. Removing PCR Duplicates
We remove PCR duplicates. Using picard is the standard approach. You can also use samtools markdup.
4. SplitNCigarReads
In CIGAR strings, N represents intronic regions. SplitNCigarReads splits reads at these regions. Adjust java-options according to your environment.
5. Calculating and Applying BQSR
First, we recalibrate base quality scores based on known variant data. Then, we apply the recalibrated scores to update the BAM file.
6. Calling Variants
We use HaplotypeCaller to call variants. HaplotypeCaller detects variants through the following steps:
- Identify active regions.
- Perform local assembly of reads in the active regions using a de Bruijn graph, then detect potential variant sites through pairwise alignment using Smith-Waterman.
- Finally, perform pairwise alignment of reads at each site using PairHMM to determine the final variant calls.
This pipeline outputs a GVCF file. A GVCF file is a variant of the VCF format that includes information about regions where no variants were detected. See here for details.
7. Converting GVCF to VCF
While GVCF files are useful, we typically only need the variant data, so we convert to VCF format.
8. Filtering Variants
In genomic sequence analysis, variant scores are calculated based on known variant data, and VCF files are filtered using that information. However, for RNA-seq, such data does not exist, so that step is omitted. Instead, we perform hard filtering based solely on the VCF data generated in this pipeline.