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.
Files changed (54) hide show
  1. package/build/drugflow-molstar-0.4.9.css +1 -0
  2. package/build/drugflow-molstar-component-0.4.9.js +25 -0
  3. package/build/drugflow-molstar-plugin-0.4.9.js +2 -0
  4. package/build/drugflow-molstar-plugin-0.4.9.js.LICENSE.txt +39 -0
  5. package/lib/alphafold-transparency.js +157 -62
  6. package/lib/contact.d.ts +7 -14
  7. package/lib/contact.js +68 -72
  8. package/lib/custom-events.js +15 -15
  9. package/lib/domain-annotations/behavior.d.ts +1 -1
  10. package/lib/domain-annotations/behavior.js +24 -20
  11. package/lib/domain-annotations/color.js +22 -22
  12. package/lib/domain-annotations/prop.js +111 -62
  13. package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
  14. package/lib/drugflow-molstar-component-build-0.4.8.js.LICENSE.txt +24 -0
  15. package/lib/drugflow-molstar-component-build-0.4.9.js +2 -0
  16. package/lib/drugflow-molstar-component-build-0.4.9.js.LICENSE.txt +24 -0
  17. package/lib/helpers.d.ts +3 -3
  18. package/lib/helpers.js +94 -89
  19. package/lib/index.d.ts +902 -1
  20. package/lib/index.js +2814 -1875
  21. package/lib/labels.d.ts +1 -1
  22. package/lib/labels.js +34 -20
  23. package/lib/loci-details.js +46 -34
  24. package/lib/sifts-mapping.js +32 -28
  25. package/lib/sifts-mappings-behaviour.d.ts +1 -1
  26. package/lib/sifts-mappings-behaviour.js +30 -26
  27. package/lib/spec.js +40 -52
  28. package/lib/structure_contact3d.d.ts +14 -21
  29. package/lib/structure_contact3d.js +46 -25
  30. package/lib/subscribe-events.js +18 -19
  31. package/lib/superposition-export.js +178 -102
  32. package/lib/superposition-focus-representation.d.ts +2 -2
  33. package/lib/superposition-focus-representation.js +131 -73
  34. package/lib/superposition-sifts-mapping.js +150 -105
  35. package/lib/superposition.js +810 -495
  36. package/lib/ui/alphafold-superposition.d.ts +1 -1
  37. package/lib/ui/alphafold-superposition.js +118 -94
  38. package/lib/ui/alphafold-tranparency.js +43 -27
  39. package/lib/ui/annotation-controls.js +89 -83
  40. package/lib/ui/export-superposition.d.ts +0 -1
  41. package/lib/ui/export-superposition.js +50 -32
  42. package/lib/ui/pdbe-left-panel.d.ts +0 -1
  43. package/lib/ui/pdbe-left-panel.js +105 -82
  44. package/lib/ui/pdbe-screenshot-controls.js +83 -54
  45. package/lib/ui/pdbe-structure-controls.js +57 -34
  46. package/lib/ui/pdbe-viewport-controls.js +29 -23
  47. package/lib/ui/segment-tree.js +663 -440
  48. package/lib/ui/superposition-components.js +312 -208
  49. package/lib/ui/superposition-viewport.js +18 -11
  50. package/package.json +3 -3
  51. package/build/drugflow-molstar-0.4.7.css +0 -1
  52. package/build/drugflow-molstar-component-0.4.7.js +0 -25
  53. package/build/drugflow-molstar-plugin-0.4.7.js +0 -2
  54. package/build/drugflow-molstar-plugin-0.4.7.js.LICENSE.txt +0 -64
@@ -44,7 +44,7 @@ type AfSuperpositionControlsState = {
44
44
  export declare class AfSuperpositionControls extends PurePluginUIComponent<{}, AfSuperpositionControlsState> {
45
45
  state: AfSuperpositionControlsState;
46
46
  componentDidMount(): void;
47
- get selection(): import("molstar/lib/mol-plugin-state/manager/structure/selection").StructureSelectionManager;
47
+ get selection(): import("Molstar/mol-plugin-state/manager/structure/selection").StructureSelectionManager;
48
48
  get customState(): any;
49
49
  superposeDb: () => Promise<void>;
50
50
  toggleOptions: () => void;
@@ -1,55 +1,56 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AfSuperpositionControls = exports.AlphafoldSuperpositionParams = exports.AlphafoldSuperpositionControls = exports.AlphafoldPaeControls = exports.InfoIconSvg = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = __importDefault(require("react"));
9
- const base_1 = require("Molstar/mol-plugin-ui/base");
10
- const icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
11
- const common_1 = require("Molstar/mol-plugin-ui/controls/common");
12
- const param_definition_1 = require("Molstar/mol-util/param-definition");
13
- const parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
14
- const superposition_1 = require("../superposition");
15
- const d3_scale_1 = require("d3-scale");
16
- const d3_axis_1 = require("d3-axis");
17
- const d3_selection_1 = require("d3-selection");
18
- const _InfoIcon = (0, jsx_runtime_1.jsx)("svg", { 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" }) });
19
- function InfoIconSvg() { return _InfoIcon; }
3
+ exports.AfSuperpositionControls = exports.AlphafoldSuperpositionParams = exports.AlphafoldSuperpositionControls = exports.AlphafoldPaeControls = void 0;
20
4
  exports.InfoIconSvg = InfoIconSvg;
21
- class AlphafoldPaeControls extends base_1.CollapsableControls {
22
- defaultState() {
5
+ var tslib_1 = require("tslib");
6
+ var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var react_1 = tslib_1.__importDefault(require("react"));
8
+ var base_1 = require("Molstar/mol-plugin-ui/base");
9
+ var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
10
+ var common_1 = require("Molstar/mol-plugin-ui/controls/common");
11
+ var param_definition_1 = require("Molstar/mol-util/param-definition");
12
+ var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
13
+ var superposition_1 = require("../superposition");
14
+ var d3_scale_1 = require("d3-scale");
15
+ var d3_axis_1 = require("d3-axis");
16
+ var d3_selection_1 = require("d3-selection");
17
+ var _InfoIcon = (0, jsx_runtime_1.jsx)("svg", { 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" }) });
18
+ function InfoIconSvg() { return _InfoIcon; }
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 () {
23
27
  return {
24
28
  isCollapsed: false,
25
29
  header: 'AlphaFold PAE',
26
30
  brand: { accent: 'gray', svg: icons_1.SuperpositionSvg },
27
31
  isHidden: true
28
32
  };
29
- }
30
- constructor(props, context) {
31
- super(props, context);
32
- this.axisBoxRef = react_1.default.createRef();
33
- }
34
- componentDidMount() {
35
- this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, sel => {
36
- const superpositionState = this.plugin.customState.superpositionState;
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;
37
38
  if (superpositionState && superpositionState.alphafold.ref && superpositionState.alphafold.apiData.pae && superpositionState.alphafold.apiData.pae !== '' && superpositionState.alphafold.apiData.pae !== '') {
38
- this.setState({ isHidden: false });
39
- const domainMax = superpositionState.alphafold.apiData.length;
40
- const x = (0, d3_scale_1.scaleLinear)().domain([0, domainMax]).range([0, 200]);
41
- const xAxis = (0, d3_axis_1.axisBottom)(x).ticks(6).tickFormat(this.formatTicks).tickSizeOuter(0);
42
- const yAxis = (0, d3_axis_1.axisLeft)(x).ticks(6).tickFormat(this.formatTicks).tickSizeOuter(0);
43
- const axisContainer = (0, d3_selection_1.select)(this.axisBoxRef.current);
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);
44
45
  axisContainer.append('svg:svg')
45
46
  .attr('width', 220)
46
47
  .attr('height', 30)
47
48
  .attr('class', 'pae-x-axis')
48
49
  .style('z-index', '1')
49
50
  .style('position', 'absolute')
50
- .attr('transform', `translate(-93,202)`)
51
+ .attr('transform', "translate(-93,202)")
51
52
  .append('g')
52
- .attr('transform', `translate(6,0)`)
53
+ .attr('transform', "translate(6,0)")
53
54
  .call(xAxis);
54
55
  axisContainer.append('svg:svg')
55
56
  .attr('width', 50)
@@ -57,98 +58,121 @@ class AlphafoldPaeControls extends base_1.CollapsableControls {
57
58
  .attr('class', 'pae-y-axis')
58
59
  .style('z-index', '1')
59
60
  .style('position', 'absolute')
60
- .attr('transform', `translate(-123,0)`)
61
+ .attr('transform', "translate(-123,0)")
61
62
  .append('g')
62
- .attr('transform', `translate(36,4)`)
63
+ .attr('transform', "translate(36,4)")
63
64
  .call(yAxis);
64
65
  }
65
66
  });
66
- }
67
- formatTicks(d) {
67
+ };
68
+ AlphafoldPaeControls.prototype.formatTicks = function (d) {
68
69
  return d > 999 ? d / 1000 + 'k' : d;
69
- }
70
- renderControls() {
71
- const superpositionState = this.plugin.customState.superpositionState;
70
+ };
71
+ AlphafoldPaeControls.prototype.renderControls = function () {
72
+ var superpositionState = this.plugin.customState.superpositionState;
72
73
  if (!superpositionState || !superpositionState.alphafold)
73
74
  return null;
74
- const errorScale = [0, 5, 10, 15, 20, 25, 30];
75
- return (0, jsx_runtime_1.jsxs)("div", { 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", { style: { transform: 'rotate(270deg)', position: 'absolute', transformOrigin: '0 0', left: '10px', top: '165px', fontWeight: 500 }, children: "Aligned residue" }), (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { height: 'auto', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { 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: `${superpositionState.alphafold.apiData.pae}`, alt: "PAE" }) }), (0, jsx_runtime_1.jsx)("div", { 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", { style: { listStyleType: 'none', fontWeight: 500, margin: 0, display: 'inline-block', position: 'absolute', top: '292px', marginLeft: '24px' }, children: errorScale.map((errValue) => (0, jsx_runtime_1.jsx)("li", { style: { float: 'left', marginRight: '18px' }, children: errValue }, errValue)) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center', paddingLeft: '20px', fontWeight: 500 }, children: "Expected position error (\u00C5ngstr\u00F6ms)" })] })] });
76
- }
77
- }
75
+ var errorScale = [0, 5, 10, 15, 20, 25, 30];
76
+ return (0, jsx_runtime_1.jsxs)("div", { 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", { style: { transform: 'rotate(270deg)', position: 'absolute', transformOrigin: '0 0', left: '10px', top: '165px', fontWeight: 500 }, children: "Aligned residue" }), (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { height: 'auto', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { 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", { 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", { 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", { style: { float: 'left', marginRight: '18px' }, children: errValue }, errValue); }) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center', paddingLeft: '20px', fontWeight: 500 }, children: "Expected position error (\u00C5ngstr\u00F6ms)" })] })] });
77
+ };
78
+ return AlphafoldPaeControls;
79
+ }(base_1.CollapsableControls));
78
80
  exports.AlphafoldPaeControls = AlphafoldPaeControls;
79
- class AlphafoldSuperpositionControls extends base_1.CollapsableControls {
80
- defaultState() {
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 () {
81
87
  return {
82
88
  isCollapsed: false,
83
89
  header: 'AlphaFold Superposition',
84
90
  brand: { accent: 'gray', svg: icons_1.SuperpositionSvg },
85
91
  isHidden: true
86
92
  };
87
- }
88
- componentDidMount() {
89
- this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, sel => {
90
- const superpositionState = this.plugin.customState.superpositionState;
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;
91
98
  if (superpositionState && superpositionState.alphafold.apiData.cif && superpositionState.alphafold.apiData.cif !== '') {
92
- this.setState({ isHidden: false });
99
+ _this.setState({ isHidden: false });
93
100
  }
94
101
  });
95
- }
96
- rmsdTable() {
97
- const spData = this.plugin.customState.superpositionState;
98
- const { activeSegment } = spData;
99
- const { rmsds } = spData.alphafold;
100
- return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-offset', children: [(rmsds.length == 0 || !rmsds[activeSegment - 1]) && (0, jsx_runtime_1.jsx)("div", { 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", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)("div", { 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", { style: { padding: '5px 0 0 5px' }, children: (0, jsx_runtime_1.jsx)("strong", { children: "RMSD (\u212B)" }) })] }), rmsds[activeSegment - 1] && rmsds[activeSegment - 1].map((d) => {
101
- const details = d.split(':');
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", { className: 'msp-control-offset', children: [(rmsds.length == 0 || !rmsds[activeSegment - 1]) && (0, jsx_runtime_1.jsx)("div", { 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", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)("div", { 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", { 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(':');
102
109
  return details[1] !== '-' ? (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)("div", { 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", { style: { padding: '5px 0 0 5px' }, children: details[1] })] }, d) : null;
103
110
  })] });
104
- }
105
- renderControls() {
106
- const superpositionState = this.plugin.customState.superpositionState;
111
+ };
112
+ AlphafoldSuperpositionControls.prototype.renderControls = function () {
113
+ var superpositionState = this.plugin.customState.superpositionState;
107
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, {})] });
108
- }
109
- }
115
+ };
116
+ return AlphafoldSuperpositionControls;
117
+ }(base_1.CollapsableControls));
110
118
  exports.AlphafoldSuperpositionControls = AlphafoldSuperpositionControls;
111
119
  exports.AlphafoldSuperpositionParams = {
112
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.' }),
113
121
  traceOnly: param_definition_1.ParamDefinition.Boolean(true, { description: 'For Chain- and Uniprot-based 3D superposition, base superposition only on CA (and equivalent) atoms.' })
114
122
  };
115
- const DefaultAlphafoldSuperpositionOptions = param_definition_1.ParamDefinition.getDefaultValues(exports.AlphafoldSuperpositionParams);
116
- class AfSuperpositionControls extends base_1.PurePluginUIComponent {
117
- constructor() {
118
- super(...arguments);
119
- this.state = {
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.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
128
+ _this.state = {
120
129
  isBusy: false,
121
130
  canUseDb: true,
122
131
  action: undefined,
123
132
  options: DefaultAlphafoldSuperpositionOptions
124
133
  };
125
- this.superposeDb = async () => {
126
- this.setState({ isBusy: true });
127
- const spData = this.plugin.customState.superpositionState;
128
- spData.alphafold.traceOnly = this.state.options.traceOnly;
129
- (0, superposition_1.superposeAf)(this.plugin, this.state.options.traceOnly);
130
- };
131
- this.toggleOptions = () => this.setState({ action: this.state.action === 'options' ? void 0 : 'options' });
132
- this.setOptions = (values) => {
133
- this.setState({ options: values });
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 });
134
147
  };
148
+ return _this;
135
149
  }
136
- componentDidMount() {
137
- this.subscribe(this.plugin.behaviors.state.isBusy, v => {
138
- this.setState({ isBusy: v });
150
+ AfSuperpositionControls.prototype.componentDidMount = function () {
151
+ var _this = this;
152
+ this.subscribe(this.plugin.behaviors.state.isBusy, function (v) {
153
+ _this.setState({ isBusy: v });
139
154
  });
140
- }
141
- get selection() {
142
- return this.plugin.managers.structure.selection;
143
- }
144
- get customState() {
145
- return this.plugin.customState;
146
- }
147
- superposeByDbMapping() {
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 () {
148
171
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(common_1.Button, { 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" }) });
149
- }
150
- render() {
172
+ };
173
+ AfSuperpositionControls.prototype.render = function () {
151
174
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: { backgroundColor: '#dce54e', fontWeight: 500, padding: '5px 12px' }, children: "New Feature!" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-help-text', style: { margin: '2px 0' }, children: (0, jsx_runtime_1.jsxs)("div", { 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", { 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", { 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 }) })] });
152
- }
153
- }
175
+ };
176
+ return AfSuperpositionControls;
177
+ }(base_1.PurePluginUIComponent));
154
178
  exports.AfSuperpositionControls = AfSuperpositionControls;
@@ -1,28 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AlphafoldTransparencyControls = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const base_1 = require("Molstar/mol-plugin-ui/base");
6
- const icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
7
- const param_definition_1 = require("Molstar/mol-util/param-definition");
8
- const parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
9
- const alphafold_transparency_1 = require("../alphafold-transparency");
10
- const TransparencyParams = {
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 = {
11
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' }),
12
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' })
13
14
  };
14
- class AlphafoldTransparencyControls extends base_1.CollapsableControls {
15
- constructor() {
16
- super(...arguments);
17
- this.updateTransparency = async (val) => {
18
- this.setState({ transpareny: val });
19
- const superpositionState = this.plugin.customState.superpositionState;
20
- const afStr = this.plugin.managers.structure.hierarchy.current.refs.get(superpositionState.alphafold.ref);
21
- await (0, alphafold_transparency_1.clearStructureTransparency)(this.plugin, afStr.components);
22
- await (0, alphafold_transparency_1.applyAFTransparency)(this.plugin, afStr, 1 - val.opacity, val.score);
23
- };
15
+ var AlphafoldTransparencyControls = /** @class */ (function (_super) {
16
+ tslib_1.__extends(AlphafoldTransparencyControls, _super);
17
+ function AlphafoldTransparencyControls() {
18
+ var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || 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;
24
38
  }
25
- defaultState() {
39
+ AlphafoldTransparencyControls.prototype.defaultState = function () {
26
40
  return {
27
41
  isCollapsed: false,
28
42
  header: 'AlphaFold Structure Opacity',
@@ -33,17 +47,19 @@ class AlphafoldTransparencyControls extends base_1.CollapsableControls {
33
47
  opacity: 0.2
34
48
  }
35
49
  };
36
- }
37
- componentDidMount() {
38
- this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, sel => {
39
- const superpositionState = this.plugin.customState.superpositionState;
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;
40
55
  if (superpositionState && superpositionState.alphafold.ref && superpositionState.alphafold.ref !== '') {
41
- this.setState({ isHidden: false });
56
+ _this.setState({ isHidden: false });
42
57
  }
43
58
  });
44
- }
45
- renderControls() {
59
+ };
60
+ AlphafoldTransparencyControls.prototype.renderControls = function () {
46
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 }) });
47
- }
48
- }
62
+ };
63
+ return AlphafoldTransparencyControls;
64
+ }(base_1.CollapsableControls));
49
65
  exports.AlphafoldTransparencyControls = AlphafoldTransparencyControls;