Question: Import Gene Symbol
0
gravatar for V
3.1 years ago by
V110
UK/London
V110 wrote:

Hello,

I'm fairly new to R and I'm having a small issue. I've generated a typical count table where the first column is a list of ensembl identifiers, each one in a different row and every other column is a different sample.

Is there a way now that the table is loaded into R, to switch out the ensembl identifier into the official gene names (e.g , Sox2) ? I'm using the following code but it doesnt seem to be working.

library(biomaRt)
mart <- useMart(biomart = 'ensembl', dataset = 'mmusculus_gene_ensembl')
bm.query <- getBM(values=rownames(counts),attributes=c("ensembl_gene_id", "external_gene_name"),filters=c("ensembl_gene_id"),mart=mart)
genes <- list(ids=rownames(counts),names=bm.query[match(rownames(counts), bm.query$ensembl_gene_id),]$external_gene_id)

I get the following error:

Error in getBM(values = rownames(counts), attributes = c("ensembl_geneid",  : 
  Values argument contains no data.

If anyone could help that would be great.

Thanks!

rna-seq • 1.1k views
ADD COMMENTlink modified 3.1 years ago by Denise - Open Targets5.0k • written 3.1 years ago by V110
0
gravatar for Denise - Open Targets
3.1 years ago by
UK, Hinxton, EMBL-EBI
Denise - Open Targets5.0k wrote:

To get gene symbols such as Sox2, you can choose MGI symbols as attributes. BioMart is also available as a web interface in case you want to give it a go as an alternative to biomaRt.

ADD COMMENTlink written 3.1 years ago by Denise - Open Targets5.0k

Hi Denise, thanks for that.

I've modified the code to say the following but it gives me exactly the same error:

library(biomaRt)
    mart <- useMart(biomart = 'ensembl', dataset = 'mmusculus_gene_ensembl')
    bm.query <- getBM(values=rownames(counts),attributes=c("mgi_symbol", "external_gene_name"),filters=c("ensembl_gene_id"),mart=mart)
    genes <- list(ids=rownames(counts),names=bm.query[match(rownames(counts), bm.query$ensembl_gene_id),]$external_gene_id)

Would you be able to clarify what you meant and how that would be written?

I use the Biomart web interface quite often but only to input gene lists for it to convert, the aim of this is to switch it around in the count table so I can avoid having to do that, and for the plots generated in R to have the official gene symbol listed rather than the ensambl ID which essentially isn't that informative or helpful when looking at the plot.

ADD REPLYlink written 3.1 years ago by V110
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 717 users visited in the last hour