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.
Is your feature request related to a problem?
In various classes or functions, a
selectkeyword is provided to perform a selection on the providedAtomGroups. E.g.RMSD,aligntoThe API is somewhat inconsistent:
RMSD,PCA…) use as defaultselect='all', which performs internally aag.select_atoms(select)that silently sorts the provided atomgroup, which is sometimes undesirable. They do not acceptNoneto avoid the selection altogether.aligntodefaults toNoneand has a special case when"all"is provided, avoiding reordering.Describe the solution you'd like
I see two options:
selectin most places, and recommend to always explicitly provide an (ordered)AtomGroup.Describe alternatives you've considered
AtomGroup.select_atoms, which always sorts.Noneshould 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.