cheminfo / nmrium

React component to display and process nuclear magnetic resonance (NMR) spectra.
https://docs.nmrium.org
MIT License
55 stars 25 forks source link

Issues parsing nmredata file associated with bruker zip file #2647

Closed CS76 closed 11 months ago

CS76 commented 1 year ago

Folder structure:

Screenshot 2023-08-24 at 14 41 31

Example zip file for testing: Pseudopelletierin_CDCl3.zip

jobo322 commented 1 year ago

Seems there is a confusion with respect of the structure of the nmrRecord. Currently, nmrium is looking for a file with extension .nmredata which file should be compressed (nmrRecord), we expand it and look for .sdf files that contains the nmredata information.

As I can see in the nmredata wiki:

@lpatiny, to support the mentioned folder structure above, I suggest to looks for .nmredata as the nmredata sdf file instead of the compressed nmrRecord (current behavior). But we should look for those .nmredata files at the begging and keep out the related items to avoid the duplication. Is it ok?

lpatiny commented 1 year ago

I will read again the original publication. What is strange at first is that the file Pseudopelletierin_CDCl3_298.0.nmredata do not reference the spectra that are in the zip but some link to the web and this seems suspicious.

lpatiny commented 1 year ago

The publication is actually not publicly available (you need to pay to get it). So we should rather base the discussions on http://nmredata.org/.

What I see in the provided zip file is that there is no '.sdf' file

image

@CS76 Can you fix your file ? Also did you test it with other softwares that read NMReData ?

I would expect that the '.sdf' file also provide an internal reference to the spectrum like:

Spectrum_Location=file:./nmr/10/1/pdata/1

Because the files are in the zip file but you are currently providing a link to the website > <NMREDATA_2D_1H_NJ_13C#3> Spectrum_Location=http://www.nmrshiftdb.org/download/NmrshiftdbServlet/60001120_H,C-ed. HSQC.zip?spectrumid=60001120&nmrshiftdbaction=exportspec&format=rawdata\

CS76 commented 1 year ago

@lpatiny this file is an export from NMRShiftDB

Regarding .sdf extension even though Pseudopelletierin_CDCl3298.0.nmredata doesn't have a .sdf in its extension it is a valid SDF file with all the NMREDATA tags. Should NMRium be looking at the contents of the file if a file .nmredata extension is available?

Regarding the spectra location, since the file is an export from nmrshift db the SDF probably the location is referencing the remote server and this can/will be fixed.

lpatiny commented 1 year ago

Should NMRium be looking at the contents of the file if a file .nmredata extension is available?

If it is in the specification of the format yes for sure. Can you point me where it is written in the specification that the extension can either be .sdf or .nmredata ?

For the location please upload the new file when it is fixed.

lpatiny commented 1 year ago

On the official website we have some examples: http://nmredata.org/wiki/Examples and it seems the file could be in many locations.

image

However this does not appear obvious reading 'Link to the spectra' in the page: http://nmredata.org/wiki/NMReDATA_tag_format#.3CNMREDATA_1D_1H.3E. It is written a link to the spectrum

@djeanner Could you comment on this ? Is many 'Spectrum_Location' allowed ?

@jobo322 Could you check that we can correctly read the official example:

compound1.zip

I think loading the files should be done like today but we need to analyse the .sdf files in order to create the links and assignments. We may need some refactoring of https://github.com/cheminfo/nmredata/ and maybe some utilities to link assignment to spectra.

CS76 commented 1 year ago

Should NMRium be looking at the contents of the file if a file .nmredata extension is available?

I am not implying that this is part of the specifications, but earlier, NMRium failed to load the spectra when the zip folder has a file with .nmredata extension without .sdf. My suggestion is to make sure that we read the contents of the file if the extension implies it's a nmredata file. But thanks to @hamed-musallam with the recent fix, zip file loading works now.

For the location, please upload the new file when it is fixed.

As I mentioned, this record is from NMRShiftDB and in the following document https://kups.ub.uni-koeln.de/8163/4/MRC_main_V25.pdf

It does specify the link to a web-accessible downloadable zip file. If the relative paths are required for linking assignments to spectra we can update those.

Screenshot 2023-09-08 at 13 47 21
jobo322 commented 1 year ago

On the official website we have some examples: http://nmredata.org/wiki/Examples and it seems the file could be in many locations.

image

However this does not appear obvious reading 'Link to the spectra' in the page: http://nmredata.org/wiki/NMReDATA_tag_format#.3CNMREDATA_1D_1H.3E. It is written a link to the spectrum

@djeanner Could you comment on this ? Is many 'Spectrum_Location' allowed ?

@jobo322 Could you check that we can correctly read the official example:

compound1.zip

I think loading the files should be done like today but we need to analyse the .sdf files in order to create the links and assignments. We may need some refactoring of https://github.com/cheminfo/nmredata/ and maybe some utilities to link assignment to spectra.

yes, it is loading with a small fix on nmredata package, seems the parseSDF package returns the nmredata version as a number and it was not expected.

also is it possible to have more than one Spectrum_Location tag, I will check how our package response in this situation.

jobo322 commented 1 year ago

Folder structure:

Screenshot 2023-08-24 at 14 41 31

Example zip file for testing: Pseudopelletierin_CDCl3.zip

  • [ ] nmrium is failing to load zip file if it contains nmredata file associated with the zip.
  • [ ] nmredata file in the folder contains spectral assignments and other metadata associated with the spectra. Currently, nmrium doesn't process the nmredata; it's totally ignored. If the nmredata file is dragged and dropped after loading spectra, then only structure details are imported; the rest of the meta data is ignored.

@CS76 in order to link the information inside of the .nmredata to the local spectra in the folder, the Spectrum_Location in the .nmredata should has a relative path to the experiment and it is not the case.

image

In the case that we support a .nmredata that is a SDF file like this, nmr-load-save will load the spectra in the folder and additionally the spectra dowloaded by the .nmredata file.

An example of the actual format of nmredata that nmrium supports is: menthol_1D_1H_assigned_J.zip

jobo322 commented 1 year ago

@CS76 could you check the functionality in the preview in

lpatiny commented 1 year ago

@CS76 Can you provide a fixed NMReData file in which Spectrum_Location points to a relative file or folder included in the zip.

CS76 commented 1 year ago

@jobo322 @lpatiny I'm still waiting for the valid nmredata records from NMRShiftDB. I will test this and update you once I have the data from NMRShiftDB.