nmr-processing 9.9.2 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assignment/get13CAssignments.js +7 -4
- package/lib/assignment/get13CAssignments.js.map +1 -1
- package/lib/assignment/get1HAssignments.js +7 -5
- package/lib/assignment/get1HAssignments.js.map +1 -1
- package/lib/assignment/utils/generalAssignment/buildAssignments.d.ts +3 -1
- package/lib/assignment/utils/generalAssignment/buildAssignments.js +18 -7
- package/lib/assignment/utils/generalAssignment/buildAssignments.js.map +1 -1
- package/lib/index.d.ts +2 -7
- package/lib/index.js +2 -7
- package/lib/index.js.map +1 -1
- package/lib/prediction/GroupDiastereotopicAtomIDs.d.ts +6 -0
- package/lib/prediction/GroupDiastereotopicAtomIDs.js +3 -0
- package/lib/prediction/GroupDiastereotopicAtomIDs.js.map +1 -0
- package/lib/prediction/Prediction1D.d.ts +2 -7
- package/lib/prediction/Prediction2D.d.ts +2 -7
- package/lib/prediction/PredictionBase1D.d.ts +8 -0
- package/lib/prediction/PredictionBase1D.js +3 -0
- package/lib/prediction/PredictionBase1D.js.map +1 -0
- package/lib/prediction/PredictionBase2D.d.ts +8 -0
- package/lib/prediction/PredictionBase2D.js +3 -0
- package/lib/prediction/PredictionBase2D.js.map +1 -0
- package/lib/prediction/predict.d.ts +55 -0
- package/lib/prediction/predict.js +113 -0
- package/lib/prediction/predict.js.map +1 -0
- package/lib/prediction/predictCOSY.d.ts +15 -13
- package/lib/prediction/predictCOSY.js +3 -6
- package/lib/prediction/predictCOSY.js.map +1 -1
- package/lib/prediction/predictCarbon.d.ts +12 -4
- package/lib/prediction/predictCarbon.js +10 -16
- package/lib/prediction/predictCarbon.js.map +1 -1
- package/lib/prediction/predictHMBC.d.ts +16 -25
- package/lib/prediction/predictHMBC.js +3 -7
- package/lib/prediction/predictHMBC.js.map +1 -1
- package/lib/prediction/predictHSQC.d.ts +16 -25
- package/lib/prediction/predictHSQC.js +3 -7
- package/lib/prediction/predictHSQC.js.map +1 -1
- package/lib/prediction/predictProton.d.ts +7 -4
- package/lib/prediction/predictProton.js +8 -21
- package/lib/prediction/predictProton.js.map +1 -1
- package/lib/prediction/{predictAllSpectra.d.ts → predictSpectra.d.ts} +1 -1
- package/lib/prediction/{predictAllSpectra.js → predictSpectra.js} +7 -5
- package/lib/prediction/predictSpectra.js.map +1 -0
- package/lib/prediction/utils/fetchPrediction.d.ts +2 -3
- package/lib/prediction/utils/fetchPrediction.js +12 -7
- package/lib/prediction/utils/fetchPrediction.js.map +1 -1
- package/lib/prediction/utils/getFilteredIDiaIDs.d.ts +4 -13
- package/lib/prediction/utils/getFilteredIDiaIDs.js +7 -20
- package/lib/prediction/utils/getFilteredIDiaIDs.js.map +1 -1
- package/lib/prediction/utils/isMolfileNotEmpty.d.ts +1 -0
- package/lib/prediction/utils/isMolfileNotEmpty.js +12 -0
- package/lib/prediction/utils/isMolfileNotEmpty.js.map +1 -0
- package/lib/prediction/utils/predict2D.d.ts +13 -16
- package/lib/prediction/utils/predict2D.js +41 -18
- package/lib/prediction/utils/predict2D.js.map +1 -1
- package/lib/prediction/utils/queryByHOSE.d.ts +1 -2
- package/lib/prediction/utils/queryByHOSE.js.map +1 -1
- package/lib/prediction/utils/shouldPredict.d.ts +2 -0
- package/lib/prediction/utils/shouldPredict.js +15 -0
- package/lib/prediction/utils/shouldPredict.js.map +1 -0
- package/lib-esm/assignment/get13CAssignments.js +7 -4
- package/lib-esm/assignment/get13CAssignments.js.map +1 -1
- package/lib-esm/assignment/get1HAssignments.js +7 -5
- package/lib-esm/assignment/get1HAssignments.js.map +1 -1
- package/lib-esm/assignment/utils/generalAssignment/buildAssignments.js +18 -7
- package/lib-esm/assignment/utils/generalAssignment/buildAssignments.js.map +1 -1
- package/lib-esm/index.js +2 -7
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/prediction/GroupDiastereotopicAtomIDs.js +2 -0
- package/lib-esm/prediction/GroupDiastereotopicAtomIDs.js.map +1 -0
- package/lib-esm/prediction/PredictionBase1D.js +2 -0
- package/lib-esm/prediction/PredictionBase1D.js.map +1 -0
- package/lib-esm/prediction/PredictionBase2D.js +2 -0
- package/lib-esm/prediction/PredictionBase2D.js.map +1 -0
- package/lib-esm/prediction/predict.js +109 -0
- package/lib-esm/prediction/predict.js.map +1 -0
- package/lib-esm/prediction/predictCOSY.js +3 -6
- package/lib-esm/prediction/predictCOSY.js.map +1 -1
- package/lib-esm/prediction/predictCarbon.js +10 -16
- package/lib-esm/prediction/predictCarbon.js.map +1 -1
- package/lib-esm/prediction/predictHMBC.js +3 -7
- package/lib-esm/prediction/predictHMBC.js.map +1 -1
- package/lib-esm/prediction/predictHSQC.js +3 -7
- package/lib-esm/prediction/predictHSQC.js.map +1 -1
- package/lib-esm/prediction/predictProton.js +8 -21
- package/lib-esm/prediction/predictProton.js.map +1 -1
- package/lib-esm/prediction/{predictAllSpectra.js → predictSpectra.js} +7 -5
- package/lib-esm/prediction/predictSpectra.js.map +1 -0
- package/lib-esm/prediction/utils/fetchPrediction.js +12 -7
- package/lib-esm/prediction/utils/fetchPrediction.js.map +1 -1
- package/lib-esm/prediction/utils/getFilteredIDiaIDs.js +7 -20
- package/lib-esm/prediction/utils/getFilteredIDiaIDs.js.map +1 -1
- package/lib-esm/prediction/utils/isMolfileNotEmpty.js +8 -0
- package/lib-esm/prediction/utils/isMolfileNotEmpty.js.map +1 -0
- package/lib-esm/prediction/utils/predict2D.js +41 -18
- package/lib-esm/prediction/utils/predict2D.js.map +1 -1
- package/lib-esm/prediction/utils/queryByHOSE.js.map +1 -1
- package/lib-esm/prediction/utils/shouldPredict.js +11 -0
- package/lib-esm/prediction/utils/shouldPredict.js.map +1 -0
- package/package.json +2 -3
- package/src/assignment/get13CAssignments.ts +9 -8
- package/src/assignment/get1HAssignments.ts +8 -9
- package/src/assignment/utils/generalAssignment/buildAssignments.ts +28 -12
- package/src/index.ts +3 -8
- package/src/prediction/GroupDiastereotopicAtomIDs.ts +6 -0
- package/src/prediction/Prediction1D.ts +2 -7
- package/src/prediction/Prediction2D.ts +2 -7
- package/src/prediction/PredictionBase1D.ts +9 -0
- package/src/prediction/PredictionBase2D.ts +9 -0
- package/src/prediction/predict.ts +201 -0
- package/src/prediction/predictCOSY.ts +18 -18
- package/src/prediction/predictCarbon.ts +28 -26
- package/src/prediction/predictHMBC.ts +17 -27
- package/src/prediction/predictHSQC.ts +18 -25
- package/src/prediction/predictProton.ts +16 -30
- package/src/prediction/{predictAllSpectra.ts → predictSpectra.ts} +6 -4
- package/src/prediction/utils/fetchPrediction.ts +15 -10
- package/src/prediction/utils/getFilteredIDiaIDs.ts +16 -49
- package/src/prediction/utils/isMolfileNotEmpty.ts +8 -0
- package/src/prediction/utils/predict2D.ts +69 -69
- package/src/prediction/utils/queryByHOSE.ts +2 -2
- package/src/prediction/utils/shouldPredict.ts +14 -0
- package/lib/prediction/predictAll.d.ts +0 -64
- package/lib/prediction/predictAll.js +0 -82
- package/lib/prediction/predictAll.js.map +0 -1
- package/lib/prediction/predictAllSpectra.js.map +0 -1
- package/lib/prediction/utils/getPredictions.d.ts +0 -4
- package/lib/prediction/utils/getPredictions.js +0 -18
- package/lib/prediction/utils/getPredictions.js.map +0 -1
- package/lib-esm/prediction/predictAll.js +0 -78
- package/lib-esm/prediction/predictAll.js.map +0 -1
- package/lib-esm/prediction/predictAllSpectra.js.map +0 -1
- package/lib-esm/prediction/utils/getPredictions.js +0 -14
- package/lib-esm/prediction/utils/getPredictions.js.map +0 -1
- package/src/openchemlib-utils.d.ts +0 -167
- package/src/prediction/predictAll.ts +0 -157
- package/src/prediction/utils/getPredictions.ts +0 -24
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Logger } from 'cheminfo-types';
|
|
2
|
-
import type { Molecule } from 'openchemlib/full';
|
|
3
|
-
import type { Prediction1D } from './Prediction1D';
|
|
4
|
-
import { PredictCarbonOptions } from './predictCarbon';
|
|
5
|
-
import { PredictProtonOptions } from './predictProton';
|
|
6
|
-
import type { Predictor } from './utils/predict2D';
|
|
7
|
-
export interface PredictAllOptions {
|
|
8
|
-
/**
|
|
9
|
-
* maximum number of bonds to take into account.
|
|
10
|
-
* @default 1
|
|
11
|
-
*/
|
|
12
|
-
maxLength?: number;
|
|
13
|
-
/**
|
|
14
|
-
* minimum number of bonds to take into account
|
|
15
|
-
* @default 1
|
|
16
|
-
*/
|
|
17
|
-
minLength?: number;
|
|
18
|
-
/**
|
|
19
|
-
* mono dimensional predictors. The object should has properties with name
|
|
20
|
-
* equal to "H" and "C".
|
|
21
|
-
*/
|
|
22
|
-
predictor?: {
|
|
23
|
-
H?: Predictor;
|
|
24
|
-
C?: Predictor;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
28
|
-
* The object should has properties with name equal to "H" and "C".
|
|
29
|
-
*/
|
|
30
|
-
predictOptions?: {
|
|
31
|
-
H?: PredictProtonOptions;
|
|
32
|
-
C?: PredictCarbonOptions;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* signals with euclidean distance in ppm less than this it will
|
|
36
|
-
* joined into a zone.
|
|
37
|
-
* @default {H:0.05,C:0.5}
|
|
38
|
-
*/
|
|
39
|
-
joinDistance?: {
|
|
40
|
-
H: number;
|
|
41
|
-
C: number;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
45
|
-
* The object should has properties with name equal to "H" and "C".
|
|
46
|
-
* the value of each prediction should be similar that predictProton and predictCarbon.
|
|
47
|
-
*/
|
|
48
|
-
predictions?: {
|
|
49
|
-
[key: string]: Prediction1D | undefined;
|
|
50
|
-
H?: Prediction1D;
|
|
51
|
-
C?: Prediction1D;
|
|
52
|
-
};
|
|
53
|
-
logger?: Logger;
|
|
54
|
-
}
|
|
55
|
-
export interface PredictedAll {
|
|
56
|
-
molfile: string;
|
|
57
|
-
diaIDs: string[];
|
|
58
|
-
spectra: Record<string, any>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
62
|
-
* @returns {Promise<object>} - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
|
|
63
|
-
*/
|
|
64
|
-
export declare function predictAll(molecule: Molecule, options?: PredictAllOptions): Promise<PredictedAll>;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.predictAll = void 0;
|
|
4
|
-
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
5
|
-
const predictCOSY_1 = require("./predictCOSY");
|
|
6
|
-
const predictCarbon_1 = require("./predictCarbon");
|
|
7
|
-
const predictHMBC_1 = require("./predictHMBC");
|
|
8
|
-
const predictHSQC_1 = require("./predictHSQC");
|
|
9
|
-
const predictProton_1 = require("./predictProton");
|
|
10
|
-
const getPredictions_1 = require("./utils/getPredictions");
|
|
11
|
-
/**
|
|
12
|
-
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
13
|
-
* @returns {Promise<object>} - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
|
|
14
|
-
*/
|
|
15
|
-
async function predictAll(molecule, options = {}) {
|
|
16
|
-
const { logger, predictor = { H: predictProton_1.predictProton, C: predictCarbon_1.predictCarbon }, joinDistance = { H: 0.05, C: 0.5 }, predictOptions = {}, } = options;
|
|
17
|
-
const diaIDs = (0, openchemlib_utils_1.getDiastereotopicAtomIDs)(molecule);
|
|
18
|
-
let { predictions } = options;
|
|
19
|
-
const protonPrediction = await (0, getPredictions_1.getPredictions)('H', molecule, predictOptions, predictor, predictions);
|
|
20
|
-
const carbonPrediction = await (0, getPredictions_1.getPredictions)('C', molecule, predictOptions, predictor, predictions);
|
|
21
|
-
if (!protonPrediction || !carbonPrediction) {
|
|
22
|
-
throw new Error('predictions are not availaible');
|
|
23
|
-
}
|
|
24
|
-
const spectra = {};
|
|
25
|
-
if (check1DPrediction(protonPrediction)) {
|
|
26
|
-
spectra.proton = protonPrediction;
|
|
27
|
-
}
|
|
28
|
-
if (check1DPrediction(carbonPrediction)) {
|
|
29
|
-
spectra.carbon = carbonPrediction;
|
|
30
|
-
}
|
|
31
|
-
const { molfile } = protonPrediction;
|
|
32
|
-
predictions = {
|
|
33
|
-
H: protonPrediction,
|
|
34
|
-
C: carbonPrediction,
|
|
35
|
-
};
|
|
36
|
-
if (spectra.proton) {
|
|
37
|
-
spectra.cosy = await (0, predictCOSY_1.predictCOSY)(molecule, {
|
|
38
|
-
predictions,
|
|
39
|
-
joinDistance,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else if (logger) {
|
|
43
|
-
logger.warn('Proton prediction is missing so COSY could not be generated.');
|
|
44
|
-
}
|
|
45
|
-
if (spectra.carbon && spectra.proton) {
|
|
46
|
-
spectra.hsqc = await (0, predictHSQC_1.predictHSQC)(molecule, {
|
|
47
|
-
predictions,
|
|
48
|
-
joinDistance,
|
|
49
|
-
});
|
|
50
|
-
spectra.hmbc = await (0, predictHMBC_1.predictHMBC)(molecule, {
|
|
51
|
-
predictions,
|
|
52
|
-
joinDistance,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else if (logger) {
|
|
56
|
-
logger.warn('Carbon and / or proton prediction is missing so HSQC and HMBC could not be generated.');
|
|
57
|
-
}
|
|
58
|
-
for (const key in spectra) {
|
|
59
|
-
delete spectra[key].molfile;
|
|
60
|
-
delete spectra[key].diaIDs;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
molfile,
|
|
64
|
-
diaIDs,
|
|
65
|
-
spectra,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
exports.predictAll = predictAll;
|
|
69
|
-
function check1DPrediction(prediction) {
|
|
70
|
-
if (!prediction)
|
|
71
|
-
return false;
|
|
72
|
-
if (prediction.ranges.length === 0)
|
|
73
|
-
return false;
|
|
74
|
-
const { signals, diaIDs } = prediction;
|
|
75
|
-
for (const signal of signals) {
|
|
76
|
-
const isCorrect = signal.diaIDs?.every((diaID) => diaIDs.includes(diaID));
|
|
77
|
-
if (!isCorrect)
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=predictAll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"predictAll.js","sourceRoot":"","sources":["../../src/prediction/predictAll.ts"],"names":[],"mappings":";;;AAEA,yDAA6D;AAG7D,+CAA4C;AAC5C,mDAAsE;AACtE,+CAA4C;AAC5C,+CAA4C;AAC5C,mDAAsE;AACtE,2DAAwD;AAgDxD;;;GAGG;AACI,KAAK,UAAU,UAAU,CAC9B,QAAkB,EAClB,UAA6B,EAAE;IAE/B,MAAM,EACJ,MAAM,EACN,SAAS,GAAG,EAAE,CAAC,EAAE,6BAAa,EAAE,CAAC,EAAE,6BAAa,EAAE,EAClD,YAAY,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAClC,cAAc,GAAG,EAAE,GACpB,GAAG,OAAO,CAAC;IAEZ,MAAM,MAAM,GAAG,IAAA,4CAAwB,EAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAE9B,MAAM,gBAAgB,GAAG,MAAM,IAAA,+BAAc,EAC3C,GAAG,EACH,QAAQ,EACR,cAAc,EACd,SAAS,EACT,WAAW,CACZ,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAM,IAAA,+BAAc,EAC3C,GAAG,EACH,QAAQ,EACR,cAAc,EACd,SAAS,EACT,WAAW,CACZ,CAAC;IAEF,IAAI,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,EAAE;QAC1C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IAED,MAAM,OAAO,G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B,SAAS;SACV,CAAC,EAAE,CAAC;KACN;AACH,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Molecule } from 'openchemlib/full';
|
|
2
|
-
import type { Prediction1D } from '../Prediction1D';
|
|
3
|
-
import type { Predictions, PredictOptions, Predictors } from './predict2D';
|
|
4
|
-
export declare function getPredictions(key: string, molecule: Molecule, predictOptions: PredictOptions, predictor?: Predictors, predictions?: Predictions): Promise<Prediction1D | undefined>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPredictions = void 0;
|
|
4
|
-
async function getPredictions(key, molecule, predictOptions, predictor, predictions) {
|
|
5
|
-
let prediction;
|
|
6
|
-
if (predictions?.[key]) {
|
|
7
|
-
prediction = predictions[key];
|
|
8
|
-
}
|
|
9
|
-
else if (predictor) {
|
|
10
|
-
const fromPredictor = predictor[key];
|
|
11
|
-
prediction = fromPredictor
|
|
12
|
-
? await fromPredictor(molecule, predictOptions[key])
|
|
13
|
-
: undefined;
|
|
14
|
-
}
|
|
15
|
-
return prediction;
|
|
16
|
-
}
|
|
17
|
-
exports.getPredictions = getPredictions;
|
|
18
|
-
//# sourceMappingURL=getPredictions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPredictions.js","sourceRoot":"","sources":["../../../src/prediction/utils/getPredictions.ts"],"names":[],"mappings":";;;AAMO,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,QAAkB,EAClB,cAA8B,EAC9B,SAAsB,EACtB,WAAyB;IAEzB,IAAI,UAAoC,CAAC;IACzC,IAAI,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE;QACtB,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;KAC/B;SAAM,IAAI,SAAS,EAAE;QACpB,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QACrC,UAAU,GAAG,aAAa;YACxB,CAAC,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;YACpD,CAAC,CAAC,SAAS,CAAC;KACf;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAjBD,wCAiBC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { getDiastereotopicAtomIDs } from 'openchemlib-utils';
|
|
2
|
-
import { predictCOSY } from './predictCOSY';
|
|
3
|
-
import { predictCarbon } from './predictCarbon';
|
|
4
|
-
import { predictHMBC } from './predictHMBC';
|
|
5
|
-
import { predictHSQC } from './predictHSQC';
|
|
6
|
-
import { predictProton } from './predictProton';
|
|
7
|
-
import { getPredictions } from './utils/getPredictions';
|
|
8
|
-
/**
|
|
9
|
-
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
10
|
-
* @returns {Promise<object>} - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
|
|
11
|
-
*/
|
|
12
|
-
export async function predictAll(molecule, options = {}) {
|
|
13
|
-
const { logger, predictor = { H: predictProton, C: predictCarbon }, joinDistance = { H: 0.05, C: 0.5 }, predictOptions = {}, } = options;
|
|
14
|
-
const diaIDs = getDiastereotopicAtomIDs(molecule);
|
|
15
|
-
let { predictions } = options;
|
|
16
|
-
const protonPrediction = await getPredictions('H', molecule, predictOptions, predictor, predictions);
|
|
17
|
-
const carbonPrediction = await getPredictions('C', molecule, predictOptions, predictor, predictions);
|
|
18
|
-
if (!protonPrediction || !carbonPrediction) {
|
|
19
|
-
throw new Error('predictions are not availaible');
|
|
20
|
-
}
|
|
21
|
-
const spectra = {};
|
|
22
|
-
if (check1DPrediction(protonPrediction)) {
|
|
23
|
-
spectra.proton = protonPrediction;
|
|
24
|
-
}
|
|
25
|
-
if (check1DPrediction(carbonPrediction)) {
|
|
26
|
-
spectra.carbon = carbonPrediction;
|
|
27
|
-
}
|
|
28
|
-
const { molfile } = protonPrediction;
|
|
29
|
-
predictions = {
|
|
30
|
-
H: protonPrediction,
|
|
31
|
-
C: carbonPrediction,
|
|
32
|
-
};
|
|
33
|
-
if (spectra.proton) {
|
|
34
|
-
spectra.cosy = await predictCOSY(molecule, {
|
|
35
|
-
predictions,
|
|
36
|
-
joinDistance,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else if (logger) {
|
|
40
|
-
logger.warn('Proton prediction is missing so COSY could not be generated.');
|
|
41
|
-
}
|
|
42
|
-
if (spectra.carbon && spectra.proton) {
|
|
43
|
-
spectra.hsqc = await predictHSQC(molecule, {
|
|
44
|
-
predictions,
|
|
45
|
-
joinDistance,
|
|
46
|
-
});
|
|
47
|
-
spectra.hmbc = await predictHMBC(molecule, {
|
|
48
|
-
predictions,
|
|
49
|
-
joinDistance,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else if (logger) {
|
|
53
|
-
logger.warn('Carbon and / or proton prediction is missing so HSQC and HMBC could not be generated.');
|
|
54
|
-
}
|
|
55
|
-
for (const key in spectra) {
|
|
56
|
-
delete spectra[key].molfile;
|
|
57
|
-
delete spectra[key].diaIDs;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
molfile,
|
|
61
|
-
diaIDs,
|
|
62
|
-
spectra,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function check1DPrediction(prediction) {
|
|
66
|
-
if (!prediction)
|
|
67
|
-
return false;
|
|
68
|
-
if (prediction.ranges.length === 0)
|
|
69
|
-
return false;
|
|
70
|
-
const { signals, diaIDs } = prediction;
|
|
71
|
-
for (const signal of signals) {
|
|
72
|
-
const isCorrect = signal.diaIDs?.every((diaID) => diaIDs.includes(diaID));
|
|
73
|
-
if (!isCorrect)
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=predictAll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"predictAll.js","sourceRoot":"","sources":["../../src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,CAAC;KACN;AACH,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export async function getPredictions(key, molecule, predictOptions, predictor, predictions) {
|
|
2
|
-
let prediction;
|
|
3
|
-
if (predictions?.[key]) {
|
|
4
|
-
prediction = predictions[key];
|
|
5
|
-
}
|
|
6
|
-
else if (predictor) {
|
|
7
|
-
const fromPredictor = predictor[key];
|
|
8
|
-
prediction = fromPredictor
|
|
9
|
-
? await fromPredictor(molecule, predictOptions[key])
|
|
10
|
-
: undefined;
|
|
11
|
-
}
|
|
12
|
-
return prediction;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=getPredictions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPredictions.js","sourceRoot":"","sources":["../../../src/prediction/utils/getPredictions.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,QAAkB,EAClB,cAA8B,EAC9B,SAAsB,EACtB,WAAyB;IAEzB,IAAI,UAAoC,CAAC;IACzC,IAAI,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE;QACtB,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;KAC/B;SAAM,IAAI,SAAS,EAAE;QACpB,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QACrC,UAAU,GAAG,aAAa;YACxB,CAAC,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;YACpD,CAAC,CAAC,SAAS,CAAC;KACf;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
declare module 'openchemlib-utils' {
|
|
2
|
-
import type { Molecule } from 'openchemlib/full';
|
|
3
|
-
|
|
4
|
-
export interface GroupDiastereotopicAtomIDs {
|
|
5
|
-
counter: number;
|
|
6
|
-
atoms: number[];
|
|
7
|
-
oclID: string;
|
|
8
|
-
atomLabel: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type GroupedDiastereotopicAtomIDs = GroupDiastereotopicAtomIDs[];
|
|
12
|
-
function getGroupedDiastereotopicAtomIDs(
|
|
13
|
-
molecule: Molecule,
|
|
14
|
-
options?: { atomLabel: string },
|
|
15
|
-
): GroupedDiastereotopicAtomIDs;
|
|
16
|
-
|
|
17
|
-
interface GetHoseCodesForAtomOptions {
|
|
18
|
-
minSphereSize?: number;
|
|
19
|
-
maxSphereSize?: number;
|
|
20
|
-
kind?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Specify is the atom is already tagged
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
isTagged?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type GetHoseCodesFromDiastereotopicIDOptions = GetHoseCodesForAtomOptions;
|
|
29
|
-
|
|
30
|
-
function getHoseCodesFromDiastereotopicID(
|
|
31
|
-
molecule: Molecule,
|
|
32
|
-
options?: GetHoseCodesFromDiastereotopicIDOptions,
|
|
33
|
-
): string[];
|
|
34
|
-
|
|
35
|
-
function getHoseCodesForAtom(
|
|
36
|
-
originalMolecule: Molecule,
|
|
37
|
-
rootAtom: number,
|
|
38
|
-
options: GetHoseCodesForAtomOptions,
|
|
39
|
-
): string[];
|
|
40
|
-
|
|
41
|
-
function ensureHeterotopicChiralBonds(molecule: Molecule): Molecule;
|
|
42
|
-
|
|
43
|
-
export interface GetPathsInfoOptions {
|
|
44
|
-
fromLabel?: string;
|
|
45
|
-
toLabel?: string;
|
|
46
|
-
minLength?: number;
|
|
47
|
-
maxLength?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface PathInfo extends AtomInfo {
|
|
51
|
-
paths: HoseCodesForPath[];
|
|
52
|
-
}
|
|
53
|
-
function getPathsInfo(
|
|
54
|
-
molecule: Molecule,
|
|
55
|
-
options?: GetPathsInfoOptions,
|
|
56
|
-
): PathInfo[];
|
|
57
|
-
|
|
58
|
-
export interface AtomInfo {
|
|
59
|
-
oclID: string;
|
|
60
|
-
x: number;
|
|
61
|
-
y: number;
|
|
62
|
-
z: number;
|
|
63
|
-
abnormalValence: number;
|
|
64
|
-
charge: number;
|
|
65
|
-
cipParity: number;
|
|
66
|
-
color: number;
|
|
67
|
-
customLabel: string;
|
|
68
|
-
atomicNo: number;
|
|
69
|
-
label: string;
|
|
70
|
-
mass: number;
|
|
71
|
-
radical: number;
|
|
72
|
-
ringBondCount: number;
|
|
73
|
-
ringSize: number;
|
|
74
|
-
allHydrogens: number;
|
|
75
|
-
connAtoms: number;
|
|
76
|
-
allConnAtoms: number;
|
|
77
|
-
implicitHydrogens: number;
|
|
78
|
-
isAromatic: boolean;
|
|
79
|
-
isAllylic: boolean;
|
|
80
|
-
isStereoCenter: boolean;
|
|
81
|
-
isRing: boolean;
|
|
82
|
-
isSmallRing: boolean;
|
|
83
|
-
isStabilized: boolean;
|
|
84
|
-
extra: {
|
|
85
|
-
singleBonds: number;
|
|
86
|
-
doubleBonds: number;
|
|
87
|
-
tripleBonds: number;
|
|
88
|
-
aromaticBonds: number;
|
|
89
|
-
totalBonds: number;
|
|
90
|
-
labileHydrogen: boolean;
|
|
91
|
-
hydrogenOnAtomicNo: number;
|
|
92
|
-
/**
|
|
93
|
-
* should be 1 (sp), 2 (sp2) or 3 (sp3)
|
|
94
|
-
*/
|
|
95
|
-
cnoHybridation: number;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
type AtomsInfo = AtomInfo[];
|
|
99
|
-
function getAtomsInfo(molecule: Molecule): AtomsInfo;
|
|
100
|
-
|
|
101
|
-
export interface Hose {
|
|
102
|
-
sphere: number;
|
|
103
|
-
oclID: string;
|
|
104
|
-
}
|
|
105
|
-
type Hoses = Hose[];
|
|
106
|
-
|
|
107
|
-
export interface HoseCodesForPath {
|
|
108
|
-
atoms: number[];
|
|
109
|
-
from: number;
|
|
110
|
-
to: number;
|
|
111
|
-
torsion?: number;
|
|
112
|
-
hoses: Hoses;
|
|
113
|
-
length: number;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function getHoseCodesForPath(
|
|
117
|
-
molecule: Molecule,
|
|
118
|
-
from: string,
|
|
119
|
-
to: string,
|
|
120
|
-
maxLength: number,
|
|
121
|
-
): HoseCodesForPath;
|
|
122
|
-
|
|
123
|
-
export interface GetConnectivityMatrixOptions {
|
|
124
|
-
/**
|
|
125
|
-
* get the path length between atoms
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
pathLength?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* set the nominal mass of the atoms on diagonal
|
|
131
|
-
* @default false
|
|
132
|
-
*/
|
|
133
|
-
mass?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* set the atomic number of the atom on diagonal
|
|
136
|
-
* @default false;
|
|
137
|
-
*/
|
|
138
|
-
atomicNo?: boolean;
|
|
139
|
-
/**
|
|
140
|
-
* set the atomic number of the atom on diagonal
|
|
141
|
-
* @default false
|
|
142
|
-
*/
|
|
143
|
-
negativeAtomicNo?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* set 1, 2 or 3 depending if single, double or triple bond
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
std?: boolean | number;
|
|
149
|
-
/**
|
|
150
|
-
* set 1, 2, 3 or 4 depending if single, double, triple or aromatic bond
|
|
151
|
-
* @default false;
|
|
152
|
-
*/
|
|
153
|
-
stda?: boolean | number;
|
|
154
|
-
}
|
|
155
|
-
function getConnectivityMatrix(
|
|
156
|
-
molecule: Molecule,
|
|
157
|
-
options?: GetConnectivityMatrixOptions,
|
|
158
|
-
): number[][] | Float64Array[];
|
|
159
|
-
|
|
160
|
-
function getDiastereotopicAtomIDs(molecule: Molecule): string[];
|
|
161
|
-
|
|
162
|
-
function groupDiastereotopicAtomIDs(
|
|
163
|
-
diaIDs: string[],
|
|
164
|
-
molecule: Molecule,
|
|
165
|
-
options?: { atomLabel: string },
|
|
166
|
-
): GroupedDiastereotopicAtomIDs;
|
|
167
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import type { Logger } from 'cheminfo-types';
|
|
2
|
-
import type { Molecule } from 'openchemlib/full';
|
|
3
|
-
import { getDiastereotopicAtomIDs } from 'openchemlib-utils';
|
|
4
|
-
|
|
5
|
-
import type { Prediction1D } from './Prediction1D';
|
|
6
|
-
import { predictCOSY } from './predictCOSY';
|
|
7
|
-
import { predictCarbon, PredictCarbonOptions } from './predictCarbon';
|
|
8
|
-
import { predictHMBC } from './predictHMBC';
|
|
9
|
-
import { predictHSQC } from './predictHSQC';
|
|
10
|
-
import { predictProton, PredictProtonOptions } from './predictProton';
|
|
11
|
-
import { getPredictions } from './utils/getPredictions';
|
|
12
|
-
import type { Predictor } from './utils/predict2D';
|
|
13
|
-
|
|
14
|
-
export interface PredictAllOptions {
|
|
15
|
-
/**
|
|
16
|
-
* maximum number of bonds to take into account.
|
|
17
|
-
* @default 1
|
|
18
|
-
*/
|
|
19
|
-
maxLength?: number;
|
|
20
|
-
/**
|
|
21
|
-
* minimum number of bonds to take into account
|
|
22
|
-
* @default 1
|
|
23
|
-
*/
|
|
24
|
-
minLength?: number;
|
|
25
|
-
/**
|
|
26
|
-
* mono dimensional predictors. The object should has properties with name
|
|
27
|
-
* equal to "H" and "C".
|
|
28
|
-
*/
|
|
29
|
-
predictor?: { H?: Predictor; C?: Predictor };
|
|
30
|
-
/**
|
|
31
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
32
|
-
* The object should has properties with name equal to "H" and "C".
|
|
33
|
-
*/
|
|
34
|
-
predictOptions?: { H?: PredictProtonOptions; C?: PredictCarbonOptions };
|
|
35
|
-
/**
|
|
36
|
-
* signals with euclidean distance in ppm less than this it will
|
|
37
|
-
* joined into a zone.
|
|
38
|
-
* @default {H:0.05,C:0.5}
|
|
39
|
-
*/
|
|
40
|
-
joinDistance?: { H: number; C: number };
|
|
41
|
-
/**
|
|
42
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
43
|
-
* The object should has properties with name equal to "H" and "C".
|
|
44
|
-
* the value of each prediction should be similar that predictProton and predictCarbon.
|
|
45
|
-
*/
|
|
46
|
-
predictions?: {
|
|
47
|
-
[key: string]: Prediction1D | undefined;
|
|
48
|
-
H?: Prediction1D;
|
|
49
|
-
C?: Prediction1D;
|
|
50
|
-
};
|
|
51
|
-
logger?: Logger;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface PredictedAll {
|
|
55
|
-
molfile: string;
|
|
56
|
-
diaIDs: string[];
|
|
57
|
-
spectra: Record<string, any>;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
61
|
-
* @returns {Promise<object>} - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
|
|
62
|
-
*/
|
|
63
|
-
export async function predictAll(
|
|
64
|
-
molecule: Molecule,
|
|
65
|
-
options: PredictAllOptions = {},
|
|
66
|
-
): Promise<PredictedAll> {
|
|
67
|
-
const {
|
|
68
|
-
logger,
|
|
69
|
-
predictor = { H: predictProton, C: predictCarbon },
|
|
70
|
-
joinDistance = { H: 0.05, C: 0.5 },
|
|
71
|
-
predictOptions = {},
|
|
72
|
-
} = options;
|
|
73
|
-
|
|
74
|
-
const diaIDs = getDiastereotopicAtomIDs(molecule);
|
|
75
|
-
let { predictions } = options;
|
|
76
|
-
|
|
77
|
-
const protonPrediction = await getPredictions(
|
|
78
|
-
'H',
|
|
79
|
-
molecule,
|
|
80
|
-
predictOptions,
|
|
81
|
-
predictor,
|
|
82
|
-
predictions,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const carbonPrediction = await getPredictions(
|
|
86
|
-
'C',
|
|
87
|
-
molecule,
|
|
88
|
-
predictOptions,
|
|
89
|
-
predictor,
|
|
90
|
-
predictions,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
if (!protonPrediction || !carbonPrediction) {
|
|
94
|
-
throw new Error('predictions are not availaible');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const spectra: any = {};
|
|
98
|
-
if (check1DPrediction(protonPrediction)) {
|
|
99
|
-
spectra.proton = protonPrediction;
|
|
100
|
-
}
|
|
101
|
-
if (check1DPrediction(carbonPrediction)) {
|
|
102
|
-
spectra.carbon = carbonPrediction;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const { molfile } = protonPrediction;
|
|
106
|
-
|
|
107
|
-
predictions = {
|
|
108
|
-
H: protonPrediction,
|
|
109
|
-
C: carbonPrediction,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
if (spectra.proton) {
|
|
113
|
-
spectra.cosy = await predictCOSY(molecule, {
|
|
114
|
-
predictions,
|
|
115
|
-
joinDistance,
|
|
116
|
-
});
|
|
117
|
-
} else if (logger) {
|
|
118
|
-
logger.warn('Proton prediction is missing so COSY could not be generated.');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (spectra.carbon && spectra.proton) {
|
|
122
|
-
spectra.hsqc = await predictHSQC(molecule, {
|
|
123
|
-
predictions,
|
|
124
|
-
joinDistance,
|
|
125
|
-
});
|
|
126
|
-
spectra.hmbc = await predictHMBC(molecule, {
|
|
127
|
-
predictions,
|
|
128
|
-
joinDistance,
|
|
129
|
-
});
|
|
130
|
-
} else if (logger) {
|
|
131
|
-
logger.warn(
|
|
132
|
-
'Carbon and / or proton prediction is missing so HSQC and HMBC could not be generated.',
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
for (const key in spectra) {
|
|
137
|
-
delete spectra[key].molfile;
|
|
138
|
-
delete spectra[key].diaIDs;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
molfile,
|
|
143
|
-
diaIDs,
|
|
144
|
-
spectra,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function check1DPrediction(prediction?: Prediction1D) {
|
|
149
|
-
if (!prediction) return false;
|
|
150
|
-
if (prediction.ranges.length === 0) return false;
|
|
151
|
-
const { signals, diaIDs } = prediction;
|
|
152
|
-
for (const signal of signals) {
|
|
153
|
-
const isCorrect = signal.diaIDs?.every((diaID) => diaIDs.includes(diaID));
|
|
154
|
-
if (!isCorrect) return false;
|
|
155
|
-
}
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Molecule } from 'openchemlib/full';
|
|
2
|
-
|
|
3
|
-
import type { Prediction1D } from '../Prediction1D';
|
|
4
|
-
|
|
5
|
-
import type { Predictions, PredictOptions, Predictors } from './predict2D';
|
|
6
|
-
|
|
7
|
-
export async function getPredictions(
|
|
8
|
-
key: string,
|
|
9
|
-
molecule: Molecule,
|
|
10
|
-
predictOptions: PredictOptions,
|
|
11
|
-
predictor?: Predictors,
|
|
12
|
-
predictions?: Predictions,
|
|
13
|
-
) {
|
|
14
|
-
let prediction: Prediction1D | undefined;
|
|
15
|
-
if (predictions?.[key]) {
|
|
16
|
-
prediction = predictions[key];
|
|
17
|
-
} else if (predictor) {
|
|
18
|
-
const fromPredictor = predictor[key];
|
|
19
|
-
prediction = fromPredictor
|
|
20
|
-
? await fromPredictor(molecule, predictOptions[key])
|
|
21
|
-
: undefined;
|
|
22
|
-
}
|
|
23
|
-
return prediction;
|
|
24
|
-
}
|