Question: Go Term Import
0
gravatar for V
2.4 years ago by
V100
UK/London
V100 wrote:

Hello Everyone,

Naive question. I have an object "cd" that has ensembl ids as row names. I use the following to construct a dataframe with 2 columns.

go <- getBM(attributes = c("ensembl_gene_id", "go_id"), filters = "ensembl_gene_id", values = rownames(cd), mart = ensembl)

and that works fine, then what I want to do is use the Go.db library to add a column to that object with the Go-term, so I do the following:

go$term <- Term(go$go_id)

This adds the column but all of the values are "NA".

Any clues what I'm doing wrong or if its further upstream? Thanks

goterm biomart ensembl • 836 views
ADD COMMENTlink modified 2.4 years ago by russhh4.1k • written 2.4 years ago by V100
0
gravatar for Emily_Ensembl
2.4 years ago by
Emily_Ensembl16k
EMBL-EBI
Emily_Ensembl16k wrote:

Why don't you just get the GO term as an attribute in BiomaRt?

go <- getBM(attributes = c("ensembl_gene_id", "go_id", " name_1006"), filters = "ensembl_gene_id", values = rownames(cd), mart = ensembl)
ADD COMMENTlink modified 2.4 years ago • written 2.4 years ago by Emily_Ensembl16k

Worked like a charm! thank you!!

ADD REPLYlink written 2.4 years ago by V100

Hi Emily,

I was wondering if you could help me with this, i'm trying to rerun the code you sent me above but this time having a list of official gene names. I've tried altering the "attributes" and "filters" to a number of stuff like "external_gene_name" or "official_gene_symbol" but nothing seems to be working. My rows are named normally such as "Sox2", "Wnt9a" etc. If you could help it would be great.

Thanks

ADD REPLYlink written 2.4 years ago by V100

Use listAttributes(ensembl) to see the attribute names and descriptions.

ADD REPLYlink written 2.4 years ago by Emily_Ensembl16k

Tried that and "associated_gene_name" comes up but R outputs the same error:

Error in getBM(attributes = c("associated_gene_name", "go_id", "name_1006"),  : 
  Invalid attribute(s): associated_gene_name
Please use the function 'listAttributes' to get valid attribute names
ADD REPLYlink written 2.4 years ago by V100

Yes, because associated_gene_name is not an attribute name. You need find the attribute name on the list of attributes.

ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by Emily_Ensembl16k
0
gravatar for russhh
2.4 years ago by
russhh4.1k
UK, U. Glasgow
russhh4.1k wrote:

There's nothing wrong with your code as it stands. I used the following example, since you didn't provide an explicit one:

library(biomaRt)
library(GO.db)
ensembl <- useMart('ensembl')
ensembl <- useDataset('hsapiens_gene_ensembl',
                      mart = useMart('ensembl'))
id <- 'ENSG00000134294'
go <- getBM(attributes = c("ensembl_gene_id", "go_id"),
            filters = "ensembl_gene_id",
            values = id,
            mart = ensembl)
head(go)

#  ensembl_gene_id      go_id
#1 ENSG00000134294 GO:0006865
#2 ENSG00000134294 GO:0014047
#3 ENSG00000134294 GO:0015293
#4 ENSG00000134294 GO:0005515
#5 ENSG00000134294 GO:0006811
#6 ENSG00000134294 GO:0006814

go$term <- Term(go$go_id)
head(go)
 #     ensembl_gene_id      go_id                 term
 #   1 ENSG00000134294 GO:0006865 amino acid transport
 #   2 ENSG00000134294 GO:0014047  glutamate secretion
 #   3 ENSG00000134294 GO:0015293   symporter activity
 #   4 ENSG00000134294 GO:0005515      protein binding
 #   5 ENSG00000134294 GO:0006811        ion transport
 #   6 ENSG00000134294 GO:0006814 sodium ion transport

Maybe you should check your row.names

ADD COMMENTlink written 2.4 years ago by russhh4.1k

Dear Russhh,

thanks for this! I keep getting the same error though, I substituted values = id, to values =cd (cd is the name of my table) and also changed the useDataset to ('mmusculus_gene_ensembl') the table generated is completely empty, not even the ensembl Ids show up. I've looked at my row names and they seem pretty normal, not sure if I'm missing something in the identifiers

e.g: ENSMUSG00000102693, ENSMUSG00000064842 etc

ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by V100

Please update your post with an explicit, reproducible, example

ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by russhh4.1k
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: 1100 users visited in the last hour