[Chimera-users] python code to loop over molecules

Julian Tirado-Rives julian.tirado-rives at yale.edu
Mon May 3 05:10:56 PDT 2021

Dear Chimera (and ChimeraX) team:

     I need to find some python example or code snippet capable of
looping over all the molecules in a particular model and do some actions
separately in each one.

      In our research we use several different docking programs and other
ways of generating poses of protein-ligand complexes, and using several
different programs to analyze them gets quite complicated. Instead,
we've found that the easiest way is to generate from each code, or using
conversion utilities such as babel, a pdb file of the host and a sdf or
mol2 file containing all the ligand poses and read them into chimera.
An excellent program, by the way. We use it all the time.

     I would love to automate the process even further by doing all the
coloring, rendering, Hydrogen Bond and contact analysis, etc. in Python
rather than manually. I have been trying to do this, but have not found 
a way to do the following:

If we have, for instance, the host in model #0, and the ligand poses in 
model #1 (#1.1, #1.2, ..., #1.N):

- Get from chimera the number of molecules in model #1 (e.g what is N)
- loop from the first #1.1 to the last #1.N molecule
- do some cations there (e.g select, color, find HB's, etc)

    I think this should be a problem other people have encountered and
solved  before, but I have not been able to find an example in your
depository, the mailing lists, or even the book ... I would appreciate
your input.

Thanks for your help, and for an excellent program!

                                              - Julian -


  | Julian Tirado-Rives      |                                      |
  | Department of Chemistry  | Phone: (203)432-3356                 |
  | Yale University          | Fax:   (203)432-6144                 |
  | P. O. Box 208107         | email:  Julian.Tirado-Rives at yale.edu |
  | New Haven, CT 06520-8107 |                                      |

More information about the Chimera-users mailing list