You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Selecting a particular chain is pretty easy. Let's say you want chain A:
importparmedaspmdstruct=pmd.load_file('something.pdb')
chainA=struct['A',:,:] # Select all residues in chain A and all atoms in that residuechainAB=struct[['A', 'B'],:,:]
Each will generate a new instance of type(struct) that contains each of the atoms and valence terms/parameters present in the selected region (from which you can simply access the topology attribute for an OpenMM Topology.
You can also generate a pandas DataFrame from the system and use very simple expressions to generate a mask array to feed to the Structure selector, if you're more comfortable with pandas...
@swails is there intention to just chainA = struct['A']?
No. struct['A'] interprets 'A' as an Amber mask. In order to have it recognized as a chain, you need to do struct[[<chains>:[<residues>:]]<atoms>] (where <chains> and <residues> are optional).
or may be chainA = struct['chain A']?
No. If I introduced a syntax like that, I'd either do what MDTraj does (use pyparsing to reduce selection strings to Python expressions) or implement it in a select method that was separate from the [] syntax.
may be add a method named select to make the selection more explicit?
This is a possible extension, but not one that is important to me.
@swails I've been thinking of expanding the Amber mask parser to be able to
do selections like this (by chain ID, molecule #, etc), but we should
probably talk about what operator characters to use first.
On Mon, Jun 22, 2015 at 10:58 AM, Jason Swails [email protected]
wrote:
No. struct['A'] interprets 'A' as an Amber mask. In order to have it
recognized as a chain, you need to do
struct[[:[:]]](where and
are optional).
or may be chainA = struct['chain A']?
No. If I introduced a syntax like that, I'd either do what MDTraj does
(use pyparsing to reduce selection strings to Python expressions) or
implement it in a select method that was separate from the [] syntax.
may be add a method named select to make the selection more explicit?
This is a possible extension, but not one that is important to me.
—
Reply to this email directly or view it on GitHub #209 (comment).
Daniel R. Roe, PhD
Department of Medicinal Chemistry
University of Utah
30 South 2000 East, Room 307
Salt Lake City, UT 84112-5820 http://home.chpc.utah.edu/~cheatham/
(801) 587-9652
(801) 585-6208 (Fax)
Use :: for chain IDs (in the same way that @% indicates atom type names)
An example of 1:
# Select residues 1-10 in chain A
:1-10.A
# Select residues 1-10 in chains A, B, and C
:1-10.A-C # I *think*; not sure if you can use - for string range, maybe .A,B,C
# etc...
An example of 2:
# Select chain A
::A
# Select residues 1-10 of chains A, B, and C
::A,B,C:1-10
# Select protein backbone atoms of residues 2-20 in chains A and B
::A,B:2-20@CA,C,O,N
Another idea for flexibility is to say that chains are strings, and use the same "chain" syntax to denote molecules when the chain is given a numerical value.
This isn't the right place to talk about expanding the Amber mask syntax. There are (at least) 3 mask parsers that will need to be updated for this -- the one in cpptraj, the one in sander/pmemd, and the one in ParmEd. The one in sander/pmemd is probably less important, unless we want to start having sander/pmemd understand the optional CHAINID flag that ParmEd's addPDB flag can add. But that is almost certainly not going to happen (lots of work for minimal gain).
But this will require a discussion/decision from the Amber dev team. I'll bring it up at the developer's meeting. But I'm closing this here.
Activity
jchodera commentedon Jun 22, 2015
It looks like UCSF Chimera does support chain selections in the syntax:
https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/atom_spec.html
I guess this comes down to the question of whether the ParmEd "very similar to" syntax includes chain support.
jchodera commentedon Jun 22, 2015
From looking at mask.py, looks like maybe not yet, but perhaps it could be extended to include chain selections?
swails commentedon Jun 22, 2015
Amber never traditionally stored chain information, so it was never supported in the mask syntax. Have a look at the selection/slicing syntax supported by
Structure: http://parmed.github.io/ParmEd/html/structure.html#structure-manipulation-slicing-combining-replicating-and-splittingSelecting a particular chain is pretty easy. Let's say you want chain A:
Each will generate a new instance of
type(struct)that contains each of the atoms and valence terms/parameters present in the selected region (from which you can simply access thetopologyattribute for an OpenMMTopology.swails commentedon Jun 22, 2015
You can also generate a
pandasDataFrame from the system and use very simple expressions to generate a mask array to feed to theStructureselector, if you're more comfortable withpandas...hainm commentedon Jun 22, 2015
@swails is there intention to just
chainA = struct['A']? or may bechainA = struct['chain A']?may be add a method named
selectto make the selection more explicit?swails commentedon Jun 22, 2015
No.
struct['A']interprets'A'as an Amber mask. In order to have it recognized as a chain, you need to dostruct[[<chains>:[<residues>:]]<atoms>](where<chains>and<residues>are optional).No. If I introduced a syntax like that, I'd either do what MDTraj does (use
pyparsingto reduce selection strings to Python expressions) or implement it in aselectmethod that was separate from the [] syntax.This is a possible extension, but not one that is important to me.
drroe commentedon Jun 23, 2015
@swails I've been thinking of expanding the Amber mask parser to be able to
do selections like this (by chain ID, molecule #, etc), but we should
probably talk about what operator characters to use first.
On Mon, Jun 22, 2015 at 10:58 AM, Jason Swails [email protected]
wrote:
Daniel R. Roe, PhD
Department of Medicinal Chemistry
University of Utah
30 South 2000 East, Room 307
Salt Lake City, UT 84112-5820
http://home.chpc.utah.edu/~cheatham/
(801) 587-9652
(801) 585-6208 (Fax)
hainm commentedon Jun 23, 2015
+1 for this. I've been waiting.
swails commentedon Jun 23, 2015
A couple ideas:
::for chain IDs (in the same way that@%indicates atom type names)An example of 1:
An example of 2:
Another idea for flexibility is to say that chains are strings, and use the same "chain" syntax to denote molecules when the chain is given a numerical value.
jchodera commentedon Dec 28, 2015
I'm not sure we even finished this discussion! I think either format works for us!
swails commentedon Feb 15, 2016
This isn't the right place to talk about expanding the Amber mask syntax. There are (at least) 3 mask parsers that will need to be updated for this -- the one in cpptraj, the one in sander/pmemd, and the one in ParmEd. The one in sander/pmemd is probably less important, unless we want to start having sander/pmemd understand the optional CHAINID flag that ParmEd's addPDB flag can add. But that is almost certainly not going to happen (lots of work for minimal gain).
But this will require a discussion/decision from the Amber dev team. I'll bring it up at the developer's meeting. But I'm closing this here.