<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Elaine and Eric,<br><br></div><div class="gmail_default" style="font-size:small">Many thanks for the prompt reply.<br><br></div><div class="gmail_default" style="font-size:small">
@Elaine:</div><div class="gmail_default" style="font-size:small">thanks for the link. I have decided to start off from script given in the link sent by you. <br></div><div class="gmail_default" style="font-size:small"><br>
You said:<br></div><div class="gmail_default" style="font-size:small"> "The script that you included gives specific residue numbers for the
four atoms. You would need to know the residue numbers for the
CB-SG-SG-CB in each structure. I’m not sure how you would get that or
pass it in. (also: the script has four different residue numbers, which
doesn’t really make sense to me; if it’s really a disulfide dihedral
you would just have two residue numbers, one cysteine CB,SG and the
other cysteine SG,CB)"<br><br></div><div class="gmail_default" style="font-size:small">You have got my problem right. I was hoping to get the specific residue numbers for four atoms (CB,SG,SG'.CB') for each pdb using "molmol" (which I am used to using for analysing NMR structures) and then some how pass the information to chimera in each iteration. I didn't know how to do the latter part. But with the code that Eric has sent, I can do everything using chimera itself and I don't need to pass the residue numbers from outside. <br>
<br></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">Yeah, you are right that residue numbers in the script that I had sent do not make sense for measuring chiSS. There should just be two residue numbers. It was my fault: by mistake I had pasted an uncorrected script; my apologies.<br>
</div><br><br><div class="gmail_default" style="font-size:small">@Eric:</div><div class="gmail_default" style="font-size:small">Many thanks for the code that you gave for extracting disulfide bonds and measuring the chiSS. I incorporated it in the code from the link sent by Elaine and executed it on a list of pdb ids. It worked fine on most of pdb files. However, for a few pdb files, some of the disulfide bonds are not recognized. Could it be due to the bad geometry in those structures?<br>
<br></div><div class="gmail_default" style="font-size:small">If I understand the code right, it extracts pairs of SG atoms that are bonded together in each model "m" by looking in "m.bonds". Then it goes on to identify the attached beta carbons and then finally calculates the chiSS. <br>
<br></div><div class="gmail_default" style="font-size:small">My suspicion is that, in some of the NMR structures (the pdb ids on which the script failed to identify all the disulfide bonds), the disulfide bond geometry is not good and hence SS bond is not listed in "m.bonds". <br>
<br>How do I go about, if I want to identify all the pairs of Cysteine SG atoms which are closer than say 2.5A and then calculate the appropriate dihedral angle about CB-SG-SG'-CB'? I will first need to calculate pairwise distances for SG atoms of all cysteines, select those pairs which are much nearer than allowed by their non-bonded distance (sum of van der waal radii) and then calculate the dihedral angle. This exercise will be useful for me to identify pairs of those Cysteines whose SG atoms have optimal geometry for formation of disulfide bond.<br>
</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">Once again many thanks for your valuable time and prompt help. I am pasting the script that I have used below. It worked fine and hence the indentation must be fine.<br>
<br></div><div class="gmail_default" style="font-size:small">with regards,<br></div><div class="gmail_default" style="font-size:small">Aswani<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
code:<br></div><div class="gmail_default" style="font-size:small">=================================================================================================<br>
import os<br>from chimera import runCommand as rc # use 'rc' as shorthand for runCommand<br>from chimera import replyobj # for emitting status messages<br><br># change to folder with data files<br>os.chdir("/home/aswani/Downloads/test")<br>
<br># gather the names of .pdb files in the folder<br>file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]<br>
<br># loop through the files, opening, processing, and closing each in turn<br>for fn in file_names:<br> replyobj.status("Processing " + fn) # show what file we're working on<br> rc("open " + fn)<br>
from chimera import openModels, Molecule<br> for m in openModels.list(modelTypes=[Molecule]):<br> for b in m.bonds:<br> if b.atoms[0].name == "SG" and b.atoms[1].name == "SG":<br>
sg1, sg2 = b.atoms<br> cbs = []<br> for sg in [sg1, sg2]:<br> if len(sg.neighbors) != 2:<br> break<br>
for nb in sg.neighbors:<br> if <a href="http://nb.name" target="_blank">nb.name</a> == "CB":<br> cbs.append(nb)<br>
break<br> else:<br> # not bonded to a CB<br> break<br> if len(cbs) != 2:<br>
continue<br> cb1, cb2 = cbs<br> from chimera import dihedral<br> print cb1, sg1, sg2, cb2, dihedral(cb1.coord(), sg1.coord(), sg2.coord(), cb2.coord())<br>
rc("close all")<br># uncommenting the line below will cause Chimera to exit when the script is done<br>#rc("stop now")<br># note that indentation is significant in Python; the fact that<br># the above command is exdented means that it is executed after<br>
# the loop completes, whereas the indented commands that <br># preceded it are executed as part of the loop.<br>===========================================================================================<br></div><div class="gmail_default" style="font-size:small">
<br>
</div><br><br><div class="gmail_quote">On 29 August 2014 23:45, Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu" target="_blank">pett@cgl.ucsf.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi Aswani,<br>
I would recommend basing your script off the link that Elaine sent, since I think it is a little easier to understand, but you could use your original one if you like. In either case, in the main loop of the script, after either the "open" command or the "openModels" call (depending on which script you use), this code would identify and print out the disulphide dihedrals:<br>
<br>
from chimera import openModels, Molecule<br>
for m in openModels.list(modelTypes=[Molecule]):<br>
for b in m.bonds:<br>
if b.atoms[0].name == "SG" and b.atoms[1].name == "SG":<br>
sg1, sg2 = b.atoms<br>
cbs = []<br>
for sg in [sg1, sg2]:<br>
if len(sg.neighbors) != 2:<br>
break<br>
for nb in sg.neighbors:<br>
if <a href="http://nb.name" target="_blank">nb.name</a> == "CB":<br>
cbs.append(nb)<br>
break<br>
else:<br>
# not bonded to a CB<br>
break<br>
if len(cbs) != 2:<br>
continue<br>
cb1, cb2 = cbs<br>
from chimera import dihedral<br>
print cb1, sg1, sg2, cb2, dihedral(cb1.coord(), sg1.coord(), sg2.coord(), cb2.coord())<br>
<br>
Make sure you maintain the relative indentation of the code and the the 'from' and first 'for' statements above are indented the same amount as the other statements in your loop.<br>
<br>
--Eric<br>
<br>
Eric Pettersen<br>
UCSF Computer Graphics Lab<br>
<a href="http://www.cgl.ucsf.edu" target="_blank">http://www.cgl.ucsf.edu</a><br>
<div><div><br>
On Aug 29, 2014, at 10:35 AM, Elaine Meng <<a href="mailto:meng@cgl.ucsf.EDU" target="_blank">meng@cgl.ucsf.EDU</a>> wrote:<br>
<br>
> Hi Aswani,<br>
> I can answer only part of the question.<br>
><br>
> For writing scripts to loop through multiple PDBs please see:<br>
> <<a href="http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html" target="_blank">http://www.rbvi.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html</a>><br>
><br>
> The script that you included gives specific residue numbers for the four atoms. You would need to know the residue numbers for the CB-SG-SG-CB in each structure. I’m not sure how you would get that or pass it in. (also: the script has four different residue numbers, which doesn’t really make sense to me; if it’s really a disulfide dihedral you would just have two residue numbers, one cysteine CB,SG and the other cysteine SG,CB).<br>
><br>
> Best,<br>
> Elaine<br>
> -----<br>
> Elaine C. Meng, Ph.D.<br>
> UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab<br>
> Department of Pharmaceutical Chemistry<br>
> University of California, San Francisco<br>
><br>
> On Aug 28, 2014, at 10:13 PM, Aswani Kumar Kancherla <<a href="mailto:ashwin2952@gmail.com" target="_blank">ashwin2952@gmail.com</a>> wrote:<br>
><br>
>> Hello Chimera Users,<br>
>> <br>
>> I have recently installed chimera version 1.9 in Linux OpenSuSe 11.4 and am trying to get acquainted with its features.<br>
>><br>
>> I am trying to measure dihedral angles (specifically the angle chiSS defined by Cb-Sg-Sg'-Cb' about disulfide bonds) for a list of pdb files containing NMR structure ensembles. I was trying to do this using a script (kindly given by a friend and pasted below) to which I can pass the coordinates of the four atoms and get the measured values for the "reply log" information.<br>
>><br>
>> I need to put the files in a directory called pdb_files, open chimera and call the script and retrieve information from the "reply log". However, there is a problem:<br>
>><br>
>> Since the coordinates of (Cb,Sg, etc ) will be different for each of the ensemble (since each ensemble is structure of a different molecule), I need to pass the coordinates dynamically for each pdbid.<br>
>><br>
>> I have found from Chimera User group archives that reply log can be saved using a function.<br>
>> <a href="http://plato.cgl.ucsf.edu/pipermail/chimera-users/2008-October/003184.html" target="_blank">http://plato.cgl.ucsf.edu/pipermail/chimera-users/2008-October/003184.html</a><br>
>> So that should solve one issue. I can save the reply log and parse it later.<br>
>><br>
>> What is the best way to measure specific dihedral angles from multiple pdb files? Is it possible to invoke chimera in tty mode and make it execute functions? In that case, I could probably write a shell script to invoke chimera once for each pdb and ask it to execute python script having appropriate atom coordinates.<br>
>><br>
>> I apologize for slightly long an e-mail. Any hints or directions to enable me figure out how to get this done efficiently in chimera will be of great help to me.<br>
>><br>
>> with regards,<br>
>> Aswani<br>
>><br>
>> script:<br>
>> ================================================================<br>
>><br>
>> import os<br>
>> import Matrix<br>
>> from chimera import openModels, selection, runCommand<br>
>><br>
>> #angle #0:resno@CB :resno@SG :resno@SG :resno@CB 34.6289<br>
>><br>
>><br>
>> # Directory containing PDB files<br>
>> directory = 'pdb_files'<br>
>><br>
>> # Get paths to all files in the specfied directory<br>
>> paths = [os.path.join(directory,f) for f in os.listdir(directory) if f.endswith('.pdb')]<br>
>><br>
>> for pdbfilename in paths:<br>
>> filename = pdbfilename.split("/")[1]<br>
>> openModels.open(pdbfilename, baseId = 0) # Open as model #2<br>
>> runCommand('angle #0:863@CB :980@SG :1130@SG :1235@CB') # calculate torsion angle<br>
>><br>
>> runCommand('close #0') # close molecule and map<br>
>> =================================================================<br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> K.Aswani Kumar<br>
>> Graduate Student<br>
>> Molecular Biophysics Unit<br>
>> Indian Institute of Science<br>
>> Bangalore-560012<br>
>> Karnataka, India.<br>
>> _______________________________________________<br>
>> Chimera-users mailing list<br>
>> <a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank">Chimera-users@cgl.ucsf.edu</a><br>
>> <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Chimera-users mailing list<br>
> <a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank">Chimera-users@cgl.ucsf.edu</a><br>
> <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br>
><br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">K.Aswani Kumar<br>Prof. Siddhartha P Sarma's Group<br>Molecular Biophysics Unit<br>Indian Institute of Science<br>Bangalore-560012<br>Karnataka, India.<br>
Ph: <a href="tel:%2B91-9945633467" value="+919945633467" target="_blank">+91-9945633467</a> (mobile)<br> <a href="tel:%2B91-80-22933454" value="+918022933454" target="_blank">+91-80-22933454</a> (lab)<br> +91-8814-278410 (home)</div>
</div></div>