filippocastelli/KEGGutils

AttributeError: 'KEGGpathway' object has no attribute 'node'

kpj opened this issue · 4 comments

kpj commented

Executing

import KEGGutils as kg
pathway = kg.KEGGpathway(pathway_id='hsa05224')

yields the error AttributeError: 'KEGGpathway' object has no attribute 'node'.

This can be fixed by editing "KEGGutils/KEGGpathway.py":

# line 164
self.pos.update({n: self.node[n]["xy"]})
# to
self.pos.update({n: self.nodes[n]["xy"]})

# line 484
"nodes": (self.node[e1]["name"], self.node[e2]["name"]),
# to
"nodes": (self.nodes[e1]["name"], self.nodes[e2]["name"]),

@kpj thanks for the contribution! last commit should fix the issue

@kpj the suggested fix causes tests to fail

FAILED tests/test_kegggraph.py::KEGGLinkGraphTests::test_kegglinkgraph_get_nodes_by_nodetype_islist
 
FAILED tests/test_kegggraph.py::KEGGLinkGraphTests::test_kegglinkgraph_projection_has_edges
 
FAILED tests/test_keggutils.py::KEGGutilsTest::test_get_nodes_by_nodetype - A...
 
FAILED tests/test_keggutils.py::KEGGutilsTest::test_get_nodes_by_nodetype_correct_nodetype_dict
 
=================== 4 failed, 24 passed, 1 warning in 16.36s ===================

I'm currently investigating on the matter.
(bro I haven't touched this code since like forever)

kpj commented

This is amazing, thank you so much!

you're welcome, I'm happy to know this tool is useful for someone enough to open an issue.
have a nice day!