Hello,
I am trying to retrieve the rsIDs from a list of chromosomal positions. This is a long query (list contains ~60k variants) and thus I cannot submit it to bioMart, so using advice found in the forum I am using REST API and simply looping my list to my query.
Does anyone know if there is a more efficient way than what I am currently doing? It is taking very long and I am aiming to have this and another (much bigger) query done by tomorrow, but I worry about the time it will take me to process it, and since it is my first time using this API, maybe you can give me advice or point me towards the right direction.
Here is my piece of code:
server <- "https://grch37.rest.ensembl.org"
#Loop each chromosomal location to query and obtain list with rsID information
ID_T2D <- c()
for (i in coords){
# print(i)
ext<-paste("/overlap/region/homo_sapiens/",i,"?;feature=variation", sep ="")
# print(ext)
r <- GET(paste(server, ext, sep = ""), content_type("application/json"))
Sys.sleep(2)
# print(r)
#To know if there has been any errors in my query
stop_for_status(r)
temp <- fromJSON(toJSON(content(r)))
# print(temp)
ID_T2D <- rbind(ID_T2D,temp)
}
Where coords is a list of chromosomal locations in format X:XXXX:XXXX (chr number, start and end positions).
Any help would be GREATLY appreciated! Thanks
Are the chromosomal coordinates just single base and you're trying to find the SNP at that locus, or are they longer and you're trying to find all of them in the region?
They are single base and I want to retrieve the rsID of the SNP at that locus.