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

Allow creation of arbitrary zones #1359

Closed ReinerD closed 1 year ago

ReinerD commented 2 years ago

When working on complex materials (polymers, or in this example, modified vegetable oils), it's not always possible to assign each signal 1:1 to an atom. Defining arbitrary zones manually for assignment would be helpful, if not essential, in such cases. in the example here below image two instances of glycerol resonances can be distinguished (2 for the CH and 2 for each of the CH2 signals). Currently when defining a zone manually ((using shift), several zones are detected and created.
It would be nice making it possible to allow for the creation of arbitrary zones, i.e. without 'decomposition' into sub-zones (e.g. using alt-shift)

lpatiny commented 2 years ago

Good idea indeed and should be easy to implement.

Either ALT + SHIFT or just ALT.

What is the difference with the current implementation ?

Currenly when we draw a rectangle we will make a 'zone' picking in order to find all the zones in the selected area.

With this new feature we will consider that the user has drawn the correct area and that this area is equal to the zone.

jwist commented 2 years ago

Going in the same direction some composite peak in metabolic profile also requires manual zones creation that are then assigned to different atoms. image In this case we look at the choline headgroup of phospholipids of HDL and LDL fractions, that are arbitrarily divided into 3 areas with "high" correlation with LDL, HDL and H4PL. So, the same atom but in different subfraction of particles.

lpatiny commented 1 year ago

@hamed-musallam @jobo322 Why actually drawing a zone is not always arbitrary ?

lpatiny commented 1 year ago

In fact currently the behaviour of 2d zone picking is different from 1d range picking. In 1D when you draw a range your create ONE range.

In 2D when you draw a zone you make a kind of peak picking in the drawn area. I think this behaviour should be changed and when we draw a rectangle we draw a zone.

@ReinerD What do you think ?

ReinerD commented 1 year ago

The idea behind the concept of range/zone, I believe, was to define a region in the spectrum (1D or 2D) where the signals corresponding to a number of atoms are located, without having to absolutely attribute the atom to one particular signal/peak - this is especially useful when there's strong overlap or when the signals are broad (e.g. polymers). Hence, I think that the definition of a zone should always be arbitrary. Notice, however, the following: in a 1D range, multiple signals can be detected (each potentially composed of several peaks). A 2D range corresponding to 2 1D ranges, any peaks contained therein should correspond to peaks belonging to a 1D signal. Doing a 'signal picking' within the range might hence still be useful, provided these can then be attributed, if possible.

jobo322 commented 1 year ago

We could keep the peak2D picking with shift + drag click. Instead of create a zone for each cluster of peaks, the result (peaks) could we added into a zone that will contains signals and those signals has the clustered peaks.