[cctbxbb] model selection

Pavel Afonine pafonine at lbl.gov
Thu Aug 16 15:37:40 PDT 2018


Currently model class has three selection methods:

def selection(self, selstr, optional=True):
def select(self, selection):
def iselection(self, selstr):

which is hideously confusing with zero chance to remember, and also 
inconsistent with the rest.

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).

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?

Pavel

On 8/16/18 15:00, CCTBX commit wrote:
> Repository : ssh://g18-sc-serv-04.diamond.ac.uk/cctbx
> On branch  : master
>
> ------------------------------------------------------------------------
>
>
> commit c98b44997e8eb7bf53ee828f510b933cd5167758
> Author: Oleg Sobolev <osobolev at lbl.gov>
> Date:   Thu Aug 16 15:00:20 2018 -0700
>
>     Proper use of model class
>
>
> ------------------------------------------------------------------------
>
>
> c98b44997e8eb7bf53ee828f510b933cd5167758
> mmtbx/model/model.py | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mmtbx/model/model.py b/mmtbx/model/model.py
> index 6f2247452..87412f95c 100644
> --- a/mmtbx/model/model.py
> +++ b/mmtbx/model/model.py
> @@ -2312,8 +2312,7 @@ class manager(object):
>      sizes = flex.int()
>      h = self.get_hierarchy()
>      if(macro_molecule_only):
> -      asc = h.atom_selection_cache()
> -      s = asc.selection("protein or nucleotide")
> +      s = self.selection("protein or nucleotide")
>        h = h.select(s)
>      for r in h.residue_groups():
>        sizes.append(r.atoms().size())

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20180816/79e8d81b/attachment.htm>


More information about the cctbxbb mailing list