This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Annotating snps with gene information

Hi,

I am trying to annotate a list of snps with the ENSG gene number using biomaRt. I need to use ensemble version 91. I have built the following query:

snps = c("rs201327123"  "rs141149254"  "rs114420996"  "rs62637817")

ensembl.snp = useEnsembl(biomart="snps", version=91)
mart.snp <- useMart(biomart = "ENSEMBL_MART_SNP")
dataset.snp <- useDataset(dataset = "hsapiens_snp", mart=mart.snp)

getBM(attributes=c('refsnp_id', 'ensembl_gene_stable_id'), 
  filters = 'snp_filter', 
  values = snps, 
  mart = dataset.snp)

However the output does not include any gene ids (all are listed as NA's).

Any thoughts very much appreciated!

Aaron

snps gene annotation biomart

1 answer

Following the example here. When you say useMart I think it creates a connection with latest version (108 when writing this) separate from the useEnsembl where you supplied the version. rs141149254 is upstream in version 91 and expected to be NA in version 108 since its intergenic, but I am not sure why others are NA in release 108.

library(biomaRt)
snpmart = useEnsembl(biomart = "snp", dataset="hsapiens_snp", version=91)
snps = c("rs201327123",  "rs141149254",  "rs114420996",  "rs62637817", "rs699")
getBM(attributes=c('refsnp_id', 'ensembl_gene_stable_id'),
    filters = 'snp_filter',
    values = snps,
    mart = snpmart)

Output:

refsnp_id ensembl_gene_stable_id
1 rs114420996        ENSG00000240361
2 rs141149254        ENSG00000268020
3 rs141149254        ENSG00000240361
4 rs201327123        ENSG00000278267
5 rs201327123        ENSG00000227232
6 rs201327123        ENSG00000223972
7  rs62637817        ENSG00000240361
8       rs699        ENSG00000135744
9       rs699        ENSG00000244137

Log in to answer this question.