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 from Ontologies downloaded April 27, 2016.

Dep <-Depth Counts->  <-Level Counts->
Lev   BP    MF    CC    BP    MF    CC
--- ----  ----  ----  ----  ----  ----
00     1     1     1     1     1     1
01    24    19    24    24    19    24
02   125   132   192   223   155   336
03   950   494   501  1907   738  1143
04  1952  1465   561  4506  1815  1294
05  3376  3861   975  7002  4074   765
06  4315  1788   724  7044  1914   274
07  4646  1011   577  4948   906    60
08  4150   577   215  2017   352     6
09  3532   309   106   753   110     1
10  2386   171    24   182    40     0
11  1587   174     3    37    22     0
12  1032    70     1     1     0     0
13   418    53     0     0     0     0
14   107    17     0     0     0     0
15    33     4     0     0     0     0
16    11     0     0     0     0     0

1. Download Ontologies, if necessary


In [6]:
# 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 [7]:
# 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 [8]:
from goatools.obo_parser import GODag

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


load obo file go-basic.obo
46518
go-basic.obo: format-version(1.2) data-version(releases/2016-04-27)
 nodes imported

4. Initialize Reporter class


In [9]:
from goatools.rpt_lev_depth import RptLevDepth

rptobj = RptLevDepth(obodag)

5. Generate depth/level report for all GO terms


In [10]:
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    24    19    24    24    19    24
02   125   132   192   223   155   336
03   950   494   501  1907   738  1143
04  1952  1465   561  4506  1815  1294
05  3376  3861   975  7002  4074   765
06  4315  1788   724  7044  1914   274
07  4646  1011   577  4948   906    60
08  4150   577   215  2017   352     6
09  3532   309   106   753   110     1
10  2386   171    24   182    40     0
11  1587   174     3    37    22     0
12  1032    70     1     1     0     0
13   418    53     0     0     0     0
14   107    17     0     0     0     0
15    33     4     0     0     0     0
16    11     0     0     0     0     0

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