Closed thollis23 closed 1 year ago
This is due to version drift with Networkx. If you downgrade to Networkx <2.8 (iirc) it should work. Alternatively, you can install graphein from the main branch in this repository where this should be resolved.
How did you get on? Can I close this issue?
executing tutorial in colab notebook, running graphein 1.5.2:
from graphein.protein.graphs import construct_graph g = construct_graph(config=config, pdb_code="7TQN")
produces the following error:
AttributeError Traceback (most recent call last) in
1 from graphein.protein.graphs import construct_graph
2
----> 3 g = construct_graph(config=config, pdb_code="7TQN")
/usr/local/lib/python3.8/dist-packages/graphein/protein/graphs.py in construct_graph(config, name, pdb_path, uniprot_id, pdb_code, chain_selection, model_index, df_processing_funcs, edge_construction_funcs, edge_annotation_funcs, node_annotation_funcs, graph_annotation_funcs) 730 task4 = progress.add_task("Constructing edges...", total=1) 731 # Compute graph edges --> 732 g = compute_edges( 733 g, 734 funcs=config.edge_construction_functions,
/usr/local/lib/python3.8/dist-packages/graphein/protein/graphs.py in compute_edges(G, funcs, get_contacts_config) 587 func(G) 588 --> 589 return add_distance_to_edges(G) 590 591
/usr/local/lib/python3.8/dist-packages/graphein/protein/edges/distance.py in add_distance_to_edges(G) 94 G.graph["dist_mat"] = dist_mat 95 ---> 96 mat = np.where(nx.to_numpy_matrix(G), dist_mat, 0) 97 node_map = {n: i for i, n in enumerate(G.nodes)} 98 for u, v, d in G.edges(data=True):
AttributeError: module 'networkx' has no attribute 'to_numpy_matrix'