Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nmr-correlation

cheminfo7kMIT3.0.0TypeScript support: included

Build and manipulation of correlations from 1D and 2D NMR data

readme

nmr-correlation

NPM version npm download

This package provides methods to build correlation data from NMR spectra. The NMR dataset has to be already processed and given in a certain format (see below).

Mainly, this is done by a grouping of signals with same nuclei between 1D and 2D or 2D and 2D NMR spectra. Each group is then represented by one correlation.

If a molecular formula is given, then missing correlations will be added as placeholder to complete the list.

Another feature is to determine the number of attached protons by using information from DEPT 90/135 or multiplicity-edited HSQC.

Input

Spectra

  • array of 1D, 2D, DEPT 90/135 spectra, e.g. obtained by nmr-load-save
  • each spectrum has to be processed, e.g. via nmr-processing
  • declared type for spectra is
type Spectra = Array<Spectrum1D | Spectrum2D>;
  • further type definitions are available in src/types

Options

  • tolerances (must be given for each occurring atom type in spectra)
  • molecular formula (optional)

Values

  • optional, previously built correlations
  • useful to not override the following information if it is set to true in edited property:
    • hybridization, equivalence, protonsCount

Output

State

  • for each atom type with at least one correlation
  • current number of correlations
  • some error information according to a given molecular formula

Values

An array of correlations with following content:

  • link (array)
    • signal, axis (1D/2D signal and current axis which links to signals in another spectra)
    • match (indices of correlations with signal shift matches)
    • pseudo (whether this link is artificial)
    • some further meta information
  • attachment (contains indices of each attached correlation/atom)
  • protonsCount (array of possible numbers of attached protons)
  • equivalence (number of equivalences, default is 1)
  • hybridization (not set, except a CH3 group was detected)
  • pseudo (whether this is a placeholder, e.g. if molecular formula is given)
  • some further meta information, e.g. the group representing signal

Installation

$ npm i nmr-correlation

Usage

import { fromJCAMP } from 'nmr-parser';
import { buildCorrelationData } from 'nmr-correlation';

// parse spectra (symbolic example)
const data1H = fromJCAMP('1h.dx');
const data13C = fromJCAMP('13C.dx');
const dataHSQC = fromJCAMP('hsqc.dx');
const dataHMBC = fromJCAMP('hmbc.dx');
const dataCOSY = fromJCAMP('cosy.dx');
const dataDEPT90 = fromJCAMP('dept90.dx');
const dataDEPT135 = fromJCAMP('dept135.dx');

// process data (ranges/zones picking)
// ...
// put all the information together into specified format
// ...

// combine spectra into one array
const spectra = [
  data1H,
  data13C,
  dataHSQC,
  dataHMBC,
  dataCOSY,
  dataDEPT90,
  dataDEPT135,
];
// create options
const options = {
  tolerance: {
    C: 0.25,
    H: 0.02,
  },
  mf: 'C11H14N2O', // molecular formula
};
// build correlation data
const correlationData = buildCorrelationData(spectra, options);

License

MIT

changelog

Changelog

3.0.0 (2025-05-25)

⚠ BREAKING CHANGES

  • migrate to ESM (#50)

Code Refactoring

2.3.5 (2025-02-04)

Bug Fixes

2.3.4 (2025-02-04)

Bug Fixes

2.3.3 (2022-08-03)

Bug Fixes

2.3.2 (2022-05-13)

Bug Fixes

2.3.1 (2022-05-12)

Bug Fixes

2.3.0 (2022-05-11)

Features

  • allow setting of hetero atom equivalence (#37) (5f9cae2)

2.2.5 (2022-02-25)

Bug Fixes

  • update dependencies and workflows (9a61e43)

2.2.4 (2022-02-25)

Bug Fixes

2.2.3 (2022-02-25)

Bug Fixes

2.2.2 (2022-02-17)

Bug Fixes

2.2.1 (2022-02-17)

Bug Fixes

  • added eslint-plugin-import package (e5b134c)
  • use eslint-plugin-jest package (c25730c)

2.2.0 (2021-11-23)

Features

  • introduction of pathLength in 2D signals (33c7c46)

Bug Fixes

  • let pathLength.source be a flexible string (1eff24a)

2.1.4 (2021-11-19)

Bug Fixes

  • set "no-unresolved" to off in eslint (9b14c0d)

2.1.3 (2021-10-22)

Bug Fixes

  • wrong proton equivalence count when it is multiple assigned (c10fb31)

2.1.2 (2021-10-15)

Bug Fixes

  • delete correlations with empty link array after external movements (a5d6e9a)

2.1.1 (2021-10-15)

Bug Fixes

  • deletion of obsolete links in 1D too (da60776)
  • deletion of obsolete links to non-existing signals (c173249)
  • do not delete moved link with empty match array (aa7c8c5)
  • missing consideration of moved signals in addFromData1D (5986216)
  • remove correlations without any link (e8d5e6a)
  • removed unnecessary experiment type and id from correlation options (28ed3c4)
  • restorage of previously set correlation properties and possibilty to skip the addFromData method (3d3b81b)
  • using wrong index in atom types array in removeDeletedAndNotLinkedCorrelations (658cbe2)

2.1.0 (2021-09-10)

Features

2.0.3 (2021-09-10)

Bug Fixes

  • do not export input values (95b5c98)

2.0.2 (2021-09-10)

Bug Fixes

2.0.1 (2021-07-28)

Bug Fixes

2.0.0 (2021-07-26)

⚠ BREAKING CHANGES

  • use plural - signals instead of signal ranges instead range (#8)

Features

  • use plural - signals instead of signal ranges instead range (#8) (9424408)

1.3.3 (2021-06-02)

Bug Fixes

  • update of obsolete description (57d6a08)
  • wrong order of pseudo correlations (95af02a)

1.3.2 (2021-05-06)

Bug Fixes

1.3.1 (2021-05-03)

Bug Fixes

  • cheminfo-bot npm access (d6b5a1c)

1.3.0 (2021-05-03)

Features

  • added and configured jest for testing (c3344a0)
  • added method descriptions (580af80)
  • added test case for getAtomCount and getAtomTypeFromNucleus (a6bf82f)
  • added test for buildState (8990a47)
  • added test for buildValues, added test dataset (4346bdc)
  • added test for getCorrelationIndex (5948edf)
  • added test for isEditedHSQC (3c2b596)
  • added test for sortCorrelations (2874d0c)
  • added testing for checkMatch (715ad9c)
  • Added tests and method descriptions (bbd1121)
  • added tests for buildCorrelationData (3e424ad)
  • convert generateID to TypeScript (dab2fa4)
  • improved test for sortCorrelations (d4ffe86)

Bug Fixes

  • added .eslintcache to .gitignore (b203052)
  • avoid test failures through checking files in lib-esm (1dae371)
  • changed signalKindsToInclude to allowedSignalKinds (b50acf5)
  • compiler errors of missing modules (72f56d0)
  • ESlint fix (677df62)
  • ESlint fixes (18744f0)
  • handle empty string in getAtomTypeFromNucleus (d924514)
  • improvement of package description (ca8a685)
  • invalid access to signal property in sortCorrelations method (6e5a926)
  • possible wrong order from sortCorrelations (c82f858)
  • prevent from possible error through undefined value (c52fb58)
  • remove remaining pseudo correlation when unsetting the mf (0fcb478)
  • removed default export (262097a)
  • renamed file (e866b48)
  • replace old tsconfig file by newer one from master branch (2d83a61)
  • run of eslint-fix (72b5631)
  • spelling (6ac1e91)
  • string as id instead of number (8b31885)
  • typo in file name (67ea162)
  • use CorrelationSignal format instead of Signal1D (33b96a7)
  • wrong folder to ignore in prettier (7ec29bd)