Loading obsolete GO terms

Obsolete GO terms are loaded upon request.

Relevant GODag arguments include:

  • load_obsolete=True
  • optional_attrs={'consider', 'replaced_by'}

1) Download GO DAG file, go-basic.obo


In [1]:
from goatools.base import download_go_basic_obo
fin_dag = download_go_basic_obo("go-basic.obo")


  EXISTS: go-basic.obo

2) Read GO terms into a GODag instance: load_obsolete=True


In [2]:
from goatools.obo_parser import GODag

godag = GODag(fin_dag, load_obsolete=True)


go-basic.obo: fmt(1.2) rel(2020-01-01) 50,119 GO Terms

3) Load the optional GODag attributes, consider and replaced_by


In [3]:
godag = GODag(fin_dag, optional_attrs={'consider', 'replaced_by'}, load_obsolete=True)


go-basic.obo: fmt(1.2) rel(2020-01-01) 50,119 GO Terms; optional_attrs(consider replaced_by)

3a) How to suppress the GODag output messages

Set argument: prt=None.


In [4]:
godag = GODag(fin_dag, optional_attrs={'consider', 'replaced_by'}, load_obsolete=True, prt=None)

4) What GO term replaced the obsolete GO terms?


In [5]:
goterms_obsolete = set(o for o in godag.values() if o.is_obsolete)
print('{N:,} GO terms are obsolete'.format(N=len(goterms_obsolete)))

num = 1
for goterm in goterms_obsolete:
    if goterm.replaced_by[:3] == 'GO:':
        print('{I} {OLD} was replaced by {NEW}'.format(
            I=num, OLD=goterm.item_id, NEW=goterm.replaced_by))
        if num == 5:
            break
        num += 1


2,717 GO terms are obsolete
1 GO:0010546 was replaced by GO:0051879
2 GO:0010539 was replaced by GO:0051008
3 GO:0010538 was replaced by GO:0051008
4 GO:0019796 was replaced by GO:0009063
5 GO:0019795 was replaced by GO:0008652

5) What GO terms were considered?


In [6]:
num = 1
for goterm in goterms_obsolete:
    if goterm.consider:
        print('{I} Given {OLD}, consider {NEW}'.format(
            I=num, OLD=goterm.item_id, NEW=goterm.consider))
        if num == 5:
            break
        num += 1


1 Given GO:0007592, consider {'GO:0040002', 'GO:0040003'}
2 Given GO:0018988, consider {'GO:0007591', 'GO:0018996'}
3 Given GO:0019791, consider {'GO:0019783'}
4 Given GO:0010546, consider {'GO:0051082', 'GO:0006457', 'GO:0051787'}
5 Given GO:0019790, consider {'GO:0019783'}