问题
I am using the following code to retrieve Gene Symbols from Entrez IDs:
library("biomaRt")
ensembl <- useMart("ENSEMBL_MART_ENSEMBL", dataset = "hsapiens_gene_ensembl", host = "www.ensembl.org")
g <- getBM(c("hgnc_symbol"), filters = "entrezgene", c(entrez), ensembl)
but I get the following error:
Error in value[[3L]](cond): Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the BioMart web service is temporarily down.
Traceback:
1. getBM(c("hgnc_symbol"), filters = "entrezgene", c(entrez), ensembl)
2. tryCatch(postForm(paste(martHost(mart), "?", sep = ""), query = xmlQuery),
. error = function(e) {
. stop("Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the BioMart web service is temporarily down.")
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop("Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the BioMart web service is temporarily down.")
回答1:
library(biomaRt)
marts <- listMarts()
ensembl <- useMart("ensembl")
datasets <- listDatasets(ensembl)
ensembl=useDataset("hsapiens_gene_ensembl",mart=ensembl)
attributes <- listAttributes(ensembl)
my_ids <- read.csv("/home/firat/Desktop/ahmet_deseq2_results.csv")
results_end_1 <- getBM(attributes = c("ensembl_gene_id","external_gene_name"), values = my_ids, mart = ensembl )
View(results_end_1)
merged_with_my_ids <- merge(my_ids,results_end_1,by.x = "X",by.y = ,"ensembl_gene_id")
View(merged_with_my_ids)
Here is how I use biomaRt. I think it is self explanatory. The lines until my_ids are quiet the same for every script. For your case, in attributes = "entrezgene" would be useful instead of me using "ensembl_gene_id". Merging is an important step. In my case, while merging, by.x= "X" means, in my_ids csv, the ensemblegeneid's were located in a column named "X". so what I am basicly saying is, from my_ids, match the X column with results_end_1's "ensembl_gene_id" column and merge. If anything that is not clear, please ask. Fırat
回答2:
Open Internet Explorer, go to the website used in the host parameter of your ensembl function.
Then go to the settings tab, and add it to your Trusted Websites list.
This solved the problem for me.
Hope it helps you too.
来源:https://stackoverflow.com/questions/38265798/unable-to-use-biomart-package-to-get-gene-symbols-from-entrez-ids