[Chimera-users] All PDB ca atom pairwise distance

Kyle Morris kylelmorris at berkeley.edu
Fri Nov 3 11:56:30 PDT 2017


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

> On 31 Oct 2017, at 12:34, Eric Pettersen <pett at cgl.ucsf.edu> wrote:
> 
> 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
> 
> <ca.py>
> 
> 
>> On Oct 31, 2017, at 11:36 AM, Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>> wrote:
>> 
>>> On Oct 31, 2017, at 9:54 AM, Kyle Morris <kylelmorris at berkeley.edu <mailto:kylelmorris at berkeley.edu>> wrote:
>>> 
>>> 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.
>> 
>> 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
>> 
>> 
>> 
>> _______________________________________________
>> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
>> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20171103/5e13dbfc/attachment.html>


More information about the Chimera-users mailing list