Re: [PyMOL] Selection algebra
Thank you, it was really what I asked! Em seg, 5 de ago de 2019 15:50, Christian "Cole" French < christian.fre...@schrodinger.com> escreveu: > select_with_filter allows you to make a selection as you would with the > select command, so it supports all selection algebra including byres, > chain, organic, etc. Here's a modified example from the wiki: > > # Select all residues within 5 Ang. of any organic small molecules whose > x-coordinate is at least 50 > select_with_filter sele, br. all within 5 of (organic and flag 8), lambda > s: cmd.get_extent(s)[0][0] >= 50 > > Best, > Cole > > On Mon, Aug 5, 2019 at 1:06 PM Pedro Lacerda wrote: > >> Yes, one more question. >> >> How to use all other "functions", like byres, "chain A" or "organic"? >> >> Em seg, 5 de ago de 2019 12:36, Christian "Cole" French < >> christian.fre...@schrodinger.com> escreveu: >> >>> I see now. I updated the code at the link in my previous email to >>> provide behavior which should allow you to do what you want. Here are your >>> examples written using the command: >>> >>> select_with_filter sele, flag 8, lambda s: len(cmd.get_chains(s)) < 2 >>> select_with_filter sele, flag 8, lambda s: cmd.get_fastastr(s) < 2 >>> select_with_filter sele, flag 8 and chain A, lambda s: peplength(s) < 15 >>> >>> If you want to write and use your own multi-line function, you can write >>> a script and cmd.extend('your_function', your_function), then use >>> your_function in select_with_filter. >>> >>> Please let me know if you have any further questions. >>> >>> Best, >>> Cole >>> >>> On Mon, Aug 5, 2019 at 8:30 AM Pedro Lacerda >>> wrote: >>> I expressed myself wrong, I'm looking something like: select peplength < 15 and chain A Where peplength is an user defined function like: def peplength(atom): return compute_peplength(atom) I'm looking for the availability of user defined functions on selection expressions. How to? Em sex, 2 de ago de 2019 às 15:44, Christian "Cole" French < christian.fre...@schrodinger.com> escreveu: > 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 >> 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 >> >> -- 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
Re: [PyMOL] Selection algebra
select_with_filter allows you to make a selection as you would with the select command, so it supports all selection algebra including byres, chain, organic, etc. Here's a modified example from the wiki: # Select all residues within 5 Ang. of any organic small molecules whose x-coordinate is at least 50 select_with_filter sele, br. all within 5 of (organic and flag 8), lambda s: cmd.get_extent(s)[0][0] >= 50 Best, Cole On Mon, Aug 5, 2019 at 1:06 PM Pedro Lacerda wrote: > Yes, one more question. > > How to use all other "functions", like byres, "chain A" or "organic"? > > Em seg, 5 de ago de 2019 12:36, Christian "Cole" French < > christian.fre...@schrodinger.com> escreveu: > >> I see now. I updated the code at the link in my previous email to provide >> behavior which should allow you to do what you want. Here are your examples >> written using the command: >> >> select_with_filter sele, flag 8, lambda s: len(cmd.get_chains(s)) < 2 >> select_with_filter sele, flag 8, lambda s: cmd.get_fastastr(s) < 2 >> select_with_filter sele, flag 8 and chain A, lambda s: peplength(s) < 15 >> >> If you want to write and use your own multi-line function, you can write >> a script and cmd.extend('your_function', your_function), then use >> your_function in select_with_filter. >> >> Please let me know if you have any further questions. >> >> Best, >> Cole >> >> On Mon, Aug 5, 2019 at 8:30 AM Pedro Lacerda wrote: >> >>> I expressed myself wrong, I'm looking something like: >>> >>>select peplength < 15 and chain A >>> >>> Where peplength is an user defined function like: >>> >>> def peplength(atom): >>> return compute_peplength(atom) >>> >>> I'm looking for the availability of user defined functions on selection >>> expressions. How to? >>> >>> Em sex, 2 de ago de 2019 às 15:44, Christian "Cole" French < >>> christian.fre...@schrodinger.com> escreveu: >>> 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 > 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 > > >>> >>> -- >>> 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
Re: [PyMOL] Selection algebra
Yes, one more question. How to use all other "functions", like byres, "chain A" or "organic"? Em seg, 5 de ago de 2019 12:36, Christian "Cole" French < christian.fre...@schrodinger.com> escreveu: > I see now. I updated the code at the link in my previous email to provide > behavior which should allow you to do what you want. Here are your examples > written using the command: > > select_with_filter sele, flag 8, lambda s: len(cmd.get_chains(s)) < 2 > select_with_filter sele, flag 8, lambda s: cmd.get_fastastr(s) < 2 > select_with_filter sele, flag 8 and chain A, lambda s: peplength(s) < 15 > > If you want to write and use your own multi-line function, you can write a > script and cmd.extend('your_function', your_function), then use > your_function in select_with_filter. > > Please let me know if you have any further questions. > > Best, > Cole > > On Mon, Aug 5, 2019 at 8:30 AM Pedro Lacerda wrote: > >> I expressed myself wrong, I'm looking something like: >> >>select peplength < 15 and chain A >> >> Where peplength is an user defined function like: >> >> def peplength(atom): >> return compute_peplength(atom) >> >> I'm looking for the availability of user defined functions on selection >> expressions. How to? >> >> Em sex, 2 de ago de 2019 às 15:44, Christian "Cole" French < >> christian.fre...@schrodinger.com> escreveu: >> >>> 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 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 >> >> -- >> 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
Re: [PyMOL] Selection algebra
I see now. I updated the code at the link in my previous email to provide behavior which should allow you to do what you want. Here are your examples written using the command: select_with_filter sele, flag 8, lambda s: len(cmd.get_chains(s)) < 2 select_with_filter sele, flag 8, lambda s: cmd.get_fastastr(s) < 2 select_with_filter sele, flag 8 and chain A, lambda s: peplength(s) < 15 If you want to write and use your own multi-line function, you can write a script and cmd.extend('your_function', your_function), then use your_function in select_with_filter. Please let me know if you have any further questions. Best, Cole On Mon, Aug 5, 2019 at 8:30 AM Pedro Lacerda wrote: > I expressed myself wrong, I'm looking something like: > >select peplength < 15 and chain A > > Where peplength is an user defined function like: > > def peplength(atom): > return compute_peplength(atom) > > I'm looking for the availability of user defined functions on selection > expressions. How to? > > Em sex, 2 de ago de 2019 às 15:44, Christian "Cole" French < > christian.fre...@schrodinger.com> escreveu: > >> 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 >>> 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 >>> >>> > > -- > 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
Re: [PyMOL] Selection algebra
I expressed myself wrong, I'm looking something like: select peplength < 15 and chain A Where peplength is an user defined function like: def peplength(atom): return compute_peplength(atom) I'm looking for the availability of user defined functions on selection expressions. How to? Em sex, 2 de ago de 2019 às 15:44, Christian "Cole" French < christian.fre...@schrodinger.com> escreveu: > 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 >> 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 >> >> -- 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
Re: [PyMOL] Selection algebra
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 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
Re: [PyMOL] Selection algebra
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 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
Re: [PyMOL] Grammar for PyMOL selection algebra
Hi Lukas, All operators: https://sourceforge.net/p/pymol/code/4159/tree/trunk/pymol/layer3/Selector.cpp#l455 Operator types (e.g. number of arguments) and priority (order of operation): https://sourceforge.net/p/pymol/code/4159/tree/trunk/pymol/layer3/Selector.cpp#l365 Hope that helps. Cheers, Thomas On 19 Jul 2016, at 05:52, Lukáš Pravdawrote: > Dear PyMOL users, > > I am trying to add support for pymol-like selection algebra into one of your > software tools. Therefore, I was wondering, if there is any formal > description of the language available in for example as context-free grammar. > I was trying to find something in the source code rather unsuccessfully. > > All the best > > Lukas Pravda > > CEITEC | Central European Institute of Technology > http://webchem.ncbr.muni.cz/ -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
[PyMOL] Grammar for PyMOL selection algebra
Dear PyMOL users, I am trying to add support for pymol-like selection algebra into one of your software tools. Therefore, I was wondering, if there is any formal description of the language available in for example as context-free grammar. I was trying to find something in the source code rather unsuccessfully. All the best Lukas Pravda CEITEC | Central European Institute of Technology http://webchem.ncbr.muni.cz/ -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
[PyMOL] Selection algebra issue
Hi all, I'm trying to write a script to data mine the pdb. I'm want to look at the ligands in a pdb file and fish out those that meet a certain criteria. I've got a script that can look at the ligands all at once but I need to assess each ligand individually. Since I'm looking at 40,000+ pdbs I need a way to define them individually. I've tried variations on %s' % (resi) and bymolec but I can't seem to figure out how to get them parsed separately without specifying a number. I've also tried using index to create a tuples list and iterating from that but I keep hitting the same issue. I've attached a couple of the attempted scripts so you can laugh at my google derived python skills. I've been trying to figure this out for a week now and I'm completely stumped. If anyone could nudge me in the right direction, even if it's some Pymolwiki article I missed, I would appreciate it immensely. Thanks for your time, Katherine -- Nil illegitimo carborundum* - *Didactylos from pymol import cmd from glob import glob for file in glob(*.pdb): cmd.load(file,'prot') #some selection criteria. I've tried 'het and (not solvent) and %s' % (resi) while cmd.count_atoms(solvent within 3.5 of sele) != 0 if cmd.count_atoms(solvent within 3.5 of het) == 0: print file break cmd.delete(prot) from pymol import cmd from glob import glob for file in glob(*.pdb): cmd.load(file,'prot') for a in cmd.index('het and (not solvent) and %s' % (resi)): solvent.name = [] cmd.iterate('%a', count_atoms('solvent within 3.5 of %a')) if cmd.count_atoms(solvent within 3.5 of %a) == 0: print file cmd.delete(prot) -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] Selection algebra issue
Katherine, not sure if that is what you are looking for but you can select for non-polymer residues with: select lig, prot and organic That will select any non polymer (protein and R(D)NA) residues present in the pdb. You then would need to break the selection further into the individual constituents, by either chain Id and resid. Hope this helps a bit. Carsten From: Katherine Sippel [mailto:katherine.sip...@gmail.com] Sent: Friday, December 13, 2013 10:28 AM To: pymol-users@lists.sourceforge.net Subject: [PyMOL] Selection algebra issue Hi all, I'm trying to write a script to data mine the pdb. I'm want to look at the ligands in a pdb file and fish out those that meet a certain criteria. I've got a script that can look at the ligands all at once but I need to assess each ligand individually. Since I'm looking at 40,000+ pdbs I need a way to define them individually. I've tried variations on %s' % (resi) and bymolec but I can't seem to figure out how to get them parsed separately without specifying a number. I've also tried using index to create a tuples list and iterating from that but I keep hitting the same issue. I've attached a couple of the attempted scripts so you can laugh at my google derived python skills. I've been trying to figure this out for a week now and I'm completely stumped. If anyone could nudge me in the right direction, even if it's some Pymolwiki article I missed, I would appreciate it immensely. Thanks for your time, Katherine -- Nil illegitimo carborundum - Didactylos -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] Selection algebra issue
Hi Carsten, Thanks for the help. I've tried variants of that selection and it works great if there is only one ligand. Unfortunately it breaks down when there are multiple ligands and they don't all fit the criteria. I'm surveying almost half the PDB so these are all different proteins with different binding sites and ligands. I was hoping for a way to get pymol to recognize each individual ligand automatically by grouping common resids within the non-solvent hetatm selection. Using the %s %(resi) seems to require an explicit input. I might be able to extract an explicit chain/resi designation for each file from the het portion of the pdb header, though I'm not sure how to automate this. I suppose it's back to the script repository for me. Cheers, Katherine On Fri, Dec 13, 2013 at 2:50 PM, Schubert, Carsten [JRDUS] cschu...@its.jnj.com wrote: Katherine, not sure if that is what you are looking for but you can select for non-polymer residues with: select lig, prot and organic That will select any non polymer (protein and R(D)NA) residues present in the pdb. You then would need to break the selection further into the individual constituents, by either chain Id and resid. Hope this helps a bit. Carsten *From:* Katherine Sippel [mailto:katherine.sip...@gmail.com] *Sent:* Friday, December 13, 2013 10:28 AM *To:* pymol-users@lists.sourceforge.net *Subject:* [PyMOL] Selection algebra issue Hi all, I'm trying to write a script to data mine the pdb. I'm want to look at the ligands in a pdb file and fish out those that meet a certain criteria. I've got a script that can look at the ligands all at once but I need to assess each ligand individually. Since I'm looking at 40,000+ pdbs I need a way to define them individually. I've tried variations on %s' % (resi) and bymolec but I can't seem to figure out how to get them parsed separately without specifying a number. I've also tried using index to create a tuples list and iterating from that but I keep hitting the same issue. I've attached a couple of the attempted scripts so you can laugh at my google derived python skills. I've been trying to figure this out for a week now and I'm completely stumped. If anyone could nudge me in the right direction, even if it's some Pymolwiki article I missed, I would appreciate it immensely. Thanks for your time, Katherine -- Nil illegitimo carborundum* - *Didactylos -- Nil illegitimo carborundum* - *Didactylos -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Re: [PyMOL] Selection algebra issue
Hi Katherine, PyMOL can do what you want. I've done this exact task before. Here's the idea. If you have a PDB with multiple ligands and you use, select allLigands, organic and myProtein you create the selection allLigands which contains all the ligand atoms in myProtein. What you need to do is extract each ligand, molecule by molecule, from the allLigands selection using selection algebra until myLigands is empty. It's done like this: # create a selection containing the atoms of all ligands select allLigands, organic and myProtein # create a selection to use later as we iterate across # all ligands, this will hold individual ligands we extract # from allLigands select current_ligand, none # enter a Python block so we can use Python while-loop # and other Python syntax python # loop until allLigands is not empty while cmd.count_atoms(myLigands) 0: # copy the first ligand selection, by molecule, into # the, current_ligand cmd.select(current_ligand, bm. first allLigands) # do something with current_ligand, like finding all ligands # without waters nearby if cmd.count_atoms(solvent within 5 of current_ligand) == 0: print This is an interesting ligand. # now remove current_ligand from allLigands # and loop again cmd.select(allLigands, allLigands and not current_ligand) python end Good luck! Cheers, -- Jason On Fri, Dec 13, 2013 at 4:58 PM, Katherine Sippel katherine.sip...@gmail.com wrote: Hi Carsten, Thanks for the help. I've tried variants of that selection and it works great if there is only one ligand. Unfortunately it breaks down when there are multiple ligands and they don't all fit the criteria. I'm surveying almost half the PDB so these are all different proteins with different binding sites and ligands. I was hoping for a way to get pymol to recognize each individual ligand automatically by grouping common resids within the non-solvent hetatm selection. Using the %s %(resi) seems to require an explicit input. I might be able to extract an explicit chain/resi designation for each file from the het portion of the pdb header, though I'm not sure how to automate this. I suppose it's back to the script repository for me. Cheers, Katherine On Fri, Dec 13, 2013 at 2:50 PM, Schubert, Carsten [JRDUS] cschu...@its.jnj.com wrote: Katherine, not sure if that is what you are looking for but you can select for non-polymer residues with: select lig, prot and organic That will select any non polymer (protein and R(D)NA) residues present in the pdb. You then would need to break the selection further into the individual constituents, by either chain Id and resid. Hope this helps a bit. Carsten From: Katherine Sippel [mailto:katherine.sip...@gmail.com] Sent: Friday, December 13, 2013 10:28 AM To: pymol-users@lists.sourceforge.net Subject: [PyMOL] Selection algebra issue Hi all, I'm trying to write a script to data mine the pdb. I'm want to look at the ligands in a pdb file and fish out those that meet a certain criteria. I've got a script that can look at the ligands all at once but I need to assess each ligand individually. Since I'm looking at 40,000+ pdbs I need a way to define them individually. I've tried variations on %s' % (resi) and bymolec but I can't seem to figure out how to get them parsed separately without specifying a number. I've also tried using index to create a tuples list and iterating from that but I keep hitting the same issue. I've attached a couple of the attempted scripts so you can laugh at my google derived python skills. I've been trying to figure this out for a week now and I'm completely stumped. If anyone could nudge me in the right direction, even if it's some Pymolwiki article I missed, I would appreciate it immensely. Thanks for your time, Katherine -- Nil illegitimo carborundum - Didactylos -- Nil illegitimo carborundum - Didactylos -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net -- Jason Vertrees, PhD Director of Core Modeling Products Schrödinger, Inc. (e) jason.vertr...@schrodinger.com (o) +1 (603) 374-7120 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear