<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Not at all! Much appreciated, as I think I mentioned, this is my first go at writing anything remotely complex in python (and not a bad turn out for about a week I don't think...)</p>
<p><br>
</p>
<p>A lot of the mess comes from copying functional bits from StackOverflow in the interests of just getting it working first, and making it pretty second as I'm sure you can appreciate (you'd hate to see my LaTeX preamble)!</p>
<p><br>
</p>
<p>Not needed to close the file with 'with' is useful to know (takes some of the headache out of knowing where to place the close).</p>
<p><br>
</p>
<p>I'll certainly make the tidy ups you've suggested, for my own learning.</p>
<p><br>
</p>
<p><br>
</p>
<p>Thanks again,</p>
<p><br>
</p>
<p>Joe :)</p>
<p><br>
</p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
Joe Healey<br style="font-size:10pt">
</div>
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<br>
</div>
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<span style="text-decoration:underline"> </span><br>
</div>
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<span style="font-size:10pt">M.Sc. B.Sc. (Hons)</span><br>
</div>
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<span style="font-size:10pt"></span>
<div><span style="font-size:10pt">PhD Student</span></div>
<div><span style="font-size:10pt">MOAC CDT, Senate House</span></div>
<div><span style="font-size:10pt">University of Warwick<br style="">
</span></div>
<div><span style="font-size:10pt">Coventry<br style="">
</span></div>
<div><span style="font-size:10pt">CV47AL<br style="">
Mob: +44 (0) 7536 042620 | </span><span style="font-size:10pt">Email: J.R.J.Healey@warwick.ac.uk</span></div>
<div><span style="font-size:10pt"><br style="">
</span></div>
<div><span style="font-size:10pt">Jointly working in:<br style="">
</span></div>
<div><span style="font-size:10pt"><a href="http://www2.warwick.ac.uk/fac/med/research/tsm/microinfect/staff/waterfieldlab/" id="LPNoLP">Waterfield Lab</a> (<span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:13.3333330154419px; background-color:rgb(255,255,255)">WMS </span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:13.3333330154419px; background-color:rgb(255,255,255)">Microbiology
and Infecti</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:13.3333330154419px; background-color:rgb(255,255,255)">on Un</span><span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:13.3333330154419px; background-color:rgb(255,255,255)">it)</span></span></div>
<div><span style="font-size:10pt">and the <a href="http://www2.warwick.ac.uk/fac/sci/chemistry/research/gibson/gibsongroup/" id="LPNoLP">Gibson Lab</a> (Warwick Chemistry)<br style="">
</span></div>
<div><span style="font-size:10pt"><br style="">
</span></div>
<div><span style="font-size:10pt">Twitter: <a href="https://twitter.com/JRJHealey" id="LPNoLP">
@JRJHealey</a> | </span><span style="font-size:10pt">Website: </span><a href="http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey" id="LPNoLP" style="font-size:10pt">MOAC Page</a></div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Jaime Rodríguez-Guerra <jaime.rodriguezguerra@uab.cat><br>
<b>Sent:</b> 23 September 2016 10:56:38<br>
<b>To:</b> Healey, Joe<br>
<b>Cc:</b> Eric Pettersen; Jaime Rodríguez-Guerra; chimera-users@cgl.ucsf.edu<br>
<b>Subject:</b> Re: [Chimera-users] Recursive structure matching and acquisition of descriptive numbers</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi Joe!<br>
<br>
You're welcome! Glad to see you got it working. I've reviewed your<br>
code and would want to point out some details that might be helpful to<br>
you in the future, though. These are mostly style-related things, but<br>
those will contribute to a cleaner reading experience!<br>
<br>
1. You don't need backslashes if you're inside parenthesis. So, in all<br>
those parse_argument lines, you can safely delete them. Related to<br>
this, you can wrap imports with parenthesis, so that backslashes are<br>
not needed.<br>
2. Tuple unpacking does not need parenthesis in you're dealing with<br>
1D-tuples. Only needed if you are dealing with more than one dimension<br>
(ie, (animal, fruit), sport = [['tiger', 'pear'], 'soccer']<br>
3. Since you are opening files with the "with" context manager, you<br>
don't need to manually close the file later. It's closed automatically<br>
as soon as you leave that with block.<br>
4. Lines 166-170 could be replaced with a (cleaner, but not<br>
necessarily more performant) glob.glob() call. Check it out to see if<br>
it satisfies your requirements.<br>
5. While you are at it, take a look at the PEP8 docs and the Google<br>
Python style guide. You don't need to follow all the rules, but they<br>
are really helpful in bringing consistency to your own style!<br>
<br>
That's it! Hope you don't mind these pieces of advice :)<br>
<br>
Cheers,<br>
Jaime.<br>
<br>
2016-09-23 11:27 GMT+02:00 Healey, Joe <J.R.J.Healey@warwick.ac.uk>:<br>
> That was exactly what I was after thanks! I figured the object orientation<br>
> should provide that somewhere but was barking up slightly the wrong tree!<br>
><br>
><br>
> Thank you all for all your help - definitely wouldn't have been able to do<br>
> it without you!<br>
><br>
><br>
> If it's of any interest, or it helps for any future questions where you<br>
> might want to refer back to code segments, I've put the<br>
> more-or-less-finished script in this paste:<br>
><br>
><br>
> <a href="http://pastebin.com/xJNSWJGq">http://pastebin.com/xJNSWJGq</a><br>
><br>
><br>
> Joe Healey<br>
><br>
><br>
> M.Sc. B.Sc. (Hons)<br>
> PhD Student<br>
> MOAC CDT, Senate House<br>
> University of Warwick<br>
> Coventry<br>
> CV47AL<br>
> Mob: +44 (0) 7536 042620 | Email: J.R.J.Healey@warwick.ac.uk<br>
><br>
> Jointly working in:<br>
> Waterfield Lab (WMS Microbiology and Infection Unit)<br>
> and the Gibson Lab (Warwick Chemistry)<br>
><br>
> Twitter: @JRJHealey | Website: MOAC Page<br>
> ________________________________<br>
> From: Eric Pettersen <pett@cgl.ucsf.edu><br>
> Sent: 22 September 2016 20:54:35<br>
> To: Jaime Rodríguez-Guerra<br>
> Cc: chimera-users@cgl.ucsf.edu; Healey, Joe<br>
> Subject: Re: [Chimera-users] Recursive structure matching and acquisition of<br>
> descriptive numbers<br>
><br>
> Thanks Jaime — exactly right. I realized that the “atoms1, atoms2” in my<br>
> original example didn’t really give any indication of which atoms were<br>
> which, which is why in my later examples I changed to "simAtoms, refAtoms”,<br>
> so it’s actually “atoms2” that are the reference atoms.<br>
><br>
> —Eric<br>
><br>
>> On Sep 22, 2016, at 11:45 AM, Jaime Rodríguez-Guerra<br>
>> <jaime.rodriguezguerra@uab.cat> wrote:<br>
>><br>
>> Hi!<br>
>><br>
>> Since you are getting lists of atoms back, you only need to do some<br>
>> attribute access (rather than method calling)!<br>
>><br>
>> Every chimera.Atom object has an attribute called molecule: a<br>
>> reference to its parent chimera.Molecule. chimera.Molecule objects<br>
>> have an attribute called 'name', but sometimes this is not very<br>
>> informative (depends on your input), so you need to resort to the pdb<br>
>> filename, stored in the first element of the openedAs tuple.<br>
>><br>
>> In code, this looks like this:<br>
>><br>
>> for atoms1, atoms2, rmsd, fullRmsd in match(CP_BEST, [ref, sims],<br>
>> defaults[MATRIX], "nw", defaults[GAP_OPEN], defaults[GAP_EXTEND]):<br>
>> molecule1 = atoms1[0].molecule # any atom from the list will do<br>
>> molecule2 = atoms2[0].molecule<br>
>> print molecule1.name, "\t", molecule2.name, "\t", rmsd #<br>
>> molecule1.openedAs[0] will also work here<br>
>><br>
>> I don't know if atoms1 comes consistently from the reference molecule,<br>
>> but I'd guess it does.<br>
>><br>
>> Hope it helps!<br>
>> _______________________________________________<br>
>> Chimera-users mailing list: Chimera-users@cgl.ucsf.edu<br>
>> Manage subscription:<br>
>> <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br>
><br>
</div>
</span></font>
</body>
</html>