In [1]:
from goatools.base import download_go_basic_obo
fin_dag = download_go_basic_obo("go-basic.obo")
In [2]:
from goatools.obo_parser import GODag
godag = GODag(fin_dag, load_obsolete=True)
In [3]:
godag = GODag(fin_dag, optional_attrs={'consider', 'replaced_by'}, load_obsolete=True)
In [4]:
godag = GODag(fin_dag, optional_attrs={'consider', 'replaced_by'}, load_obsolete=True, prt=None)
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
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