Skip to content

Harmonize semantics of select keyword in various places #5300

@ollyfutur

Description

@ollyfutur

Is your feature request related to a problem?

In various classes or functions, a select keyword is provided to perform a selection on the provided AtomGroups. E.g. RMSD, alignto
The API is somewhat inconsistent:

  • many analysis classes (RMSD, PCA…) use as default select='all', which performs internally a ag.select_atoms(select) that silently sorts the provided atomgroup, which is sometimes undesirable. They do not accept None to avoid the selection altogether.
  • alignto defaults to None and has a special case when "all" is provided, avoiding reordering.

Describe the solution you'd like

I see two options:

  • I personally think those functions/classes should not have the responsibility of selecting atomgroups, since this can be easily done upstream by the user. This also leads to a lot of code reduplication. I would consider in the long run to deprecate select in most places, and recommend to always explicitly provide an (ordered) AtomGroup.

Describe alternatives you've considered

  • If the keyword is kept, I think its behavior should be harmonized and match the behavior of AtomGroup.select_atoms, which always sorts. None should be always accepted to avoid any selection.

Additional context

I have submitted a PR #5296 implementing the second solution for analysis.rms.RMSD, but I now realize the problem applies to many places.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions