Opened 3 months ago

Last modified 39 hours ago

#19400 reopened enhancement

Have Render By Attribute externally controllable

Reported by: Tom Goddard Owned by: Eric Pettersen
Priority: blocker Milestone:
Component: Structure Analysis Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Allow other code to bring up Render By Attribute showing desired attribute/colors/etc.

Change History (10)

comment:1 by Eric Pettersen, 3 months ago

Priority: highblocker

comment:2 by Tom Goddard, 3 months ago

I added structure coloring controls to the mutation scatter plot gui yesterday that attempts to setup the Render by Attribute GUI (residues, specific structures, mutation score attribute, palette and levels). I used private methods of render by attribute in scatter plot function _show_render_by_attribute_gui() in code

chimerax/src/bundles/mutation_scores/src/ms_scatter_plot.py

It is not quite working because setting the render by attribute models causes a delayed callback that overwrites my render by attribute palette setting. So using a public API to set the render by attribute gui controls would be helpful.

comment:3 by Tom Goddard, 3 months ago

The mutation scores scatter plot use of render by attribute is part of ticket #19403.

comment:4 by Eric Pettersen, 2 months ago

By "palette" do you literally mean a palette name, or do you mean a series of color values?

comment:5 by Tom Goddard, 2 months ago

I meant color values and specified color levels.

comment:6 by Eric Pettersen, 2 months ago

Resolution: fixed
Status: assignedclosed

The Render/Select By Attribute tool now has a configure() method. I hope the method's doc string does a good enough job of explaining how it's used.

comment:7 by Tom Goddard, 12 days ago

Resolution: fixed
Status: closedreopened

The level_info argument of the RenderByAttrTool.configure() method does not show the requested levels in the GUI. Instead it appears to set the default levels. I tested this with the MutationScatterPlot tool and I have code in that tool (ms_scatter_plot.py) commented out. That is probably not the easiest way to test since it requires mutation score data.

Another option that the MutationScatterPlot tool wants to set is the no value color and the no value checkbutton. That is not currently settable by the configure() function.

comment:8 by Eric Pettersen, 8 days ago

Fixed the color-configuration issue (worked if no 'models' were specified, but not if they were): https://github.com/RBVI/ChimeraX/commit/9b513971a3b0f752c4ddfe914710836ecbfb1996

Working on no-color configuration now.

comment:9 by Eric Pettersen, 8 days ago

Resolution: fixed
Status: reopenedclosed

Okay, you can configure the no-value controls via the no_value_info keyword, which takes a two-tuple/list consisting of a boolean and a value. The boolean controls whether the checkbox is checked.

Code change: https://github.com/RBVI/ChimeraX/commit/9c8d82c6bbfb85220adfe7ca590a531bfda34482

comment:10 by Tom Goddard, 39 hours ago

Resolution: fixed
Status: closedreopened

If I call configure() with models specified and render by attribute gui already showing and the specified models are already selected in the gui then the gui does not update.

Also when I then click on the models list in a blank space not on any model I get the following tracebacks:

raceback (most recent call last):

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 800, in _new_render_attr

self._update_render_histogram(attr_name)

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 1069, in _update_render_histogram

any_None = self._update_histogram(self.render_histogram, attr_name)


File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 993, in _update_histogram

values, any_None = attr_info.values(attr_name, self.model_list.value)


File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/atomic/init.py", line 297, in values

collections = concatenate(collections)


File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/atomic/molarray.py", line 366, in concatenate

c = object_class(None)


TypeError: 'NoneType' object is not callable

TypeError: 'NoneType' object is not callable

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/atomic/molarray.py", line 366, in concatenate
c = object_class(None)

See log for complete Python traceback.

Traceback (most recent call last):

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 768, in _models_changed

self._finish_config(self._config_info)

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 491, in _finish_config

cur_min, cur_max, data = histogram.data_source

ValueError: too many values to unpack (expected 3)

ValueError: too many values to unpack (expected 3)

File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/render_by_attr/tool.py", line 491, in _finish_config
cur_min, cur_max, data = histogram.data_source

See log for complete Python traceback.

Note: See TracTickets for help on using tickets.