Hello,
I have a text file containing a list of rsIDs for many snp. I want to make the same request to search for gene names and transcripts on each line of this file. So, I would like to read my file line by line and indicate the current line (loop?) in my request. How to read my file line by line and put in "value" (of the getBM function) each line of my file (here instead of Data_with it is to have each line of the file).
Here is the code I tried:
Data <- readLines ("/Users/amandinelecerfdefer/Desktop/rsID.txt")
require(biomaRt)
sink("sortie_rsID.txt")
retrieve<-list()
for (i in 1:nrow(Data)){
values <- Data_vec[[i]]
ensembl <- useMart("ENSEMBL_MART_SNP", dataset = "hsapiens_snp")
retrieve[[i]] <-getBM(attributes=c(
"refsnp_id", "ensembl_gene_stable_id", "ensembl_transcript_stable_id"),
filters="snp_filter", values=values,
mart=ensembl, uniqueRows=TRUE)
}
but I still have this message:
Error in 1:nrow(Data) : argument of length 0
How can I link the file line by line and indicate to value each line line after line? and so how can I iterate this search command on all my snps in my file?
I guess your
Data
is incharacter
class. If whatever you want to stick to your codes, you can try:Thank you for your answer but the search command via mart does not start. How to solve this problem?
Thank you for your answer but the search command via mart does not start. How to solve this problem?
Did you have a look at the final dataframe:
result
if using the codes from fracarb8?Thank you for your help SMK , your solution works perfectly! Thank you! Thank you!
Hello, I turn to you because since Friday, I can no longer retrieve my various information because I find myself with a recurrent error:
Despite my internet research, I can't fix this mistake. How can I get this tool to work again?
Thank you in advance
Did you find answers in BioMart : the BioMart webservice returned an invalid result?
Yes, it's also my post ^^. The problem is the length of the list to send to the server. A maximum of 500 queries can be sent. What seems strange to me is that last week I managed to send 100,000 rsIDs.
I added a comment there, regarding the batch issue.