Thanks. How can I modify your code to cater for Mouse instead of human?
I have the following list of probes (from Mouse),
1460644_at
1460645_at
1460646_at
1460647_a_at
1460648_at
1460649_at
1460650_at
1460651_at
1460652_at
1460653_at
1460654_at
1460655_a_at
1460656_a_at
1460657_at
1460658_at
1460659_at
1460660_x_at
1460661_at
The longer list can be found here: http://dpaste.com/1371949/plain/
What I want to do is to convert that name with HUGO gene symbol using R. What's the way to do it?
I tried this but failed
library(biomaRt)
dat<-read.table("http://dpaste.com/1371949/plain/")
probes<-as.vector(as.matrix(dat))
mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
g = getGene( id = probes, type = "affy_mg_u74av2", mart = mouse)
show(g)
It prints Ensembl gene id instead (e.g.ENSMUSG00000057666)
1 answer
I generally do it in this way using the biomarRt package
EnsembleToHGNC<-function(EnsembleIDs, organism="hsapiens_gene_ensembl"){
require(biomaRt);
ensemble<-useMart("ensembl");
hsp<-useDataset(mart=ensemble,dataset=organism);
ids<-getBM(filters= "ensembl_gene_id",
attributes= c("ensembl_gene_id","hgnc_id", "hgnc_symbol","description"),
values= EnsembleIDs, mart= hsp);
return(ids);
}
Hope it helps :)
As in your own code, use "mmusculus_gene_ensembl". And since you want mouse gene symbols - I assume that is MGI symbols? so omit "hgnc_id", "hgnc_symbol","description" in the attributes and use "mgi_id", "mgi_symbol", "mgi_description" instead.
You can get a data frame of attributes using listAttributes(hsp).
Thanks Neilfws, for the corrections :). Yeah, just as Neilfws said, you change the attributes with the one Neifwd mentioned in the getBM line, and just call it as follow EnsembleToHGNC(ensembleIDs,organism="mmusculus_gene_ensembl"), where ensembleID is a list of your IDs
Log in to answer this question.
Good attempt. You want getBM(), not getGene() - see the answer by Sirus.
Also: HUGO gene symbols are for human genes. So do you want mouse gene symbols? Or the human equivalent of mouse genes?
I want mouse gene symbols.