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

Issues parsing nmredata file associated with bruker zip file #2647

Closed
2 tasks
CS76 opened this issue Aug 24, 2023 · 12 comments · Fixed by #2692
Closed
2 tasks

Issues parsing nmredata file associated with bruker zip file #2647

CS76 opened this issue Aug 24, 2023 · 12 comments · Fixed by #2692
Assignees

Comments

@CS76
Copy link
Collaborator

CS76 commented Aug 24, 2023

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.
@jobo322
Copy link
Member

jobo322 commented Sep 8, 2023

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:

  • The nmrRecord should have a .zip extension, folder or database
  • The nmredata file should have .nmredata.sdf?

@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
Copy link
Member

lpatiny commented Sep 8, 2023

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
Copy link
Member

lpatiny commented Sep 8, 2023

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
Copy link
Collaborator Author

CS76 commented Sep 8, 2023

@lpatiny this file is an export from NMRShiftDB

Regarding .sdf extension even though Pseudopelletierin_CDCl3_298.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
Copy link
Member

lpatiny commented Sep 8, 2023

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
Copy link
Member

lpatiny commented Sep 8, 2023

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
Copy link
Collaborator Author

CS76 commented Sep 8, 2023

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
Copy link
Member

jobo322 commented Sep 8, 2023

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
Copy link
Member

jobo322 commented Sep 18, 2023

Folder structure:

Screenshot 2023-08-24 at 14 41 31 Example zip file for testing: [Pseudopelletierin_CDCl3.zip](https://github.com/cheminfo/nmrium/files/12429562/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
Copy link
Member

jobo322 commented Sep 21, 2023

@CS76 could you check the functionality in the preview in

@lpatiny
Copy link
Member

lpatiny commented Sep 21, 2023

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

@CS76
Copy link
Collaborator Author

CS76 commented Oct 9, 2023

@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.

@github-project-automation github-project-automation bot moved this from 🟠 In Progress to 🟢 Done in NMR and Cheminfo projects organisation Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants