Question: Import Gene Symbol
gravatar for V
4.3 years ago by
V230 wrote:


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.

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.


rna-seq • 1.7k views
ADD COMMENTlink modified 4.3 years ago by Denise CS5.1k • written 4.3 years ago by V230
gravatar for Denise CS
4.3 years ago by
Denise CS5.1k
UK, Hinxton, EMBL-EBI
Denise CS5.1k 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 4.3 years ago by Denise CS5.1k

Hi Denise, thanks for that.

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

    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 4.3 years ago by V230
Please log in to add an answer.


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