nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
664 stars 169 forks source link

Show connections in two difference files #1034

Closed hellhorse123 closed 5 months ago

hellhorse123 commented 6 months ago

Is it possible to use NGL to create our own connections (bonds) between atoms from different files (preferably pdb and sdf)? If yes, is it possible to customize the appearance of the lines used to connect atoms? The question is a bit related to issue 1023

papillot commented 6 months ago

It's not possible at the moment to create either a covalent bond nor a contact between atoms from different file. There is a request made to be able to compute contacts (non-covalent interactions) between different entities, which has implications like docking. In the meantime, if you want to display such bonds, you may create the corresponding cylinder representations "manually" using the coordinates of the terminal atoms.

hellhorse123 commented 6 months ago

I'm found this code example: https://codepen.io/arose/pen/VQjBGq

Is this method wrong?

papillot commented 6 months ago

I was not aware of this concatStructure method. This is brilliant! I suppose the issue might come if you want to compare different ligands docked to the same receptor. But as it is, that's very convenient

fredludlow commented 5 months ago

Aside: For viewing interactions for docking results (for example) you can set the masterModelIndex parameter so that interactions are only calculated between each model and the 'master' (so if protein is model 0, then each ligand model 1.. you don't get interactions between different ligand poses). https://github.com/nglviewer/ngl/blob/master/examples/scripts/test/concat.js#L14