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.