Skip to content
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

Adding JSON I/O for molecules #230

Open
isty2e opened this issue Aug 13, 2024 · 1 comment
Open

Adding JSON I/O for molecules #230

isty2e opened this issue Aug 13, 2024 · 1 comment

Comments

@isty2e
Copy link

isty2e commented Aug 13, 2024

Sometimes it is convenient to exchange molecules in JSON format rather than SMILES or .sdf files. Fortunately, rdChem.Mol <-> JSON is already implemented in rdkit.Chem.rdMolInterchange.MolsToJSON and rdkit.Chem.rdMolInterchange.JSONToMols. This can be implemented in either datamol.io or datamol.mol, though I'm not sure exactly where, and what the signatures should be: For example, implementing this in datamol.mol.to_mol() with JSON string input will require another if-else, which will slow down the method slightly. Perhaps datamol.mol.to_mol(mol: str | Mol | dict) might be better, but the JSON can contain multiple molecules so it's not a good interface in the first place.

@maclandrol
Copy link
Member

I suggest adding a read_json method in datamol.io. That seems to be the best place and will match with the rest of the read_* API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants