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
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.predictCarbon = void 0;
|
|
4
4
|
const uuid_1 = require("@lukeed/uuid");
|
|
5
|
-
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
6
5
|
const setIDs_1 = require("../peaks/util/setIDs");
|
|
7
6
|
const signalsToRanges_1 = require("../signals/signalsToRanges");
|
|
8
7
|
const fetchPrediction_1 = require("./utils/fetchPrediction");
|
|
9
8
|
const getFilteredIDiaIDs_1 = require("./utils/getFilteredIDiaIDs");
|
|
10
|
-
const
|
|
9
|
+
const isMolfileNotEmpty_1 = require("./utils/isMolfileNotEmpty");
|
|
11
10
|
const queryByHOSE_1 = require("./utils/queryByHOSE");
|
|
12
11
|
function checkFromPrediction(signal) {
|
|
13
12
|
if (!signal.atoms)
|
|
@@ -21,21 +20,19 @@ function checkFromPrediction(signal) {
|
|
|
21
20
|
* Make a query to a hose code based database to predict carbon chemical shift
|
|
22
21
|
* @returns {Promise<object>} - object with molfile, diaIDs, signals, joined signals by diaIDs and ranges.
|
|
23
22
|
*/
|
|
24
|
-
async function predictCarbon(
|
|
25
|
-
|
|
23
|
+
async function predictCarbon(options) {
|
|
24
|
+
const { hoses, molfile, database, webserviceURL = 'https://nmr-prediction.service.zakodium.com/v1/predict/carbon', groupedDiaIDs, } = options;
|
|
25
|
+
if (!database && (0, isMolfileNotEmpty_1.isMolfileNotEmpty)(molfile)) {
|
|
26
|
+
return (0, fetchPrediction_1.fetchPrediction)(molfile, { webserviceURL });
|
|
27
|
+
}
|
|
28
|
+
else if (!(0, isMolfileNotEmpty_1.isMolfileNotEmpty)(molfile)) {
|
|
26
29
|
return {
|
|
27
|
-
molfile: molecule.toMolfile(),
|
|
28
30
|
nucleus: '13C',
|
|
29
|
-
diaIDs: [],
|
|
30
31
|
joinedSignals: [],
|
|
31
32
|
signals: [],
|
|
32
33
|
ranges: [],
|
|
33
|
-
molecule,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const { database, webserviceURL = 'https://nmr-prediction.service.zakodium.com/v1/predict/carbon', diaIDs = (0, openchemlib_utils_1.getDiastereotopicAtomIDs)(molecule), } = options;
|
|
37
|
-
if (!database)
|
|
38
|
-
return (0, fetchPrediction_1.fetchPrediction)(molecule, { webserviceURL });
|
|
39
36
|
if (!database) {
|
|
40
37
|
throw new Error('There is not a database');
|
|
41
38
|
}
|
|
@@ -43,9 +40,9 @@ async function predictCarbon(molecule, options = {}) {
|
|
|
43
40
|
let { maxSphereSize = maxLevel } = options;
|
|
44
41
|
if (maxSphereSize > maxLevel)
|
|
45
42
|
maxSphereSize = maxLevel;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const carbonDiaIDs = (0, getFilteredIDiaIDs_1.getFilteredIDiaIDs)({
|
|
44
|
+
groupedDiaIDs,
|
|
45
|
+
hoses,
|
|
49
46
|
});
|
|
50
47
|
const predictions = (0, queryByHOSE_1.queryByHose)(carbonDiaIDs, database, {
|
|
51
48
|
maxSphereSize,
|
|
@@ -53,13 +50,10 @@ async function predictCarbon(molecule, options = {}) {
|
|
|
53
50
|
const signals = formatSignals(predictions);
|
|
54
51
|
const joinedSignals = joinSignalByDiaID(signals);
|
|
55
52
|
return {
|
|
56
|
-
molfile,
|
|
57
53
|
nucleus: '13C',
|
|
58
|
-
diaIDs,
|
|
59
54
|
joinedSignals,
|
|
60
55
|
signals,
|
|
61
56
|
ranges: (0, signalsToRanges_1.signalsToRanges)(joinedSignals),
|
|
62
|
-
molecule,
|
|
63
57
|
};
|
|
64
58
|
}
|
|
65
59
|
exports.predictCarbon = predictCarbon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predictCarbon.js","sourceRoot":"","sources":["../../src/prediction/predictCarbon.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAEhD,
|
|
1
|
+
{"version":3,"file":"predictCarbon.js","sourceRoot":"","sources":["../../src/prediction/predictCarbon.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAEhD,iDAA8C;AAE9C,gEAA6D;AAK7D,6DAA0D;AAC1D,mEAAgE;AAChE,iEAA8D;AAC9D,qDAA8D;AAuC9D,SAAS,mBAAmB,CAC1B,MAAmB;IAEnB,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE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AC,KAAK,CAAC,CAAC;SAClD;KACF;IACD,OAAO,IAAA,eAAM,EAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Molecule } from 'openchemlib/full';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type { PredictProtonOptions } from './predictProton';
|
|
5
|
-
import type { Predictor } from './utils/predict2D';
|
|
2
|
+
import { GroupDiastereotopicAtomIDs } from './GroupDiastereotopicAtomIDs';
|
|
3
|
+
import { PredictionBase1D } from './PredictionBase1D';
|
|
6
4
|
/**
|
|
7
5
|
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
8
6
|
* @returns {Promise<object>} - object with molfile, diaIDs, 2D signals joined signals and zones.
|
|
@@ -18,22 +16,6 @@ export interface PredictHMBCOptions {
|
|
|
18
16
|
* @default 2
|
|
19
17
|
*/
|
|
20
18
|
minLength?: number;
|
|
21
|
-
/**
|
|
22
|
-
* mono dimensional predictors. The object should has properties with name
|
|
23
|
-
* equal to "H" and "C".
|
|
24
|
-
*/
|
|
25
|
-
predictor?: {
|
|
26
|
-
H?: Predictor;
|
|
27
|
-
C?: Predictor;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
31
|
-
* The object should has properties with name equal to "H" and "C".
|
|
32
|
-
*/
|
|
33
|
-
predictOptions?: {
|
|
34
|
-
H?: PredictProtonOptions;
|
|
35
|
-
C?: PredictCarbonOptions;
|
|
36
|
-
};
|
|
37
19
|
/**
|
|
38
20
|
* signals with euclidean distance in ppm less than this it will
|
|
39
21
|
* joined into a zone.
|
|
@@ -48,10 +30,19 @@ export interface PredictHMBCOptions {
|
|
|
48
30
|
* The object should has properties with name equal to "H" and "C".
|
|
49
31
|
* the value of each prediction should be similar that predictProton and predictCarbon.
|
|
50
32
|
*/
|
|
51
|
-
predictions
|
|
52
|
-
[key: string]:
|
|
53
|
-
H?:
|
|
54
|
-
C?:
|
|
33
|
+
predictions: {
|
|
34
|
+
[key: string]: PredictionBase1D | undefined;
|
|
35
|
+
H?: PredictionBase1D;
|
|
36
|
+
C?: PredictionBase1D;
|
|
55
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* diastereotopic atom ids of the molecule.
|
|
40
|
+
*/
|
|
41
|
+
diaIDs: string[];
|
|
42
|
+
/**
|
|
43
|
+
* grouped diastereotopic atom ids of the molecule.
|
|
44
|
+
*/
|
|
45
|
+
groupedDiaIDs: GroupDiastereotopicAtomIDs[];
|
|
46
|
+
distanceMatrix: number[][];
|
|
56
47
|
}
|
|
57
|
-
export declare function predictHMBC(molecule: Molecule, options
|
|
48
|
+
export declare function predictHMBC(molecule: Molecule, options: PredictHMBCOptions): Promise<import("./PredictionBase2D").PredictionBase2D>;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.predictHMBC = void 0;
|
|
4
|
-
const predictCarbon_1 = require("./predictCarbon");
|
|
5
|
-
const predictProton_1 = require("./predictProton");
|
|
6
4
|
const predict2D_1 = require("./utils/predict2D");
|
|
7
|
-
async function predictHMBC(molecule, options
|
|
8
|
-
const { minLength = 2, maxLength = 3,
|
|
5
|
+
async function predictHMBC(molecule, options) {
|
|
6
|
+
const { minLength = 2, maxLength = 3, joinDistance = { H: 0.05, C: 0.5 }, } = options;
|
|
9
7
|
return (0, predict2D_1.predict2D)(molecule, {
|
|
8
|
+
...options,
|
|
10
9
|
from: 'H',
|
|
11
10
|
to: 'C',
|
|
12
|
-
predictor,
|
|
13
11
|
minLength,
|
|
14
12
|
maxLength,
|
|
15
|
-
predictions,
|
|
16
|
-
predictOptions,
|
|
17
13
|
joinDistance,
|
|
18
14
|
});
|
|
19
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predictHMBC.js","sourceRoot":"","sources":["../../src/prediction/predictHMBC.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"predictHMBC.js","sourceRoot":"","sources":["../../src/prediction/predictHMBC.ts"],"names":[],"mappings":";;;AAIA,iDAA8C;AA6CvC,KAAK,UAAU,WAAW,CAC/B,QAAkB,EAClB,OAA2B;IAE3B,MAAM,EACJ,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,CAAC,EACb,YAAY,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,GACnC,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE;QACzB,GAAG,OAAO;QACV,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,GAAG;QACP,SAAS;QACT,SAAS;QACT,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAlBD,kCAkBC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Molecule } from 'openchemlib/full';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { PredictProtonOptions } from './predictProton';
|
|
5
|
-
import { Predictor } from './utils/predict2D';
|
|
2
|
+
import { GroupDiastereotopicAtomIDs } from './GroupDiastereotopicAtomIDs';
|
|
3
|
+
import { PredictionBase1D } from './PredictionBase1D';
|
|
6
4
|
export interface PredictHSQCOptions {
|
|
7
5
|
/**
|
|
8
6
|
* maximum number of bonds to take into account.
|
|
@@ -14,22 +12,6 @@ export interface PredictHSQCOptions {
|
|
|
14
12
|
* @default 1
|
|
15
13
|
*/
|
|
16
14
|
minLength?: number;
|
|
17
|
-
/**
|
|
18
|
-
* mono dimensional predictors. The object should has properties with name
|
|
19
|
-
* equal to "H" and "C".
|
|
20
|
-
*/
|
|
21
|
-
predictor?: {
|
|
22
|
-
H?: Predictor;
|
|
23
|
-
C?: Predictor;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* mono dimensional signal to generate the bidimenionals cross peaks.
|
|
27
|
-
* The object should has properties with name equal to "H" and "C".
|
|
28
|
-
*/
|
|
29
|
-
predictOptions?: {
|
|
30
|
-
H?: PredictProtonOptions;
|
|
31
|
-
C?: PredictCarbonOptions;
|
|
32
|
-
};
|
|
33
15
|
/**
|
|
34
16
|
* signals with euclidean distance in ppm less than this it will
|
|
35
17
|
* joined into a zone.
|
|
@@ -44,14 +26,23 @@ export interface PredictHSQCOptions {
|
|
|
44
26
|
* The object should has properties with name equal to "H" and "C".
|
|
45
27
|
* the value of each prediction should be similar that predictProton and predictCarbon.
|
|
46
28
|
*/
|
|
47
|
-
predictions
|
|
48
|
-
[key: string]:
|
|
49
|
-
H?:
|
|
50
|
-
C?:
|
|
29
|
+
predictions: {
|
|
30
|
+
[key: string]: PredictionBase1D | undefined;
|
|
31
|
+
H?: PredictionBase1D;
|
|
32
|
+
C?: PredictionBase1D;
|
|
51
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* diastereotopic atom ids of the molecule.
|
|
36
|
+
*/
|
|
37
|
+
diaIDs: string[];
|
|
38
|
+
/**
|
|
39
|
+
* grouped diastereotopic atom ids of the molecule.
|
|
40
|
+
*/
|
|
41
|
+
groupedDiaIDs: GroupDiastereotopicAtomIDs[];
|
|
42
|
+
distanceMatrix: number[][];
|
|
52
43
|
}
|
|
53
44
|
/**
|
|
54
45
|
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
55
46
|
* @returns {Promise<object>} - object with molfile, diaIDs, 2D signals joined signals and zones.
|
|
56
47
|
*/
|
|
57
|
-
export declare function predictHSQC(molecule: Molecule, options
|
|
48
|
+
export declare function predictHSQC(molecule: Molecule, options: PredictHSQCOptions): Promise<import("./PredictionBase2D").PredictionBase2D>;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.predictHSQC = void 0;
|
|
4
|
-
const predictCarbon_1 = require("./predictCarbon");
|
|
5
|
-
const predictProton_1 = require("./predictProton");
|
|
6
4
|
const predict2D_1 = require("./utils/predict2D");
|
|
7
5
|
/**
|
|
8
6
|
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
9
7
|
* @returns {Promise<object>} - object with molfile, diaIDs, 2D signals joined signals and zones.
|
|
10
8
|
*/
|
|
11
|
-
async function predictHSQC(molecule, options
|
|
12
|
-
const { minLength = 1, maxLength = 1,
|
|
9
|
+
async function predictHSQC(molecule, options) {
|
|
10
|
+
const { minLength = 1, maxLength = 1, joinDistance = { H: 0.05, C: 0.5 }, } = options;
|
|
13
11
|
return (0, predict2D_1.predict2D)(molecule, {
|
|
12
|
+
...options,
|
|
14
13
|
from: 'H',
|
|
15
14
|
to: 'C',
|
|
16
|
-
predictor,
|
|
17
15
|
minLength,
|
|
18
16
|
maxLength,
|
|
19
|
-
predictions,
|
|
20
|
-
predictOptions,
|
|
21
17
|
joinDistance,
|
|
22
18
|
});
|
|
23
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predictHSQC.js","sourceRoot":"","sources":["../../src/prediction/predictHSQC.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"predictHSQC.js","sourceRoot":"","sources":["../../src/prediction/predictHSQC.ts"],"names":[],"mappings":";;;AAIA,iDAA8C;AAuC9C;;;GAGG;AAEI,KAAK,UAAU,WAAW,CAC/B,QAAkB,EAClB,OAA2B;IAE3B,MAAM,EACJ,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,CAAC,EACb,YAAY,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,GACnC,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,qBAAS,EAAC,QAAQ,EAAE;QACzB,GAAG,OAAO;QACV,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,GAAG;QACP,SAAS;QACT,SAAS;QACT,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAlBD,kCAkBC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Prediction1D } from './Prediction1D';
|
|
1
|
+
import { PredictionBase1D } from './PredictionBase1D';
|
|
3
2
|
/**
|
|
4
3
|
* Makes a prediction using proton.
|
|
5
4
|
* @returns {Promise<object>} - object with molfile, diaIDs, signals, joined signals by diaIDs and ranges.
|
|
@@ -12,7 +11,11 @@ export interface PredictProtonOptions {
|
|
|
12
11
|
/**
|
|
13
12
|
* diastereotopic atom ids.
|
|
14
13
|
*/
|
|
15
|
-
diaIDs
|
|
14
|
+
diaIDs: string[];
|
|
15
|
+
/**
|
|
16
|
+
* distance matrix
|
|
17
|
+
*/
|
|
18
|
+
distanceMatrix: number[][];
|
|
16
19
|
}
|
|
17
20
|
export type PredictProton = typeof predictProton;
|
|
18
|
-
export declare function predictProton(
|
|
21
|
+
export declare function predictProton(molfile: string, options: PredictProtonOptions): Promise<PredictionBase1D>;
|
|
@@ -7,27 +7,19 @@ exports.predictProton = void 0;
|
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
8
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
9
9
|
const form_data_1 = __importDefault(require("form-data"));
|
|
10
|
-
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
11
10
|
const signalsJoin_1 = require("../signals/signalsJoin");
|
|
12
11
|
const signalsToRanges_1 = require("../signals/signalsToRanges");
|
|
13
|
-
const
|
|
14
|
-
async function predictProton(
|
|
15
|
-
if ((0,
|
|
12
|
+
const isMolfileNotEmpty_1 = require("./utils/isMolfileNotEmpty");
|
|
13
|
+
async function predictProton(molfile, options) {
|
|
14
|
+
if (!(0, isMolfileNotEmpty_1.isMolfileNotEmpty)(molfile)) {
|
|
16
15
|
return {
|
|
17
|
-
|
|
18
|
-
nucleus: '13C',
|
|
19
|
-
diaIDs: [],
|
|
16
|
+
nucleus: '1H',
|
|
20
17
|
joinedSignals: [],
|
|
21
18
|
signals: [],
|
|
22
19
|
ranges: [],
|
|
23
|
-
molecule,
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
22
|
const { cache } = options;
|
|
27
|
-
molecule = molecule.getCompactCopy();
|
|
28
|
-
molecule.addImplicitHydrogens();
|
|
29
|
-
(0, openchemlib_utils_1.ensureHeterotopicChiralBonds)(molecule);
|
|
30
|
-
const molfile = molecule.toMolfile();
|
|
31
23
|
let result;
|
|
32
24
|
if (cache) {
|
|
33
25
|
result = cache(molfile);
|
|
@@ -45,27 +37,22 @@ async function predictProton(molecule, options = {}) {
|
|
|
45
37
|
cache(molfile, result);
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
|
-
const { diaIDs
|
|
49
|
-
const signals = protonParser(result,
|
|
40
|
+
const { diaIDs, distanceMatrix } = options;
|
|
41
|
+
const signals = protonParser(result, { diaIDs, distanceMatrix });
|
|
50
42
|
const joinedSignals = (0, signalsJoin_1.signalsJoin)(signals);
|
|
51
43
|
return {
|
|
52
|
-
molfile,
|
|
53
|
-
diaIDs,
|
|
54
44
|
nucleus: '1H',
|
|
55
45
|
joinedSignals,
|
|
56
46
|
signals,
|
|
57
47
|
ranges: (0, signalsToRanges_1.signalsToRanges)(joinedSignals),
|
|
58
|
-
molecule,
|
|
59
48
|
};
|
|
60
49
|
}
|
|
61
50
|
exports.predictProton = predictProton;
|
|
62
|
-
function protonParser(result,
|
|
63
|
-
if (molecule.getAllAtoms() === 0)
|
|
64
|
-
return [];
|
|
51
|
+
function protonParser(result, options) {
|
|
65
52
|
if (result.includes('ERR')) {
|
|
66
53
|
throw Error(`Spinus optimization: ${result}`);
|
|
67
54
|
}
|
|
68
|
-
const
|
|
55
|
+
const { diaIDs, distanceMatrix } = options;
|
|
69
56
|
const lines = result.split('\n').filter((line) => line);
|
|
70
57
|
const signals = [];
|
|
71
58
|
for (const line of lines) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predictProton.js","sourceRoot":"","sources":["../../src/prediction/predictProton.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAgD;AAChD,8DAAgC;AAChC,0DAAiC;
|
|
1
|
+
{"version":3,"file":"predictProton.js","sourceRoot":"","sources":["../../src/prediction/predictProton.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAgD;AAChD,8DAAgC;AAChC,0DAAiC;AAGjC,wDAAqD;AACrD,gEAA6D;AAG7D,iEAA8D;AAwBvD,KAAK,UAAU,aAAa,CACjC,OAAe,EACf,OAA6B;IAE7B,IAAI,CAAC,IAAA,qCAAiB,EAAC,OAAO,CAAC,EAAE;QAC/B,OAAO;YACL,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;SACX,CAAC;KACH;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1B,IAAI,MAAM,CAAC;IACX,IAAI,KAAK,EAAE;QACT,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;IACD,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAK,EAAC,yCAAyC,EAAE;YACtE,MAAM,EAAE,MAAM;YACd,+DAA+D;YAC/D,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACxB;KACF;IAED,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,IAAA,yBAAW,EAA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AAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACxC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;gBACb,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClC,KAAK,EAAE,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACxB,YAAY,EAAE,GAAG;gBACjB,UAAU,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;aACzC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;SACnD;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FromTo, PointXY } from 'cheminfo-types';
|
|
2
2
|
import type { Molecule } from 'openchemlib/full';
|
|
3
|
-
import { PredictAllOptions } from './
|
|
3
|
+
import { PredictAllOptions } from './predict';
|
|
4
4
|
/**
|
|
5
5
|
* This function will generate an object compatible with NMR-ium
|
|
6
6
|
*
|
|
@@ -4,11 +4,10 @@ exports.predictAllSpectra = void 0;
|
|
|
4
4
|
const signals2DToZ_1 = require("../signals/signals2DToZ");
|
|
5
5
|
const signalsToXY_1 = require("../signals/signalsToXY");
|
|
6
6
|
const getFrequency_1 = require("../utilities/getFrequency");
|
|
7
|
-
const
|
|
7
|
+
const predict_1 = require("./predict");
|
|
8
8
|
async function predictAllSpectra(molecule, options = {}) {
|
|
9
9
|
const { simulation: simulationOptions = { oneD: {}, twoD: {} }, prediction: predictionOptions = {}, } = options;
|
|
10
|
-
const
|
|
11
|
-
const { molfile, spectra } = predictions;
|
|
10
|
+
const { spectra } = await (0, predict_1.predict)(molecule, predictionOptions);
|
|
12
11
|
const oneDOptions = {
|
|
13
12
|
...{
|
|
14
13
|
proton: { from: 0, to: 14 },
|
|
@@ -54,7 +53,10 @@ async function predictAllSpectra(molecule, options = {}) {
|
|
|
54
53
|
break;
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
return {
|
|
56
|
+
return {
|
|
57
|
+
spectra: newSpectra,
|
|
58
|
+
molecules: [{ molfile: molecule.toMolfile() }],
|
|
59
|
+
};
|
|
58
60
|
}
|
|
59
61
|
exports.predictAllSpectra = predictAllSpectra;
|
|
60
62
|
function get2DSpectrum(prediction, options) {
|
|
@@ -122,4 +124,4 @@ function calculateFrequency(nucleus, frequency) {
|
|
|
122
124
|
})}`;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
//# sourceMappingURL=
|
|
127
|
+
//# sourceMappingURL=predictSpectra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictSpectra.js","sourceRoot":"","sources":["../../src/prediction/predictSpectra.ts"],"names":[],"mappings":";;;AAGA,0DAAuD;AACvD,wDAAyE;AACzE,4DAAyD;AAEzD,uCAAuD;AA8BhD,KAAK,UAAU,iBAAiB,CACrC,QAAkB,EAClB,UAAoC,EAAE;IAEtC,MAAM,EACJ,UAAU,EAAE,iBAAiB,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAuB,EAC3E,UAAU,EAAE,iBAAiB,GAAG,EAAE,GACnC,GAAG,OAAO,CAAC;IAEZ,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAE/D,MAAM,WAAW,GAAgB;QAC/B,GAAG;YACD,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAA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,SAAS,IAAI,SAAS,EAAE,CAAC;KACpC;SAAM;QACL,OAAO,GAAG,SAAS,IAAI,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC9C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YACnB,SAAS;SACV,CAAC,EAAE,CAAC;KACN;AACH,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Prediction1D } from '../Prediction1D';
|
|
1
|
+
import { PredictionBase1D } from '../PredictionBase1D';
|
|
3
2
|
interface FetchPredictionOptions {
|
|
4
3
|
webserviceURL: string;
|
|
5
4
|
}
|
|
6
|
-
export declare function fetchPrediction(
|
|
5
|
+
export declare function fetchPrediction(molfile: string, options: FetchPredictionOptions): Promise<PredictionBase1D>;
|
|
7
6
|
export {};
|
|
@@ -5,24 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchPrediction = void 0;
|
|
7
7
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
|
|
8
|
+
const isMolfileNotEmpty_1 = require("./isMolfileNotEmpty");
|
|
9
|
+
async function fetchPrediction(molfile, options) {
|
|
10
|
+
if (!(0, isMolfileNotEmpty_1.isMolfileNotEmpty)(molfile)) {
|
|
11
|
+
return {
|
|
12
|
+
nucleus: '13C',
|
|
13
|
+
joinedSignals: [],
|
|
14
|
+
signals: [],
|
|
15
|
+
ranges: [],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
9
18
|
const { webserviceURL } = options;
|
|
10
19
|
const response = await (0, cross_fetch_1.default)(webserviceURL, {
|
|
11
20
|
headers: {
|
|
12
21
|
accept: 'application/json',
|
|
13
22
|
'content-type': 'application/json',
|
|
14
23
|
},
|
|
15
|
-
body: JSON.stringify({ molfile
|
|
24
|
+
body: JSON.stringify({ molfile }),
|
|
16
25
|
method: 'POST',
|
|
17
26
|
});
|
|
18
27
|
if (response.status >= 400) {
|
|
19
28
|
throw new Error(response.statusText);
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
prediction.molecule = molecule
|
|
23
|
-
.getOCL()
|
|
24
|
-
.Molecule.fromMolfile(prediction.molfile);
|
|
25
|
-
return prediction;
|
|
30
|
+
return (await response.json()).data;
|
|
26
31
|
}
|
|
27
32
|
exports.fetchPrediction = fetchPrediction;
|
|
28
33
|
//# sourceMappingURL=fetchPrediction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchPrediction.js","sourceRoot":"","sources":["../../../src/prediction/utils/fetchPrediction.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;
|
|
1
|
+
{"version":3,"file":"fetchPrediction.js","sourceRoot":"","sources":["../../../src/prediction/utils/fetchPrediction.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAIhC,2DAAwD;AAMjD,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,OAA+B;IAE/B,IAAI,CAAC,IAAA,qCAAiB,EAAC,OAAO,CAAC,EAAE;QAC/B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;SACX,CAAC;KACH;IACD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAK,EAAC,aAAa,EAAE;QAC1C,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;QACjC,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;KACtC;IAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AACtC,CAAC;AA3BD,0CA2BC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export type GroupedDiaIDsWithHose = GroupDiaIDsWithHose[];
|
|
7
|
-
export declare function getFilteredIDiaIDs(molecule: Molecule, options: {
|
|
8
|
-
maxSphereSize: number;
|
|
9
|
-
diaIDs: string[];
|
|
10
|
-
}): {
|
|
11
|
-
molfile: string;
|
|
12
|
-
carbonDiaIDs: GroupedDiaIDsWithHose;
|
|
13
|
-
};
|
|
1
|
+
export declare function getFilteredIDiaIDs(options: {
|
|
2
|
+
groupedDiaIDs: any[];
|
|
3
|
+
hoses: any;
|
|
4
|
+
}): any[];
|
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFilteredIDiaIDs = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(0, openchemlib_utils_1.ensureHeterotopicChiralBonds)(molecule);
|
|
10
|
-
const molfile = molecule.toMolfile();
|
|
11
|
-
const groupedDiaIDs = (0, openchemlib_utils_1.groupDiastereotopicAtomIDs)(diaIDs, molecule, {
|
|
12
|
-
atomLabel: 'C',
|
|
13
|
-
});
|
|
14
|
-
const carbonDiaIDs = groupedDiaIDs.sort((a, b) => {
|
|
4
|
+
function getFilteredIDiaIDs(options) {
|
|
5
|
+
const { groupedDiaIDs, hoses } = options;
|
|
6
|
+
const carbonDiaIDs = groupedDiaIDs
|
|
7
|
+
.filter((group) => group.atomLabel === 'C')
|
|
8
|
+
.sort((a, b) => {
|
|
15
9
|
if (a.atomLabel === b.atomLabel) {
|
|
16
10
|
return b.counter - a.counter;
|
|
17
11
|
}
|
|
18
12
|
return a.atomLabel < b.atomLabel ? 1 : -1;
|
|
19
13
|
});
|
|
20
|
-
const OCL = molecule.getOCL();
|
|
21
14
|
for (const diaId of carbonDiaIDs) {
|
|
22
|
-
diaId.hose =
|
|
23
|
-
maxSphereSize,
|
|
24
|
-
});
|
|
15
|
+
diaId.hose = hoses[diaId.atoms[0]];
|
|
25
16
|
}
|
|
26
|
-
|
|
27
|
-
molfile,
|
|
28
|
-
carbonDiaIDs: carbonDiaIDs,
|
|
29
|
-
};
|
|
30
|
-
return toReturn;
|
|
17
|
+
return carbonDiaIDs;
|
|
31
18
|
}
|
|
32
19
|
exports.getFilteredIDiaIDs = getFilteredIDiaIDs;
|
|
33
20
|
//# sourceMappingURL=getFilteredIDiaIDs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredIDiaIDs.js","sourceRoot":"","sources":["../../../src/prediction/utils/getFilteredIDiaIDs.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getFilteredIDiaIDs.js","sourceRoot":"","sources":["../../../src/prediction/utils/getFilteredIDiaIDs.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,OAGlC;IACC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,YAAY,GAAG,aAAa;SAC/B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC;SAC1C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACb,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,EAAE;YAC/B,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;SAC9B;QACD,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEL,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;QAChC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACpC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AApBD,gDAoBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMolfileNotEmpty(molFile?: string): molFile is string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMolfileNotEmpty = void 0;
|
|
4
|
+
const full_1 = require("openchemlib/full");
|
|
5
|
+
const isEmptyMolecule_1 = require("./isEmptyMolecule");
|
|
6
|
+
function isMolfileNotEmpty(molFile) {
|
|
7
|
+
if (!molFile?.match(/V[23]0/))
|
|
8
|
+
return false;
|
|
9
|
+
return !(0, isEmptyMolecule_1.isEmptyMolecule)(full_1.Molecule.fromMolfile(molFile));
|
|
10
|
+
}
|
|
11
|
+
exports.isMolfileNotEmpty = isMolfileNotEmpty;
|
|
12
|
+
//# sourceMappingURL=isMolfileNotEmpty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMolfileNotEmpty.js","sourceRoot":"","sources":["../../../src/prediction/utils/isMolfileNotEmpty.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,uDAAoD;AAEpD,SAAgB,iBAAiB,CAAC,OAAgB;IAChD,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,CAAC,IAAA,iCAAe,EAAC,eAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AACzD,CAAC;AAHD,8CAGC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Molecule } from 'openchemlib/full';
|
|
2
|
+
import { GroupDiastereotopicAtomIDs } from '../GroupDiastereotopicAtomIDs';
|
|
3
|
+
import { PredictionBase1D } from '../PredictionBase1D';
|
|
4
|
+
import { PredictionBase2D } from '../PredictionBase2D';
|
|
4
5
|
import type { PredictCarbon, PredictCarbonOptions } from '../predictCarbon';
|
|
5
6
|
import type { PredictProton, PredictProtonOptions } from '../predictProton';
|
|
6
7
|
/**
|
|
@@ -36,15 +37,6 @@ export interface Predict2DOptions {
|
|
|
36
37
|
* @default 0
|
|
37
38
|
*/
|
|
38
39
|
minLength?: number;
|
|
39
|
-
/**
|
|
40
|
-
* mono dimensional predictors.
|
|
41
|
-
*/
|
|
42
|
-
predictor?: Predictors;
|
|
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
|
-
*/
|
|
47
|
-
predictOptions?: PredictOptions;
|
|
48
40
|
/**
|
|
49
41
|
* signals with euclidean distance in ppm less than this it will
|
|
50
42
|
* joined into a zone.
|
|
@@ -56,7 +48,7 @@ export interface Predict2DOptions {
|
|
|
56
48
|
* The object should has properties with name equal to "H" and "C".
|
|
57
49
|
* the value of each prediction should be similar that predictProton and predictCarbon.
|
|
58
50
|
*/
|
|
59
|
-
predictions
|
|
51
|
+
predictions: Predictions;
|
|
60
52
|
/**
|
|
61
53
|
* if true, the self correlation signal will be add to the prediction.
|
|
62
54
|
* @default false
|
|
@@ -65,13 +57,18 @@ export interface Predict2DOptions {
|
|
|
65
57
|
/**
|
|
66
58
|
* diastereotopic atom ids of the molecule.
|
|
67
59
|
*/
|
|
68
|
-
diaIDs
|
|
60
|
+
diaIDs: string[];
|
|
61
|
+
/**
|
|
62
|
+
* grouped diastereotopic atom ids of the molecule.
|
|
63
|
+
*/
|
|
64
|
+
groupedDiaIDs: GroupDiastereotopicAtomIDs[];
|
|
65
|
+
distanceMatrix: number[][];
|
|
69
66
|
}
|
|
70
67
|
export interface PredictOptions {
|
|
71
68
|
[key: string]: PredictProtonOptions | PredictCarbonOptions | undefined;
|
|
72
69
|
H?: PredictProtonOptions;
|
|
73
70
|
C?: PredictCarbonOptions;
|
|
74
71
|
}
|
|
75
|
-
export type Predictions = Record<string,
|
|
76
|
-
export declare function predict2D(molecule: Molecule, options
|
|
72
|
+
export type Predictions = Record<string, PredictionBase1D | undefined>;
|
|
73
|
+
export declare function predict2D(molecule: Molecule, options: Predict2DOptions): Promise<PredictionBase2D>;
|
|
77
74
|
export {};
|