Edit: remove the cmd. part when running select_with_filter. (Since it's a custom command, it doesn't belong to the cmd module.)
On Fri, Aug 2, 2019 at 2:41 PM Christian "Cole" French < christian.fre...@schrodinger.com> wrote: > Hi Pedro Lacerda, > > Here is a link to a script I wrote which adds a command which does what > you ask: > https://gist.github.com/ColeFrench/6f68fa5f04a67bb6234f10c25debb865. To > use it, download the file to the directory where you run PyMOL from, then > open PyMOL and run run select_with_filter.py. > > For your examples, the commands would be > cmd.select_with_filter(predicate=lambda > s: len(cmd.get_chains(s)) < 2) and cmd.select_with_filter(predicate=lambda > s: cmd.get_fastastr(s) < 2). > > Commands which can be simply run are a convenience which allows you to > type less (e.g., select chain A instead of cmd.select('chain A')). Some > commands require different arguments and can only be run the longer way, > such as the one I wrote which takes a function as an argument. > > Hope this helps, > Cole > > On Fri, Aug 2, 2019 at 11:45 AM Pedro Lacerda <pslace...@gmail.com> wrote: > >> Hi PyMOL users, >> >> It there any way to enhance the selecion algebra with functions? For >> instance: >> >> select len(get_chains(*)) < 2 >>> >> >> Or even: >> >> select cmd.get_fastastr(*) < 2 >>> >> >> >> By the way, why some commands we can simply run (like get_chains) and >> others are different (like cmd.get_fastastr())? >> >> -- >> Pedro Sousa Lacerda >> >> >> *Laboratório de Bioinformática e Modelagem Molecular* >> *Faculdade de Farmácia / UFBA* >> >> *@pslacerda* >> >> *+55 71 9 9981-1856* >> _______________________________________________ >> PyMOL-users mailing list >> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net >> Unsubscribe: >> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe > >
_______________________________________________ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe