Report counts of GO terms at various levels and depths

Reports the number of GO terms at each level and depth.

  • Level refers to the length of the shortest path from the top.
  • Depth refers to the length of the longest path from the top.

See the Gene Ontology Consorium's (GOC) advice regarding levels and depths of a GO term

GO level and depth reporting

GO terms reported can be all GO terms in an ontology.
Or subsets of GO terms can be reported.
GO subset examples include all GO terms annotated for a species or all GO terms in a study.

Example report on full Ontology:

go-basic.obo: fmt(1.2) rel(2019-01-12) 47,374 GO Terms

Summary for all Ontologies:
Dep <-Depth Counts->  <-Level Counts->
Lev   BP    MF    CC    BP    MF    CC
--- ----  ----  ----  ----  ----  ----
00     1     1     1     1     1     1
01    29    16    21    29    16    21
02   264   125   345   421   154   746
03  1273   570   494  2205   866  1073
04  2376  1516   735  4825  2072  1359
05  3692  4801   913  7297  5035   697
06  4474  1834   787  7287  1934   230
07  4699  1029   600  4696   728    68
08  4214   508   254  2018   194    10
09  3516   312    51   631    79     1
10  2399   153     4   241    13     0
11  1511   140     1    38    19     0
12   854    42     0     0     0     0
13   303    35     0     0     0     0
14    66    21     0     0     0     0
15    14     7     0     0     0     0
16     4     1     0     0     0     0

1. Download Ontologies, if necessary


In [1]:
# Get http://geneontology.org/ontology/go-basic.obo
from goatools.base import download_go_basic_obo
obo_fname = download_go_basic_obo()


  EXISTS: go-basic.obo

2. Download Associations, if necessary


In [2]:
# Get ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz
from goatools.base import download_ncbi_associations
gene2go = download_ncbi_associations()


  EXISTS: gene2go

3. Initialize GODag object


In [3]:
from goatools.obo_parser import GODag

obodag = GODag("go-basic.obo")


go-basic.obo: fmt(1.2) rel(2019-04-17) 47,398 GO Terms

4. Initialize Reporter class


In [4]:
from goatools.rpt.rpt_lev_depth import RptLevDepth

rptobj = RptLevDepth(obodag)

5. Generate depth/level report for all GO terms


In [5]:
rptobj.write_summary_cnts_all()


Dep <-Depth Counts->  <-Level Counts->
Lev   BP    MF    CC    BP    MF    CC
--- ----  ----  ----  ----  ----  ----
00     1     1     1     1     1     1
01    29    18    21    29    18    21
02   268   128   344   426   156   747
03  1279   576   489  2223   870  1065
04  2387  1511   730  4823  2031  1358
05  3687  4802   913  7300  5026   697
06  4485  1834   789  7309  1963   232
07  4713  1033   603  4671   744    68
08  4237   506   254  2011   194    10
09  3521   309    51   630    78     1
10  2390   151     4   243    13     0
11  1498   136     1    38    19     0
12   830    41     0     0     0     0
13   295    36     0     0     0     0
14    67    23     0     0     0     0
15    13     7     0     0     0     0
16     4     1     0     0     0     0

Copyright (C) 2016-2019, DV Klopfenstein, H Tang. All rights reserved.