drugflow-molstar 0.4.7 → 0.4.9
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/build/drugflow-molstar-0.4.9.css +1 -0
- package/build/drugflow-molstar-component-0.4.9.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.9.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.9.js.LICENSE.txt +39 -0
- package/lib/alphafold-transparency.js +157 -62
- package/lib/contact.d.ts +7 -14
- package/lib/contact.js +68 -72
- package/lib/custom-events.js +15 -15
- package/lib/domain-annotations/behavior.d.ts +1 -1
- package/lib/domain-annotations/behavior.js +24 -20
- package/lib/domain-annotations/color.js +22 -22
- package/lib/domain-annotations/prop.js +111 -62
- package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.8.js.LICENSE.txt +24 -0
- package/lib/drugflow-molstar-component-build-0.4.9.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.9.js.LICENSE.txt +24 -0
- package/lib/helpers.d.ts +3 -3
- package/lib/helpers.js +94 -89
- package/lib/index.d.ts +902 -1
- package/lib/index.js +2814 -1875
- package/lib/labels.d.ts +1 -1
- package/lib/labels.js +34 -20
- package/lib/loci-details.js +46 -34
- package/lib/sifts-mapping.js +32 -28
- package/lib/sifts-mappings-behaviour.d.ts +1 -1
- package/lib/sifts-mappings-behaviour.js +30 -26
- package/lib/spec.js +40 -52
- package/lib/structure_contact3d.d.ts +14 -21
- package/lib/structure_contact3d.js +46 -25
- package/lib/subscribe-events.js +18 -19
- package/lib/superposition-export.js +178 -102
- package/lib/superposition-focus-representation.d.ts +2 -2
- package/lib/superposition-focus-representation.js +131 -73
- package/lib/superposition-sifts-mapping.js +150 -105
- package/lib/superposition.js +810 -495
- package/lib/ui/alphafold-superposition.d.ts +1 -1
- package/lib/ui/alphafold-superposition.js +118 -94
- package/lib/ui/alphafold-tranparency.js +43 -27
- package/lib/ui/annotation-controls.js +89 -83
- package/lib/ui/export-superposition.d.ts +0 -1
- package/lib/ui/export-superposition.js +50 -32
- package/lib/ui/pdbe-left-panel.d.ts +0 -1
- package/lib/ui/pdbe-left-panel.js +105 -82
- package/lib/ui/pdbe-screenshot-controls.js +83 -54
- package/lib/ui/pdbe-structure-controls.js +57 -34
- package/lib/ui/pdbe-viewport-controls.js +29 -23
- package/lib/ui/segment-tree.js +663 -440
- package/lib/ui/superposition-components.js +312 -208
- package/lib/ui/superposition-viewport.js +18 -11
- package/package.json +3 -3
- package/build/drugflow-molstar-0.4.7.css +0 -1
- package/build/drugflow-molstar-component-0.4.7.js +0 -25
- package/build/drugflow-molstar-plugin-0.4.7.js +0 -2
- package/build/drugflow-molstar-plugin-0.4.7.js.LICENSE.txt +0 -64
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SuperpositionFocusRepresentation = exports.SuperpositionFocusRepresentationTags = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
6
|
+
var structure_representation_params_1 = require("Molstar/mol-plugin-state/helpers/structure-representation-params");
|
|
7
|
+
var transforms_1 = require("Molstar/mol-plugin-state/transforms");
|
|
8
|
+
var behavior_1 = require("Molstar/mol-plugin/behavior");
|
|
9
|
+
var builder_1 = require("Molstar/mol-script/language/builder");
|
|
10
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
11
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
12
|
+
var commands_1 = require("Molstar/mol-plugin/commands");
|
|
13
|
+
var loci_details_1 = require("./loci-details");
|
|
14
|
+
var SuperpositionFocusRepresentationParams = function (plugin) {
|
|
15
|
+
var reprParams = transforms_1.StateTransforms.Representation.StructureRepresentation3D.definition.params(void 0, plugin);
|
|
15
16
|
return {
|
|
16
17
|
expandRadius: param_definition_1.ParamDefinition.Numeric(5, { min: 1, max: 10, step: 1 }),
|
|
17
18
|
surroundingsParams: param_definition_1.ParamDefinition.Group(reprParams, {
|
|
@@ -25,13 +26,21 @@ var SuperpositionFocusRepresentationTags;
|
|
|
25
26
|
SuperpositionFocusRepresentationTags["SurrSel"] = "superposition-focus-surr-sel";
|
|
26
27
|
SuperpositionFocusRepresentationTags["SurrRepr"] = "superposition-focus-surr-repr";
|
|
27
28
|
})(SuperpositionFocusRepresentationTags || (exports.SuperpositionFocusRepresentationTags = SuperpositionFocusRepresentationTags = {}));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
var TagSet = new Set([SuperpositionFocusRepresentationTags.SurrSel, SuperpositionFocusRepresentationTags.SurrRepr]);
|
|
30
|
+
var SuperpositionFocusRepresentationBehavior = /** @class */ (function (_super) {
|
|
31
|
+
tslib_1.__extends(SuperpositionFocusRepresentationBehavior, _super);
|
|
32
|
+
function SuperpositionFocusRepresentationBehavior() {
|
|
33
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(SuperpositionFocusRepresentationBehavior.prototype, "surrLabel", {
|
|
36
|
+
get: function () { return "[Focus] Surroundings (".concat(this.params.expandRadius, " \u00C5)"); },
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
SuperpositionFocusRepresentationBehavior.prototype.ensureShape = function (cell) {
|
|
41
|
+
var state = this.plugin.state.data, tree = state.tree;
|
|
42
|
+
var builder = state.build();
|
|
43
|
+
var refs = mol_state_1.StateSelection.findUniqueTagsInSubtree(tree, cell.transform.ref, TagSet);
|
|
35
44
|
// Selections
|
|
36
45
|
if (!refs[SuperpositionFocusRepresentationTags.SurrSel]) {
|
|
37
46
|
refs[SuperpositionFocusRepresentationTags.SurrSel] = builder
|
|
@@ -44,72 +53,121 @@ class SuperpositionFocusRepresentationBehavior extends behavior_1.PluginBehavior
|
|
|
44
53
|
.to(refs[SuperpositionFocusRepresentationTags.SurrSel])
|
|
45
54
|
.apply(transforms_1.StateTransforms.Representation.StructureRepresentation3D, this.params.surroundingsParams, { tags: SuperpositionFocusRepresentationTags.SurrRepr }).ref;
|
|
46
55
|
}
|
|
47
|
-
return { state, builder, refs };
|
|
48
|
-
}
|
|
49
|
-
clear(root) {
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
return { state: state, builder: builder, refs: refs };
|
|
57
|
+
};
|
|
58
|
+
SuperpositionFocusRepresentationBehavior.prototype.clear = function (root) {
|
|
59
|
+
var e_1, _a;
|
|
60
|
+
var state = this.plugin.state.data;
|
|
61
|
+
var surrs = state.select(mol_state_1.StateSelection.Generators.byRef(root).subtree().withTag(SuperpositionFocusRepresentationTags.SurrSel));
|
|
52
62
|
if (surrs.length === 0)
|
|
53
63
|
return;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
var update = state.build();
|
|
65
|
+
var expression = builder_1.MolScriptBuilder.struct.generator.empty();
|
|
66
|
+
try {
|
|
67
|
+
for (var surrs_1 = tslib_1.__values(surrs), surrs_1_1 = surrs_1.next(); !surrs_1_1.done; surrs_1_1 = surrs_1.next()) {
|
|
68
|
+
var s = surrs_1_1.value;
|
|
69
|
+
update.to(s).update(transforms_1.StateTransforms.Model.StructureSelectionFromExpression, function (old) { return (tslib_1.__assign(tslib_1.__assign({}, old), { expression: expression })); });
|
|
70
|
+
}
|
|
58
71
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const loci = structure_1.StructureElement.Loci.remap(sourceLoci, parent.obj.data);
|
|
66
|
-
const residueLoci = structure_1.StructureElement.Loci.extendToWholeResidues(loci);
|
|
67
|
-
const residueBundle = structure_1.StructureElement.Bundle.fromLoci(residueLoci);
|
|
68
|
-
const target = structure_1.StructureElement.Bundle.toExpression(residueBundle);
|
|
69
|
-
let surroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({
|
|
70
|
-
0: target,
|
|
71
|
-
radius: this.params.expandRadius,
|
|
72
|
-
'as-whole-residues': true
|
|
73
|
-
});
|
|
74
|
-
const lociDeatils = (0, loci_details_1.lociDetails)(sourceLoci);
|
|
75
|
-
if (!lociDeatils) {
|
|
76
|
-
surroundings = builder_1.MolScriptBuilder.struct.modifier.exceptBy({
|
|
77
|
-
0: surroundings,
|
|
78
|
-
by: target
|
|
79
|
-
});
|
|
72
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
73
|
+
finally {
|
|
74
|
+
try {
|
|
75
|
+
if (surrs_1_1 && !surrs_1_1.done && (_a = surrs_1.return)) _a.call(surrs_1);
|
|
76
|
+
}
|
|
77
|
+
finally { if (e_1) throw e_1.error; }
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
return commands_1.PluginCommands.State.Update(this.plugin, { state: state, tree: update, options: { doNotLogTiming: true, doNotUpdateCurrent: true } });
|
|
80
|
+
};
|
|
81
|
+
SuperpositionFocusRepresentationBehavior.prototype.focus = function (sourceLoci) {
|
|
82
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var parent, loci, residueLoci, residueBundle, target, surroundings, lociDeatils, _a, state, builder, refs;
|
|
84
|
+
var _this = this;
|
|
85
|
+
return tslib_1.__generator(this, function (_b) {
|
|
86
|
+
switch (_b.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
parent = this.plugin.helpers.substructureParent.get(sourceLoci.structure);
|
|
89
|
+
if (!parent || !parent.obj)
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
loci = structure_1.StructureElement.Loci.remap(sourceLoci, parent.obj.data);
|
|
92
|
+
residueLoci = structure_1.StructureElement.Loci.extendToWholeResidues(loci);
|
|
93
|
+
residueBundle = structure_1.StructureElement.Bundle.fromLoci(residueLoci);
|
|
94
|
+
target = structure_1.StructureElement.Bundle.toExpression(residueBundle);
|
|
95
|
+
surroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({
|
|
96
|
+
0: target,
|
|
97
|
+
radius: this.params.expandRadius,
|
|
98
|
+
'as-whole-residues': true
|
|
99
|
+
});
|
|
100
|
+
lociDeatils = (0, loci_details_1.lociDetails)(sourceLoci);
|
|
101
|
+
if (!lociDeatils) {
|
|
102
|
+
surroundings = builder_1.MolScriptBuilder.struct.modifier.exceptBy({
|
|
103
|
+
0: surroundings,
|
|
104
|
+
by: target
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
_a = this.ensureShape(parent), state = _a.state, builder = _a.builder, refs = _a.refs;
|
|
108
|
+
builder.to(refs[SuperpositionFocusRepresentationTags.SurrSel]).update(transforms_1.StateTransforms.Model.StructureSelectionFromExpression, function (old) { return (tslib_1.__assign(tslib_1.__assign({}, old), { expression: surroundings, label: _this.surrLabel })); });
|
|
109
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.plugin, { state: state, tree: builder, options: { doNotLogTiming: true, doNotUpdateCurrent: true } })];
|
|
110
|
+
case 1:
|
|
111
|
+
_b.sent();
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
SuperpositionFocusRepresentationBehavior.prototype.register = function (ref) {
|
|
118
|
+
var _this = this;
|
|
119
|
+
this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current, function (entry) {
|
|
87
120
|
// if (entry) this.focus(entry.loci);
|
|
88
121
|
// else this.clear(StateTransform.RootRef);
|
|
89
|
-
|
|
122
|
+
_this.clear(mol_state_1.StateTransform.RootRef);
|
|
90
123
|
if (entry)
|
|
91
|
-
|
|
124
|
+
_this.focus(entry.loci);
|
|
92
125
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
126
|
+
};
|
|
127
|
+
SuperpositionFocusRepresentationBehavior.prototype.update = function (params) {
|
|
128
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
129
|
+
var old, state, builder, all, _a, _b, repr;
|
|
130
|
+
var e_2, _c;
|
|
131
|
+
return tslib_1.__generator(this, function (_d) {
|
|
132
|
+
switch (_d.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
old = this.params;
|
|
135
|
+
this.params = params;
|
|
136
|
+
state = this.plugin.state.data;
|
|
137
|
+
builder = state.build();
|
|
138
|
+
all = mol_state_1.StateSelection.Generators.root.subtree();
|
|
139
|
+
try {
|
|
140
|
+
for (_a = tslib_1.__values(state.select(all.withTag(SuperpositionFocusRepresentationTags.SurrRepr))), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
141
|
+
repr = _b.value;
|
|
142
|
+
builder.to(repr).update(this.params.surroundingsParams);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
146
|
+
finally {
|
|
147
|
+
try {
|
|
148
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
149
|
+
}
|
|
150
|
+
finally { if (e_2) throw e_2.error; }
|
|
151
|
+
}
|
|
152
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.plugin, { state: state, tree: builder, options: { doNotLogTiming: true, doNotUpdateCurrent: true } })];
|
|
153
|
+
case 1:
|
|
154
|
+
_d.sent();
|
|
155
|
+
if (!(params.expandRadius !== old.expandRadius)) return [3 /*break*/, 3];
|
|
156
|
+
return [4 /*yield*/, this.clear(mol_state_1.StateTransform.RootRef)];
|
|
157
|
+
case 2:
|
|
158
|
+
_d.sent();
|
|
159
|
+
_d.label = 3;
|
|
160
|
+
case 3: return [2 /*return*/, true];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
return SuperpositionFocusRepresentationBehavior;
|
|
166
|
+
}(behavior_1.PluginBehavior.WithSubscribers));
|
|
109
167
|
exports.SuperpositionFocusRepresentation = behavior_1.PluginBehavior.create({
|
|
110
168
|
name: 'create-superposition-focus-representation',
|
|
111
169
|
display: { name: 'Superposition Focus Representation' },
|
|
112
170
|
category: 'interaction',
|
|
113
171
|
ctor: SuperpositionFocusRepresentationBehavior,
|
|
114
|
-
params: (_, plugin)
|
|
172
|
+
params: function (_, plugin) { return SuperpositionFocusRepresentationParams(plugin); }
|
|
115
173
|
});
|
|
@@ -1,90 +1,124 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alignAndSuperposeWithSIFTSMapping =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports.alignAndSuperposeWithSIFTSMapping = alignAndSuperposeWithSIFTSMapping;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var int_1 = require("Molstar/mol-data/int");
|
|
6
|
+
var minimize_rmsd_1 = require("Molstar/mol-math/linear-algebra/3d/minimize-rmsd");
|
|
7
|
+
var sifts_mapping_1 = require("./sifts-mapping");
|
|
8
|
+
var element_1 = require("Molstar/mol-model/structure/structure/element");
|
|
8
9
|
function alignAndSuperposeWithSIFTSMapping(structures, options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var e_1, _a;
|
|
11
|
+
var _b, _c;
|
|
12
|
+
var indexMap = new Map();
|
|
13
|
+
for (var i = 0; i < structures.length; i++) {
|
|
14
|
+
var includeResidueTest = (_b = options === null || options === void 0 ? void 0 : options.includeResidueTest) !== null && _b !== void 0 ? _b : _includeAllResidues;
|
|
15
|
+
if ((options === null || options === void 0 ? void 0 : options.applyTestIndex) && !options.applyTestIndex.includes(i))
|
|
13
16
|
includeResidueTest = _includeAllResidues;
|
|
14
|
-
buildIndex(structures[i], indexMap, i, options
|
|
17
|
+
buildIndex(structures[i], indexMap, i, (_c = options === null || options === void 0 ? void 0 : options.traceOnly) !== null && _c !== void 0 ? _c : true, includeResidueTest);
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
var index = Array.from(indexMap.values());
|
|
17
20
|
// TODO: support non-first structure pivots
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const [a, b] = getPositionTables(index, p.i, p.j, p.count);
|
|
28
|
-
const transform = minimize_rmsd_1.MinimizeRmsd.compute({ a, b });
|
|
29
|
-
if (Number.isNaN(transform.rmsd)) {
|
|
30
|
-
failedPairs.push([p.i, p.j]);
|
|
21
|
+
var pairs = findPairs(structures.length, index);
|
|
22
|
+
var zeroOverlapPairs = [];
|
|
23
|
+
var failedPairs = [];
|
|
24
|
+
var entries = [];
|
|
25
|
+
try {
|
|
26
|
+
for (var pairs_1 = tslib_1.__values(pairs), pairs_1_1 = pairs_1.next(); !pairs_1_1.done; pairs_1_1 = pairs_1.next()) {
|
|
27
|
+
var p = pairs_1_1.value;
|
|
28
|
+
if (p.count === 0) {
|
|
29
|
+
zeroOverlapPairs.push([p.i, p.j]);
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
33
|
-
|
|
32
|
+
var _d = tslib_1.__read(getPositionTables(index, p.i, p.j, p.count), 2), a = _d[0], b = _d[1];
|
|
33
|
+
var transform = minimize_rmsd_1.MinimizeRmsd.compute({ a: a, b: b });
|
|
34
|
+
if (Number.isNaN(transform.rmsd)) {
|
|
35
|
+
failedPairs.push([p.i, p.j]);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
entries.push({ transform: transform, pivot: p.i, other: p.j });
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (pairs_1_1 && !pairs_1_1.done && (_a = pairs_1.return)) _a.call(pairs_1);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e_1) throw e_1.error; }
|
|
49
|
+
}
|
|
50
|
+
return { entries: entries, zeroOverlapPairs: zeroOverlapPairs, failedPairs: failedPairs };
|
|
38
51
|
}
|
|
39
|
-
exports.alignAndSuperposeWithSIFTSMapping = alignAndSuperposeWithSIFTSMapping;
|
|
40
52
|
function getPositionTables(index, pivot, other, N) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
var e_2, _a;
|
|
54
|
+
var xs = minimize_rmsd_1.MinimizeRmsd.Positions.empty(N);
|
|
55
|
+
var ys = minimize_rmsd_1.MinimizeRmsd.Positions.empty(N);
|
|
56
|
+
var o = 0;
|
|
57
|
+
try {
|
|
58
|
+
for (var index_1 = tslib_1.__values(index), index_1_1 = index_1.next(); !index_1_1.done; index_1_1 = index_1.next()) {
|
|
59
|
+
var pivots = index_1_1.value.pivots;
|
|
60
|
+
var a = pivots[pivot];
|
|
61
|
+
var b = pivots[other];
|
|
62
|
+
if (!a || !b)
|
|
63
|
+
continue;
|
|
64
|
+
var l = Math.min(a[2] - a[1], b[2] - b[1]);
|
|
65
|
+
// TODO: check if residue types match?
|
|
66
|
+
for (var i = 0; i < l; i++) {
|
|
67
|
+
var eI = (a[1] + i);
|
|
68
|
+
xs.x[o] = a[0].conformation.x(eI);
|
|
69
|
+
xs.y[o] = a[0].conformation.y(eI);
|
|
70
|
+
xs.z[o] = a[0].conformation.z(eI);
|
|
71
|
+
eI = (b[1] + i);
|
|
72
|
+
ys.x[o] = b[0].conformation.x(eI);
|
|
73
|
+
ys.y[o] = b[0].conformation.y(eI);
|
|
74
|
+
ys.z[o] = b[0].conformation.z(eI);
|
|
75
|
+
o++;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
80
|
+
finally {
|
|
81
|
+
try {
|
|
82
|
+
if (index_1_1 && !index_1_1.done && (_a = index_1.return)) _a.call(index_1);
|
|
61
83
|
}
|
|
84
|
+
finally { if (e_2) throw e_2.error; }
|
|
62
85
|
}
|
|
63
86
|
return [xs, ys];
|
|
64
87
|
}
|
|
65
88
|
function findPairs(N, index) {
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
var e_3, _a;
|
|
90
|
+
var pairwiseCounts = [];
|
|
91
|
+
for (var i = 0; i < N; i++) {
|
|
68
92
|
pairwiseCounts[i] = [];
|
|
69
|
-
for (
|
|
93
|
+
for (var j = 0; j < N; j++)
|
|
70
94
|
pairwiseCounts[i][j] = 0;
|
|
71
95
|
}
|
|
72
|
-
|
|
73
|
-
for (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
for (let j = i + 1; j < N; j++) {
|
|
78
|
-
if (!pivots[j])
|
|
96
|
+
try {
|
|
97
|
+
for (var index_2 = tslib_1.__values(index), index_2_1 = index_2.next(); !index_2_1.done; index_2_1 = index_2.next()) {
|
|
98
|
+
var pivots = index_2_1.value.pivots;
|
|
99
|
+
for (var i = 0; i < N; i++) {
|
|
100
|
+
if (!pivots[i])
|
|
79
101
|
continue;
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
var lI = pivots[i][2] - pivots[i][1];
|
|
103
|
+
for (var j = i + 1; j < N; j++) {
|
|
104
|
+
if (!pivots[j])
|
|
105
|
+
continue;
|
|
106
|
+
var lJ = pivots[j][2] - pivots[j][1];
|
|
107
|
+
pairwiseCounts[i][j] = pairwiseCounts[i][j] + Math.min(lI, lJ);
|
|
108
|
+
}
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
111
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
113
|
+
finally {
|
|
114
|
+
try {
|
|
115
|
+
if (index_2_1 && !index_2_1.done && (_a = index_2.return)) _a.call(index_2);
|
|
116
|
+
}
|
|
117
|
+
finally { if (e_3) throw e_3.error; }
|
|
118
|
+
}
|
|
119
|
+
var ret = [];
|
|
120
|
+
for (var j = 1; j < N; j++) {
|
|
121
|
+
ret[j - 1] = { i: 0, j: j, count: pairwiseCounts[0][j] };
|
|
88
122
|
}
|
|
89
123
|
// TODO: support non-first structure pivots
|
|
90
124
|
// for (let i = 0; i < N - 1; i++) {
|
|
@@ -101,53 +135,64 @@ function findPairs(N, index) {
|
|
|
101
135
|
}
|
|
102
136
|
function _includeAllResidues() { return true; }
|
|
103
137
|
function buildIndex(structure, index, sI, traceOnly, includeTest) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
while (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (traceOnly) {
|
|
128
|
-
start = traceElement;
|
|
129
|
-
if (start === -1)
|
|
138
|
+
var e_4, _a, _b;
|
|
139
|
+
var loc = element_1.StructureElement.Location.create(structure);
|
|
140
|
+
try {
|
|
141
|
+
for (var _c = tslib_1.__values(structure.units), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
142
|
+
var unit = _d.value;
|
|
143
|
+
if (unit.kind !== 0 /* Unit.Kind.Atomic */)
|
|
144
|
+
continue;
|
|
145
|
+
var elements = unit.elements, model = unit.model;
|
|
146
|
+
loc.unit = unit;
|
|
147
|
+
var map = sifts_mapping_1.SIFTSMapping.Provider.get(model).value;
|
|
148
|
+
if (!map)
|
|
149
|
+
return;
|
|
150
|
+
var dbName = map.dbName, accession = map.accession, num = map.num;
|
|
151
|
+
var chainsIt = int_1.Segmentation.transientSegments(unit.model.atomicHierarchy.chainAtomSegments, elements);
|
|
152
|
+
var residuesIt = int_1.Segmentation.transientSegments(unit.model.atomicHierarchy.residueAtomSegments, elements);
|
|
153
|
+
var traceElementIndex = unit.model.atomicHierarchy.derived.residue.traceElementIndex;
|
|
154
|
+
while (chainsIt.hasNext) {
|
|
155
|
+
var chainSegment = chainsIt.move();
|
|
156
|
+
residuesIt.setSegment(chainSegment);
|
|
157
|
+
while (residuesIt.hasNext) {
|
|
158
|
+
var residueSegment = residuesIt.move();
|
|
159
|
+
var rI = residueSegment.index;
|
|
160
|
+
if (!dbName[rI])
|
|
130
161
|
continue;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
162
|
+
var traceElement = traceElementIndex[rI];
|
|
163
|
+
var start = void 0, end = void 0;
|
|
164
|
+
if (traceOnly) {
|
|
165
|
+
start = traceElement;
|
|
166
|
+
if (start === -1)
|
|
167
|
+
continue;
|
|
168
|
+
end = start + 1;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
start = elements[residueSegment.start];
|
|
172
|
+
end = elements[residueSegment.end - 1] + 1;
|
|
173
|
+
}
|
|
174
|
+
loc.element = (traceElement >= 0 ? traceElement : start);
|
|
175
|
+
if (!includeTest(loc, rI, start, end))
|
|
176
|
+
continue;
|
|
177
|
+
var key = "".concat(dbName[rI], "-").concat(accession[rI].split('-')[0], "-").concat(num[rI]);
|
|
178
|
+
if (!index.has(key)) {
|
|
179
|
+
index.set(key, { key: key, pivots: (_b = {}, _b[sI] = [unit, start, end], _b) });
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
var entry = index.get(key);
|
|
183
|
+
if (!entry.pivots[sI]) {
|
|
184
|
+
entry.pivots[sI] = [unit, start, end];
|
|
185
|
+
}
|
|
148
186
|
}
|
|
149
187
|
}
|
|
150
188
|
}
|
|
151
189
|
}
|
|
152
190
|
}
|
|
191
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
192
|
+
finally {
|
|
193
|
+
try {
|
|
194
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
195
|
+
}
|
|
196
|
+
finally { if (e_4) throw e_4.error; }
|
|
197
|
+
}
|
|
153
198
|
}
|