Hi everyone,
I have seen a similar question (here) but I can't figure out how the issue was solved.
I have a list (> 500k) of SNPs rs numbers and would like to get their corresponding stable snp names. The code that I am running to test for one snp before I have a go with the whole list is:
library(biomaRt)
ensembl = useDataset("btaurus_gene_ensembl", mart = ensembl)
getBM(attributes=c("ensembl_gene_id","variation_name"),filters = c("snp_filter"),
values="rs17870417", mart=ensembl, uniqueRows=TRUE)
But I get this error:
Error in getBM(attributes = c("ensembl_gene_id", "variation_name"), filters = c("snp_filter"), :
Invalid filters(s): snp_filter
Please use the function 'listFilters' to get valid filter names
How can I solve this error or is there another filter option for "snp_filter"? I can find the snp name on the ensembl website. Thanks in advance.
1 answer
Hi,
You are using the incorrect dataset, which is why that filter cannot be found; In addition, ensembl_gene_id is not an attribute in the SNP biomaRt.
Here is a reproducible solution:
require(biomaRt)
ensembl <- useMart('ENSEMBL_MART_SNP', dataset = 'btaurus_snp')
getBM(
attributes = c('refsnp_id',
'chr_name', 'chrom_start','chrom_end',
'allele', 'mapweight', 'validated', 'allele_1', 'minor_allele',
'minor_allele_freq', 'minor_allele_count',
'synonym_name', 'ensembl_gene_stable_id'),
filters = c('snp_filter'),
values = 'rs17870417',
mart = ensembl,
uniqueRows = TRUE)
refsnp_id chr_name chrom_start chrom_end allele mapweight
1 rs17870417 1 78737731 78737731 A/G 1
validated allele_1 minor_allele minor_allele_freq
1 Frequency,Multiple_observations NA NA NA
minor_allele_count synonym_name ensembl_gene_stable_id
1 NA NA ENSBTAG00000044001
Example for Homo sapeins SNP biomaRt here: How to retrieve Gene name from SNP ID using biomaRt
Kevin
Log in to answer this question.
Error is clear,
"snp_filter"is not a valid filter name, check the output oflistFilters(ensembl).Thanks for the feedback. I have gone through the
listFilters(ensembl)andlistAttributes(ensembl)and I am not sure what I should set for both to get the stable snp IDs for the rs numbers.Please help.