Calculate the allele frequency of specific sub-population using VEP
1
0
Entering edit mode
2.5 years ago

I have more than 800 snps with rs ids, i want to calculate the allele frequency of these snps in British (GBR) population from 1000 Genomes Project. The thing is that i can calculate the allele frequencies of super population like European (EUR) using VEP script but unable to find the way to calculate the allele frequency of specific population like British (GBR) population.

vep allele frequency • 1.2k views
2
Entering edit mode
2.5 years ago

Unfortunately VEP doesn't give the sub-population frequencies, only the super-populations. To get the sub-populations, you will need to use the Ensembl REST API. I would recommend using the variation_post endpoint, although you will need to split your variant list into 200 variant chunks. You can then parse the GBR frequency out of the JSON. If you're not already familiar with using REST APIs and parsing JSON, we've got an online course.

2
Entering edit mode

Installation of Ensembl Rest API on R:

Install latest Rtools in base R from: https://cran.r-project.org/bin/windows/Rtools/

install.packages("githubinstall")
library(githubinstall)
library(devtools)
devtools::install_github("timyates/EnsemblRest")
library(EnsemblRest)


R code for Ensembl Rest API:

library(httr)
library(jsonlite)
library(xml2)

server <- "https://rest.ensembl.org"
ext <- "/variation/human/rs56116432?pops=1"

r <- GET(paste(server, ext, sep = ""), content_type("application/json"))

stop_for_status(r)

# use this if you get a simple nested list back, otherwise inspect its structure

0
Entering edit mode

Dear Emily, your post above helped us a lot! Two questions: 1) The reported MAF in the JSON is always based on 1000Genomes? 2) Is there some other database providing sub-population resolution in addition to 1000Genomes?

1
Entering edit mode

Overall MAF is always 1000 Genomes, but if you get population MAFs they will come from different sources and will be labelled with their source.