Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a volume from residue list, and select all atoms inside volume #971

Open
pguillem opened this issue Mar 2, 2023 · 3 comments
Open

Comments

@pguillem
Copy link

pguillem commented Mar 2, 2023

Hello everyone.
Is there a way to use the NGL selection language to:

  1. Create a "volume" or a "3d mesh/cube" provided a residue list? (the volume should include all space in between them).
  2. Return every atom contained in such volume.

The idea is to fill the volume of a protein-protein interface with a different color, and to extract everything contained in such space.

Best
Pedro

@fredludlow
Copy link
Collaborator

You can create a StructureView from a structure and a selection, this has a bounding box (a Box3 instance). Box3 has a contains method that will test whether a 3D point is within it.

If you don't want an axes-aligned box it's more involved...

The other approach might be to find all atoms in the first protein within some distance of the second protein (and vice-versa). The SpatialHash (structure.spatialHash) allows you to do this efficiently and build selections for those two sets (which you can then colour differently).

@pguillem
Copy link
Author

pguillem commented Mar 2, 2023

Excellent approach. I'm truly amazed at how powerful the library is.
Thank you very much @fredludlow

Can these objects be instantiated from the python nglview API?
(not to view them for now ... just to work with the structure/tjframes as a python objects instead of JS)

Best!
Pedro

@hainm
Copy link
Contributor

hainm commented Mar 9, 2023

Can these objects be instantiated from the python nglview API?

No I don't think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants