Let’s visualize some of the data from our somatic call annotation!
At first we should load one of the vep annotated files from one of the exercises. Let’s load the results from exercise 3 (feel free to load another one!), chr6ch17_mutect2_annotated_with_clinVar.txt from the exercise Cancer-Specific Annotation.
Code
# get librarieslibrary(magrittr)library(readr)library(ggplot2)library(dplyr)library(tidyr)library(stringr)# VEP output invep_data <-read_tsv("~/variants/chr6ch17_mutect2_annotated_with_clinVar.txt",comment ="##")# better to set up a ggplot2 themetheme_course <-function() {theme_minimal(base_size =14) +# Base size affects all texttheme(plot.title =element_text(size =16, face ="bold"),axis.title =element_text(size =14, face ="bold"),axis.text =element_text(size =12),legend.title =element_text(size =13, face ="bold"),legend.text =element_text(size =12),strip.text =element_text(size =13, face ="bold"), # For facetslegend.position ="bottom" )}# get chrvep_data <- vep_data %>%separate(Location, into =c("chr", "position"), sep=":") %>%mutate(chr =factor(chr, levels =c("chr6", "chr17")))# Extract IMPACT from Extra columnvep_data$IMPACT <-gsub(".*IMPACT=([^;]+).*", "\\1", vep_data$Extra)# get nice data out of the df# returns NA when the field is missing in a row (gsub would return the whole Extra string)extract_field <-function(data, field) {str_match(data$Extra, paste0("(?:^|;)", field, "=([^;]+)"))[, 2]}# combine multiple fieldsvep_data <- vep_data %>%mutate(IMPACT =extract_field(., "IMPACT"),SYMBOL =extract_field(., "SYMBOL"),VARIANT_CLASS =extract_field(., "VARIANT_CLASS"),BIOTYPE =extract_field(., "BIOTYPE") )# VEP joins several consequence terms with a comma: one row per termvep_long <- vep_data %>%separate_rows(Consequence, sep =",")
Exercise 5
ImportantVisualize the data from VEP
Objective: Learn how to quickly visualize your variants.
Task: Visualize:
Consequence plot, to visualize the distribution of consequences?
Consequence plot, by chromosome?
Can we see the consequence colored by impact?
Can we see the consequence colored by impact by chromosome?
What are the most common variant classes?
What are the most common biotypes?
Bonus: ClinVar, SIFT, and PolyPhen
Bonus: Gene level damage
Tip1. Consequence plot, to visualize the distribution of consequences