drugflow-molstar 0.1.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/LICENSE +201 -0
- package/README.md +15 -0
- package/build/pdbe-molstar-3.1.2.css +1 -0
- package/build/pdbe-molstar-component-3.1.2.js +25 -0
- package/build/pdbe-molstar-plugin-3.1.2.js +2 -0
- package/build/pdbe-molstar-plugin-3.1.2.js.LICENSE.txt +39 -0
- package/lib/alphafold-transparency.d.ts +6 -0
- package/lib/alphafold-transparency.js +153 -0
- package/lib/custom-events.d.ts +4 -0
- package/lib/custom-events.js +56 -0
- package/lib/domain-annotations/behavior.d.ts +5 -0
- package/lib/domain-annotations/behavior.js +49 -0
- package/lib/domain-annotations/color.d.ts +10 -0
- package/lib/domain-annotations/color.js +78 -0
- package/lib/domain-annotations/prop.d.ts +35 -0
- package/lib/domain-annotations/prop.js +160 -0
- package/lib/helpers.d.ts +80 -0
- package/lib/helpers.js +278 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +901 -0
- package/lib/labels.d.ts +2 -0
- package/lib/labels.js +42 -0
- package/lib/loci-details.d.ts +27 -0
- package/lib/loci-details.js +128 -0
- package/lib/pdbe-molstar-component-build-3.1.2.js +2 -0
- package/lib/pdbe-molstar-component-build-3.1.2.js.LICENSE.txt +24 -0
- package/lib/sifts-mapping.d.ts +16 -0
- package/lib/sifts-mapping.js +83 -0
- package/lib/sifts-mappings-behaviour.d.ts +5 -0
- package/lib/sifts-mappings-behaviour.js +64 -0
- package/lib/spec.d.ts +75 -0
- package/lib/spec.js +105 -0
- package/lib/subscribe-events.d.ts +1 -0
- package/lib/subscribe-events.js +194 -0
- package/lib/superposition-export.d.ts +4 -0
- package/lib/superposition-export.js +152 -0
- package/lib/superposition-focus-representation.d.ts +16 -0
- package/lib/superposition-focus-representation.js +153 -0
- package/lib/superposition-sifts-mapping.d.ts +22 -0
- package/lib/superposition-sifts-mapping.js +159 -0
- package/lib/superposition.d.ts +18 -0
- package/lib/superposition.js +794 -0
- package/lib/ui/alphafold-superposition.d.ts +56 -0
- package/lib/ui/alphafold-superposition.js +178 -0
- package/lib/ui/alphafold-tranparency.d.ts +22 -0
- package/lib/ui/alphafold-tranparency.js +65 -0
- package/lib/ui/annotation-controls.d.ts +24 -0
- package/lib/ui/annotation-controls.js +166 -0
- package/lib/ui/export-superposition.d.ts +6 -0
- package/lib/ui/export-superposition.js +71 -0
- package/lib/ui/pdbe-left-panel.d.ts +18 -0
- package/lib/ui/pdbe-left-panel.js +167 -0
- package/lib/ui/pdbe-screenshot-controls.d.ts +20 -0
- package/lib/ui/pdbe-screenshot-controls.js +101 -0
- package/lib/ui/pdbe-structure-controls.d.ts +17 -0
- package/lib/ui/pdbe-structure-controls.js +70 -0
- package/lib/ui/pdbe-viewport-controls.d.ts +6 -0
- package/lib/ui/pdbe-viewport-controls.js +56 -0
- package/lib/ui/segment-tree.d.ts +18 -0
- package/lib/ui/segment-tree.js +804 -0
- package/lib/ui/superposition-components.d.ts +10 -0
- package/lib/ui/superposition-components.js +435 -0
- package/lib/ui/superposition-viewport.d.ts +5 -0
- package/lib/ui/superposition-viewport.js +23 -0
- package/package.json +79 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CollapsableControls, PurePluginUIComponent } from 'Molstar/mol-plugin-ui/base';
|
|
3
|
+
import { ParamDefinition as PD } from 'Molstar/mol-util/param-definition';
|
|
4
|
+
export declare function InfoIconSvg(): JSX.Element;
|
|
5
|
+
export declare class AlphafoldPaeControls extends CollapsableControls {
|
|
6
|
+
private axisBoxRef;
|
|
7
|
+
defaultState(): {
|
|
8
|
+
isCollapsed: boolean;
|
|
9
|
+
header: string;
|
|
10
|
+
brand: {
|
|
11
|
+
accent: "gray";
|
|
12
|
+
svg: typeof import("Molstar/mol-plugin-ui/controls/icons").FlipToFrontSvg;
|
|
13
|
+
};
|
|
14
|
+
isHidden: boolean;
|
|
15
|
+
};
|
|
16
|
+
constructor(props: any, context: any);
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
formatTicks(d: any): any;
|
|
19
|
+
renderControls(): JSX.Element | null;
|
|
20
|
+
}
|
|
21
|
+
export declare class AlphafoldSuperpositionControls extends CollapsableControls {
|
|
22
|
+
defaultState(): {
|
|
23
|
+
isCollapsed: boolean;
|
|
24
|
+
header: string;
|
|
25
|
+
brand: {
|
|
26
|
+
accent: "gray";
|
|
27
|
+
svg: typeof import("Molstar/mol-plugin-ui/controls/icons").FlipToFrontSvg;
|
|
28
|
+
};
|
|
29
|
+
isHidden: boolean;
|
|
30
|
+
};
|
|
31
|
+
componentDidMount(): void;
|
|
32
|
+
rmsdTable(): JSX.Element;
|
|
33
|
+
renderControls(): JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
export declare const AlphafoldSuperpositionParams: {
|
|
36
|
+
traceOnly: PD.BooleanParam;
|
|
37
|
+
};
|
|
38
|
+
export declare type AlphafoldSuperpositionOptions = PD.ValuesFor<typeof AlphafoldSuperpositionParams>;
|
|
39
|
+
declare type AfSuperpositionControlsState = {
|
|
40
|
+
isBusy: boolean;
|
|
41
|
+
action?: 'byChains' | 'byAtoms' | 'options';
|
|
42
|
+
canUseDb?: boolean;
|
|
43
|
+
options: AlphafoldSuperpositionOptions;
|
|
44
|
+
};
|
|
45
|
+
export declare class AfSuperpositionControls extends PurePluginUIComponent<{}, AfSuperpositionControlsState> {
|
|
46
|
+
state: AfSuperpositionControlsState;
|
|
47
|
+
componentDidMount(): void;
|
|
48
|
+
get selection(): import("molstar/lib/mol-plugin-state/manager/structure/selection").StructureSelectionManager;
|
|
49
|
+
get customState(): any;
|
|
50
|
+
superposeDb: () => Promise<void>;
|
|
51
|
+
toggleOptions: () => void;
|
|
52
|
+
superposeByDbMapping(): JSX.Element;
|
|
53
|
+
private setOptions;
|
|
54
|
+
render(): JSX.Element;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AfSuperpositionControls = exports.AlphafoldSuperpositionParams = exports.AlphafoldSuperpositionControls = exports.AlphafoldPaeControls = exports.InfoIconSvg = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
8
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
9
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
10
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
11
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
12
|
+
var superposition_1 = require("../superposition");
|
|
13
|
+
var d3_scale_1 = require("d3-scale");
|
|
14
|
+
var d3_axis_1 = require("d3-axis");
|
|
15
|
+
var d3_selection_1 = require("d3-selection");
|
|
16
|
+
var _InfoIcon = (0, jsx_runtime_1.jsx)("svg", tslib_1.__assign({ width: '24px', height: '24px', viewBox: '0 0 24 24', strokeWidth: '0.1px' }, { children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" }) }));
|
|
17
|
+
function InfoIconSvg() { return _InfoIcon; }
|
|
18
|
+
exports.InfoIconSvg = InfoIconSvg;
|
|
19
|
+
var AlphafoldPaeControls = /** @class */ (function (_super) {
|
|
20
|
+
tslib_1.__extends(AlphafoldPaeControls, _super);
|
|
21
|
+
function AlphafoldPaeControls(props, context) {
|
|
22
|
+
var _this = _super.call(this, props, context) || this;
|
|
23
|
+
_this.axisBoxRef = react_1.default.createRef();
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
AlphafoldPaeControls.prototype.defaultState = function () {
|
|
27
|
+
return {
|
|
28
|
+
isCollapsed: false,
|
|
29
|
+
header: 'AlphaFold PAE',
|
|
30
|
+
brand: { accent: 'gray', svg: icons_1.SuperpositionSvg },
|
|
31
|
+
isHidden: true
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
AlphafoldPaeControls.prototype.componentDidMount = function () {
|
|
35
|
+
var _this = this;
|
|
36
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function (sel) {
|
|
37
|
+
var superpositionState = _this.plugin.customState.superpositionState;
|
|
38
|
+
if (superpositionState && superpositionState.alphafold.ref && superpositionState.alphafold.apiData.pae && superpositionState.alphafold.apiData.pae !== '' && superpositionState.alphafold.apiData.pae !== '') {
|
|
39
|
+
_this.setState({ isHidden: false });
|
|
40
|
+
var domainMax = superpositionState.alphafold.apiData.length;
|
|
41
|
+
var x = (0, d3_scale_1.scaleLinear)().domain([0, domainMax]).range([0, 200]);
|
|
42
|
+
var xAxis = (0, d3_axis_1.axisBottom)(x).ticks(6).tickFormat(_this.formatTicks).tickSizeOuter(0);
|
|
43
|
+
var yAxis = (0, d3_axis_1.axisLeft)(x).ticks(6).tickFormat(_this.formatTicks).tickSizeOuter(0);
|
|
44
|
+
var axisContainer = (0, d3_selection_1.select)(_this.axisBoxRef.current);
|
|
45
|
+
axisContainer.append('svg:svg')
|
|
46
|
+
.attr('width', 220)
|
|
47
|
+
.attr('height', 30)
|
|
48
|
+
.attr('class', 'pae-x-axis')
|
|
49
|
+
.style('z-index', '1')
|
|
50
|
+
.style('position', 'absolute')
|
|
51
|
+
.attr('transform', "translate(-93,202)")
|
|
52
|
+
.append('g')
|
|
53
|
+
.attr('transform', "translate(6,0)")
|
|
54
|
+
.call(xAxis);
|
|
55
|
+
axisContainer.append('svg:svg')
|
|
56
|
+
.attr('width', 50)
|
|
57
|
+
.attr('height', 220)
|
|
58
|
+
.attr('class', 'pae-y-axis')
|
|
59
|
+
.style('z-index', '1')
|
|
60
|
+
.style('position', 'absolute')
|
|
61
|
+
.attr('transform', "translate(-123,0)")
|
|
62
|
+
.append('g')
|
|
63
|
+
.attr('transform', "translate(36,4)")
|
|
64
|
+
.call(yAxis);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
AlphafoldPaeControls.prototype.formatTicks = function (d) {
|
|
69
|
+
return d > 999 ? d / 1000 + 'k' : d;
|
|
70
|
+
};
|
|
71
|
+
AlphafoldPaeControls.prototype.renderControls = function () {
|
|
72
|
+
var superpositionState = this.plugin.customState.superpositionState;
|
|
73
|
+
if (!superpositionState || !superpositionState.alphafold)
|
|
74
|
+
return null;
|
|
75
|
+
var errorScale = [0, 5, 10, 15, 20, 25, 30];
|
|
76
|
+
return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row', style: { height: 'auto', textAlign: 'center', justifyContent: 'center', padding: '15px 0', position: 'relative', fontSize: '12px' } }, { children: [(0, jsx_runtime_1.jsx)("div", { ref: this.axisBoxRef, className: 'pae-axis-box', style: { position: 'absolute', width: '100%', height: '100%' } }), (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ style: { transform: 'rotate(270deg)', position: 'absolute', transformOrigin: '0 0', left: '10px', top: '165px', fontWeight: 500 } }, { children: "Aligned residue" })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row', style: { height: 'auto', flexDirection: 'column' } }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { width: '200px', height: '200px', border: '1px solid #6a635a', margin: '2px 0 25px 25px', position: 'relative' } }, { children: (0, jsx_runtime_1.jsx)("img", { style: { width: '100%', height: '100%', position: 'absolute', left: 0, top: 0 }, src: "".concat(superpositionState.alphafold.apiData.pae), alt: "PAE" }) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { textAlign: 'center', paddingLeft: '30px', marginBottom: '20px', fontWeight: 500 } }, { children: "Scored residue" })), (0, jsx_runtime_1.jsx)("img", { style: { width: '200px', height: '10px', border: '1px solid #6a635a', margin: '2px 0 25px 25px', transform: 'rotate(180deg)' }, src: 'https://alphafold.ebi.ac.uk/assets/img/horizontal_colorbar.png', alt: "PAE Scale" }), (0, jsx_runtime_1.jsx)("ul", tslib_1.__assign({ style: { listStyleType: 'none', fontWeight: 500, margin: 0, display: 'inline-block', position: 'absolute', top: '292px', marginLeft: '24px' } }, { children: errorScale.map(function (errValue) { return (0, jsx_runtime_1.jsx)("li", tslib_1.__assign({ style: { float: 'left', marginRight: '18px' } }, { children: errValue }), errValue); }) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { textAlign: 'center', paddingLeft: '20px', fontWeight: 500 } }, { children: "Expected position error (\u00C5ngstr\u00F6ms)" }))] }))] }));
|
|
77
|
+
};
|
|
78
|
+
return AlphafoldPaeControls;
|
|
79
|
+
}(base_1.CollapsableControls));
|
|
80
|
+
exports.AlphafoldPaeControls = AlphafoldPaeControls;
|
|
81
|
+
var AlphafoldSuperpositionControls = /** @class */ (function (_super) {
|
|
82
|
+
tslib_1.__extends(AlphafoldSuperpositionControls, _super);
|
|
83
|
+
function AlphafoldSuperpositionControls() {
|
|
84
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
85
|
+
}
|
|
86
|
+
AlphafoldSuperpositionControls.prototype.defaultState = function () {
|
|
87
|
+
return {
|
|
88
|
+
isCollapsed: false,
|
|
89
|
+
header: 'AlphaFold Superposition',
|
|
90
|
+
brand: { accent: 'gray', svg: icons_1.SuperpositionSvg },
|
|
91
|
+
isHidden: true
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
AlphafoldSuperpositionControls.prototype.componentDidMount = function () {
|
|
95
|
+
var _this = this;
|
|
96
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function (sel) {
|
|
97
|
+
var superpositionState = _this.plugin.customState.superpositionState;
|
|
98
|
+
if (superpositionState && superpositionState.alphafold.apiData.cif && superpositionState.alphafold.apiData.cif !== '') {
|
|
99
|
+
_this.setState({ isHidden: false });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
AlphafoldSuperpositionControls.prototype.rmsdTable = function () {
|
|
104
|
+
var spData = this.plugin.customState.superpositionState;
|
|
105
|
+
var activeSegment = spData.activeSegment;
|
|
106
|
+
var rmsds = spData.alphafold.rmsds;
|
|
107
|
+
return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-control-offset' }, { children: [(rmsds.length == 0 || !rmsds[activeSegment - 1]) && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-flex-row', style: { padding: '5px 0 0 10px' } }, { children: (0, jsx_runtime_1.jsx)("strong", { children: "No overlap found!" }) })), rmsds[activeSegment - 1] && (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { width: '40%', borderRight: '1px solid rgb(213 206 196)', padding: '5px 0 0 5px' } }, { children: (0, jsx_runtime_1.jsx)("strong", { children: "Entry" }) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { padding: '5px 0 0 5px' } }, { children: (0, jsx_runtime_1.jsx)("strong", { children: "RMSD (\u212B)" }) }))] })), rmsds[activeSegment - 1] && rmsds[activeSegment - 1].map(function (d) {
|
|
108
|
+
var details = d.split(':');
|
|
109
|
+
return details[1] !== '-' ? (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-control-row-label', style: { width: '40%', borderRight: '1px solid rgb(213 206 196)', padding: '5px 0 0 5px' } }, { children: details[0] })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { padding: '5px 0 0 5px' } }, { children: details[1] }))] }), d) : null;
|
|
110
|
+
})] }));
|
|
111
|
+
};
|
|
112
|
+
AlphafoldSuperpositionControls.prototype.renderControls = function () {
|
|
113
|
+
var superpositionState = this.plugin.customState.superpositionState;
|
|
114
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [superpositionState.alphafold.ref !== '' && this.rmsdTable(), superpositionState.alphafold.ref === '' && (0, jsx_runtime_1.jsx)(AfSuperpositionControls, {})] });
|
|
115
|
+
};
|
|
116
|
+
return AlphafoldSuperpositionControls;
|
|
117
|
+
}(base_1.CollapsableControls));
|
|
118
|
+
exports.AlphafoldSuperpositionControls = AlphafoldSuperpositionControls;
|
|
119
|
+
exports.AlphafoldSuperpositionParams = {
|
|
120
|
+
// alignSequences: PD.Boolean(true, { isEssential: true, description: 'For Chain-based 3D superposition, perform a sequence alignment and use the aligned residue pairs to guide the 3D superposition.' }),
|
|
121
|
+
traceOnly: param_definition_1.ParamDefinition.Boolean(true, { description: 'For Chain- and Uniprot-based 3D superposition, base superposition only on CA (and equivalent) atoms.' })
|
|
122
|
+
};
|
|
123
|
+
var DefaultAlphafoldSuperpositionOptions = param_definition_1.ParamDefinition.getDefaultValues(exports.AlphafoldSuperpositionParams);
|
|
124
|
+
var AfSuperpositionControls = /** @class */ (function (_super) {
|
|
125
|
+
tslib_1.__extends(AfSuperpositionControls, _super);
|
|
126
|
+
function AfSuperpositionControls() {
|
|
127
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
128
|
+
_this.state = {
|
|
129
|
+
isBusy: false,
|
|
130
|
+
canUseDb: true,
|
|
131
|
+
action: undefined,
|
|
132
|
+
options: DefaultAlphafoldSuperpositionOptions
|
|
133
|
+
};
|
|
134
|
+
_this.superposeDb = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
135
|
+
var spData;
|
|
136
|
+
return tslib_1.__generator(this, function (_a) {
|
|
137
|
+
this.setState({ isBusy: true });
|
|
138
|
+
spData = this.plugin.customState.superpositionState;
|
|
139
|
+
spData.alphafold.traceOnly = this.state.options.traceOnly;
|
|
140
|
+
(0, superposition_1.superposeAf)(this.plugin, this.state.options.traceOnly);
|
|
141
|
+
return [2 /*return*/];
|
|
142
|
+
});
|
|
143
|
+
}); };
|
|
144
|
+
_this.toggleOptions = function () { return _this.setState({ action: _this.state.action === 'options' ? void 0 : 'options' }); };
|
|
145
|
+
_this.setOptions = function (values) {
|
|
146
|
+
_this.setState({ options: values });
|
|
147
|
+
};
|
|
148
|
+
return _this;
|
|
149
|
+
}
|
|
150
|
+
AfSuperpositionControls.prototype.componentDidMount = function () {
|
|
151
|
+
var _this = this;
|
|
152
|
+
this.subscribe(this.plugin.behaviors.state.isBusy, function (v) {
|
|
153
|
+
_this.setState({ isBusy: v });
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
Object.defineProperty(AfSuperpositionControls.prototype, "selection", {
|
|
157
|
+
get: function () {
|
|
158
|
+
return this.plugin.managers.structure.selection;
|
|
159
|
+
},
|
|
160
|
+
enumerable: false,
|
|
161
|
+
configurable: true
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(AfSuperpositionControls.prototype, "customState", {
|
|
164
|
+
get: function () {
|
|
165
|
+
return this.plugin.customState;
|
|
166
|
+
},
|
|
167
|
+
enumerable: false,
|
|
168
|
+
configurable: true
|
|
169
|
+
});
|
|
170
|
+
AfSuperpositionControls.prototype.superposeByDbMapping = function () {
|
|
171
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ icon: icons_1.SuperposeChainsSvg, title: 'Superpose AlphaFold structure using intersection of residues from SIFTS UNIPROT mapping.', className: 'msp-btn msp-btn-block', onClick: this.superposeDb, style: { marginTop: '1px', textAlign: 'left' }, disabled: this.state.isBusy }, { children: "Load AlphaFold structure" })) });
|
|
172
|
+
};
|
|
173
|
+
AfSuperpositionControls.prototype.render = function () {
|
|
174
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { backgroundColor: '#dce54e', fontWeight: 500, padding: '5px 12px' } }, { children: "New Feature!" })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-help-text', style: { margin: '2px 0' } }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-help-description' }, { children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { svg: InfoIconSvg, inline: true }), "Load and superpose AlphaFold structure against representative chains."] })) })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row' }, { children: [this.state.canUseDb && this.superposeByDbMapping(), (0, jsx_runtime_1.jsx)(common_1.ToggleButton, { icon: icons_1.TuneSvg, label: '', title: 'Options', toggle: this.toggleOptions, isSelected: this.state.action === 'options', disabled: this.state.isBusy, style: { flex: '0 0 40px', padding: 0 } })] })), this.state.action === 'options' && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-control-offset' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: exports.AlphafoldSuperpositionParams, values: this.state.options, onChangeValues: this.setOptions, isDisabled: this.state.isBusy }) }))] });
|
|
175
|
+
};
|
|
176
|
+
return AfSuperpositionControls;
|
|
177
|
+
}(base_1.PurePluginUIComponent));
|
|
178
|
+
exports.AfSuperpositionControls = AfSuperpositionControls;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CollapsableControls } from 'Molstar/mol-plugin-ui/base';
|
|
3
|
+
export declare class AlphafoldTransparencyControls extends CollapsableControls<{}, {
|
|
4
|
+
transpareny: any;
|
|
5
|
+
}> {
|
|
6
|
+
defaultState(): {
|
|
7
|
+
isCollapsed: boolean;
|
|
8
|
+
header: string;
|
|
9
|
+
brand: {
|
|
10
|
+
accent: "gray";
|
|
11
|
+
svg: typeof import("Molstar/mol-plugin-ui/controls/icons").FlipToFrontSvg;
|
|
12
|
+
};
|
|
13
|
+
isHidden: boolean;
|
|
14
|
+
transpareny: {
|
|
15
|
+
score: number;
|
|
16
|
+
opacity: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
componentDidMount(): void;
|
|
20
|
+
updateTransparency: (val: any) => Promise<void>;
|
|
21
|
+
renderControls(): JSX.Element;
|
|
22
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlphafoldTransparencyControls = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
7
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
8
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
9
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
10
|
+
var alphafold_transparency_1 = require("../alphafold-transparency");
|
|
11
|
+
var TransparencyParams = {
|
|
12
|
+
score: param_definition_1.ParamDefinition.Numeric(70, { min: 0, max: 100, step: 1 }, { label: 'pLDDT less than', description: 'pLDDT score value in the range of 0 to 100' }),
|
|
13
|
+
opacity: param_definition_1.ParamDefinition.Numeric(0.2, { min: 0, max: 1, step: 0.01 }, { description: 'Opacity value in the range 0 to 1' })
|
|
14
|
+
};
|
|
15
|
+
var AlphafoldTransparencyControls = /** @class */ (function (_super) {
|
|
16
|
+
tslib_1.__extends(AlphafoldTransparencyControls, _super);
|
|
17
|
+
function AlphafoldTransparencyControls() {
|
|
18
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
19
|
+
_this.updateTransparency = function (val) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
20
|
+
var superpositionState, afStr;
|
|
21
|
+
return tslib_1.__generator(this, function (_a) {
|
|
22
|
+
switch (_a.label) {
|
|
23
|
+
case 0:
|
|
24
|
+
this.setState({ transpareny: val });
|
|
25
|
+
superpositionState = this.plugin.customState.superpositionState;
|
|
26
|
+
afStr = this.plugin.managers.structure.hierarchy.current.refs.get(superpositionState.alphafold.ref);
|
|
27
|
+
return [4 /*yield*/, (0, alphafold_transparency_1.clearStructureTransparency)(this.plugin, afStr.components)];
|
|
28
|
+
case 1:
|
|
29
|
+
_a.sent();
|
|
30
|
+
return [4 /*yield*/, (0, alphafold_transparency_1.applyAFTransparency)(this.plugin, afStr, 1 - val.opacity, val.score)];
|
|
31
|
+
case 2:
|
|
32
|
+
_a.sent();
|
|
33
|
+
return [2 /*return*/];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}); };
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
AlphafoldTransparencyControls.prototype.defaultState = function () {
|
|
40
|
+
return {
|
|
41
|
+
isCollapsed: false,
|
|
42
|
+
header: 'AlphaFold Structure Opacity',
|
|
43
|
+
brand: { accent: 'gray', svg: icons_1.SuperpositionSvg },
|
|
44
|
+
isHidden: true,
|
|
45
|
+
transpareny: {
|
|
46
|
+
score: 70,
|
|
47
|
+
opacity: 0.2
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
AlphafoldTransparencyControls.prototype.componentDidMount = function () {
|
|
52
|
+
var _this = this;
|
|
53
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function (sel) {
|
|
54
|
+
var superpositionState = _this.plugin.customState.superpositionState;
|
|
55
|
+
if (superpositionState && superpositionState.alphafold.ref && superpositionState.alphafold.ref !== '') {
|
|
56
|
+
_this.setState({ isHidden: false });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
AlphafoldTransparencyControls.prototype.renderControls = function () {
|
|
61
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: TransparencyParams, values: this.state.transpareny, onChangeValues: this.updateTransparency }) });
|
|
62
|
+
};
|
|
63
|
+
return AlphafoldTransparencyControls;
|
|
64
|
+
}(base_1.CollapsableControls));
|
|
65
|
+
exports.AlphafoldTransparencyControls = AlphafoldTransparencyControls;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PurePluginUIComponent } from 'Molstar/mol-plugin-ui/base';
|
|
3
|
+
export declare function TextsmsOutlinedSvg(): JSX.Element;
|
|
4
|
+
export declare class AnnotationsComponentControls extends PurePluginUIComponent<{}, {
|
|
5
|
+
isCollapsed: boolean;
|
|
6
|
+
validationApplied: boolean;
|
|
7
|
+
domainAtnApplied: boolean;
|
|
8
|
+
validationParams: any;
|
|
9
|
+
domainAtnParams: any;
|
|
10
|
+
validationOptions: any;
|
|
11
|
+
domainAtnOptions: any;
|
|
12
|
+
description?: string;
|
|
13
|
+
}> {
|
|
14
|
+
state: any;
|
|
15
|
+
componentDidMount(): void;
|
|
16
|
+
getOptionParams: () => void;
|
|
17
|
+
toggleCollapsed: () => void;
|
|
18
|
+
toggleOptions: (type: number) => void;
|
|
19
|
+
applyAnnotation: (type: number, visibleState: boolean, params?: any) => void;
|
|
20
|
+
initApplyAnnotation: (type: number) => void;
|
|
21
|
+
updateValidationParams: (val: any) => void;
|
|
22
|
+
updateDomainAtnParams: (val: any) => void;
|
|
23
|
+
render(): JSX.Element;
|
|
24
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnnotationsComponentControls = exports.TextsmsOutlinedSvg = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
7
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
8
|
+
var color_1 = require("Molstar/extensions/pdbe/structure-quality-report/color");
|
|
9
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
10
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
11
|
+
var color_2 = require("../domain-annotations/color");
|
|
12
|
+
var behavior_1 = require("Molstar/extensions/pdbe/structure-quality-report/behavior");
|
|
13
|
+
var behavior_2 = require("../domain-annotations/behavior");
|
|
14
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
15
|
+
var hierarchy_1 = require("Molstar/mol-plugin-state/manager/structure/hierarchy");
|
|
16
|
+
var _TextsmsOutlined = (0, jsx_runtime_1.jsxs)("svg", tslib_1.__assign({ width: '24px', height: '24px', viewBox: '0 0 24 24' }, { children: [(0, jsx_runtime_1.jsx)("path", { fill: "none", d: "M0 0h24v24H0V0z" }), (0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 9h2v2H7zM11 9h2v2h-2zM15 9h2v2h-2z" })] })] }));
|
|
17
|
+
function TextsmsOutlinedSvg() { return _TextsmsOutlined; }
|
|
18
|
+
exports.TextsmsOutlinedSvg = TextsmsOutlinedSvg;
|
|
19
|
+
var AnnotationsComponentControls = /** @class */ (function (_super) {
|
|
20
|
+
tslib_1.__extends(AnnotationsComponentControls, _super);
|
|
21
|
+
function AnnotationsComponentControls() {
|
|
22
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
+
_this.state = {
|
|
24
|
+
isCollapsed: false,
|
|
25
|
+
validationApplied: false,
|
|
26
|
+
domainAtnApplied: false,
|
|
27
|
+
validationOptions: false,
|
|
28
|
+
domainAtnOptions: false
|
|
29
|
+
};
|
|
30
|
+
_this.getOptionParams = function () {
|
|
31
|
+
var validationAnnotationCtrl = false;
|
|
32
|
+
var domainAnnotationCtrl = false;
|
|
33
|
+
var customState = _this.plugin.customState;
|
|
34
|
+
if (customState && customState.initParams) {
|
|
35
|
+
if (customState.initParams.validationAnnotation)
|
|
36
|
+
validationAnnotationCtrl = true;
|
|
37
|
+
if (customState.initParams.domainAnnotation)
|
|
38
|
+
domainAnnotationCtrl = true;
|
|
39
|
+
}
|
|
40
|
+
if ((validationAnnotationCtrl && !_this.state.validationParams) || (domainAnnotationCtrl && !_this.state.domainAtnParams)) {
|
|
41
|
+
var groupRef = mol_state_1.StateSelection.findTagInSubtree(_this.plugin.state.data.tree, mol_state_1.StateTransform.RootRef, 'structure-component-static-polymer');
|
|
42
|
+
if (groupRef) {
|
|
43
|
+
var struct = _this.plugin.state.data.select(groupRef)[0].obj;
|
|
44
|
+
if (struct) {
|
|
45
|
+
var themeDataCtx = { structure: struct.data };
|
|
46
|
+
if (validationAnnotationCtrl && !_this.state.validationParams) {
|
|
47
|
+
var validationActionsParams = color_1.StructureQualityReportColorThemeProvider.getParams(themeDataCtx);
|
|
48
|
+
if (validationActionsParams) {
|
|
49
|
+
_this.setState({ validationParams: {
|
|
50
|
+
params: validationActionsParams,
|
|
51
|
+
values: { type: validationActionsParams.type.defaultValue }
|
|
52
|
+
} });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (domainAnnotationCtrl && !_this.state.domainAtnParams) {
|
|
56
|
+
var domainActionsParams = color_2.DomainAnnotationsColorThemeProvider.getParams(themeDataCtx);
|
|
57
|
+
if (domainActionsParams) {
|
|
58
|
+
_this.setState({ domainAtnParams: {
|
|
59
|
+
params: domainActionsParams,
|
|
60
|
+
values: { type: domainActionsParams.type.defaultValue }
|
|
61
|
+
} });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
_this.toggleCollapsed = function () {
|
|
69
|
+
_this.setState({ isCollapsed: !_this.state.isCollapsed });
|
|
70
|
+
};
|
|
71
|
+
_this.toggleOptions = function (type) {
|
|
72
|
+
if (type === 0)
|
|
73
|
+
_this.setState({ validationOptions: !_this.state.validationOptions });
|
|
74
|
+
if (type === 1)
|
|
75
|
+
_this.setState({ domainAtnOptions: !_this.state.domainAtnOptions });
|
|
76
|
+
};
|
|
77
|
+
_this.applyAnnotation = function (type, visibleState, params) {
|
|
78
|
+
// Defaults
|
|
79
|
+
var themeName = 'polymer-id';
|
|
80
|
+
var themePropsToAdd = behavior_1.PDBeStructureQualityReport;
|
|
81
|
+
var themePropsToRemove = _this.state.domainAtnParams ? behavior_2.PDBeDomainAnnotations : void 0;
|
|
82
|
+
// Set Theme Params
|
|
83
|
+
if (type === 0) {
|
|
84
|
+
if (visibleState) {
|
|
85
|
+
themeName = 'pdbe-structure-quality-report';
|
|
86
|
+
}
|
|
87
|
+
_this.setState({ validationApplied: visibleState });
|
|
88
|
+
_this.setState({ domainAtnApplied: false });
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
themePropsToAdd = behavior_2.PDBeDomainAnnotations;
|
|
92
|
+
themePropsToRemove = _this.state.validationParams ? behavior_1.PDBeStructureQualityReport : void 0;
|
|
93
|
+
if (visibleState)
|
|
94
|
+
themeName = 'pdbe-domain-annotations';
|
|
95
|
+
_this.setState({ domainAtnApplied: visibleState });
|
|
96
|
+
_this.setState({ validationApplied: false });
|
|
97
|
+
}
|
|
98
|
+
// Update Tooltip
|
|
99
|
+
if (visibleState && themeName !== 'polymer-id') {
|
|
100
|
+
var addTooltipUpdate = _this.plugin.state.behaviors.build().to(themePropsToAdd.id).update(themePropsToAdd, function (old) { old.showTooltip = true; });
|
|
101
|
+
_this.plugin.runTask(_this.plugin.state.behaviors.updateTree(addTooltipUpdate));
|
|
102
|
+
if (themePropsToRemove) {
|
|
103
|
+
var removeTooltipUpdate = _this.plugin.state.behaviors.build().to(themePropsToRemove.id).update(themePropsToRemove, function (old) { old.showTooltip = false; });
|
|
104
|
+
_this.plugin.runTask(_this.plugin.state.behaviors.updateTree(removeTooltipUpdate));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var polymerGroup;
|
|
108
|
+
var componentGroups = _this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
109
|
+
componentGroups.forEach(function (compGrp) {
|
|
110
|
+
if (compGrp[0].key === 'structure-component-static-polymer')
|
|
111
|
+
polymerGroup = compGrp;
|
|
112
|
+
});
|
|
113
|
+
if (polymerGroup) {
|
|
114
|
+
_this.plugin.managers.structure.component.updateRepresentationsTheme(polymerGroup, { color: themeName, colorParams: params ? params : void 0 });
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
_this.initApplyAnnotation = function (type) {
|
|
118
|
+
if (type === 0)
|
|
119
|
+
_this.applyAnnotation(0, !_this.state.validationApplied, _this.state.validationParams.values);
|
|
120
|
+
if (type === 1)
|
|
121
|
+
_this.applyAnnotation(1, !_this.state.domainAtnApplied, _this.state.domainAtnParams.values);
|
|
122
|
+
};
|
|
123
|
+
_this.updateValidationParams = function (val) {
|
|
124
|
+
var updatedParams = tslib_1.__assign({}, _this.state.validationParams);
|
|
125
|
+
updatedParams.values = val;
|
|
126
|
+
_this.setState({ validationParams: updatedParams });
|
|
127
|
+
if (_this.state.validationApplied)
|
|
128
|
+
_this.applyAnnotation(0, _this.state.validationApplied, val);
|
|
129
|
+
};
|
|
130
|
+
_this.updateDomainAtnParams = function (val) {
|
|
131
|
+
var updatedParams = tslib_1.__assign({}, _this.state.domainAtnParams);
|
|
132
|
+
updatedParams.values = val;
|
|
133
|
+
_this.setState({ domainAtnParams: updatedParams });
|
|
134
|
+
if (_this.state.domainAtnApplied)
|
|
135
|
+
_this.applyAnnotation(1, _this.state.domainAtnApplied, val);
|
|
136
|
+
};
|
|
137
|
+
return _this;
|
|
138
|
+
}
|
|
139
|
+
AnnotationsComponentControls.prototype.componentDidMount = function () {
|
|
140
|
+
var _this = this;
|
|
141
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function () {
|
|
142
|
+
_this.getOptionParams();
|
|
143
|
+
_this.forceUpdate();
|
|
144
|
+
});
|
|
145
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function (c) { return _this.setState({
|
|
146
|
+
description: hierarchy_1.StructureHierarchyManager.getSelectedStructuresDescription(_this.plugin)
|
|
147
|
+
}); });
|
|
148
|
+
};
|
|
149
|
+
AnnotationsComponentControls.prototype.render = function () {
|
|
150
|
+
var _this = this;
|
|
151
|
+
if (!this.state.validationParams && !this.state.domainAtnParams)
|
|
152
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
153
|
+
var brand = {
|
|
154
|
+
accent: 'green',
|
|
155
|
+
svg: TextsmsOutlinedSvg
|
|
156
|
+
};
|
|
157
|
+
var wrapClass = this.state.isCollapsed
|
|
158
|
+
? 'msp-transform-wrapper msp-transform-wrapper-collapsed'
|
|
159
|
+
: 'msp-transform-wrapper';
|
|
160
|
+
return (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: wrapClass }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-transform-header' }, { children: (0, jsx_runtime_1.jsxs)(common_1.Button, tslib_1.__assign({ icon: brand ? void 0 : this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, noOverflow: true, onClick: this.toggleCollapsed, className: brand ? "msp-transform-header-brand msp-transform-header-brand-".concat(brand.accent) : void 0, title: "Click to ".concat(this.state.isCollapsed ? 'expand' : 'collapse') }, { children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { svg: brand === null || brand === void 0 ? void 0 : brand.svg, inline: true }), "Annotations", (0, jsx_runtime_1.jsx)("small", tslib_1.__assign({ style: { margin: '0 6px' } }, { children: this.state.isCollapsed ? '' : this.state.description }))] })) })), !this.state.isCollapsed && this.state.validationParams &&
|
|
161
|
+
(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ noOverflow: true, className: 'msp-control-button-label', title: "Validation Report Annotations.", style: { textAlign: 'left' } }, { children: "Validation Report" })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.initApplyAnnotation(0); }, toggleState: false, svg: !this.state.validationApplied ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, title: "Click to ".concat(this.state.validationApplied ? 'Hide' : 'Show', " Validation Report Annotation"), small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.toggleOptions(0); }, svg: icons_1.MoreHorizSvg, title: 'Actions', toggleState: this.state.validationOptions, className: 'msp-form-control', flex: true })] })), !this.state.isCollapsed && this.state.validationParams && this.state.validationOptions && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: '6px' } }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "msp-accent-offset" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.validationParams.params, values: this.state.validationParams.values, onChangeValues: this.updateValidationParams }) })) })) })), !this.state.isCollapsed && this.state.domainAtnParams &&
|
|
162
|
+
(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ noOverflow: true, className: 'msp-control-button-label', title: "Domain Annotations.", style: { textAlign: 'left' } }, { children: "Domains" })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.initApplyAnnotation(1); }, toggleState: false, svg: !this.state.domainAtnApplied ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, title: "Click to ".concat(this.state.domainAtnApplied ? 'Hide' : 'Show', " Domain Annotation"), small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { onClick: function () { return _this.toggleOptions(1); }, svg: icons_1.MoreHorizSvg, title: 'Actions', toggleState: this.state.domainAtnOptions, className: 'msp-form-control', flex: true })] })), !this.state.isCollapsed && this.state.domainAtnParams && this.state.domainAtnOptions && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: '6px' } }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "msp-accent-offset" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.domainAtnParams.params, values: this.state.domainAtnParams.values, onChangeValues: this.updateDomainAtnParams }) })) })) }))] }));
|
|
163
|
+
};
|
|
164
|
+
return AnnotationsComponentControls;
|
|
165
|
+
}(base_1.PurePluginUIComponent));
|
|
166
|
+
exports.AnnotationsComponentControls = AnnotationsComponentControls;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CollapsableControls, CollapsableState } from 'Molstar/mol-plugin-ui/base';
|
|
3
|
+
export declare class SuperpositionModelExportUI extends CollapsableControls<{}, {}> {
|
|
4
|
+
protected defaultState(): CollapsableState;
|
|
5
|
+
protected renderControls(): JSX.Element | null;
|
|
6
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SuperpositionModelExportUI = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
8
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
9
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
10
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
11
|
+
var use_behavior_1 = require("Molstar/mol-plugin-ui/hooks/use-behavior");
|
|
12
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
13
|
+
var superposition_export_1 = require("../superposition-export");
|
|
14
|
+
var SuperpositionModelExportUI = /** @class */ (function (_super) {
|
|
15
|
+
tslib_1.__extends(SuperpositionModelExportUI, _super);
|
|
16
|
+
function SuperpositionModelExportUI() {
|
|
17
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
18
|
+
}
|
|
19
|
+
SuperpositionModelExportUI.prototype.defaultState = function () {
|
|
20
|
+
return {
|
|
21
|
+
header: 'Export Models',
|
|
22
|
+
isCollapsed: true,
|
|
23
|
+
brand: { accent: 'cyan', svg: icons_1.GetAppSvg }
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
SuperpositionModelExportUI.prototype.renderControls = function () {
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(SuperpositionExportControls, { plugin: this.plugin });
|
|
28
|
+
};
|
|
29
|
+
return SuperpositionModelExportUI;
|
|
30
|
+
}(base_1.CollapsableControls));
|
|
31
|
+
exports.SuperpositionModelExportUI = SuperpositionModelExportUI;
|
|
32
|
+
var Params = {
|
|
33
|
+
format: param_definition_1.ParamDefinition.Select('cif', [['cif', 'mmCIF'], ['bcif', 'Binary mmCIF']])
|
|
34
|
+
};
|
|
35
|
+
var DefaultParams = param_definition_1.ParamDefinition.getDefaultValues(Params);
|
|
36
|
+
function SuperpositionExportControls(_a) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
var plugin = _a.plugin;
|
|
39
|
+
var _b = (0, react_1.useState)(DefaultParams), params = _b[0], setParams = _b[1];
|
|
40
|
+
var _c = (0, react_1.useState)(false), exporting = _c[0], setExporting = _c[1];
|
|
41
|
+
(0, use_behavior_1.useBehavior)(plugin.managers.structure.hierarchy.behaviors.selection); // triggers UI update
|
|
42
|
+
var isBusy = (0, use_behavior_1.useBehavior)(plugin.behaviors.state.isBusy);
|
|
43
|
+
var hierarchy = plugin.managers.structure.hierarchy.current;
|
|
44
|
+
var label = 'Nothing to Export';
|
|
45
|
+
if (hierarchy.structures.length === 1) {
|
|
46
|
+
label = 'Export';
|
|
47
|
+
}
|
|
48
|
+
if (hierarchy.structures.length > 1) {
|
|
49
|
+
label = 'Export (as ZIP)';
|
|
50
|
+
}
|
|
51
|
+
var onExport = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
return tslib_1.__generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
setExporting(true);
|
|
56
|
+
_a.label = 1;
|
|
57
|
+
case 1:
|
|
58
|
+
_a.trys.push([1, , 3, 4]);
|
|
59
|
+
return [4 /*yield*/, (0, superposition_export_1.superpositionExportHierarchy)(plugin, { format: params.format })];
|
|
60
|
+
case 2:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [3 /*break*/, 4];
|
|
63
|
+
case 3:
|
|
64
|
+
setExporting(false);
|
|
65
|
+
return [7 /*endfinally*/];
|
|
66
|
+
case 4: return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); };
|
|
70
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: Params, values: params, onChangeValues: setParams, isDisabled: isBusy || exporting }), (0, jsx_runtime_1.jsx)(common_1.Button, tslib_1.__assign({ onClick: onExport, style: { marginTop: 1 }, disabled: isBusy || hierarchy.structures.length === 0 || exporting, commit: hierarchy.structures.length ? 'on' : 'off' }, { children: label }))] });
|
|
71
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PluginUIComponent } from 'Molstar/mol-plugin-ui/base';
|
|
3
|
+
export declare function WavesIconSvg(): JSX.Element;
|
|
4
|
+
declare type LeftPanelTabName = 'none' | 'root' | 'data' | 'states' | 'settings' | 'help' | 'segments';
|
|
5
|
+
export declare class LeftPanelControls extends PluginUIComponent<{}, {
|
|
6
|
+
tab: LeftPanelTabName;
|
|
7
|
+
}> {
|
|
8
|
+
state: {
|
|
9
|
+
tab: LeftPanelTabName;
|
|
10
|
+
};
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
set: (tab: LeftPanelTabName) => void;
|
|
13
|
+
tabs: {
|
|
14
|
+
[K in LeftPanelTabName]: JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
render(): JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|