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

File drop not implemented? #87

Open
BobHanson opened this issue Feb 8, 2023 · 2 comments
Open

File drop not implemented? #87

BobHanson opened this issue Feb 8, 2023 · 2 comments

Comments

@BobHanson
Copy link

The DnD capabilities of openchemlib seem very limited -- the drop must be a string chemical MIME or possibly a java.lang.String for an "IDCode" (not sure what that is).

Does this mean that openchemlib does not have a structure type resolver? That is, it cannot take a String or InputStream and reasonably determine its structure file type?

If this were possible, or perhaps even without that but based on file extensions, we could still do file DnD.

This isn't a huge deal for me, as my Java+JavaScript application of openchemlib (OCL-SwingJS) can have access to Jmol-SwingJS, but it still seems like it would be useful in openchemlib itself. No?

@thsa
Copy link
Contributor

thsa commented Feb 9, 2023

An IDCode is a canonical, compact molecule/fragment representation that may include atom/bond query features. It is similar to a canonical, isomeric SMILES, but more compact and more comprehensive, e.g. it contains the enhanced stereo representation. It is created with a Canonizer and parsed with the IDCodeParser. It can be used together with encoded 2D- or 3D-coordinates. It is probably the most important asset of OpenChemLib.

For Copy/Paste OpenChemLib uses the ClipboardHandler, which understands IDCodes (with coords, if given), native OpenChemLib molecules, molfiles, SMILES, lists of SMILES or IDCodes, and the MDL-Sketch format (Windows only). The ClipboardHandler may optionally provide a StructureNameResolver (which e.g. DataWarrior does) to resolve natural product names, IUPAC names, CAS-Numbers, drug names, etc.

Admittedly, D&D is not on the same level and should be extended...

@BobHanson
Copy link
Author

Ah, now I am getting a better picture of the power of openchemlib. Thank you for that!

In JME-SwingJS right now I can leverage the full file adapter capabilities of Jmol. This includes file reading (including file drop) resolution of dozens of file types, including CDXML. The adapter represents those as relatively simple node/edge graphs, including CDXML and uses a simple iterator class to access that information.

For my IUPAC metadata extractor project I will be using JME-SwingJS, which incorporates OCL-SwingJS (or will, momentarily). So, if nothing else, we can use that as a test-bed for what might be included here.

I think, for example, nmrdb could be very much enhanced with a nice CDXML loader.

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