Skip to content

Amber mask syntax for chainid selections? #209

Closed

Description

@jchodera

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

Activity

  1. jchodera commented on Jun 22, 2015

    @jchodera
    ContributorAuthor

    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.

  2. jchodera commented on Jun 22, 2015

    @jchodera
    ContributorAuthor

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

  3. swails commented on Jun 22, 2015

    @swails
    Contributor

    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.

  4. swails commented on Jun 22, 2015

    @swails
    Contributor

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

  5. hainm commented on Jun 22, 2015

    @hainm
    Contributor

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

  6. swails commented on Jun 22, 2015

    @swails
    Contributor

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

  7. drroe commented on Jun 23, 2015

    @drroe

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

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

  8. hainm commented on Jun 23, 2015

    @hainm
    Contributor

    +1 for this. I've been waiting.

  9. swails commented on Jun 23, 2015

    @swails
    Contributor

    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.

  10. jchodera commented on Dec 28, 2015

    @jchodera
    ContributorAuthor

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

  11. swails commented on Feb 15, 2016

    @swails
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions