<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">Hi Eric,</div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">Thank you very much for the sample code. I am afraid though that recursion is not the proper solution. There are much more combinations of protonation states that must be created. I solved this problem by expanding Tree structures. However the python module for Tree structures named 'ete3' is not a standard one, hence Chimera's python interpreter cannot find it although I have installed in on my local Anaconda python distribution. Do you know how I can make Chimera find it? I can imagine that even if it finds it, there may be conflicts between my local python version and Chimera's python version.</div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><br></div><div class="gmail_default"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font color="#000000" size="4">Traceback (most recent call last):<br></font><font color="#000000" size="4">  File "/home/thomas/Programs/Chimera/share/chimeraInit.py", line 698, in init<br></font><font color="#000000" size="4">    midas_text.doRunScript("runscript", script)<br></font><font color="#000000" size="4">  File "/home/thomas/Programs/Chimera/share/Midas/midas_text.py", line 2248, in doRunScript<br></font><font color="#000000" size="4">    execfile(scriptPath, scriptGlobals)<br></font><font color="#000000" size="4">  File "/usr/local/bin/protonate_receptor.py", line 12, in <module><br></font><font color="#000000" size="4">    from ete3 import Tree<br></font><font color="#000000" size="4">ImportError: No module named ete3</font></blockquote><div class="gmail_default" style="color:rgb(0,0,0);font-size:large"><br></div></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)"><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 19 Mar 2019 at 19:04, Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">hi Thomas,<div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">      </span>I’m pretty sure this would have to be a Python script.  The general idea would be to select residues within a certain distance of the ligand, systematically change their names to indicate alternative protonation states, delete all protons and then run AddH and write out PDBs.  Since you have an indeterminate number of loops needed, I would use recursion, so something like:</div><div><br></div><div>pdb_num = 1</div><div>from chimera import runCommand as rc</div><div>rc(“sel ligands z<DIST”)</div>from chimera.selection import currentResidues<br><div>residues = currentResidues()</div><div><br></div><div>def change_protonation(remaining_residues):</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">        </span>if not remaining_residues:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">          </span>global pdb_num</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">              </span>rc(“del H”)</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">             </span>rc(“addh”)</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">              </span>rc(“write %d.pdb” % pdb_num)</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">            </span>pdb_num += 1</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">                </span>return</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">      </span>r = remaining_residues[0]</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>if r.type == “GLU”:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">             </span>states = [“GLU”, “GLH”]</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">     </span>elif r.type == “ASP”:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">           </span>states = [“ASP”, “ASH”]</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">     </span>elif r.type == “HIS”:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">           </span>etc….</div><div><br></div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">    </span>else:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">               </span>states = [r.type]</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>for state in states:</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">                </span>r.type = state</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">              </span>change_protonation(remaining_residues[1:])</div><div><br></div><div>change_protonation(residues)</div><div><br></div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">     </span>The script is incomplete and I haven’t tested it, but you get the idea.</div><div><br></div><div>—Eric</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">    </span></div><div><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>Eric Pettersen</div><div><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">      </span>UCSF Computer Graphics Lab</div><div><br></div></div><br class="gmail-m_-8269703844614469315Apple-interchange-newline"><br class="gmail-m_-8269703844614469315Apple-interchange-newline">

</div>
<div><br><blockquote type="cite"><div>On Mar 19, 2019, at 7:59 AM, Thomas Evangelidis <<a href="mailto:tevang3@gmail.com" target="_blank">tevang3@gmail.com</a>> wrote:</div><br class="gmail-m_-8269703844614469315Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_default" style="font-size:large">Greetings,</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">I want to write a script that will read a protein-ligand complex, will find all residues with alternative protonation states within a radius from the ligand, and will write to separate pdb files all combinations of alternative protonations or the protein's binding site. Is this possible in Chimera? I saw at the documentation of addh command that there is not a way to specify explicitly which residues to protonate and how (e.g. I can protonate all ASP to ASH but not ASP34 to ASH34 and keep ASP52 as it is).</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Thanks in advance.</div><div class="gmail_default" style="font-size:large">Thomas </div><div><br></div>-- <br><div dir="ltr" class="gmail-m_-8269703844614469315gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><p style="margin-bottom:0cm" align="LEFT"><span><span style="font-family:arial,helvetica,sans-serif"><font size="2">======================================================================</font></span></span></p><p style="margin-bottom:0cm" align="LEFT"><span><span style="font-family:arial,helvetica,sans-serif"><font size="2">Dr Thomas Evangelidis</font></span></span></p><p style="margin-bottom:0cm" align="LEFT"><span style="font-family:arial,helvetica,sans-serif;font-size:small">Research Scientist</span></p><p style="margin-bottom:0cm" align="LEFT"><span style="font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://www.uochb.cz/web/structure/31.html?lang=en" target="_blank">IOCB - Institute of Organic Chemistry and Biochemistry of the Czech Academy of Sciences</a></span></p><font size="2"><div><font face="arial, helvetica, sans-serif"><div>Prague, Czech Republic</div><div>  & </div></font></div><font face="arial, helvetica, sans-serif"><a href="https://www.ceitec.eu/" target="_blank">CEITEC - Central European Institute of Technology</a></font><br><font face="arial, helvetica, sans-serif">Brno, Czech Republic </font></font></div><div><font size="2"><font face="arial, helvetica, sans-serif"><br></font></font></div><div dir="ltr"><p style="margin-bottom:0cm" align="LEFT"><span><span style="font-family:arial,helvetica,sans-serif"><font size="2">email: </font></span></span><a href="mailto:tevang3@gmail.com" style="font-size:small;font-family:arial,helvetica,sans-serif" target="_blank">tevang3@gmail.com</a></p><p style="margin-bottom:0cm" align="LEFT"><span><span style="font-family:arial,helvetica,sans-serif"><font size="2">website:
<a href="https://sites.google.com/site/thomasevangelidishomepage/" target="_blank">https://sites.google.com/site/thomasevangelidishomepage/</a></font></span></span></p><span><br><br></span><div style="margin-bottom:0cm">
<br class="gmail-m_-8269703844614469315webkit-block-placeholder"></div>
</div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>Chimera-users mailing list: <a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank">Chimera-users@cgl.ucsf.edu</a><br>Manage subscription: <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>


        
        
        
        

<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">======================================================================</font></span></span></p>
<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">Dr Thomas Evangelidis</font></span></span></p><p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif;font-size:small">Research Scientist</span></p><p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif;font-size:small"><a href="https://www.uochb.cz/web/structure/31.html?lang=en" target="_blank">IOCB - Institute of Organic Chemistry and Biochemistry of the Czech Academy of Sciences</a></span></p><font size="2"><div><font color="#000000" face="arial, helvetica, sans-serif"><div>Prague, Czech Republic</div><div>  & </div></font></div><font color="#000000" face="arial, helvetica, sans-serif"><a href="https://www.ceitec.eu/" target="_blank">CEITEC - Central European Institute of Technology</a></font><br><font color="#000000" face="arial, helvetica, sans-serif">Brno, Czech Republic </font></font></div><div><font size="2"><font color="#000000" face="arial, helvetica, sans-serif"><br></font></font></div><div dir="ltr"><p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">email: </font></span></span><a href="mailto:tevang3@gmail.com" style="font-size:small;font-family:arial,helvetica,sans-serif" target="_blank">tevang3@gmail.com</a></p><p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">website:
<a href="https://sites.google.com/site/thomasevangelidishomepage/" target="_blank">https://sites.google.com/site/thomasevangelidishomepage/</a></font></span></span></p><span style="color:rgb(0,0,0)"><br><br></span><p style="margin-bottom:0cm" align="LEFT">
</p>
</div></div></div></div></div></div></div></div></div></div>