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
package/lib/labels.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PluginBehavior } from 'Molstar/mol-plugin/behavior';
|
|
2
|
-
export declare const PDBeLociLabelProvider: import("
|
|
2
|
+
export declare const PDBeLociLabelProvider: import("Molstar/mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {}>;
|
package/lib/labels.js
CHANGED
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PDBeLociLabelProvider = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var behavior_1 = require("Molstar/mol-plugin/behavior");
|
|
6
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
7
|
+
var label_1 = require("Molstar/mol-theme/label");
|
|
7
8
|
exports.PDBeLociLabelProvider = behavior_1.PluginBehavior.create({
|
|
8
9
|
name: 'pdbe-loci-label-provider',
|
|
9
10
|
category: 'interaction',
|
|
10
|
-
ctor: class {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
constructor(ctx) {
|
|
11
|
+
ctor: /** @class */ (function () {
|
|
12
|
+
function class_1(ctx) {
|
|
13
|
+
var _this = this;
|
|
14
14
|
this.ctx = ctx;
|
|
15
15
|
this.f = {
|
|
16
|
-
label: (loci)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
label: function (loci) {
|
|
17
|
+
var e_1, _a;
|
|
18
|
+
var customState = (_this.ctx.customState);
|
|
19
|
+
var superpositionView = (customState && customState.initParams.superposition) ? true : false;
|
|
20
|
+
var label = [];
|
|
20
21
|
if (!superpositionView && structure_1.StructureElement.Loci.is(loci) && loci.elements.length === 1) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
var entityNames = new Set();
|
|
23
|
+
try {
|
|
24
|
+
for (var _b = tslib_1.__values(loci.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
25
|
+
var u = _c.value.unit;
|
|
26
|
+
var l = structure_1.StructureElement.Location.create(loci.structure, u, u.elements[0]);
|
|
27
|
+
var name_1 = structure_1.StructureProperties.entity.pdbx_description(l).join(', ');
|
|
28
|
+
entityNames.add(name_1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e_1) throw e_1.error; }
|
|
26
37
|
}
|
|
27
38
|
if (entityNames.size === 1)
|
|
28
|
-
entityNames.forEach(name
|
|
39
|
+
entityNames.forEach(function (name) { return label.push(name); });
|
|
29
40
|
}
|
|
30
41
|
label.push((0, label_1.lociLabel)(loci));
|
|
31
|
-
return label.filter(l
|
|
42
|
+
return label.filter(function (l) { return !!l; }).join('</br>');
|
|
32
43
|
},
|
|
33
|
-
group: (label)
|
|
44
|
+
group: function (label) { return label.toString().replace(/Model [0-9]+/g, 'Models'); },
|
|
34
45
|
priority: 100
|
|
35
46
|
};
|
|
36
47
|
}
|
|
37
|
-
|
|
48
|
+
class_1.prototype.register = function () { this.ctx.managers.lociLabels.addProvider(this.f); };
|
|
49
|
+
class_1.prototype.unregister = function () { this.ctx.managers.lociLabels.removeProvider(this.f); };
|
|
50
|
+
return class_1;
|
|
51
|
+
}()),
|
|
38
52
|
display: { name: 'Provide PDBe Loci Label' }
|
|
39
53
|
});
|
package/lib/loci-details.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.lociDetails = lociDetails;
|
|
4
|
+
exports.bondLabel = bondLabel;
|
|
5
|
+
exports._bundleLabel = _bundleLabel;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
8
|
+
var int_1 = require("Molstar/mol-data/int");
|
|
9
|
+
var sifts_mapping_1 = require("Molstar/mol-model-props/sequence/sifts-mapping");
|
|
7
10
|
function lociDetails(loci) {
|
|
8
11
|
switch (loci.kind) {
|
|
9
12
|
case 'structure-loci':
|
|
10
|
-
return { models: loci.structure.models.map(m
|
|
13
|
+
return { models: loci.structure.models.map(function (m) { return m.entry; }).filter(function (l) { return !!l; }) };
|
|
11
14
|
case 'element-loci':
|
|
12
15
|
return structureElementStatsDetail(structure_1.StructureElement.Stats.ofLoci(loci));
|
|
13
16
|
case 'bond-loci':
|
|
14
|
-
|
|
15
|
-
return bond ? bondLabel(bond, 'element') :
|
|
17
|
+
var bond = loci.bonds[0];
|
|
18
|
+
return bond ? bondLabel(bond, 'element') : undefined;
|
|
16
19
|
default:
|
|
17
20
|
return void 0;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
exports.lociDetails = lociDetails;
|
|
21
23
|
function structureElementStatsDetail(stats) {
|
|
22
|
-
|
|
24
|
+
var chainCount = stats.chainCount, residueCount = stats.residueCount, elementCount = stats.elementCount;
|
|
23
25
|
if (elementCount === 1 && residueCount === 0 && chainCount === 0) {
|
|
24
26
|
return getElementDetails(stats.firstElementLoc, 'element');
|
|
25
27
|
}
|
|
@@ -30,9 +32,10 @@ function structureElementStatsDetail(stats) {
|
|
|
30
32
|
return void 0;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
function getElementDetails(location, granularity
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
function getElementDetails(location, granularity) {
|
|
36
|
+
if (granularity === void 0) { granularity = 'element'; }
|
|
37
|
+
var basicDetails = {};
|
|
38
|
+
var entry = location.unit.model.entry;
|
|
36
39
|
if (entry.length > 30)
|
|
37
40
|
entry = entry.substr(0, 27) + '\u2026'; // ellipsis
|
|
38
41
|
basicDetails['entry_id'] = entry; // entry
|
|
@@ -40,17 +43,17 @@ function getElementDetails(location, granularity = 'element') {
|
|
|
40
43
|
basicDetails['model'] = location.unit.model.modelNum; // model
|
|
41
44
|
basicDetails['instance'] = location.unit.conformation.operator.name; // instance
|
|
42
45
|
}
|
|
43
|
-
|
|
46
|
+
var elementDetails;
|
|
44
47
|
if (structure_1.Unit.isAtomic(location.unit)) {
|
|
45
48
|
elementDetails = atomicElementDetails(location, granularity);
|
|
46
49
|
}
|
|
47
50
|
else if (structure_1.Unit.isCoarse(location.unit)) {
|
|
48
51
|
elementDetails = coarseElementDetails(location, granularity);
|
|
49
52
|
}
|
|
50
|
-
return {
|
|
53
|
+
return tslib_1.__assign(tslib_1.__assign({}, basicDetails), elementDetails);
|
|
51
54
|
}
|
|
52
55
|
function atomicElementDetails(location, granularity) {
|
|
53
|
-
|
|
56
|
+
var elementDetails = {
|
|
54
57
|
entity_id: structure_1.StructureProperties.chain.label_entity_id(location),
|
|
55
58
|
label_asym_id: structure_1.StructureProperties.chain.label_asym_id(location),
|
|
56
59
|
auth_asym_id: structure_1.StructureProperties.chain.auth_asym_id(location),
|
|
@@ -63,29 +66,29 @@ function atomicElementDetails(location, granularity) {
|
|
|
63
66
|
atom_id: [structure_1.StructureProperties.atom.label_atom_id(location)],
|
|
64
67
|
alt_id: structure_1.StructureProperties.atom.label_alt_id(location)
|
|
65
68
|
};
|
|
66
|
-
|
|
69
|
+
var unpLabel = sifts_mapping_1.SIFTSMapping.getLabel(location);
|
|
67
70
|
if (unpLabel) {
|
|
68
|
-
|
|
71
|
+
var unpLabelDetails = unpLabel.split(' ');
|
|
69
72
|
if (unpLabelDetails[0] === 'UNP') {
|
|
70
73
|
elementDetails.unp_accession = unpLabelDetails[1];
|
|
71
74
|
elementDetails.unp_seq_id = +unpLabelDetails[2];
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
var microHetCompIds = structure_1.StructureProperties.residue.microheterogeneityCompIds(location);
|
|
75
78
|
elementDetails['micro_het_comp_ids'] = granularity === 'residue' && microHetCompIds.length > 1 ?
|
|
76
79
|
microHetCompIds : [elementDetails['comp_id']];
|
|
77
80
|
return elementDetails;
|
|
78
81
|
}
|
|
79
82
|
function coarseElementDetails(location, granularity) {
|
|
80
|
-
|
|
83
|
+
var elementDetails = {
|
|
81
84
|
asym_id: structure_1.StructureProperties.coarse.asym_id(location),
|
|
82
85
|
seq_id_begin: structure_1.StructureProperties.coarse.seq_id_begin(location),
|
|
83
86
|
seq_id_end: structure_1.StructureProperties.coarse.seq_id_end(location)
|
|
84
87
|
};
|
|
85
88
|
if (granularity === 'residue') {
|
|
86
89
|
if (elementDetails.seq_id_begin === elementDetails.seq_id_end) {
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
var entityIndex = structure_1.StructureProperties.coarse.entityKey(location);
|
|
91
|
+
var seq = location.unit.model.sequence.byEntityKey[entityIndex];
|
|
89
92
|
elementDetails['comp_id'] = seq.sequence.compId.value(elementDetails.seq_id_begin - 1); // 1-indexed
|
|
90
93
|
}
|
|
91
94
|
}
|
|
@@ -97,29 +100,38 @@ function bondLabel(bond, granularity) {
|
|
|
97
100
|
structure_1.StructureElement.Loci(bond.bStructure, [{ unit: bond.bUnit, indices: int_1.OrderedSet.ofSingleton(bond.bIndex) }])
|
|
98
101
|
] }, granularity);
|
|
99
102
|
}
|
|
100
|
-
exports.bondLabel = bondLabel;
|
|
101
103
|
function _bundleLabel(bundle, granularity) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
var e_1, _a;
|
|
105
|
+
var isSingleElements = true;
|
|
106
|
+
try {
|
|
107
|
+
for (var _b = tslib_1.__values(bundle.loci), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
108
|
+
var l = _c.value;
|
|
109
|
+
if (!structure_1.StructureElement.Loci.is(l) || structure_1.StructureElement.Loci.size(l) !== 1) {
|
|
110
|
+
isSingleElements = false;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
116
|
+
finally {
|
|
117
|
+
try {
|
|
118
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
107
119
|
}
|
|
120
|
+
finally { if (e_1) throw e_1.error; }
|
|
108
121
|
}
|
|
109
122
|
if (isSingleElements) {
|
|
110
|
-
|
|
111
|
-
|
|
123
|
+
var locations = bundle.loci.map(function (l) {
|
|
124
|
+
var _a = l.elements[0], unit = _a.unit, indices = _a.indices;
|
|
112
125
|
return structure_1.StructureElement.Location.create(l.structure, unit, unit.elements[int_1.OrderedSet.start(indices)]);
|
|
113
126
|
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
var elementDetailsArr = locations.map(function (l) { return getElementDetails(l, granularity); });
|
|
128
|
+
var atomIds = [elementDetailsArr[0].atom_id[0], elementDetailsArr[1].atom_id[0]];
|
|
129
|
+
var elementDetails = elementDetailsArr[0];
|
|
117
130
|
elementDetails['atom_id'] = atomIds;
|
|
118
131
|
return elementDetails;
|
|
119
132
|
}
|
|
120
133
|
else {
|
|
121
|
-
|
|
134
|
+
var elementDetails = bundle.loci.map(function (l) { return lociDetails(l); });
|
|
122
135
|
return elementDetails;
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
|
-
exports._bundleLabel = _bundleLabel;
|
package/lib/sifts-mapping.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SIFTSMapping = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var db_1 = require("Molstar/mol-data/db");
|
|
6
|
+
var mmcif_1 = require("Molstar/mol-model-formats/structure/mmcif");
|
|
7
|
+
var custom_property_1 = require("Molstar/mol-model/custom-property");
|
|
8
|
+
var custom_model_property_1 = require("Molstar/mol-model-props/common/custom-model-property");
|
|
8
9
|
var SIFTSMapping;
|
|
9
10
|
(function (SIFTSMapping) {
|
|
11
|
+
var _this = this;
|
|
10
12
|
SIFTSMapping.Provider = custom_model_property_1.CustomModelProperty.createProvider({
|
|
11
13
|
label: 'SIFTS Mapping',
|
|
12
14
|
descriptor: (0, custom_property_1.CustomPropertyDescriptor)({
|
|
@@ -14,54 +16,56 @@ var SIFTSMapping;
|
|
|
14
16
|
}),
|
|
15
17
|
type: 'static',
|
|
16
18
|
defaultParams: {},
|
|
17
|
-
getParams: ()
|
|
18
|
-
isApplicable: (data)
|
|
19
|
-
obtain:
|
|
20
|
-
return
|
|
21
|
-
|
|
19
|
+
getParams: function () { return ({}); },
|
|
20
|
+
isApplicable: function (data) { return isAvailable(data); },
|
|
21
|
+
obtain: function (ctx, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
22
|
+
return tslib_1.__generator(this, function (_a) {
|
|
23
|
+
return [2 /*return*/, { value: fromCif(data) }];
|
|
24
|
+
});
|
|
25
|
+
}); }
|
|
22
26
|
});
|
|
23
27
|
function isAvailable(model) {
|
|
24
28
|
if (!mmcif_1.MmcifFormat.is(model.sourceData))
|
|
25
29
|
return false;
|
|
26
|
-
|
|
30
|
+
var _a = model.sourceData.data.db.atom_site, db_name = _a.pdbx_sifts_xref_db_name, db_acc = _a.pdbx_sifts_xref_db_acc, db_num = _a.pdbx_sifts_xref_db_num, db_res = _a.pdbx_sifts_xref_db_res;
|
|
27
31
|
return db_name.isDefined && db_acc.isDefined && db_num.isDefined && db_res.isDefined;
|
|
28
32
|
}
|
|
29
33
|
SIFTSMapping.isAvailable = isAvailable;
|
|
30
34
|
function getKey(loc) {
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
var model = loc.unit.model;
|
|
36
|
+
var data = SIFTSMapping.Provider.get(model).value;
|
|
33
37
|
if (!data)
|
|
34
38
|
return '';
|
|
35
|
-
|
|
39
|
+
var rI = model.atomicHierarchy.residueAtomSegments.index[loc.element];
|
|
36
40
|
return data.accession[rI];
|
|
37
41
|
}
|
|
38
42
|
SIFTSMapping.getKey = getKey;
|
|
39
43
|
function getLabel(loc) {
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
var model = loc.unit.model;
|
|
45
|
+
var data = SIFTSMapping.Provider.get(model).value;
|
|
42
46
|
if (!data)
|
|
43
47
|
return;
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
var rI = model.atomicHierarchy.residueAtomSegments.index[loc.element];
|
|
49
|
+
var dbName = data.dbName[rI];
|
|
46
50
|
if (!dbName)
|
|
47
51
|
return;
|
|
48
|
-
return
|
|
52
|
+
return "".concat(dbName, " ").concat(data.accession[rI], " ").concat(data.num[rI], " ").concat(data.residue[rI]);
|
|
49
53
|
}
|
|
50
54
|
SIFTSMapping.getLabel = getLabel;
|
|
51
55
|
function fromCif(model) {
|
|
52
56
|
if (!mmcif_1.MmcifFormat.is(model.sourceData))
|
|
53
57
|
return;
|
|
54
|
-
|
|
58
|
+
var _a = model.sourceData.data.db.atom_site, db_name = _a.pdbx_sifts_xref_db_name, db_acc = _a.pdbx_sifts_xref_db_acc, db_num = _a.pdbx_sifts_xref_db_num, db_res = _a.pdbx_sifts_xref_db_res;
|
|
55
59
|
if (!db_name.isDefined || !db_acc.isDefined || !db_num.isDefined || !db_res.isDefined)
|
|
56
60
|
return;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for (
|
|
64
|
-
|
|
61
|
+
var atomSourceIndex = model.atomicHierarchy.atomSourceIndex;
|
|
62
|
+
var _b = model.atomicHierarchy.residueAtomSegments, count = _b.count, residueOffsets = _b.offsets;
|
|
63
|
+
var dbName = new Array(count);
|
|
64
|
+
var accession = new Array(count);
|
|
65
|
+
var num = new Array(count);
|
|
66
|
+
var residue = new Array(count);
|
|
67
|
+
for (var i = 0; i < count; i++) {
|
|
68
|
+
var row = atomSourceIndex.value(residueOffsets[i]);
|
|
65
69
|
if (db_name.valueKind(row) !== db_1.Column.ValueKind.Present) {
|
|
66
70
|
dbName[i] = '';
|
|
67
71
|
accession[i] = '';
|
|
@@ -74,6 +78,6 @@ var SIFTSMapping;
|
|
|
74
78
|
num[i] = db_num.value(row);
|
|
75
79
|
residue[i] = db_res.value(row);
|
|
76
80
|
}
|
|
77
|
-
return { dbName, accession, num, residue };
|
|
81
|
+
return { dbName: dbName, accession: accession, num: num, residue: residue };
|
|
78
82
|
}
|
|
79
83
|
})(SIFTSMapping || (exports.SIFTSMapping = SIFTSMapping = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginBehavior } from 'Molstar/mol-plugin/behavior';
|
|
2
|
-
export declare const PDBeSIFTSMapping: import("
|
|
2
|
+
export declare const PDBeSIFTSMapping: import("Molstar/mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {
|
|
3
3
|
autoAttach: boolean;
|
|
4
4
|
showTooltip: boolean;
|
|
5
5
|
}>;
|
|
@@ -1,60 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PDBeSIFTSMapping = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var int_1 = require("Molstar/mol-data/int");
|
|
6
|
+
var sifts_mapping_1 = require("./sifts-mapping");
|
|
7
|
+
var sifts_mapping_2 = require("Molstar/mol-model-props/sequence/themes/sifts-mapping");
|
|
8
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
9
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
10
|
+
var behavior_1 = require("Molstar/mol-plugin/behavior");
|
|
10
11
|
exports.PDBeSIFTSMapping = behavior_1.PluginBehavior.create({
|
|
11
12
|
name: 'pdbe-sifts-mapping-prop',
|
|
12
13
|
category: 'custom-props',
|
|
13
14
|
display: { name: 'PDBe SIFTS Mapping' },
|
|
14
|
-
ctor: class
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
ctor: /** @class */ (function (_super) {
|
|
16
|
+
tslib_1.__extends(class_1, _super);
|
|
17
|
+
function class_1() {
|
|
18
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
19
|
+
_this.provider = sifts_mapping_1.SIFTSMapping.Provider;
|
|
20
|
+
_this.labelProvider = {
|
|
21
|
+
label: function (loci) {
|
|
22
|
+
if (!_this.params.showTooltip)
|
|
21
23
|
return;
|
|
22
24
|
return PDBeBestDatabaseSequenceMappingLabel(loci);
|
|
23
25
|
}
|
|
24
26
|
};
|
|
27
|
+
return _this;
|
|
25
28
|
}
|
|
26
|
-
update(p) {
|
|
27
|
-
|
|
29
|
+
class_1.prototype.update = function (p) {
|
|
30
|
+
var updated = (this.params.autoAttach !== p.autoAttach ||
|
|
28
31
|
this.params.showTooltip !== p.showTooltip);
|
|
29
32
|
this.params.autoAttach = p.autoAttach;
|
|
30
33
|
this.params.showTooltip = p.showTooltip;
|
|
31
34
|
this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name, this.params.autoAttach);
|
|
32
35
|
return updated;
|
|
33
|
-
}
|
|
34
|
-
register() {
|
|
36
|
+
};
|
|
37
|
+
class_1.prototype.register = function () {
|
|
35
38
|
this.ctx.customModelProperties.register(this.provider, this.params.autoAttach);
|
|
36
39
|
this.ctx.representation.structure.themes.colorThemeRegistry.add(sifts_mapping_2.SIFTSMappingColorThemeProvider);
|
|
37
40
|
this.ctx.managers.lociLabels.addProvider(this.labelProvider);
|
|
38
|
-
}
|
|
39
|
-
unregister() {
|
|
41
|
+
};
|
|
42
|
+
class_1.prototype.unregister = function () {
|
|
40
43
|
this.ctx.customModelProperties.unregister(this.provider.descriptor.name);
|
|
41
44
|
this.ctx.representation.structure.themes.colorThemeRegistry.remove(sifts_mapping_2.SIFTSMappingColorThemeProvider);
|
|
42
45
|
this.ctx.managers.lociLabels.removeProvider(this.labelProvider);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
};
|
|
47
|
+
return class_1;
|
|
48
|
+
}(behavior_1.PluginBehavior.Handler)),
|
|
49
|
+
params: function () { return ({
|
|
46
50
|
autoAttach: param_definition_1.ParamDefinition.Boolean(true),
|
|
47
51
|
showTooltip: param_definition_1.ParamDefinition.Boolean(true)
|
|
48
|
-
})
|
|
52
|
+
}); }
|
|
49
53
|
});
|
|
50
54
|
//
|
|
51
55
|
function PDBeBestDatabaseSequenceMappingLabel(loci) {
|
|
52
56
|
if (loci.kind === 'element-loci') {
|
|
53
57
|
if (loci.elements.length === 0)
|
|
54
58
|
return;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
var e = loci.elements[0];
|
|
60
|
+
var u = e.unit;
|
|
61
|
+
var se = structure_1.StructureElement.Location.create(loci.structure, u, u.elements[int_1.OrderedSet.getAt(e.indices, 0)]);
|
|
58
62
|
return sifts_mapping_1.SIFTSMapping.getLabel(se);
|
|
59
63
|
}
|
|
60
64
|
}
|
package/lib/spec.js
CHANGED
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.DefaultParams = exports.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
exports.DefaultParams = exports.DefaultPluginUISpec = exports.DefaultPluginSpec = void 0;
|
|
4
|
+
exports.createPluginUI = createPluginUI;
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
6
|
+
var React = tslib_1.__importStar(require("react"));
|
|
7
|
+
var ReactDOM = tslib_1.__importStar(require("react-dom"));
|
|
8
|
+
var volume_1 = require("Molstar/mol-plugin-ui/custom/volume");
|
|
9
|
+
var plugin_1 = require("Molstar/mol-plugin-ui/plugin");
|
|
10
|
+
var behavior_1 = require("Molstar/mol-plugin/behavior");
|
|
11
|
+
var transformers_1 = require("Molstar/mol-plugin/behavior/dynamic/volume-streaming/transformers");
|
|
12
|
+
var context_1 = require("Molstar/mol-plugin-ui/context");
|
|
13
|
+
var spec_1 = require("Molstar/mol-plugin/spec");
|
|
14
|
+
var config_1 = require("Molstar/mol-plugin/config");
|
|
15
|
+
var actions_1 = require("Molstar/mol-plugin-state/actions");
|
|
16
|
+
var labels_1 = require("./labels");
|
|
17
|
+
var sifts_mappings_behaviour_1 = require("./sifts-mappings-behaviour");
|
|
18
|
+
var DefaultPluginSpec = function () { return ({
|
|
40
19
|
actions: [
|
|
41
20
|
spec_1.PluginSpec.Action(actions_1.StateActions.Structure.EnableStructureCustomProps)
|
|
42
21
|
],
|
|
@@ -59,25 +38,34 @@ const DefaultPluginSpec = () => ({
|
|
|
59
38
|
config: [
|
|
60
39
|
[config_1.PluginConfig.VolumeStreaming.DefaultServer, 'https://www.ebi.ac.uk/pdbe/volume-server']
|
|
61
40
|
]
|
|
62
|
-
});
|
|
41
|
+
}); };
|
|
63
42
|
exports.DefaultPluginSpec = DefaultPluginSpec;
|
|
64
|
-
|
|
65
|
-
...(0, exports.DefaultPluginSpec)(),
|
|
66
|
-
customParamEditors: [
|
|
43
|
+
var DefaultPluginUISpec = function () { return (tslib_1.__assign(tslib_1.__assign({}, (0, exports.DefaultPluginSpec)()), { customParamEditors: [
|
|
67
44
|
[transformers_1.CreateVolumeStreamingBehavior, volume_1.VolumeStreamingCustomControls]
|
|
68
|
-
]
|
|
69
|
-
});
|
|
45
|
+
] })); };
|
|
70
46
|
exports.DefaultPluginUISpec = DefaultPluginUISpec;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
function createPluginUI(target, spec, options) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var ctx;
|
|
50
|
+
return tslib_1.__generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
ctx = new context_1.PluginUIContext(spec || (0, exports.DefaultPluginUISpec)());
|
|
54
|
+
return [4 /*yield*/, ctx.init()];
|
|
55
|
+
case 1:
|
|
56
|
+
_a.sent();
|
|
57
|
+
if (!(options === null || options === void 0 ? void 0 : options.onBeforeUIRender)) return [3 /*break*/, 3];
|
|
58
|
+
return [4 /*yield*/, options.onBeforeUIRender(ctx)];
|
|
59
|
+
case 2:
|
|
60
|
+
_a.sent();
|
|
61
|
+
_a.label = 3;
|
|
62
|
+
case 3:
|
|
63
|
+
ReactDOM.render(React.createElement(plugin_1.Plugin, { plugin: ctx }), target);
|
|
64
|
+
return [2 /*return*/, ctx];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
79
68
|
}
|
|
80
|
-
exports.createPluginUI = createPluginUI;
|
|
81
69
|
exports.DefaultParams = {
|
|
82
70
|
moleculeId: undefined,
|
|
83
71
|
superposition: undefined,
|