<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Hi Pavel,</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">Speaking of consistency, 'selection' of 'atom_selection_cache' uses
'string' as the argument, not selstr as in 'model', example:<br></div></blockquote><div>Indeed this is not very consistent. I don't remember if it was in original model, or I did it. Anyway, I'll change selstr to string for consistency.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
I see the different between these flavors of select*. Ok, I afraid
I'll have to read the code each time I use these..</div></blockquote><div>Forgetting to use atom_selection_cache() function at all should help with this.</div><div><br></div><div>Oleg. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><span class="HOEnZb"><font color="#888888"><br>
<br>
Pavel</font></span><div><div class="h5"><br>
<br>
<div class="m_6779630709706154447moz-cite-prefix">On 8/16/18 16:01, Oleg Sobolev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi Pavel,<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000">Currently model
class has three selection methods:<br>
<br>
def selection(self, selstr, optional=True):<br>
</div>
</div>
</div>
</blockquote>
<div>Takes selection string, returns bool selection </div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000"> def
select(self, selection):<br>
</div>
</div>
</div>
</blockquote>
<div>Takes selection (bool or iselection), applies it to
self and returns selected part of model object. </div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000"> def
iselection(self, selstr):<br>
</div>
</div>
</div>
</blockquote>
<div>Same as first, but returns iselection.</div>
<div><br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000"> which is
hideously confusing with zero chance to remember,
and also inconsistent with the rest. <br>
</div>
</div>
</div>
</blockquote>
<div>Let me disagree on the point of inconsistency with the
rest. </div>
<div>selection and iselection functions are available with
exactly same meaning for atom_selection_cache.</div>
<div>select is available with exact same meaning (returning
part of an object) in hierarchy, af_shared_atom,
flex.vec3_double, xray_structure etc which you pointed
out. </div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000"> Can we
consolidate all three into one ".select()" that
would allow taking bool or int or str? </div>
</div>
</div>
</blockquote>
<div>
<div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">No,
because they are doing different things. Selection and
iselection wraps atom_selection_cache functionality and
not duplicating those of select() function. ".select()"
function already has the described functionality.</div>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000">Or you think
there are philosophical arguments against it?<br>
</div>
</div>
</div>
</blockquote>
<div>Yes, and practical ones as well. I'm caching
atom_selection_cache inside model object, so you don't
have to construct it again if you use wrappers available
in model class. hierarchy.atom_selection_<wbr>cache() is not a
free function to the point I had to pass the cache around
to avoid constructing it again to achieve measurable
speedup. Especially for larger models.</div>
<div><br>
</div>
<div>At the very least, please use
model.get_atom_selection_<wbr>cache() instead of constructing
it.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Oleg Sobolev.</div>
<div> <br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_6779630709706154447HOEnZb">
<div class="m_6779630709706154447h5">
<div bgcolor="#FFFFFF" text="#000000"> <br>
Pavel<br>
<br>
<div class="m_6779630709706154447m_5786486340573780857moz-cite-prefix">On
8/16/18 15:00, CCTBX commit wrote:<br>
</div>
<blockquote type="cite"> <tt>Repository : <a class="m_6779630709706154447m_5786486340573780857moz-txt-link-freetext">ssh://g18-sc-serv-04.diamond.a<wbr>c.uk/cctbx</a><br>
On branch : master<br>
<br>
<hr><br>
<br>
commit c98b44997e8eb7bf53ee828f510b93<wbr>3cd5167758<br>
Author: Oleg Sobolev <a class="m_6779630709706154447m_5786486340573780857moz-txt-link-rfc2396E" href="mailto:osobolev@lbl.gov" target="_blank"><osobolev@lbl.gov></a><br>
Date: Thu Aug 16 15:00:20 2018 -0700<br>
<br>
Proper use of model class<br>
<br>
<br>
<hr><br>
<br>
c98b44997e8eb7bf53ee828f510b93<wbr>3cd5167758<br>
mmtbx/model/model.py | 3 +--<br>
1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/mmtbx/model/model.py
b/mmtbx/model/model.py<br>
index 6f2247452..87412f95c 100644<br>
<tt style="color:#800">---
a/mmtbx/model/model.py</tt><br>
<tt style="color:#008">+++
b/mmtbx/model/model.py</tt><br>
@@ -2312,8 +2312,7 @@ class manager(object):<br>
sizes = <a href="http://flex.int" target="_blank">flex.int</a>()<br>
h = self.get_hierarchy()<br>
if(macro_molecule_only):<br>
<tt style="color:#800">- asc =
h.atom_selection_cache()</tt><br>
<tt style="color:#800">- s =
asc.selection("protein or nucleotide")</tt><br>
<tt style="color:#008">+ s =
self.selection("protein or nucleotide")</tt><br>
h = h.select(s)<br>
for r in h.residue_groups():<br>
sizes.append(r.atoms().<wbr>size())</tt><br>
</blockquote>
<br>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
cctbxbb mailing list<br>
<a href="mailto:cctbxbb@phenix-online.org" target="_blank">cctbxbb@phenix-online.org</a><br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" rel="noreferrer" target="_blank">http://phenix-online.org/mailm<wbr>an/listinfo/cctbxbb</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div></div>