Hi everyone,

I have seen a similar question [(here)][1] 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][1]. 
Thanks in advance.


  [1]: http://asia.ensembl.org/Bos_taurus/Variation/Explore?r=1:78737231-78738231;v=rs17870417;vdb=variation;vf=27409771
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: https://www.biostars.org/p/336724/

Kevin