3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
Other
770 stars 191 forks source link

Visualizing multiple protein structures in the same viewer #755

Open OreFoX18 opened 5 months ago

OreFoX18 commented 5 months ago

Hello everyone!

I've been working on a project where it would be very cool to have more protein structures rendered in the same viewer simultaneously but as individual objects. I would also like to be able to set up coordinates of those structures to be able to position them in the viewer. I was trying to find solution and a way to do it in this library but so far came short handed. I'm wondering if that is possible and how?

Kind regards, Haris

dkoes commented 5 months ago

Can you elaborate on what you mean by “individual objects”? You can add each structure to a different model object. Are you asking for the ability to have mouse controls only effect a subset of models?

OreFoX18 commented 5 months ago

Thank you, dkoes, for your prompt response.

I'm exploring the possibility of loading multiple protein structures into the viewer simultaneously while having individual control over their positioning, translation, rotation, and zooming. The goal is to display several structures side by side in the viewer, and I attempted to add more protein models to the same viewer object. However, they seem to overlap.

Any insights or suggestions on how to achieve separate control for each structure within the same viewer would be greatly appreciated. Thank you!

dkoes commented 5 months ago

Based on your comment about wanting to avoid overlap, I think what you want is a viewer grid: https://3dmol.org/doc/global.html#createViewerGrid https://3dmol.org/tests/auto/generate_test.cgi?test=testAllenes

If you actually want a single viewer where you can manipulate the position of models within it, that is something you would have implement yourself by manipulating the model's rotation matrices (which isn't something that is cleanly exposed in the API).