<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="HOEnZb"><div class="h5"><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="HOEnZb"><div class="h5"><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="HOEnZb"><div class="h5"><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="HOEnZb"><div class="h5"><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="HOEnZb"><div class="h5"><div bgcolor="#FFFFFF" text="#000000">
    Can we consolidate all three into one &quot;.select()&quot; 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. &quot;.select()&quot; 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="HOEnZb"><div class="h5"><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&#39;m caching atom_selection_cache inside model object, so you don&#39;t have to construct it again if you use wrappers available in model class. hierarchy.atom_selection_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_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="HOEnZb"><div class="h5"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Pavel<br>
    <br>
    <div class="m_5786486340573780857moz-cite-prefix">On 8/16/18 15:00, CCTBX commit wrote:<br>
    </div>
    <blockquote type="cite">
      
      <tt>Repository : <a class="m_5786486340573780857moz-txt-link-freetext">ssh://g18-sc-serv-04.diamond.<wbr>ac.uk/cctbx</a><br>
        On branch  : master<br>
        <br>
        <hr><br>
        <br>
        commit c98b44997e8eb7bf53ee828f510b93<wbr>3cd5167758<br>
        Author: Oleg Sobolev <a class="m_5786486340573780857moz-txt-link-rfc2396E" href="mailto:osobolev@lbl.gov" target="_blank">&lt;osobolev@lbl.gov&gt;</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(&quot;protein or
          nucleotide&quot;)</tt><br>
        <tt style="color:#008">+      s = self.selection(&quot;protein or
          nucleotide&quot;)</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">cctbxbb@phenix-online.org</a><br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" rel="noreferrer" target="_blank">http://phenix-online.org/<wbr>mailman/listinfo/cctbxbb</a><br>
<br></blockquote></div><br></div></div>