-
Notifications
You must be signed in to change notification settings - Fork 659
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
API for converters #2790
Comments
According to the docs https://docs.mdanalysis.org/2.0.0-dev0/documentation_pages/converters.html , the argument of Should it be possible to do something like I know that TAB-completion is nice but I am also worried about adding more and more methods onto AtomGroup. (We got rid of "instant selectors" #1377 which were nice for interactive work but more confusing and hard to maintain in the long run... although they also had other problems that warranted their removal.) My initial gut reaction is to not proliferate |
More generally speaking: laying down an API for the converters 👍 👍 |
Thanks for starting this @cbouy! @Luthaf not sure if you were planning on taking chemfiles in a converter direction; if so, you might also be interested in this discussion.
It should be (and it's an easy fix), but currently the function to get the right converter just passes in the string un-uppercased.
I'm inclined to favour any method that doesn't rely on us remembering to do things manually. One solution to this as proposed by @RMeli is to add on a bunch of Another solution is to stop hiding the registries in Finally a hacky solution is to some kind of wrapper class that we attach the Personally my favourite direction is to stop hiding registries because it's easy and general, but would love to get everyone's thoughts. |
It seems that most people here would go for If we define an API for the registries then we can make them public. If we don't have one/don't want to settle on one then we should keep them private. (I predict that even public registries are still going to be a feature for the small percentage of power users and the majority of users would rather just work with |
I did not see this issue before. I hope it is still time to chip in. I am not a big fan of cluttering the atom group namespace. It is already very much cluttered with dynamically added attributes that end up not appearing in the doc. While the converters would most likely appear in the doc more easily, I do not think it would be wise to open the gate to even more attributes. I think the If having tab-completion is really a must-have, then I would go for the wrapper approach that @lilyminium suggested. @lilyminium suggested that the separate namespace was inconsistent with the Implementing the wrapper is not that complicated. The One more problem with cluttering the namespace of Some time ago, we were discussing having all the box related operations under a |
On the other hand, their From the thread above I would summarize that our UI should allow for the following (and maybe not all are possible)
|
In the process of adding parallel capabilities to the H5MD reader #2865 , @edisj brought up an important point that is relevant for the convertors: When you take a foreign object such as a The broader question here is how the convertor API should handle |
@orbeckst isn't this for Readers/Parsers instead of converters ? or am I just too tired 😅 ? |
I have been considering the fact that we can do
where So if you have a RDKIT thingy that generated 5 conformers (because you told RDKIT to so) then these conformers are now represented as a MDA trajectory. But when you hit |
You're right in that the original discussion centered on |
Fixes #2790 ## Work done in this PR * Creates a new converters API * Makes u.atoms.convert_to("PACKAGE") case insensitive * Allows passing kwargs to converters: u.atoms.convert_to("rdkit", NoImplicit=False) * Adds u.atoms.convert_to.package() methods automatically from the metaclass magic, with TAB completion support, and docstring from the converter * Moves RDKit, Parmed, and OpenMM to MDAnalysis.converters Authored-by: Cédric Bouysset <[email protected]>
Is your feature request related to a problem?
Currently, converters are called with the
convert_to
method, e.g.u.atoms.convert_to('PARMED')
. This requires users to:Describe the solution you'd like
Add
to_lib
methods for all converters, e.g.u.atoms.to_parmed()
. This allows users to use auto-completion to quickly check for which converters are available after typingto_
.Optionally, allowing
u.atoms.convert_to('parmed')
would be great as it feels more naturalDescribe alternatives you've considered
u.atoms.parmed()
, i.e. pytorch style, but it's less useful for auto-completionAdditional context
Discussed in PR #2775 (more technically here)
Currently concerns the ParmEd converter, and will also concern the RDKit converter in 2.0.0
Tagging @lilyminium @RMeli @richardjgowers @IAlibay
The text was updated successfully, but these errors were encountered: