[Chimera-users] getting surface patches

Elaine Meng meng at cgl.ucsf.edu
Fri Jun 11 07:51:53 PDT 2021

Hi Diego,
If you look at the "export" help link I sent before, there are several other formats: STL, OBJ, COLLADA, VRML...  


First use some commands to show patches for a test case, e.g.

open 2gbp
surface protein & :BGC za<5

And then you can use either the export command or menu: File... Export Scene  and choose the different formats to try them.  I don't know what you plan to do with them, so you'd have to try them yourself to decide if any will work for you.

I tried some of them.  Looks like I can get the patches using STL and COLLADA.  As mentioned in the Limitations in the help link, OBJ has the same problem as VTK that it saves the whole surface even when only patches are shown at the time of saving.


> On Jun 11, 2021, at 12:42 AM, Diego Amaya via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
> Hello Elaine,
> Thanks for your explanations. Would it be possible to build the patches and export them in another format ?
> Best regards
> El jue, 10 jun 2021 a las 23:56, Elaine Meng (<meng at cgl.ucsf.edu>) escribió:
> 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
> -- 
> Diego A. Amaya Ramírez
> Aviso legal: El contenido de este mensaje y los archivos adjuntos son confidenciales y de uso exclusivo de la Universidad Nacional de Colombia. Se encuentran dirigidos sólo para el uso del destinatario al cual van enviados. La reproducción, lectura y/o copia se encuentran prohibidas a cualquier persona diferente a este y puede ser ilegal. Si usted lo ha recibido por error, infórmenos y elimínelo de su correo. Los Datos Personales serán tratados conforme a la Ley 1581 de 2012 y a nuestra Política de Datos Personales que podrá consultar en la página web www.unal.edu.co. Las opiniones, informaciones, conclusiones y cualquier otro tipo de dato contenido en este correo electrónico, no relacionados con la actividad de la Universidad Nacional de Colombia, se entenderá como personales y de ninguna manera son avaladas por la Universidad.
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list