cheminfo / chromatography

Tools for storing, search and analyze GC/MS spectra
https://cheminfo.github.io/chromatography
MIT License
9 stars 6 forks source link

Change of format #42

Open lpatiny opened 4 years ago

lpatiny commented 4 years ago

Today for series 2D we have

    [
      [
        [
          127.5, 83.7, 75.9, 63.9,
           55.9, 43.9, 39.9,   38,
           36.8,   36, 34.8, 31.9,
             29,   28,   18,   17,
           15.9, 13.9
        ],
        [
            58,  33, 227,   31,   38,
           948,  73, 451,   42, 1017,
           258, 905,  42, 1908, 5593,
          1444, 147,  60
        ]
      ],

An array (the time) of array (2 values, mass, intensity) of array (the mass values and the intensity values).

I would like to change this to

    [
      { 
       x :  [
          127.5, 83.7, 75.9, 63.9,
           55.9, 43.9, 39.9,   38,
           36.8,   36, 34.8, 31.9,
             29,   28,   18,   17,
           15.9, 13.9
        ],
       y : [
            58,  33, 227,   31,   38,
           948,  73, 451,   42, 1017,
           258, 905,  42, 1908, 5593,
          1444, 147,  60
        ],
      },

This will allow me to add a third parameter (third dimension) that is in this case the msms. We have indeed mass spectra of GC / MS / MS

This would be of course a major release and will also require major release of jcampconverter and mzdata.

@targos Is this ok for you ? @josoriom This should solve your problem as well.

targos commented 4 years ago

What does GC/MS/MS data look like?

lpatiny commented 4 years ago

You have our normal view with GC and MS but you can click on some of the MS peaks (the main peaks of the MS) and you get the corresponding mass spectrum of this mass peak.

targos commented 4 years ago

Wouldn't it be better to have a Series3D class? I don't object to changing the shape of the Series2D but that seems not directly related

targos commented 4 years ago

I'm not asking how it looks like in an interface, but what how is the data (you only showed how you want the data to be for GC/MS in the original post)

lpatiny commented 4 years ago

Indeed x/y object is not related to this problem.

Data is indeed Series3D

The format would look for 3D like:

  [
      { 
       x :  [
          127.5, 83.7, 75.9, 63.9,
           55.9, 43.9, 39.9,   38,
           36.8,   36, 34.8, 31.9,
             29,   28,   18,   17,
           15.9, 13.9
        ],
       y : [
            58,  33, 227,   31,   38,
           948,  73, 451,   42, 1017,
           258, 905,  42, 1908, 5593,
          1444, 147,  60
        ],
        ms: {
           data: [
              {x:[], y:[]},
         ]
      },

And therefore would be compatible with the functions of Series2D. There would be only this new ms property.