#!/usr/bin/env python # coding: utf-8 # Demonstrates mapping between GO GAF Codes (IEA, ISS, etc) and ECO classes. # # See http://purl.obolibrary.org/obo/eco/gaf-eco-mapping.txt # # In[1]: ## Create an EcoMap object, for mapping to and from ECO classes from ontobio.ecomap import EcoMap m = EcoMap() # In[2]: ## Create an ontology object for ECO; ## This is optional; we use this in this notebook ## to look up ECO class labels, and parentage from ontobio.ontol_factory import OntologyFactory ontol = OntologyFactory().create('eco') # In[3]: ## Given a code 'IEA' and no further information, map it m.coderef_to_ecoclass('IEA') # Including a specific reference, such as [GO_REF:000002 Gene Ontology annotation through association of InterPro records with GO terms](http://purl.obolibrary.org/obo/go/references/0000002) can increase the specificity of the mapping # In[11]: ## Given a combination of a code plus a reference, ## we can map this to a more precise evidence type cls = m.coderef_to_ecoclass('IEA','GO_REF:0000002') cls # In[12]: ontol.label(cls) # In[13]: ["{} '{}'".format(c, ontol.label(c)) for c in ontol.ancestors(cls)] # In[14]: m.ecoclass_to_coderef('ECO:0000501') # In[15]: m.ecoclass_to_coderef('ECO:0000256') # In[ ]: