Opened 8 years ago

Closed 8 years ago

#751 closed defect (fixed)

contacts command fails

Reported by: pett Owned by: Tom Goddard
Priority: minor Milestone: Alpha2
Component: Structure Analysis Version:
Keywords: Cc: Elaine Meng
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

'contacts #1' fails when running 'debug test'. Easily reproducible with:

open 4hhb
contacts #1

The output and error is:

contacts #1
5 buried areas: B A 1013, D C 951, D A 818, B C 816, C A 340
Traceback (most recent call last):
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/networkx/drawing/layout.py", line 292, in fruchterman_reingold_layout
raise ValueError
ValueError

Change History (5)

comment:1 by Tom Goddard, 8 years ago

This error is a bug in the Python networkx module. We must have updated numpy from 1.12 to 1.13 recently because the error was just a warning with numpy 1.12. I tested a newer networkx version about a year ago which may fix this problem but networkx function behaviors changed significantly including new bugs that effected the contacts tool.

Will need to try the latest networkx and see if the problems are fixed.

UCSF ChimeraX version: 0.1 (2017-07-17)
OpenGL version: 4.1 NVIDIA-10.17.5 355.10.05.45f01
OpenGL renderer: NVIDIA GeForce GT 650M OpenGL Engine
OpenGL vendor: NVIDIA Corporation
open 4hhb
Summary of feedback from opening 4hhb fetched from pdb
notes Used PDBx fixed column width tables to speed up reading mmCIF file
Used PDBx keywords to speed up reading mmCIF file
Chain information for 4hhb #1
Chain Description
A C hemoglobin (deoxy) (α chain)
B D hemoglobin (deoxy) (β chain)
Opened mmCIF data containing 4779 atoms and 4684 bonds
contacts #1
5 buried areas: B A 1013, D C 951, D A 818, B C 816, C A 340
Traceback (most recent call last):
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/networkx/drawing/layout.py", line 292, in fruchterman_reingold_layout
raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/cmd_line/tool.py", line 178, in execute
cmd.run(cmd_text)
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/commands/cli.py", line 2390, in run
result = ci.function(session, kw_args)
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/contacts/cmd.py", line 43, in contacts
tool.ContactPlot(session, sg, ba, interface_residue_area_cutoff)
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/contacts/tool.py", line 39, in init
self.draw_graph()
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/contacts/graph.py", line 160, in draw_graph
node_pos = self._draw_nodes()
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/contacts/graph.py", line 176, in _draw_nodes
node_pos = self._node_layout_positions()
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/contacts/graph.py", line 216, in _node_layout_positions
pos = nx.spring_layout(self.graph, pos = ipos, k = d) # positions for all nodes
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/networkx/drawing/layout.py", line 305, in fruchterman_reingold_layout
pos = _fruchterman_reingold(A, dim, k, pos_arr, fixed, iterations)
File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/networkx/drawing/layout.py", line 330, in _fruchterman_reingold
if pos==None:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

File "/Users/goddard/Desktop/ChimeraX July 17 2017.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/networkx/drawing/layout.py", line 330, in _fruchterman_reingold
if pos==None:

See log for complete Python traceback.

If you wish to report this error, send mail to chimerax-bugs@… and describe what you were doing and include a copy of the contents of the log.

toolshed show Shell

comment:2 by Tom Goddard, 8 years ago

The latest networkx version 1.11 is from Jan 2016 about 1.5 years ago. We are using version 1.10. I tested 1.11 and encountered problems a year ago. Will need to try again to see what the problems in the new version are.

comment:3 by Tom Goddard, 8 years ago

There have been many code changes to networkx including fixes to the routine with the error -- available at github. Currently we use PyPi networkx but we could install from github source -- it is entirely Python.

comment:4 by Tom Goddard, 8 years ago

networkx 1.11 gives completely wrong (random looking) spring layout for 5cd4.

comment:5 by Tom Goddard, 8 years ago

Resolution: fixed
Status: assignedclosed

Updated to networkx 2.0 (prerelease) from current git source code. This fixes the numpy error. Required changing networkx use since the 2.0 API is different from 1.x in how nodes are accessed.

Note: See TracTickets for help on using tickets.