pymol-open-source icon indicating copy to clipboard operation
pymol-open-source copied to clipboard

Transforming vertices to match original pdb reference frame using `transform_selection`

Open OliviaViessmann opened this issue 2 years ago • 0 comments

Hi,

I am using pymol to generate surface meshes from pdb source files. I would like to have the vertices in the same reference frame as the original pdb coordinates. However, when I save the obj file the object is centered at [0,0,0]. I tried to use the following code snippet to transform the surface, but it didn't do anything to the coordinates. What am I doing wrong, or is the command not behaving how supposed to?

pymol.load(pdb_file)
view = list(pymol.get_view())
M = view[0:3] + [-view[12]] + view[3:6] + [-view[13]] + view[6:9] + [-view[14]] + view[12:15] + [1.0]
pymol.transform_selection("(all)", M, 0, 0, 0, 1)
pymol.set_view([1, 0, 0, 0, 1, 0, 0, 0, 1] + view[9:])

Any help would be greatly appreciated. If there is a way to avoid the centering at the loading stage, that would be awesome too. Thanks Olivia

OliviaViessmann avatar Feb 11 '23 20:02 OliviaViessmann