Module 2.5 JBrowse2 and Variant Statistic Plots - mestato/EPP622_2026 GitHub Wiki

Module 2.4: Understanding variation

How do we filter SNPs?

  1. First, let's build a new conda environment:
conda create -n variant_qc -c bioconda bcftools matplotlib scipy pandas polars
  1. Second, let's plot the variant statistics distributions from our VCF files to assess quality. Claude and I prepared a python script that should plot the distributions of your data for you. The script should auto-detect and produce PNG plots and statistics in TSV format for each VCF in your current directory. I have only validated this on gzipped VCFs.

You do NOT need to run this, but if you wanted to, you would do the following.

cd /lustre/isaac/proj/UTK0505/module2_data/<YOUR_GROUP>_results>
cp /lustre/isaac24/proj/UTK0505/module2_data/scripts/plot_VCF_stats.py .
python3 plot_VCF_stats.py
  1. Your plots should look similar to the following (click the dropdowns to view the huge images) or look at the outputs for your specific group (raw and filtered) at the following filepath.
# Your plots are here:
/lustre/isaac24/proj/UTK0505/module2_data/variant_qc
Site-level Metrics:

site_metric_distributions

Sample-level Metrics:

sample_metric_distributions

  1. Okay, now that we can see our variants, choosing filtering cut-offs becomes simple and obvious. Just kidding.
  • Here's an example of the raw depth of a few WGS samples.
image
  • Here, the blue curve represents low-coverage variants, which could also be sequencing errors (because the sequencing of this dataset is very deep).
image
  • If we filter out variants with less than ~10 depth at the sample level, we would expect our distribution to look a bit more like this:
image

JBrowse2: Visualizing alignments and variant calls

  1. Make sure you've installed JBrowse2: https://jbrowse.org/jb2/download/

  2. If you want to follow along with the in-class demonstration, feel free to download the following zip file. [Demo Files]

  3. We are going to load the following files into JBrowse2:

  • The reference genome (FASTA)
  • The reference genome gene annotation (GFF3)
  • The reference genome transposable element (TE) annotation (This GFF has HiTE in the name).
  • A BAM file for Chromosome 17 (BAM)
  • A VCF of variant calls (VCF)

Important note: These files should all be indexed. However, if you forget, JBrowse2 can index most files for you.

  1. In the File dropdown in the top left corner, we can see the menu to add our files. The default options for most of your files are fine and don't require tweaking.
image
  1. For example, under 'Open Assembly...' There will be a dropdown to upload the main file, as well as a place to upload the index. You want to upload local files (the 'File' option), not files from a URL (the 'URL' option).
image
  1. All other files are loaded with 'Open Tracks...'. You want to upload local files (the 'File' option), not files from a URL (the 'URL' option).
image

Examples of Variant Features in JBrowse2.

  1. Clean SNPs and Indels: Chr17:17,554,137-17554783
image
  1. Spurious SNPs from misalignments. Chr17:17,132,511-17,132,778
image
  1. Repeat region - MAPQ 0 reads, spurious calls? Chr17:18,387,728-18,393,197
image
  1. Homopolymer - Length-variable indel calls. Chr17:16,083,542-16,083,608
image
  1. Soft-clipping. Chr17:17,554,270-17,554,536
image
  1. Strand Bias - Alt allele on one strand only. Chr17:13,419,374-13,419,651
image
⚠️ **GitHub.com Fallback** ⚠️