schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.21k stars 283 forks source link

new API to export geometry per selection #82

Open speleo3 opened 4 years ago

speleo3 commented 4 years ago

This is a feature request to export geometry per selection.

First requested by @jaredsampson on the pymol-users mailing list: https://www.mail-archive.com/pymol-users@lists.sourceforge.net/msg15640.html

Input arguments:

Output: CGO or lists of vertex and normal coordinates. CGO would be more generic, but eventually harder to use (needs to be parsed). List of coordinates would be specific for the primitive type (e.g. triangles), which will not work for some representations which have more than one primitive (e.g. cartoon can have triangles and cylinders).

jaredsampson commented 4 years ago

Thanks, Thomas. This sounds great. To produce the different output possibilities, there could be a mode argument, with such options as:

For reference, my current application and the reason for my original inquiry on pymol-users, would be to export the surface geometry to calculate average per-residue surface normal vectors.

Also, the output for the "primitives" option could be a list of dicts, which would take care of handling multiple primitive types.