Question: Go Term Import
0
gravatar for V
2.2 years ago by
V90
UK/London
V90 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 • 768 views
ADD COMMENTlink modified 2.2 years ago by russhh3.8k • written 2.2 years ago by V90
0
gravatar for Emily_Ensembl
2.2 years ago by
Emily_Ensembl15k
EMBL-EBI
Emily_Ensembl15k 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.2 years ago • written 2.2 years ago by Emily_Ensembl15k

Worked like a charm! thank you!!

ADD REPLYlink written 2.2 years ago by V90

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.2 years ago by V90

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

ADD REPLYlink written 2.2 years ago by Emily_Ensembl15k

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.2 years ago by V90

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.2 years ago • written 2.2 years ago by Emily_Ensembl15k
0
gravatar for russhh
2.2 years ago by
russhh3.8k
UK, U. Glasgow
russhh3.8k 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.2 years ago by russhh3.8k

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.2 years ago • written 2.2 years ago by V90

Please update your post with an explicit, reproducible, example

ADD REPLYlink modified 2.2 years ago • written 2.2 years ago by russhh3.8k
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: 618 users visited in the last hour