<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Thomas,<div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>I don’t understand your aversion to the recursion solution.  Recursion will enumerate all the combinations.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Well, regardless, if you wish to use another approach that’s okay.  In order to install a Python package where Chimera will find it, you need to install it with Chimera’s Python interpreter.  How you do so is covered in the Programmer’s FAQ: <a href="https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html" class="">https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html</a> (actually tomorrow’s FAQ, since it needed a little tweak).  So namely:</div><div class=""><br class=""></div><div class=""><h3 style="font-family: -webkit-standard;" class=""><a name="q3b" class="">3b) Installing Python packages into Chimera.</a></h3><h3 style="font-family: -webkit-standard;" class=""><p style="font-weight: normal;" class="">To use a package from Chimera, you would need to install it with Chimera's Python. Chimera's Python has the Python version number appended to it, so it will be named python2.x (python2.7 when this was written; also on Windows add ".exe"). On non-Mac, it will be found in <your Chimera installation>/bin. On Mac it's in Chimera.app/Contents/Resources/bin — don't use the one in Chimera.app/Contents/MacOS!</p><p style="font-weight: normal;" class="">The best way to install packages is with pip, using (Chimera's) <code class="">python2.x -m pip install <i class="">package</i></code>. If the pip module is not found, you'll need to install it first with (Chimera's) <code class="">python2.x -m ensurepip</code>. Then <code class="">-m pip install</code> will work. For packages not supported by pip, you will have to follow the installation instructions that come with the package.</p></h3><br class=""><div>—Eric</div><div><br class=""></div><div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">  </span>UCSF Computer Graphics Lab</div><div class=""><br class=""></div></div></div></div><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 20, 2019, at 4:17 PM, Thomas Evangelidis <<a href="mailto:tevang3@gmail.com" class="">tevang3@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size: large;">Hi Eric,</div><div class="gmail_default" style="font-size: large;"><br class=""></div><div class="gmail_default" style="font-size: large;">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;"><br class=""></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 size="4" class="">Traceback (most recent call last):<br class=""></font><font size="4" class="">  File "/home/thomas/Programs/Chimera/share/chimeraInit.py", line 698, in init<br class=""></font><font size="4" class="">    midas_text.doRunScript("runscript", script)<br class=""></font><font size="4" class="">  File "/home/thomas/Programs/Chimera/share/Midas/midas_text.py", line 2248, in doRunScript<br class=""></font><font size="4" class="">    execfile(scriptPath, scriptGlobals)<br class=""></font><font size="4" class="">  File "/usr/local/bin/protonate_receptor.py", line 12, in <module><br class=""></font><font size="4" class="">    from ete3 import Tree<br class=""></font><font size="4" class="">ImportError: No module named ete3</font></blockquote><div class="gmail_default" style="font-size: large;"><br class=""></div></div><div class="gmail_default" style="font-size: large;"><br class=""></div><div class="gmail_default" style="font-size: large;"><br class=""></div></div></div><br class=""><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" class="">pett@cgl.ucsf.edu</a>> wrote:<br class=""></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" class="">hi Thomas,<div class=""><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 class=""><br class=""></div><div class="">pdb_num = 1</div><div class="">from chimera import runCommand as rc</div><div class="">rc(“sel ligands z<DIST”)</div>from chimera.selection import currentResidues<br class=""><div class="">residues = currentResidues()</div><div class=""><br class=""></div><div class="">def change_protonation(remaining_residues):</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">       </span>if not remaining_residues:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">               </span>global pdb_num</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">           </span>rc(“del H”)</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">          </span>rc(“addh”)</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">           </span>rc(“write %d.pdb” % pdb_num)</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">         </span>pdb_num += 1</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">             </span>return</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>r = remaining_residues[0]</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">        </span>if r.type == “GLU”:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">          </span>states = [“GLU”, “GLH”]</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">  </span>elif r.type == “ASP”:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">                </span>states = [“ASP”, “ASH”]</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">  </span>elif r.type == “HIS”:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">                </span>etc….</div><div class=""><br class=""></div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>else:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">            </span>states = [r.type]</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">        </span>for state in states:</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">             </span>r.type = state</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">           </span>change_protonation(remaining_residues[1:])</div><div class=""><br class=""></div><div class="">change_protonation(residues)</div><div class=""><br class=""></div><div class=""><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 class=""><br class=""></div><div class="">—Eric</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">        </span></div><div class=""><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">        </span>Eric Pettersen</div><div class=""><span class="gmail-m_-8269703844614469315Apple-tab-span" style="white-space:pre-wrap">   </span>UCSF Computer Graphics Lab</div><div class=""><br class=""></div></div><br class="gmail-m_-8269703844614469315Apple-interchange-newline"><br class="gmail-m_-8269703844614469315Apple-interchange-newline">

</div>
<div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 19, 2019, at 7:59 AM, Thomas Evangelidis <<a href="mailto:tevang3@gmail.com" target="_blank" class="">tevang3@gmail.com</a>> wrote:</div><br class="gmail-m_-8269703844614469315Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size:large">Greetings,</div><div class="gmail_default" style="font-size:large"><br class=""></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 class=""></div><div class="gmail_default" style="font-size:large">Thanks in advance.</div><div class="gmail_default" style="font-size:large">Thomas </div><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail-m_-8269703844614469315gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><p style="margin-bottom:0cm" align="LEFT" class=""><span class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">======================================================================</font></span></span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">Dr Thomas Evangelidis</font></span></span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="font-family:arial,helvetica,sans-serif;font-size:small" class="">Research Scientist</span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="font-family:arial,helvetica,sans-serif;font-size:small" class=""><a href="https://www.uochb.cz/web/structure/31.html?lang=en" target="_blank" class="">IOCB - Institute of Organic Chemistry and Biochemistry of the Czech Academy of Sciences</a></span></p><font size="2" class=""><div class=""><font face="arial, helvetica, sans-serif" class=""><div class="">Prague, Czech Republic</div><div class="">  & </div></font></div><font face="arial, helvetica, sans-serif" class=""><a href="https://www.ceitec.eu/" target="_blank" class="">CEITEC - Central European Institute of Technology</a></font><br class=""><font face="arial, helvetica, sans-serif" class="">Brno, Czech Republic </font></font></div><div class=""><font size="2" class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></font></div><div dir="ltr" class=""><p style="margin-bottom:0cm" align="LEFT" class=""><span class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">email: </font></span></span><a href="mailto:tevang3@gmail.com" style="font-size:small;font-family:arial,helvetica,sans-serif" target="_blank" class="">tevang3@gmail.com</a></p><p style="margin-bottom:0cm" align="LEFT" class=""><span class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">website:
<a href="https://sites.google.com/site/thomasevangelidishomepage/" target="_blank" class="">https://sites.google.com/site/thomasevangelidishomepage/</a></font></span></span></p><span class=""><br class=""><br class=""></span><div style="margin-bottom:0cm" class="">
<br class="gmail-m_-8269703844614469315webkit-block-placeholder"></div>
</div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br class="">Chimera-users mailing list: <a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank" class="">Chimera-users@cgl.ucsf.edu</a><br class="">Manage subscription: <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><p style="margin-bottom:0cm" align="LEFT" class=""><span style="" class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">======================================================================</font></span></span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="" class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">Dr Thomas Evangelidis</font></span></span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: small;" class="">Research Scientist</span></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="font-family: arial, helvetica, sans-serif; font-size: small;" class=""><a href="https://www.uochb.cz/web/structure/31.html?lang=en" target="_blank" class="">IOCB - Institute of Organic Chemistry and Biochemistry of the Czech Academy of Sciences</a></span></p><font size="2" class=""><div class=""><font face="arial, helvetica, sans-serif" class=""><div class="">Prague, Czech Republic</div><div class="">  & </div></font></div><font face="arial, helvetica, sans-serif" class=""><a href="https://www.ceitec.eu/" target="_blank" class="">CEITEC - Central European Institute of Technology</a></font><br class=""><font face="arial, helvetica, sans-serif" class="">Brno, Czech Republic </font></font></div><div class=""><font size="2" class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></font></div><div dir="ltr" class=""><p style="margin-bottom:0cm" align="LEFT" class=""><span style="" class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">email: </font></span></span><a href="mailto:tevang3@gmail.com" style="font-size:small;font-family:arial,helvetica,sans-serif" target="_blank" class="">tevang3@gmail.com</a></p><p style="margin-bottom:0cm" align="LEFT" class=""><span style="" class=""><span style="font-family:arial,helvetica,sans-serif" class=""><font size="2" class="">website:
<a href="https://sites.google.com/site/thomasevangelidishomepage/" target="_blank" class="">https://sites.google.com/site/thomasevangelidishomepage/</a></font></span></span></p><span style="" class=""><br class=""><br class=""></span><div style="margin-bottom: 0cm;" class="">
<br class="webkit-block-placeholder"></div>
</div></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>