[Chimera-users] getting surface patches

Elaine Meng meng at cgl.ucsf.edu
Thu Jun 10 14:56:38 PDT 2021


Hi Diego,
Sorry, Chimera VTK export has the limitation that it always exports the whole thing (all atoms and the whole surface) even if it is not displayed.  So you can't get just the patches from some atoms (at least, I can't think of a way to do it).

<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/export.html>

"VTK export includes only molecule models, molecular surfaces, and multiscale surfaces with associated atoms. The molecule export includes all atoms and bonds, even if not displayed, and uses dots to represent atoms and wires to represent bonds regardless of their display styles in Chimera."

Secondarily, about displaying atomic patches of molecular surface in Chimera (which you could possibly try exporting to some other format):
if you really want patches that go with the atoms, but within the context of the full surface, you would not use "surfcat."  Normally the surface would go around the whole protein, and you could get patches from atoms that are in that surface by simply using the "surface" command to display those patches.  If you use surfcat, you are telling it to instead make a surface enclosing only those atoms, ignoring the rest of the protein.

I usually recommend figuring out exactly what commands you need for some example situation (test case) by typing commands directly into the command line.  Then you can generalize to a script after that. Here is one example.   Say I want the surface patches of protein atoms that are within 5 angstroms of the ligand BGC in structure 2gbp.  Commands:

open 2gbp
surface protein & :BGC za<5

However, this will not solve the main problem that VTK will still export the whole surface including the parts that aren't shown.
Elaine
-----
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jun 10, 2021, at 2:04 PM, Diego Amaya via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
> 
> Hello all,
> I'm trying to get surface patches of PDB structures in VTK format. So I want to define a patch as the set of atoms within a given radius of a specific residue, build the surface corresponding to that patch and export the result in VTK format. Additionally, I want to do all this with a python script. 
> 
> Here the code I'm trying but doesn't work :
> 
> import pychimera
> pychimera.patch_environ()
> pychimera.enable_chimera()
> import os
> import chimera
> from chimera import runCommand as rc
> 
> list_resid = [31, 64]
> radius = 3
> list_pdbs = ['ensayo.pdb']
> 
> for resid in list_resid:
>     for line in list_pdbs:
>         list_atoms = []
>         rc('open '+line)
>         rc('sel :{} za<{}'.format(resid, radius))
>         for a in chimera.selection.currentAtoms():
>             list_atoms.append('serialNumber=' + str(a.serialNumber))
>         sel_atoms = ' or '.join(list_atoms)
>         rc('surfcat patch @*/{}'.format(sel_atoms))
>         rc('surface patch')
>         rc("export format VTK {}_resid_{}_radius_{}.vtk".format(line[:-4], resid, radius))
>                     
> rc("close all")
> 
> Thanks in advance for your help.
> -- 
> Diego A. Amaya Ramírez




More information about the Chimera-users mailing list