partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
248 stars 61 forks source link

viewing JCAMP-DX? #242

Closed registerme1963 closed 2 years ago

registerme1963 commented 3 years ago

Hi, Is there any option to include viewing NMR, IR, Mass data using JCAMP-DX format? If not are there any plans for that in future? thanks

partridgejiang commented 3 years ago

Currently JCAMP-DX format is not supported yet but there do exists plans for it, :).

registerme1963 commented 3 years ago

is there any timeline? We are planning for integration with Gaussian/NWChem and others for full blown web based chemistry app? Thanks

partridgejiang commented 3 years ago

There is no precise timeline yet, perhaps in several months.

partridgejiang commented 2 years ago

Hi @registerme1963, the supports of JCAMP-DX/CMLSpect reading and spectra displaying have been added. Please check the spectrum viewer demo (http://partridgejiang.github.io/Kekule.js/demos/items/spectrum/spectrumViewer.html). Note that these features are in its early stage, and the internal structures and APIs of spectrum objects may be changes in the future.

registerme1963 commented 2 years ago

It is great and many thanks. Probably I can now use this in MOODLE with a filter.

  1. It throws an error 'JCAMP data table X value check failed!' when I tried load simulated NMR data from https://www.nmrdb.org/ (see the attached file)
  2. It would be great if I can expand the x- and y-scale through mouse, rather than manully input the scaling values in a textbox.
  3. How were the cml files generated? is there a way to convert jcamp to cml?
  4. Please update the documentation related to this.

Many thanks onceagain, impatiently waiting for the final version regards rV predictedSpectrum.zip

partridgejiang commented 2 years ago

Hi @registerme1963 currently only the CMLSpect/JCAMP readers are implemented, and the outputter is under development, please wait for a while. The document about spectrum will be published when all those works are done, :).

Currently the demo use a simple viewer widget for displaying the spectrum, and the interaction mode of the widget is mainly based on molecule. So many customizations may need to be applied later, or a new widget need to be created.

As the "JCAMP data... failed" error, from the file attached. it seems that the original data does not match the value validation rules. The first a few lines of the file are:

图片

The X values (first value on each line) are incremented with equal interval, but the Y value (the following values in the same line) counts are different in line1 and 2. To workaround that, you may need to erase the last 0 in the first data line manually. In the latest dist, a new global option is added to enable/disable the value validation in reading JCAMP data. You may also disable it before reading the file:

Kekule.globalOptions.IO.jcamp.enableXYDataValueCheck = false;

Please note that disabling this value check may lead to potential data errors in the spectrum.

registerme1963 commented 2 years ago

After deleting the last 0, it is now loading. Sorry to quote another competing product, is it possible to have zoom like https://web.chemdoodle.com/tutorial/spectrum-canvases/perspective-canvas and structure correlation like https://web.chemdoodle.com/tutorial/advanced/structurespectrum-correlations and also some documentation how to go about it it would be great for my organic spectroscopy teaching

partridgejiang commented 2 years ago

Thanks for the demos of ChemDoodle Web, :). Structure correlation has been implemented in internal structures and logic already (but not in the UI, :( ). The proper interaction modes for a spectrum is also quite straightforward, just need some time for the implementation...

registerme1963 commented 2 years ago

How do I implement this in moodle page?

partridgejiang commented 2 years ago

The Kekule-Moodle plugins are not updated with those spectrum functions yet, please wait for a while. By the way, the Viewer widget has been expanded to support interactions of spectrum (including zoom, moving, hot tracking, peak selecting, etc.) now. You may check the test/widgetTest/chemWidgets/spectrumViewerTest.html page in Spectra branch of this repository for a preview of it, :).

partridgejiang commented 2 years ago

A new widget (ChemWidget.SpectrumInspector) is now introduced to display the spectrum-molecule correlation as a supplement of ChemWidget.Viewer. Demo (http://partridgejiang.github.io/Kekule.js/demos/items/spectrum/spectrumInspector.html) and tutorial documents (http://partridgejiang.github.io/Kekule.js/documents/tutorial/content/spectra.html) have been published on the website as well. The Kekule-Moodle plugin has also been expanded with a new atto button to insert spectrum with HTML editors in Moodle.

partridgejiang commented 2 years ago

A new widget (ChemWidget.SpectrumInspector) is now introduced to display the spectrum-molecule correlation as a supplement of ChemWidget.Viewer. Demo (http://partridgejiang.github.io/Kekule.js/demos/items/spectrum/spectrumInspector.html) and tutorial documents (http://partridgejiang.github.io/Kekule.js/documents/tutorial/content/spectra.html) have been published on the website as well. The Kekule-Moodle plugin has also been expanded with a new atto button to insert spectrum with HTML editors in Moodle.

registerme1963 commented 2 years ago

Thank you very much. Let me try it out and get back to you.