pymol-open-source
pymol-open-source copied to clipboard
alter_state changes all states in object ?
I'm now using the free version of PyMOL v. 2.4.0a0.
According to Wiki, the alter_state command should alter specified states in a given object:
alter_state state, (selection), expression.
It seems that it does not work like that, rather all states in a given object are altered. Perhaps I'm making some mistake, but here is a step-by-step procedure, how to reproduce the misbehaviour:
-
open .pdb file (extension changed to .txt just so it can be attached here) 4r_6r.txt
-
make new state in the same object:
create 4r_6r, 4r_6r, 1, 2(Wiki says:create name, (selection) [, source_state [, target_state ]]) -
check b-factor values for selected atoms in state 1
alter_state 1, 4r_6r and chain A and resi 3, print(b, state)prints 10 times (which is OK):
0.0 1
now state 2
alter_state 2, 4r_6r and chain A and resi 3, print(b, state)prints 10 times (which is OK):
0.0 2
-
alter b-factor for selected atoms in state 2
alter_state 2, 4r_6r and chain A and resi 3, b=1prints:
AlterState: modified 10 atom coordinate states.
This looks OK, as if going just over 10 atoms, i.e. one state, because using
alter_state 0, 4r_6r and chain A and resi 3, b=1prints:AlterState: modified 20 atom coordinate states
i.e. going through both states (2x10 atoms).
-
again, check b-factor values for selected atoms in state 1
alter_state 1, 4r_6r and chain A and resi 3, print(b, state)alter_state 2, 4r_6r and chain A and resi 3, print(b, state)both print 10 times:
1.0 1 (or 1.0 2 for second state).
This is not OK, as state 1 should not have been changed and the b-factor should remian 0.0.
Some alternate definition(s) of the selection yield to same behaviour. e.g.: alter_state 2, A/3/, b=1
Perhaps someone may reflect on this and confirm that I make some mistake and all works, or indeed there is some bug. Thanks' in advance. V
This is not a bug, but a limitation of the current implementation. b is not implemented as an atom-state level property. The only way to have per-state b-factors is by using "discrete" states.
load 4r_6r.pdb, discrete=1
create 4r_6r, 4r_6r, 1, 2
alter_state 2, chain A and resi 3, b=1
iterate_state 0, chain A and resi 3, print(state, model, chain, resi, b)
Prints:
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
1 4r_6r A 3 0.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
2 4r_6r A 3 1.0
OK, thanks' a lot. It will help me. Apparently, in such case the sequence view does not show residues any more (just states). But I guess that is intentional so that for objects with many states it does not get too crowded. So thank you.