Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amber mask syntax for chainid selections? #209

Closed
jchodera opened this issue Jun 22, 2015 · 11 comments
Closed

Amber mask syntax for chainid selections? #209

jchodera opened this issue Jun 22, 2015 · 11 comments

Comments

@jchodera
Copy link
Contributor

Is there some special syntax for Amber mask selection of specific chain IDs?

@jchodera
Copy link
Contributor Author

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
Copy link
Contributor Author

From looking at mask.py, looks like maybe not yet, but perhaps it could be extended to include chain selections?

@swails
Copy link
Contributor

swails commented 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-splitting

Selecting a particular chain is pretty easy. Let's say you want chain A:

import parmed as pmd
struct = pmd.load_file('something.pdb')
chainA = struct['A',:,:] # Select all residues in chain A and all atoms in that residue
chainAB = 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.

@swails
Copy link
Contributor

swails commented Jun 22, 2015

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...

@hainm
Copy link
Contributor

hainm commented Jun 22, 2015

@swails is there intention to just chainA = struct['A']? or may be chainA = struct['chain A']?

may be add a method named select to make the selection more explicit?

@swails
Copy link
Contributor

swails commented Jun 22, 2015

@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.

@drroe
Copy link

drroe commented 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 notifications@github.com
wrote:

@swails https://github.com/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[[:[:]]](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)

@hainm
Copy link
Contributor

hainm commented Jun 23, 2015

+1 for this. I've been waiting.

@swails
Copy link
Contributor

swails commented Jun 23, 2015

A couple ideas:

  1. Do what Chimera does (see https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/frameatom_spec.html)
  2. 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.

@jchodera
Copy link
Contributor Author

I'm not sure we even finished this discussion! I think either format works for us!

@swails
Copy link
Contributor

swails commented 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.

@swails swails closed this as completed Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants