3dmol / 3Dmol.js

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

Highlighting specific residues #781

Closed KeaunAmani closed 3 months ago

KeaunAmani commented 3 months ago

Is there a way to select some specific residues and then highlight them but not color them differently? I want to highlight some residues that are already colored by some color scheme similar to how selecting residues in pymol doesn't color them.

dkoes commented 3 months ago

We don't have any built-in highlight style; you have to implement it yourself. For example, you could add transparent spheres around the selected atoms.

KeaunAmani commented 3 months ago

@dkoes Ah that makes sense. By any chance would happen to have any example code for this or something similar to this?

dkoes commented 3 months ago

https://3dmol.org/tests/auto/generate_test.cgi?test=testclick

KeaunAmani commented 3 months ago

@dkoes thanks I got it work but it leaves a bit to be desired. Got any suggestions based off the below screenshot?

image

dkoes commented 3 months ago

I would change the color. Alternatively, you could use createModelFrom to create a copy of the selected atoms and then render that copy using a slightly larger transparent version of the current style (e.g., transparent white or yellow). This should looks like a glow.

KeaunAmani commented 3 months ago

@dkoes That's a fantastic idea thank you for the suggestions!

dkoes commented 3 months ago

https://3dmol.org/doc/GLViewer.html#removeModel