ontobio icon indicating copy to clipboard operation
ontobio copied to clipboard

KeyError: 'GO:0110142' while using ontobio python library

Open kevinxin90 opened this issue 5 years ago • 1 comments

Hi there,

When using the Ontobio python library, a "keyerror" occured. (Was testing with the code maybe 5 days ago, it's working, but it suddenly breaks today).

Here's the detailed error message.

KeyError Traceback (most recent call last) in ----> 1 func_sim_human.load_associations()

~/Documents/work/translator/translator-workflows/Workflow2/Modules/Mod1A_functional_sim.py in load_associations(self) 45 46 def load_associations(self): ---> 47 self.retrieve_associations(ont=self.ont, group=self.group) 48 49 def load_gene_set(self):

~/Documents/work/translator/translator-workflows/Workflow2/Modules/generic_similarity.py in retrieve_associations(self, ont, group) 26 if ont == 'go': 27 go_roots = set(self.ontology.descendants('GO:0008150') + self.ontology.descendants('GO:0003674')) ---> 28 sub_ont = self.ontology.subontology(go_roots) 29 if group == 'mouse': 30 url = "http://current.geneontology.org/annotations/mgi.gaf.gz"

~/Documents/work/translator/translator-workflows/ENV/lib/python3.7/site-packages/ontobio/sparql/sparql_ontology.py in subontology(self, nodes, **args) 109 def subontology(self, nodes=None, **args): 110 # ensure caches populated --> 111 self.all_synonyms() 112 self.all_text_definitions() 113 return super().subontology(nodes, **args)

~/Documents/work/translator/translator-workflows/ENV/lib/python3.7/site-packages/ontobio/sparql/sparql_ontology.py in all_synonyms(self, include_label) 99 syns = [Synonym(t[0],pred=t[1], val=t[2]) for t in syntups] 100 for syn in syns: --> 101 self.add_synonym(syn) 102 if include_label: 103 lsyns = [Synonym(x, pred='label', val=self.label(x)) for x in self.nodes()]

~/Documents/work/translator/translator-workflows/ENV/lib/python3.7/site-packages/ontobio/ontol.py in add_synonym(self, syn) 843 Adds a synonym for a node 844 """ --> 845 n = self.node(syn.class_id) 846 if 'meta' not in n: 847 n['meta'] = {}

~/Documents/work/translator/translator-workflows/ENV/lib/python3.7/site-packages/ontobio/ontol.py in node(self, id) 339 Wraps networkx by default 340 """ --> 341 return self.get_graph().node[id] 342 343 def has_node(self, id):

~/Documents/work/translator/translator-workflows/ENV/lib/python3.7/site-packages/networkx/classes/reportviews.py in getitem(self, n) 176 177 def getitem(self, n): --> 178 return self._nodes[n] 179 180 # Set methods

KeyError: 'GO:0110142'

kevinxin90 avatar May 16 '19 15:05 kevinxin90

https://github.com/biolink/ontobio/pull/381 merged. This should be fixed in the next release.

dougli1sqrd avatar Oct 01 '19 19:10 dougli1sqrd