Hello, I want to retrieve set_gene_id (ENSG), set_transcript_id (ENST) from a file containing the rsIDs of many SNPs. After a lot of research, the BioMart package from R would allow me to do this. After some research, I saw that I had to use the argument refsnp_id to tell the program that I wanted to provide them with the rsIDs of my SNPs to perform the search and retrieve the gene and transcript ID.
Here is the code:
library(biomaRt)
Data <- readLines ("rsID.txt")
length(Data)
for (i in 1:length(Data)){
mart <- useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl")
results <- getBM(attributes = c("refsnp_id", "ensembl_gene_id", "ensembl_transcript_id"),
filters = "refsnp_id", values = "i",
mart = mart)
}
However, it returns the following error :
Error in getBM(attributes = c("refsnp_id", "ensembl_gene_id", "ensembl_transcript_id"), :
Invalid attribute(s): refsnp_id
Please use the function 'listAttributes' to get valid attribute names
How to tell it that I want to give him rsIDs ?
Second, is this the right way to read a txt file line by line and thus search for gene and transcript names for each sNP?
Thank you in advance for your help.