Skip to content

Residue & Segment slicing. Residue.select_atoms? #1163

@richardjgowers

Description

@richardjgowers

I'm going over the old tests in test_atomgroup and found some differences in behaviour between the old and new systems. Because Residue and Segment used to be derived from AtomGroup, these could be sliced to give atoms.

u = mda.Universe()

res = u.residues[0]

# Previously
res[2]  # would return second Atom in Residue

# Now have to go via atoms attribute
res.atoms[2]

This also applies to things like __contains__, should atom in res work?

Also, select_atoms now has to be called off either a Universe or AtomGroup object, but because it explicitly says _atoms in the method name, shouldn't this always work off any object? (ie with SegmentGroup.select_atoms it's obvious what is meant, so allow it?)

I'm in favour of changing these things back to how they used to work, but just checking this seems better with everyone else.

poking @dotsdl in particular

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions