This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get dbSNP ids for a gene name

Hi all,

I have a list of genes and I would like a list of rs# for that gene. I can see that one can view such a list at the following URL:

http://www.ncbi.nlm.nih.gov/snp?cmd=search&term=LPL

But my question is how could I do this programatically and get a list of rs#.

Thanks

dbsnp gene

3 answers

Programatically, you can use BioMart. Here's an example using the R/Bioconductor biomaRt package.

library(biomaRt)
mart.genes <- useMart("ensembl", "hsapiens_gene_ensembl")

getRsids <- function(gene = "LPL", mart = mart.genes) {
  results <- getBM(attributes = c("external_id", "external_gene_id"),
                   filters    = "hgnc_symbol", values = gene, mart = mart)
  return(results)
}

# default gene = LPL
lpl <- getRsids()

head(lpl)
  external_id external_gene_id
1 rs368991480              LPL
2 rs200280296              LPL
3 rs186940970              LPL
4 rs151133350              LPL
5 rs180845880              LPL
6   rs3043732              LPL

# or specify gene e.g. p53
p53 <- getRsids(gene = "TP53")

It seems this is what you want ( ftp://ftp.ncbi.nlm.nih.gov/snp/organisms/human_9606/gene_report/ ).

It also seems that Bioconductor maintains an annotation package for some of the dbSNP releases, eg http://www.bioconductor.org/packages/release/data/annotation/html/SNPlocs.Hsapiens.dbSNP.20120608.html

Log in to answer this question.