<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Currently model class has three selection methods:<br>
<br>
def selection(self, selstr, optional=True):<br>
def select(self, selection):<br>
def iselection(self, selstr):<br>
<br>
which is hideously confusing with zero chance to remember, and also
inconsistent with the rest. <br>
<br>
Most objects in cctbx have ".select(self, selection)" methods,
while being inconsistent about what they expect: iselection or
boolean selection as "selection" argument. Some smart ones though
can take both int or bool selections (figure out type automatically,
which is trivial). <br>
<br>
Can we consolidate all three into one ".select()" that would allow
taking bool or int or str? Or you think there are philosophical
arguments against it?<br>
<br>
Pavel<br>
<br>
<div class="moz-cite-prefix">On 8/16/18 15:00, CCTBX commit wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20180816220234.C914A1023BE@g18-sc-serv-04.diamond.ac.uk">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<tt>Repository : <a class="moz-txt-link-freetext" href="ssh://g18-sc-serv-04.diamond.ac.uk/cctbx">ssh://g18-sc-serv-04.diamond.ac.uk/cctbx</a><br>
On branch : master<br>
<br>
<hr><br>
<br>
commit c98b44997e8eb7bf53ee828f510b933cd5167758<br>
Author: Oleg Sobolev <a class="moz-txt-link-rfc2396E" href="mailto:osobolev@lbl.gov"><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>
c98b44997e8eb7bf53ee828f510b933cd5167758<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 = flex.int()<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().size())</tt><br>
</blockquote>
<br>
</body>
</html>