require(ggplot2)
# get high impact table
df <- read.table('~/Desktop/210131_ukbb_mfi_vep_all_HIGH_maf_info.txt')
colnames(df) <- c('CHR','BP1','SNPID','RSID','REF','ALT','MAF','MA','INFO','BP2','MINOR','MAJOR','CONS')
df <- df[!is.na(df$BP1), ] # remove some NA's
## tables
cons <- as.data.frame(do.call(rbind, strsplit(df$CONS, '\\|')))
colnames(cons) <- c('CSQ','ENST','TRANS','TYPE','IMPACT','GENE','HGNC','AFFECT','YES',"CDS","AA_POS",'EXON','INTRON')
cons$TYPE_SIMPLE <- unlist(lapply(strsplit(cons$TYPE, split = '\\&'), function(x) x[1]))
combined = cbind(df, cons)
combined$INDEL = as.logical(apply(cbind(unlist(lapply(combined$REF, nchar)), unlist(lapply(combined$ALT, nchar))), 1, max) > 1)
combined$variant_type = ifelse(combined$INDEL, 'Indel','SNV')
##
p1 <- ggplot(combined, aes(x=log10(MAF), y=INFO, color = variant_type)) +
geom_point(alpha = 0.8) +
geom_hline(yintercept=0.9, linetype = 'dashed') +
geom_vline(xintercept=log10(0.001), linetype = 'dashed') +
geom_vline(xintercept=log10(0.02), linetype = 'dashed') +
ggtitle(paste('Overview of',nrow(combined),'high impact variants')) +
theme_bw()
ggsave(plot = p1, filename = '~/Desktop/210131_INFOvsMAF.png', width = 8, height = 8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.