From: Pawel <pa...@gm...> - 2013-07-31 18:18:53
|
Hello, I am having trouble running scripts which vary selections on different states of a PyMOL object. I've converted an MD trajectory into a pdb with 500 models that PyMOL loads as 500 states of 1 object. For example, I would then like to run the anglesbetweenhelices.py script (from PyMOL wiki) on each state separately. A simple script example: import anglebetweenhelices as abh cmd.load('output.pdb', object="cdp") for i in range(1,501): cmd.set('state',i,'cdp') cmd.select('hel1','/cdp///1-22') cmd.select('hel2','/cdp///25-37') x=abh.angle_between_helices('hel1','hel2', visualize=0, quiet=1) print x In theory the select command has a state option but this doesn't seem to work (as is confirmed by http://www.mail-archive.com/pym...@li.../msg08224.html). I then tried using the set state command, but this also does not seem to affect the actual coordinates of the selection. The only thing that does work is if in the GUI I go to the desired state by pressing the "<" and ">" animation buttons. But is there a way to select the state from within a script? Thanks! Pawel |
From: Thomas H. <tho...@sc...> - 2013-07-31 20:53:43
|
Hi Pawel, the state argument of the select command is only for state sensitive selection criteria (like around or within operators). The selection will always be on all states (exception: discrete objects). The angle_between_helices command itself needs a state argument. Since I wrote that script, it's my fault that it doesn't have one :) But I continued to work on that script in the PSICO package and actually added state support there. So I recommend that you install PSICO and change your script like this: import psico.orientation as abh x=abh.angle_between_helices('hel1','hel2', visualize=0, state1=i+1, state2=i+1, quiet=1) http://pymolwiki.org/index.php/Psico https://github.com/speleo3/pymol-psico Hope that helps. Cheers, Thomas Pawel wrote, On 07/31/13 20:18: > Hello, > > I am having trouble running scripts which vary selections on different > states of a PyMOL object. I've converted an MD trajectory into a pdb > with 500 models that PyMOL loads as 500 states of 1 object. For example, > I would then like to run the anglesbetweenhelices.py script (from PyMOL > wiki) on each state separately. A simple script example: > > import anglebetweenhelices as abh > cmd.load('output.pdb', object="cdp") > for i in range(1,501): > cmd.set('state',i,'cdp') > cmd.select('hel1','/cdp///1-22') > cmd.select('hel2','/cdp///25-37') > x=abh.angle_between_helices('hel1','hel2', visualize=0, quiet=1) > print x > > In theory the select command has a state option but this doesn't seem to > work (as is confirmed by > http://www.mail-archive.com/pym...@li.../msg08224.html). > I then tried using the set state command, but this also does not seem to > affect the actual coordinates of the selection. The only thing that does > work is if in the GUI I go to the desired state by pressing the "<" and > ">" animation buttons. But is there a way to select the state from > within a script? > > Thanks! > Pawel -- Thomas Holder PyMOL Developer Schrödinger Contractor |
From: Pawel <pa...@gm...> - 2013-08-01 11:32:23
|
Hi Thomas, That helps greatly. I wasn't aware of the PSICO package and it will surely be useful for more than just helix angles. By the way, before you responded I found the way to do what I wanted using the old anglebetweenhelices script: using "frame i" command. Setting frame to the desired state number resulted in the selection having those state's coordinates. If it's not too much to ask: can you clarify the first paragraph of your response or point me to some place on the Wiki that explains it. Not sure what you mean by "state sensitive selection criteria" and by "operators". Thanks! Pawel On 07/31/2013 04:53 PM, Thomas Holder wrote: > Hi Pawel, > > the state argument of the select command is only for state sensitive > selection criteria (like around or within operators). The selection will > always be on all states (exception: discrete objects). > > The angle_between_helices command itself needs a state argument. Since I > wrote that script, it's my fault that it doesn't have one :) But I > continued to work on that script in the PSICO package and actually added > state support there. So I recommend that you install PSICO and change > your script like this: > > import psico.orientation as abh > x=abh.angle_between_helices('hel1','hel2', visualize=0, > state1=i+1, state2=i+1, quiet=1) > > http://pymolwiki.org/index.php/Psico > https://github.com/speleo3/pymol-psico > > Hope that helps. > > Cheers, > Thomas > > Pawel wrote, On 07/31/13 20:18: >> Hello, >> >> I am having trouble running scripts which vary selections on different >> states of a PyMOL object. I've converted an MD trajectory into a pdb >> with 500 models that PyMOL loads as 500 states of 1 object. For example, >> I would then like to run the anglesbetweenhelices.py script (from PyMOL >> wiki) on each state separately. A simple script example: >> >> import anglebetweenhelices as abh >> cmd.load('output.pdb', object="cdp") >> for i in range(1,501): >> cmd.set('state',i,'cdp') >> cmd.select('hel1','/cdp///1-22') >> cmd.select('hel2','/cdp///25-37') >> x=abh.angle_between_helices('hel1','hel2', visualize=0, quiet=1) >> print x >> >> In theory the select command has a state option but this doesn't seem to >> work (as is confirmed by >> http://www.mail-archive.com/pym...@li.../msg08224.html). >> I then tried using the set state command, but this also does not seem to >> affect the actual coordinates of the selection. The only thing that does >> work is if in the GUI I go to the desired state by pressing the "<" and >> ">" animation buttons. But is there a way to select the state from >> within a script? >> >> Thanks! >> Pawel |
From: Thomas H. <tho...@sc...> - 2013-08-01 11:44:31
|
Hi Pawel, Pawel wrote, On 08/01/13 13:32: > If it's not too much to ask: can you clarify the first paragraph of your > response or point me to some place on the Wiki that explains it. Not > sure what you mean by "state sensitive selection criteria" and by > "operators". I'm talking about the selection language. You could do something like: PyMOL> select pocket, polymer within 8.0 of organic This depends on distances between atoms, which may be different in different states, thus are state sensitive. See: http://pymolwiki.org/index.php/Selection_Algebra In particular all distance operators: http://pymolwiki.org/index.php/Selection_Algebra#Comparison_of_distance_operators Cheers, Thomas -- Thomas Holder PyMOL Developer Schrödinger Contractor |