Exporting org.*.*.db Gene Ontology annotations to excel sheet or txt
1
0
Entering edit mode
Jonas • 0
@f91ff31c
Last seen 2.1 years ago
United Kingdom

Hi, I would like to export the GO annotations to either csv or txt:

  1. Go to gene id:

example: GOxxxxxx; gene1,gene2,gene3.....

  1. gene id to GO:

example: gene1; GO term1, GO term2, GO term3 .....

I've been trying the following code:

library(org.Pf.plasmo.db)
xgo <- org.Pf.plasmoGO
mapped_genes <- mappedkeys(xgo)
xx2 <- as.list(xgo[mapped_genes])

It produces a complex list with at least 3 levels.

Could you please help advise how to extract these information into a excel sheet?

It would be better if I can also differentiate between GO terms of biological process, cellular components and molecular functions individually, as well as altogether.

Thanks!

Jonas

OrgDb RNASeq • 1.5k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States

The first direction:

> go2gn <- sapply(mapIds(org.Pf.plasmo.db, keys(org.Pf.plasmo.db, "GO"), "ORF", "GO", multivals = "list"), paste, collapse = ",")
'select()' returned 1:many mapping between keys and columns

> go2gn.df <- data.frame(GOIDS = names(go2gn), ORF = go2gn)
> head(go2gn.df)
                GOIDS           ORF
GO:0004872 GO:0004872 PF3D7_0100100
GO:0009405 GO:0009405 PF3D7_0100100
GO:0016021 GO:0016021 PF3D7_0100100
GO:0016337 GO:0016337 PF3D7_0100100
GO:0020002 GO:0020002 PF3D7_0100100
GO:0020013 GO:0020013 PF3D7_0100100

## and the reverse

> gn2go <- sapply(mapIds(org.Pf.plasmo.db, keys(org.Pf.plasmo.db), "GO", "ORF", multiVals = "list"), paste, collapse = ",")
'select()' returned 1:many mapping between keys and columns
> gn2go.df <- data.frame(ORF = names(gn2go), GOIDS = gn2go)
> head(gn2go.df)
                        ORF
PF3D7_0100100 PF3D7_0100100
PF3D7_0100200 PF3D7_0100200
PF3D7_0100300 PF3D7_0100300
PF3D7_0100400 PF3D7_0100400
PF3D7_0100500 PF3D7_0100500
PF3D7_0100600 PF3D7_0100600
                                                                                                                      GOIDS
PF3D7_0100100 GO:0004872,GO:0009405,GO:0016021,GO:0016337,GO:0020002,GO:0020013,GO:0020030,GO:0020033,GO:0020035,GO:0050839
PF3D7_0100200                                             GO:0020002,GO:0020003,GO:0020013,GO:0020033,GO:0020035,GO:0020036
PF3D7_0100300                                                                              GO:0004872,GO:0009405,GO:0016021
PF3D7_0100400                                             GO:0020002,GO:0020003,GO:0020013,GO:0020033,GO:0020035,GO:0020036
PF3D7_0100500                                                                                                            NA
PF3D7_0100600                                                                              GO:0016020,GO:0020002,GO:0020033

You can then use e.g., write.xlsx in the openxlsx package to write to an Excel workbook.

ADD COMMENT

Login before adding your answer.

Traffic: 742 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6