notebook-molecular-visualization
notebook-molecular-visualization copied to clipboard
viewer.color_by is slow for large molecules
This actually looks cool, although it's probably not what we want :)
To reproduce: In a notebook, execute this cell:
mol = mdt.from_pdb('3aid')
drug = mol.chains['A'].get_ligand()
viewer = mol.draw(display=True)
viewer.stick()
Then this one:
viewer.color_by(lambda atom:atom.distance(drug))
In the latest version, the colors draw in 1-at-a-time, which takes a while:
In 0.7.3, the color comes in all-at-once after thinking for a second or two:
Were you running the latest code that includes my performance PR https://github.com/Autodesk/notebook-molecular-visualization/pull/27 when you saw this? Just making sure.
Yeah - it's all from the latest master (fb2eee08faca347444dc7bbf85de2d8792ccd6f2)
On Nov 2, 2016, at 5:16 PM, Justin McCandless [email protected] wrote:
Were you running the latest code that includes my performance PR #27 https://github.com/Autodesk/notebook-molecular-visualization/pull/27 when you saw this? Just making sure.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Autodesk/notebook-molecular-visualization/issues/39#issuecomment-258037963, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8_5-8qjuV-eBlDKc9mMPIgiaQU2FyYks5q6SfPgaJpZM4Kn3Kx.
Solution here: https://github.com/Autodesk/notebook-molecular-visualization/pull/42
It was syncing the data over the network 1 color at a time, which was very slow AND caused a rerender for reach color. Now we do it all at once. The frontend still has to call 3dmol's setStyle
for each color, which is a lot, but it happens fast enough and with no pop-in.