nmr-processing 7.1.0 → 7.2.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.d.ts +3 -3
- package/lib/assignment/get13CAssignments.js.map +1 -1
- package/lib/assignment/get1HAssignments.d.ts +3 -3
- package/lib/assignment/get1HAssignments.js.map +1 -1
- package/lib/assignment/getAssignments.d.ts +81 -0
- package/lib/assignment/getAssignments.js +44 -0
- package/lib/assignment/getAssignments.js.map +1 -0
- package/lib/assignment/utils/buildAssignments.d.ts +4 -4
- package/lib/assignment/utils/buildAssignments.js.map +1 -1
- package/lib/assignment/utils/createMapPossibleAssignments.d.ts +2 -2
- package/lib/assignment/utils/exploreTreeRec.d.ts +3 -3
- package/lib/assignment/utils/exploreTreeRec.js.map +1 -1
- package/lib/assignment/utils/getAssignment/buildAssignments.d.ts +72 -0
- package/lib/assignment/utils/getAssignment/buildAssignments.js +205 -0
- package/lib/assignment/utils/getAssignment/buildAssignments.js.map +1 -0
- package/lib/assignment/utils/getAssignment/checkIDs.d.ts +23 -0
- package/lib/assignment/utils/getAssignment/checkIDs.js +57 -0
- package/lib/assignment/utils/getAssignment/checkIDs.js.map +1 -0
- package/lib/assignment/utils/getAssignment/createMapPossibleAssignment.d.ts +15 -0
- package/lib/assignment/utils/getAssignment/createMapPossibleAssignment.js +55 -0
- package/lib/assignment/utils/getAssignment/createMapPossibleAssignment.js.map +1 -0
- package/lib/assignment/utils/getAssignment/exploreTree.d.ts +22 -0
- package/lib/assignment/utils/getAssignment/exploreTree.js +93 -0
- package/lib/assignment/utils/getAssignment/exploreTree.js.map +1 -0
- package/lib/assignment/utils/getAssignment/formatData.d.ts +14 -0
- package/lib/assignment/utils/getAssignment/formatData.js +20 -0
- package/lib/assignment/utils/getAssignment/formatData.js.map +1 -0
- package/lib/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.d.ts +3 -0
- package/lib/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.js +14 -0
- package/lib/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.js.map +1 -0
- package/lib/assignment/utils/getAssignment/getTargetsAndCorrelations.d.ts +18 -0
- package/lib/assignment/utils/getAssignment/getTargetsAndCorrelations.js +37 -0
- package/lib/assignment/utils/getAssignment/getTargetsAndCorrelations.js.map +1 -0
- package/lib/assignment/utils/getAssignment/getWorkFlow.d.ts +19 -0
- package/lib/assignment/utils/getAssignment/getWorkFlow.js +52 -0
- package/lib/assignment/utils/getAssignment/getWorkFlow.js.map +1 -0
- package/lib/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.d.ts +7 -0
- package/lib/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.js +43 -0
- package/lib/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.js.map +1 -0
- package/lib/assignment/utils/getAssignment/isSpectraData1D.d.ts +2 -0
- package/lib/assignment/utils/getAssignment/isSpectraData1D.js +8 -0
- package/lib/assignment/utils/getAssignment/isSpectraData1D.js.map +1 -0
- package/lib/assignment/utils/getAssignment/partialScore.d.ts +13 -0
- package/lib/assignment/utils/getAssignment/partialScore.js +221 -0
- package/lib/assignment/utils/getAssignment/partialScore.js.map +1 -0
- package/lib/assignment/utils/getAssignment/searchIndices.d.ts +6 -0
- package/lib/assignment/utils/getAssignment/searchIndices.js +21 -0
- package/lib/assignment/utils/getAssignment/searchIndices.js.map +1 -0
- package/lib/assignment/utils/partialScore.d.ts +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/peaks/peaksToRanges.js +1 -0
- package/lib/peaks/peaksToRanges.js.map +1 -1
- package/lib/prediction/utils/predict2D.d.ts +0 -2
- package/lib/prediction/utils/predict2D.js.map +1 -1
- package/lib-esm/assignment/get13CAssignments.js.map +1 -1
- package/lib-esm/assignment/get1HAssignments.js.map +1 -1
- package/lib-esm/assignment/getAssignments.js +37 -0
- package/lib-esm/assignment/getAssignments.js.map +1 -0
- package/lib-esm/assignment/utils/buildAssignments.js.map +1 -1
- package/lib-esm/assignment/utils/exploreTreeRec.js.map +1 -1
- package/lib-esm/assignment/utils/getAssignment/buildAssignments.js +198 -0
- package/lib-esm/assignment/utils/getAssignment/buildAssignments.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/checkIDs.js +48 -0
- package/lib-esm/assignment/utils/getAssignment/checkIDs.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/createMapPossibleAssignment.js +51 -0
- package/lib-esm/assignment/utils/getAssignment/createMapPossibleAssignment.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/exploreTree.js +89 -0
- package/lib-esm/assignment/utils/getAssignment/exploreTree.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/formatData.js +16 -0
- package/lib-esm/assignment/utils/getAssignment/formatData.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.js +10 -0
- package/lib-esm/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/getTargetsAndCorrelations.js +33 -0
- package/lib-esm/assignment/utils/getAssignment/getTargetsAndCorrelations.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/getWorkFlow.js +50 -0
- package/lib-esm/assignment/utils/getAssignment/getWorkFlow.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.js +41 -0
- package/lib-esm/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/isSpectraData1D.js +4 -0
- package/lib-esm/assignment/utils/getAssignment/isSpectraData1D.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/partialScore.js +214 -0
- package/lib-esm/assignment/utils/getAssignment/partialScore.js.map +1 -0
- package/lib-esm/assignment/utils/getAssignment/searchIndices.js +17 -0
- package/lib-esm/assignment/utils/getAssignment/searchIndices.js.map +1 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/peaks/peaksToRanges.js +1 -0
- package/lib-esm/peaks/peaksToRanges.js.map +1 -1
- package/lib-esm/prediction/utils/predict2D.js.map +1 -1
- package/package.json +2 -1
- package/src/assignment/get13CAssignments.ts +2 -2
- package/src/assignment/get1HAssignments.ts +2 -2
- package/src/assignment/getAssignments.ts +149 -0
- package/src/assignment/utils/buildAssignments.ts +4 -4
- package/src/assignment/utils/createMapPossibleAssignments.ts +2 -2
- package/src/assignment/utils/exploreTreeRec.ts +5 -5
- package/src/assignment/utils/getAssignment/buildAssignments.ts +339 -0
- package/src/assignment/utils/getAssignment/checkIDs.ts +76 -0
- package/src/assignment/utils/getAssignment/createMapPossibleAssignment.ts +85 -0
- package/src/assignment/utils/getAssignment/data/correlations.js +713 -0
- package/src/assignment/utils/getAssignment/data/predictions.js +34 -0
- package/src/assignment/utils/getAssignment/exploreTree.ts +171 -0
- package/src/assignment/utils/getAssignment/formatData.ts +35 -0
- package/src/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.ts +16 -0
- package/src/assignment/utils/getAssignment/getTargetsAndCorrelations.ts +63 -0
- package/src/assignment/utils/getAssignment/getWorkFlow.ts +72 -0
- package/src/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.ts +55 -0
- package/src/assignment/utils/getAssignment/isSpectraData1D.ts +7 -0
- package/src/assignment/utils/getAssignment/partialScore.ts +308 -0
- package/src/assignment/utils/getAssignment/searchIndices.ts +19 -0
- package/src/assignment/utils/partialScore.ts +2 -2
- package/src/index.ts +1 -0
- package/src/ml-tree-set.d.ts +1 -1
- package/src/peaks/peaksToRanges.ts +1 -0
- package/src/prediction/utils/predict2D.ts +0 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addIDs = exports.hasIDs = exports.checkIDs = void 0;
|
|
7
|
+
const generateID_1 = __importDefault(require("../generateID"));
|
|
8
|
+
const isSpectraData1D_1 = require("./isSpectraData1D");
|
|
9
|
+
function checkIDs(input = []) {
|
|
10
|
+
let inputClone = JSON.parse(JSON.stringify(input));
|
|
11
|
+
let spectra = [];
|
|
12
|
+
for (const spectraData of inputClone) {
|
|
13
|
+
const { info, id } = spectraData;
|
|
14
|
+
if ((0, isSpectraData1D_1.isSpectraData1D)(spectraData)) {
|
|
15
|
+
let data = addIDs(spectraData.ranges);
|
|
16
|
+
for (const element of data) {
|
|
17
|
+
const { integration } = element;
|
|
18
|
+
for (let signal of element.signals || []) {
|
|
19
|
+
if (!signal.integration)
|
|
20
|
+
signal.integration = integration;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
spectra.push({ id, info, ranges: data });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
let data = addIDs(spectraData.zones);
|
|
27
|
+
spectra.push({ id, info, zones: data });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return spectra;
|
|
31
|
+
}
|
|
32
|
+
exports.checkIDs = checkIDs;
|
|
33
|
+
function hasIDs(data) {
|
|
34
|
+
for (const element of data) {
|
|
35
|
+
if (!element.id)
|
|
36
|
+
throw new Error('A range/zone has not an ID');
|
|
37
|
+
for (let signal of element.signals || []) {
|
|
38
|
+
if (!signal.id)
|
|
39
|
+
throw new Error('A signal has not an ID');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.hasIDs = hasIDs;
|
|
44
|
+
function addIDs(data) {
|
|
45
|
+
for (const element of data) {
|
|
46
|
+
if (!element.id)
|
|
47
|
+
element.id = (0, generateID_1.default)();
|
|
48
|
+
for (let signal of element.signals || []) {
|
|
49
|
+
if (!signal.id)
|
|
50
|
+
signal.id = (0, generateID_1.default)();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
hasIDs(data);
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
exports.addIDs = addIDs;
|
|
57
|
+
//# sourceMappingURL=checkIDs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkIDs.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/checkIDs.ts"],"names":[],"mappings":";;;;;;AAOA,+DAAuC;AAEvC,uDAAoD;AAwBpD,SAAgB,QAAQ,CAAC,QAAuB,EAAE;IAChD,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAkB,CAAC;IACpE,IAAI,OAAO,GAAyB,EAAE,CAAC;IACvC,KAAK,MAAM,WAAW,IAAI,UAAU,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,WAAW,CAAC;QACjC,IAAI,IAAA,iCAAe,EAAC,WAAW,CAAC,EAAE;YAChC,IAAI,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAsB,CAAC;YAC3D,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE;gBAC1B,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;gBAChC,KAAK,IAAI,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE;oBACxC,IAAI,CAAC,MAAM,CAAC,WAAW;wBAAE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;iBAC3D;aACF;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SAC1C;aAAM;YACL,IAAI,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAqB,CAAC;YACzD,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;SACzC;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AApBD,4BAoBC;AAED,SAAgB,MAAM,CACpB,IAA4B;IAE5B,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC/D,KAAK,IAAI,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3D;KACF;AACH,CAAC;AATD,wBASC;AAED,SAAgB,MAAM,CAAC,IAA4B;IACjD,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,GAAG,IAAA,oBAAU,GAAE,CAAC;QAC3C,KAAK,IAAI,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,MAAM,CAAC,EAAE,GAAG,IAAA,oBAAU,GAAE,CAAC;SAC1C;KACF;IACD,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC;AATD,wBASC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PossibleAssignmentMap } from '../createMapPossibleAssignments';
|
|
2
|
+
import { PredictionsByAtomType, RestrictionByCS } from './buildAssignments';
|
|
3
|
+
import { TargetsByAtomType } from './getTargetsAndCorrelations';
|
|
4
|
+
export interface PossibleAssignments {
|
|
5
|
+
[key: string]: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface MapPossibleAssignments {
|
|
8
|
+
[key: string]: PossibleAssignmentMap;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateMapPossibleAssignmentOptions {
|
|
11
|
+
restrictionByCS: RestrictionByCS;
|
|
12
|
+
predictions: PredictionsByAtomType;
|
|
13
|
+
targets: TargetsByAtomType;
|
|
14
|
+
}
|
|
15
|
+
export declare function createMapPossibleAssignment(expandMap: MapPossibleAssignments, props: CreateMapPossibleAssignmentOptions): MapPossibleAssignments;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMapPossibleAssignment = void 0;
|
|
4
|
+
const nmr_correlation_1 = require("nmr-correlation");
|
|
5
|
+
function createMapPossibleAssignment(expandMap, props) {
|
|
6
|
+
const { restrictionByCS, predictions, targets } = props;
|
|
7
|
+
const { tolerance: toleranceCS, chemicalShiftRestriction } = restrictionByCS;
|
|
8
|
+
const atomTypes = Object.keys(predictions);
|
|
9
|
+
for (const atomType of atomTypes) {
|
|
10
|
+
let errorAbs = toleranceCS[atomType];
|
|
11
|
+
let predictionByAtomType = predictions[atomType];
|
|
12
|
+
let targetByAtomType = targets[atomType];
|
|
13
|
+
if (!expandMap[atomType])
|
|
14
|
+
expandMap[atomType] = {};
|
|
15
|
+
for (const diaID in predictionByAtomType) {
|
|
16
|
+
let prediction = predictionByAtomType[diaID];
|
|
17
|
+
expandMap[atomType][diaID] = [];
|
|
18
|
+
if (targetByAtomType) {
|
|
19
|
+
for (const targetID in targetByAtomType) {
|
|
20
|
+
let target = targetByAtomType[targetID];
|
|
21
|
+
const { nbAtoms, protonsCount: protonsCountFromPrediction } = prediction;
|
|
22
|
+
const { integration, protonsCount } = target;
|
|
23
|
+
const couldBeAssigned = !integration
|
|
24
|
+
? true
|
|
25
|
+
: atomType === 'H'
|
|
26
|
+
? nbAtoms - integration < 1
|
|
27
|
+
: protonsCount.length > 0
|
|
28
|
+
? protonsCount.some((count) => protonsCountFromPrediction === count)
|
|
29
|
+
: true;
|
|
30
|
+
if (couldBeAssigned) {
|
|
31
|
+
if (!chemicalShiftRestriction ||
|
|
32
|
+
typeof prediction.delta === 'undefined') {
|
|
33
|
+
// Chemical shift is not a restriction
|
|
34
|
+
expandMap[atomType][diaID].push(targetID);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
let targetDelta = (0, nmr_correlation_1.getCorrelationDelta)(target);
|
|
38
|
+
if (targetDelta === undefined) {
|
|
39
|
+
throw new Error(`Correlation has not delta`);
|
|
40
|
+
}
|
|
41
|
+
let distAfterLimit = Math.abs(prediction.delta - targetDelta - errorAbs);
|
|
42
|
+
if (distAfterLimit < 4 * errorAbs) {
|
|
43
|
+
expandMap[atomType][diaID].push(targetID);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
expandMap[atomType][diaID].push('*');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return expandMap;
|
|
53
|
+
}
|
|
54
|
+
exports.createMapPossibleAssignment = createMapPossibleAssignment;
|
|
55
|
+
//# sourceMappingURL=createMapPossibleAssignment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMapPossibleAssignment.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/createMapPossibleAssignment.ts"],"names":[],"mappings":";;;AAAA,qDAAsD;AAsBtD,SAAgB,2BAA2B,CACzC,SAAiC,EACjC,KAAyC;IAEzC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAExD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,wBAAwB,EAAE,GAAG,eAAe,CAAC;IAE7E,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAgB,CAAC;IAE1D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,IAAI,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,S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I,cAAc,GAAG,IAAI,CAAC,GAAG,CAC3B,UAAU,CAAC,KAAK,GAAG,WAAW,GAAG,QAAQ,CAC1C,CAAC;4BAEF,IAAI,cAAc,GAAG,CAAC,GAAG,QAAQ,EAAE;gCACjC,SAAS,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;6BAC3C;yBACF;qBACF;iBACF;aACF;YACD,SAAS,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtC;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AA9DD,kEA8DC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StoreAssignments } from '../buildAssignments';
|
|
2
|
+
import { RestrictionByCS, DiaIDPeerPossibleAssignment, InfoByAtomType, Partial, CurrentAtoms, PredictionsByAtomType } from './buildAssignments';
|
|
3
|
+
import { MapPossibleAssignments } from './createMapPossibleAssignment';
|
|
4
|
+
import { CorrelationWithIntegration, TargetsByAtomType } from './getTargetsAndCorrelations';
|
|
5
|
+
export interface ExploreTreeRecOptions {
|
|
6
|
+
currentAtomTypes: CurrentAtoms;
|
|
7
|
+
restrictionByCS: RestrictionByCS;
|
|
8
|
+
timeout: number;
|
|
9
|
+
timeStart: number;
|
|
10
|
+
maxSolutions: number;
|
|
11
|
+
targets: TargetsByAtomType;
|
|
12
|
+
predictions: PredictionsByAtomType;
|
|
13
|
+
correlations: CorrelationWithIntegration[];
|
|
14
|
+
lowerBoundScore: number;
|
|
15
|
+
possibleAssignmentMap: MapPossibleAssignments;
|
|
16
|
+
diaIDPeerPossibleAssignment: DiaIDPeerPossibleAssignment;
|
|
17
|
+
}
|
|
18
|
+
export declare function exploreTree(props: ExploreTreeRecOptions, infoByAtomTypes: InfoByAtomType, partial: Partial, store: StoreAssignments): StoreAssignments | undefined;
|
|
19
|
+
export interface AssignmentSolution {
|
|
20
|
+
assignment: string[];
|
|
21
|
+
score: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exploreTree = void 0;
|
|
4
|
+
const partialScore_1 = require("./partialScore");
|
|
5
|
+
function exploreTree(props, infoByAtomTypes, partial, store) {
|
|
6
|
+
const { currentAtomTypes, restrictionByCS, timeout, timeStart, maxSolutions, targets, predictions, correlations, lowerBoundScore, possibleAssignmentMap, diaIDPeerPossibleAssignment, } = props;
|
|
7
|
+
const currentDate = new Date();
|
|
8
|
+
if (currentDate.getTime() - timeStart > timeout) {
|
|
9
|
+
new Error('timeout expired');
|
|
10
|
+
return store;
|
|
11
|
+
}
|
|
12
|
+
for (const atomType of currentAtomTypes) {
|
|
13
|
+
const { currentIndex, nSources } = infoByAtomTypes[atomType];
|
|
14
|
+
if (currentIndex >= nSources - 1 &&
|
|
15
|
+
partial[atomType][currentIndex] !== null) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const diaID = diaIDPeerPossibleAssignment[atomType][currentIndex];
|
|
19
|
+
const possibleAssignments = possibleAssignmentMap[atomType][diaID];
|
|
20
|
+
for (let targetID of possibleAssignments) {
|
|
21
|
+
partial[atomType][currentIndex] = targetID;
|
|
22
|
+
let score = (0, partialScore_1.partialScore)(partial, {
|
|
23
|
+
diaIDPeerPossibleAssignment,
|
|
24
|
+
infoByAtomTypes,
|
|
25
|
+
restrictionByCS,
|
|
26
|
+
predictions,
|
|
27
|
+
correlations,
|
|
28
|
+
targets,
|
|
29
|
+
});
|
|
30
|
+
if (score === 0) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (isLastOne(currentAtomTypes, infoByAtomTypes) &&
|
|
34
|
+
score >= lowerBoundScore) {
|
|
35
|
+
addSolution(store, { predictions, partial, score, maxSolutions });
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const newInfo = JSON.parse(JSON.stringify(infoByAtomTypes));
|
|
39
|
+
newInfo[atomType].currentIndex += 1;
|
|
40
|
+
exploreTree({
|
|
41
|
+
currentAtomTypes,
|
|
42
|
+
restrictionByCS,
|
|
43
|
+
timeout,
|
|
44
|
+
timeStart,
|
|
45
|
+
maxSolutions,
|
|
46
|
+
targets,
|
|
47
|
+
predictions,
|
|
48
|
+
correlations,
|
|
49
|
+
lowerBoundScore,
|
|
50
|
+
possibleAssignmentMap,
|
|
51
|
+
diaIDPeerPossibleAssignment,
|
|
52
|
+
}, newInfo, JSON.parse(JSON.stringify(partial)), store);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.exploreTree = exploreTree;
|
|
58
|
+
function addSolution(store, props) {
|
|
59
|
+
let { score, maxSolutions, partial, predictions } = props;
|
|
60
|
+
score /= doubleAssignmentPenalty(partial, predictions);
|
|
61
|
+
let solution = {
|
|
62
|
+
assignment: JSON.parse(JSON.stringify(partial)),
|
|
63
|
+
score,
|
|
64
|
+
};
|
|
65
|
+
if (store.nSolutions >= maxSolutions) {
|
|
66
|
+
if (solution.score > store.solutions.last().score) {
|
|
67
|
+
store.solutions.pollLast();
|
|
68
|
+
store.solutions.add(solution);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
store.solutions.add(solution);
|
|
73
|
+
store.nSolutions++;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function isLastOne(currentAtomTypes, infoByAtomTypes) {
|
|
77
|
+
let lastOne = true;
|
|
78
|
+
for (const atomType of currentAtomTypes) {
|
|
79
|
+
const { currentIndex, nSources } = infoByAtomTypes[atomType];
|
|
80
|
+
lastOne = lastOne && currentIndex >= nSources - 1;
|
|
81
|
+
}
|
|
82
|
+
return lastOne;
|
|
83
|
+
}
|
|
84
|
+
function doubleAssignmentPenalty(partial, predictions) {
|
|
85
|
+
let nbDoubleAssignment = 0;
|
|
86
|
+
for (const atomType in predictions) {
|
|
87
|
+
const nbSources = Object.keys(predictions[atomType]).length;
|
|
88
|
+
let assignments = new Set(partial[atomType]);
|
|
89
|
+
nbDoubleAssignment += nbSources - assignments.size;
|
|
90
|
+
}
|
|
91
|
+
return nbDoubleAssignment > 0 ? 2 * nbDoubleAssignment : 1;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=exploreTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exploreTree.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/exploreTree.ts"],"names":[],"mappings":";;;AAeA,iDAA8C;AAsB9C,SAAgB,WAAW,CACzB,KAA4B,EAC5B,eAA+B,EAC/B,OAAgB,EAChB,KAAuB;IAEvB,MAAM,EACJ,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,SAAS,EACT,YAAY,EACZ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,2BAA2B,GAC5B,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAC/B,IAAI,WAAW,CAAC,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE;QAC/C,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC;KACd;IAED,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE;QACvC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QAE7D,IACE,YAAY,IAAI,QAAQ,GAAG,CAAC;YAC5B,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,KAAK,IAAI,EACxC;YACA,SAAS;SACV;QAED,MAAM,KAAK,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;QAEnE,KAAK,IAA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,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NMRRangeWithIds, NMRZoneWithIds, SpectraData1DWithIds, SpectraData2DWithIds, SpectraDataWithIds } from './checkIDs';
|
|
2
|
+
interface SpectraData1DFormatted extends Omit<SpectraData1DWithIds, 'ranges'> {
|
|
3
|
+
ranges: {
|
|
4
|
+
values: NMRRangeWithIds[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
interface SpectraData2DFormatted extends Omit<SpectraData2DWithIds, 'zones'> {
|
|
8
|
+
zones: {
|
|
9
|
+
values: NMRZoneWithIds[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare type SpectraDataFormatted = SpectraData1DFormatted | SpectraData2DFormatted;
|
|
13
|
+
export declare function formatData(input?: SpectraDataWithIds[]): SpectraDataFormatted[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatData = void 0;
|
|
4
|
+
const isSpectraData1D_1 = require("./isSpectraData1D");
|
|
5
|
+
function formatData(input = []) {
|
|
6
|
+
let inputClone = JSON.parse(JSON.stringify(input));
|
|
7
|
+
let spectra = [];
|
|
8
|
+
for (const spectraData of inputClone) {
|
|
9
|
+
const { info } = spectraData;
|
|
10
|
+
if ((0, isSpectraData1D_1.isSpectraData1D)(spectraData)) {
|
|
11
|
+
spectra.push({ info, ranges: { values: spectraData.ranges } });
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
spectra.push({ info, zones: { values: spectraData.zones } });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return spectra;
|
|
18
|
+
}
|
|
19
|
+
exports.formatData = formatData;
|
|
20
|
+
//# sourceMappingURL=formatData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatData.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/formatData.ts"],"names":[],"mappings":";;;AAOA,uDAAoD;AAapD,SAAgB,UAAU,CACxB,QAA8B,EAAE;IAEhC,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAyB,CAAC;IAC3E,IAAI,OAAO,GAA2B,EAAE,CAAC;IACzC,KAAK,MAAM,WAAW,IAAI,UAAU,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;QAC7B,IAAI,IAAA,iCAAe,EAAC,WAAW,CAAC,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAChE;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SAC9D;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAdD,gCAcC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIntegrationOfAttachedProtons = void 0;
|
|
4
|
+
function getIntegrationOfAttachedProtons(target, correlations) {
|
|
5
|
+
const { H: attachment = [] } = target.attachment;
|
|
6
|
+
let integration = 0;
|
|
7
|
+
for (const match of attachment) {
|
|
8
|
+
const correlation = correlations[match];
|
|
9
|
+
integration += Number(correlation.link[0].signal.integration);
|
|
10
|
+
}
|
|
11
|
+
return integration;
|
|
12
|
+
}
|
|
13
|
+
exports.getIntegrationOfAttachedProtons = getIntegrationOfAttachedProtons;
|
|
14
|
+
//# sourceMappingURL=getIntegrationOfAttachedProtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIntegrationOfAttachedProtons.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/getIntegrationOfAttachedProtons.ts"],"names":[],"mappings":";;;AAIA,SAAgB,+BAA+B,CAC7C,MAAkC,EAClC,YAAoB;IAEpB,MAAM,EAAE,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;IACjD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE;QAC9B,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACxC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KAC/D;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAXD,0EAWC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Correlation, Link } from 'nmr-correlation';
|
|
2
|
+
import { SpectraDataWithIds } from './checkIDs';
|
|
3
|
+
export interface CorrelationWithIntegration extends Pick<Correlation, 'link' | 'atomType' | 'label' | 'attachment' | 'protonsCount'> {
|
|
4
|
+
integration: number;
|
|
5
|
+
indirectLinks: Array<Link>;
|
|
6
|
+
}
|
|
7
|
+
export interface Targets {
|
|
8
|
+
[key: string]: CorrelationWithIntegration;
|
|
9
|
+
}
|
|
10
|
+
export interface TargetsByAtomType {
|
|
11
|
+
H: Targets;
|
|
12
|
+
C: Targets;
|
|
13
|
+
}
|
|
14
|
+
export interface TargetsAndCorrelations {
|
|
15
|
+
targets: TargetsByAtomType;
|
|
16
|
+
correlations: CorrelationWithIntegration[];
|
|
17
|
+
}
|
|
18
|
+
export declare function getTargetsAndCorrelations(spectra: SpectraDataWithIds[], options?: any): TargetsAndCorrelations;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTargetsAndCorrelations = void 0;
|
|
4
|
+
const nmr_correlation_1 = require("nmr-correlation");
|
|
5
|
+
const formatData_1 = require("./formatData");
|
|
6
|
+
const getIntegrationOfAttachedProtons_1 = require("./getIntegrationOfAttachedProtons");
|
|
7
|
+
function getTargetsAndCorrelations(spectra, options = {}) {
|
|
8
|
+
//add indirect links, if a carbon C1 is attached to a proton H1 that correlating
|
|
9
|
+
//with carbon C2, so the carbon C1 and C2 are also correlating
|
|
10
|
+
const { tolerance = { C: 0.25, H: 0.05 } } = options;
|
|
11
|
+
const spectraData = (0, formatData_1.formatData)(spectra);
|
|
12
|
+
const { values: correlations } = (0, nmr_correlation_1.buildCorrelationData)(spectraData, {
|
|
13
|
+
tolerance,
|
|
14
|
+
});
|
|
15
|
+
let targets = {};
|
|
16
|
+
for (const correlation of correlations) {
|
|
17
|
+
if (correlation.pseudo)
|
|
18
|
+
continue;
|
|
19
|
+
const { id: targetID, atomType } = correlation;
|
|
20
|
+
if (!targets[atomType])
|
|
21
|
+
targets[atomType] = {};
|
|
22
|
+
targets[atomType][targetID] = correlation;
|
|
23
|
+
if (atomType === 'H') {
|
|
24
|
+
targets[atomType][targetID].integration =
|
|
25
|
+
correlation.link[0].signal.integration;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
targets[atomType][targetID].integration = (0, getIntegrationOfAttachedProtons_1.getIntegrationOfAttachedProtons)(correlation, correlations);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
targets,
|
|
33
|
+
correlations,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.getTargetsAndCorrelations = getTargetsAndCorrelations;
|
|
37
|
+
//# sourceMappingURL=getTargetsAndCorrelations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTargetsAndCorrelations.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/getTargetsAndCorrelations.ts"],"names":[],"mappings":";;;AAAA,qDAAuD;AAIvD,6CAA0C;AAC1C,uFAAoF;AAsBpF,SAAgB,yBA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es we can just predict 13C
|
|
5
|
+
* spectrum and try to assign the carbons first.
|
|
6
|
+
* @param {*} correlations
|
|
7
|
+
* @param {*} justAssign
|
|
8
|
+
*/
|
|
9
|
+
declare function getWorkFlow(correlations: Values, justAssign?: Array<AtomTypes[]>): {
|
|
10
|
+
assignmentOrder: AtomTypes[][];
|
|
11
|
+
experimentTypes: ExperimentTypes;
|
|
12
|
+
};
|
|
13
|
+
export default getWorkFlow;
|
|
14
|
+
interface ExperimentTypes {
|
|
15
|
+
types: string[];
|
|
16
|
+
hasProton: boolean;
|
|
17
|
+
hasCarbon: boolean;
|
|
18
|
+
hasHSQC: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* if hsqc is present in experimentTypes we can just predict 13C
|
|
5
|
+
* spectrum and try to assign the carbons first.
|
|
6
|
+
* @param {*} correlations
|
|
7
|
+
* @param {*} justAssign
|
|
8
|
+
*/
|
|
9
|
+
function getWorkFlow(correlations, justAssign = []) {
|
|
10
|
+
const experimentTypes = extractExperimentType(correlations);
|
|
11
|
+
const { hasHSQC, types } = experimentTypes;
|
|
12
|
+
if (justAssign.length > 0) {
|
|
13
|
+
return { assignmentOrder: justAssign, experimentTypes };
|
|
14
|
+
}
|
|
15
|
+
const assignmentOrder = [];
|
|
16
|
+
if (hasHSQC) {
|
|
17
|
+
assignmentOrder.push(['C'], ['H']);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
assignmentOrder.push(types.filter((type) => type === 'H' || type === 'C'));
|
|
21
|
+
}
|
|
22
|
+
return { assignmentOrder, experimentTypes };
|
|
23
|
+
}
|
|
24
|
+
exports.default = getWorkFlow;
|
|
25
|
+
function extractExperimentType(correlations) {
|
|
26
|
+
const types = [];
|
|
27
|
+
for (const correlation of correlations) {
|
|
28
|
+
let experimentType = correlation.experimentType;
|
|
29
|
+
if (experimentType === '1d') {
|
|
30
|
+
experimentType = `${correlation.atomType.toUpperCase()}`;
|
|
31
|
+
}
|
|
32
|
+
if (!types.includes(experimentType)) {
|
|
33
|
+
types.push(experimentType);
|
|
34
|
+
}
|
|
35
|
+
for (const link of correlation.link) {
|
|
36
|
+
experimentType = link.experimentType;
|
|
37
|
+
if (experimentType === '1d') {
|
|
38
|
+
experimentType = `${link.atomType[0].toUpperCase()}`;
|
|
39
|
+
}
|
|
40
|
+
if (!types.includes(experimentType)) {
|
|
41
|
+
types.push(experimentType);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
types,
|
|
47
|
+
hasProton: types.includes('H'),
|
|
48
|
+
hasCarbon: types.includes('C'),
|
|
49
|
+
hasHSQC: types.includes('hsqc'),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=getWorkFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWorkFlow.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/getWorkFlow.ts"],"names":[],"mappings":";;AAGA;;;;;GAKG;AAEH,SAAS,WAAW,CAClB,YAAoB,EACpB,aAAiC,EAAE;IAEnC,MAAM,eAAe,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAE5D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;IAE3C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACzB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;KACzD;IAED,MAAM,eAAe,GAAuB,EAAE,CAAC;IAE/C,IAAI,OAAO,EAAE;QACX,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KACpC;SAAM;QACL,eAAe,CAAC,IAAI,CAClB,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,E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TargetByIntegrationZone(activeDomainOnTarget: string[], targets: Targets, correlations: CorrelationWithIntegration[]): {
|
|
3
|
+
atomType: string;
|
|
4
|
+
targetIDs: string[];
|
|
5
|
+
integration: number;
|
|
6
|
+
}[];
|
|
7
|
+
export default groupCarbonTargetByIntegrationZone;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function groupCarbonTargetByIntegrationZone(activeDomainOnTarget, targets, correlations) {
|
|
4
|
+
let targetID = activeDomainOnTarget[0];
|
|
5
|
+
let { H: attachments = [] } = targets[targetID].attachment;
|
|
6
|
+
let targetByIntegral = [
|
|
7
|
+
{ targetIDs: [targetID], attachments: new Set(attachments) },
|
|
8
|
+
];
|
|
9
|
+
for (let i = 1; i < activeDomainOnTarget.length; i++) {
|
|
10
|
+
let targetID = activeDomainOnTarget[i];
|
|
11
|
+
let target = targets[targetID];
|
|
12
|
+
let { H: attachments = [] } = target.attachment;
|
|
13
|
+
let alone = true;
|
|
14
|
+
for (let group of targetByIntegral) {
|
|
15
|
+
const pertain = attachments.some((attachment) => group.attachments.has(attachment));
|
|
16
|
+
if (pertain) {
|
|
17
|
+
alone = false;
|
|
18
|
+
group.targetIDs.push(targetID);
|
|
19
|
+
for (let attachment of attachments) {
|
|
20
|
+
group.attachments.add(attachment);
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (alone) {
|
|
26
|
+
targetByIntegral.push({
|
|
27
|
+
targetIDs: [targetID],
|
|
28
|
+
attachments: new Set(attachments),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return targetByIntegral.map((t) => ({
|
|
33
|
+
atomType: 'C',
|
|
34
|
+
targetIDs: t.targetIDs,
|
|
35
|
+
integration: correlations
|
|
36
|
+
? Array.from(t.attachments).reduce((sum, index) => {
|
|
37
|
+
return correlations[index].integration + sum;
|
|
38
|
+
}, 0)
|
|
39
|
+
: 0,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
exports.default = groupCarbonTargetByIntegrationZone;
|
|
43
|
+
//# sourceMappingURL=groupCarbonTargetByIntegrationZone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupCarbonTargetByIntegrationZone.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/groupCarbonTargetByIntegrationZone.ts"],"names":[],"mappings":";;AAKA,SAAS,kCAAkC,CACzC,oBAA8B,EAC9B,OAAgB,EAChB,YAA0C;IAE1C,IAAI,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,EAAE,CAAC,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC;IAE3D,IAAI,gBAAgB,GAAG;QACrB,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,GAAG,CAAS,WAAW,CAAC,EAAE;KACrE,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpD,IAAI,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,EAAE,CAAC,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;QAEhD,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,KAAK,IAAI,KAAK,IAAI,gBAAgB,EAAE;YAClC,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,UAAe,EAAE,EAAE,CACnD,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAClC,CAAC;YACF,IAAI,OAAO,EAAE;gBACX,KAAK,GAAG,KAAK,CAAC;gBACd,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC/B,KAAK,IAAI,UAAU,IAAI,WAAW,EAAE;oBAClC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;iBACnC;gBACD,MAAM;aACP;SACF;QACD,IAAI,KAAK,EAAE;YACT,gBAAgB,CAAC,IAAI,CAAC;gBACpB,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,WAAW,EAAE,IAAI,GAAG,CAAS,WAAW,CAAC;aAC1C,CAAC,CAAC;SACJ;KACF;IACD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClC,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW,EAAE,YAAY;YACvB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC9C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC;YAC/C,CAAC,EAAE,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;KACN,CAAC,CAAC,CAAC;AACN,CAAC;AAED,kBAAe,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSpectraData1D = void 0;
|
|
4
|
+
function isSpectraData1D(spectrum) {
|
|
5
|
+
return 'ranges' in spectrum;
|
|
6
|
+
}
|
|
7
|
+
exports.isSpectraData1D = isSpectraData1D;
|
|
8
|
+
//# sourceMappingURL=isSpectraData1D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSpectraData1D.js","sourceRoot":"","sources":["../../../../src/assignment/utils/getAssignment/isSpectraData1D.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAC7B,QAAqB;IAErB,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAC9B,CAAC;AAJD,0CAIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InfoByAtomType, Partial, PredictionsByAtomType, RestrictionByCS } from './buildAssignments';
|
|
2
|
+
import { CorrelationWithIntegration, TargetsByAtomType } from './getTargetsAndCorrelations';
|
|
3
|
+
export interface PartialScoreOptions {
|
|
4
|
+
diaIDPeerPossibleAssignment: {
|
|
5
|
+
[key: string]: string[];
|
|
6
|
+
};
|
|
7
|
+
restrictionByCS: RestrictionByCS;
|
|
8
|
+
infoByAtomTypes: InfoByAtomType;
|
|
9
|
+
correlations: CorrelationWithIntegration[];
|
|
10
|
+
predictions: PredictionsByAtomType;
|
|
11
|
+
targets: TargetsByAtomType;
|
|
12
|
+
}
|
|
13
|
+
export declare function partialScore(partial: Partial, props: PartialScoreOptions): number;
|