
Dear chimera dev and users, Is there a way to calculate (using the GUI, commands or using a python script) the pairwise distances for every single c-alpha atom in a set of loaded PDB coordinates and spit this out to a file for further analysis? There are 142,800 atoms in the current loaded assembly. Thanks! Kyle

Do you mean CA-CA distances, or CA-any-other-atom distances? Even CA-CA only (assuming CAs are roughly 1/10 of your atoms) will be more than one hundred million distances, and CA-other will be more than a billion. Is this really what you want? If so, it would seem more efficient and much faster to write a special purpose program for this in a compiled language, like C, C++ or some such. It is of course doable in Chimera via Python. If you really do want to do it that way, I can offer further guidance... —Eric Eric Pettersen UCSF Computer Graphics Lab

Well, since the code is simple, I’ve included it below. You should put it in a file whose name in “.py” to indicate it’s Python code, then you can run it in Chimera simply by opening it. It will create a file named “output” in your home folder. It assumes you’re doing CA-CA distances, not CA-any. Probably still very slow. from chimera import openModels, Molecule mol = openModels.list(modelTypes=[Molecule])[0] cas = [ a for a in mol.atoms if a.name == “CA” and a.element.name == “C”] import os.path f = open(os.path.expanduser(“~/output”), “w”) for i, ca1 in enumerate(cas): for ca2 in cas[i+1:]: print>>f, ca1, ca2, ca1.coord().distance(ca2.coord()) f.close() Since my mail client does wonky things to quotation marks, I’ve also attached the above as a file. —Eric

Thanks for this Eric. You had assumed correct that I wanted to do Ca-Ca only. Completely agreed that it is a bit of a big calculation to make and perhaps there are more efficient ways. Whichever way I manage to do this, the outputs will make beautiful heat maps of interactions! I’ll experiment with your script and see how it goes, thanks for sending this. Best, Kyle
participants (2)
-
Eric Pettersen
-
Kyle Morris