NPellet / visualizer

Other
43 stars 24 forks source link

Weird behavior when displaying molfiles in a table #1070

Closed otrobernal closed 6 years ago

otrobernal commented 6 years ago

This view: https://my.cheminfo.org/?viewURL=https%3A%2F%2Fmydb.cheminfo.org%2Fdb%2Fvisualizer%2Fentry%2F8290d0faef669d82e142bc2533a34cc0%2Fview.json%3Frev%3D8-13c927a1dd8f19894bffb0d7e88cf2d1

Drag and drop an sdf to load it (I used Aldrich's acyl chlorides dataset: https://www.sigmaaldrich.com/chemistry/chemistry-services/selected-structure.html). The sdf is parsed by the leftmost code executor, an array of {molfile, molecule-object} pairs is generated, and the molfiles are displayed as structures in the upper table (slick grid module). Upon clicking a structure the corresponding molecule object is passed to the rightmost code executor, a molfile is generated, pushed into an array, and the one-member array is passed to the lower table for display. The strange thing is that upon doing this an error is generated and the molecule fails to be displayed; but if you go into the lower table's module configuration and save without doing nothing, the molecule is now displayed correctly. Click a new molecule and the same happens: fail first, save module config without changing anything, the molecule is now displayed. As far as i can see the upper and lower table modules are doing the same, the only difference being that the later receives a one-member-only array, so i don't understand what is wrong.

lpatiny commented 6 years ago

It is really a bad idea to store something else that native kinds in the visualizer. There is for this API.cache that allows to deal with more complex object between various code executor.

A slickgrid table module is also only able to display array of objects. You was trying to display array of string which also leads to unpredictable results.

In attached an improved version of your view.

newView.json.zip