pdbe-molstar 3.4.0 → 3.5.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.
Files changed (62) hide show
  1. package/build/pdbe-molstar-component.js +2 -2
  2. package/build/pdbe-molstar-light.css +2 -2
  3. package/build/pdbe-molstar-plugin.js +2 -2
  4. package/build/pdbe-molstar-plugin.js.LICENSE.txt +26 -1
  5. package/build/pdbe-molstar.css +2 -2
  6. package/lib/alphafold-transparency.js +5 -6
  7. package/lib/custom-events.js +1 -1
  8. package/lib/domain-annotations/behavior.d.ts +1 -1
  9. package/lib/domain-annotations/color.js +2 -2
  10. package/lib/domain-annotations/prop.js +1 -2
  11. package/lib/extensions/foldseek/index.d.ts +1 -1
  12. package/lib/extensions/foldseek/index.js +7 -7
  13. package/lib/extensions/interactions/index.d.ts +36 -0
  14. package/lib/extensions/interactions/index.js +112 -0
  15. package/lib/extensions/state-gallery/behavior.d.ts +1 -1
  16. package/lib/extensions/state-gallery/config.js +2 -2
  17. package/lib/extensions/state-gallery/manager.js +5 -4
  18. package/lib/extensions/state-gallery/ui.js +12 -12
  19. package/lib/helpers.d.ts +4 -0
  20. package/lib/helpers.js +68 -19
  21. package/lib/labels.d.ts +1 -1
  22. package/lib/loci-details.js +4 -5
  23. package/lib/plugin-custom-state.js +2 -2
  24. package/lib/sifts-mapping.js +1 -2
  25. package/lib/sifts-mappings-behaviour.d.ts +1 -1
  26. package/lib/spec-from-html.js +1 -2
  27. package/lib/spec.js +3 -3
  28. package/lib/subscribe-events.js +1 -2
  29. package/lib/superposition-export.js +1 -2
  30. package/lib/superposition-focus-representation.d.ts +2 -2
  31. package/lib/superposition-focus-representation.js +1 -1
  32. package/lib/superposition-sifts-mapping.js +1 -2
  33. package/lib/superposition.d.ts +1 -1
  34. package/lib/superposition.js +34 -39
  35. package/lib/ui/alphafold-superposition.js +6 -6
  36. package/lib/ui/annotation-controls.d.ts +1 -1
  37. package/lib/ui/annotation-controls.js +2 -2
  38. package/lib/ui/annotation-row-controls.js +3 -3
  39. package/lib/ui/custom-controls.js +1 -1
  40. package/lib/ui/export-superposition.d.ts +0 -1
  41. package/lib/ui/export-superposition.js +1 -1
  42. package/lib/ui/icons.js +1 -1
  43. package/lib/ui/left-panel/core.d.ts +0 -1
  44. package/lib/ui/left-panel/core.js +5 -6
  45. package/lib/ui/left-panel/pdbe-left-panel.d.ts +0 -1
  46. package/lib/ui/left-panel/tabs.d.ts +1 -1
  47. package/lib/ui/left-panel/tabs.js +2 -2
  48. package/lib/ui/overlay.js +3 -4
  49. package/lib/ui/pdbe-screenshot-controls.js +4 -4
  50. package/lib/ui/pdbe-structure-controls.js +3 -3
  51. package/lib/ui/pdbe-viewport-controls.js +1 -1
  52. package/lib/ui/pdbe-viewport.d.ts +0 -1
  53. package/lib/ui/pdbe-viewport.js +1 -1
  54. package/lib/ui/segment-tree.js +40 -45
  55. package/lib/ui/split-ui/components.d.ts +0 -1
  56. package/lib/ui/split-ui/split-ui.js +6 -7
  57. package/lib/ui/superposition-components.js +16 -21
  58. package/lib/ui/symmetry-annotation-controls.d.ts +4 -4
  59. package/lib/ui/symmetry-annotation-controls.js +18 -25
  60. package/lib/viewer.d.ts +24 -2
  61. package/lib/viewer.js +28 -27
  62. package/package.json +3 -3
package/lib/viewer.js CHANGED
@@ -8,6 +8,8 @@ const behavior_2 = require("molstar/lib/extensions/model-archive/quality-assessm
8
8
  const mp4_export_1 = require("molstar/lib/extensions/mp4-export");
9
9
  const behavior_3 = require("molstar/lib/extensions/mvs/behavior");
10
10
  const custom_tooltips_prop_1 = require("molstar/lib/extensions/mvs/components/custom-tooltips-prop");
11
+ const load_1 = require("molstar/lib/extensions/mvs/load");
12
+ const mvs_data_1 = require("molstar/lib/extensions/mvs/mvs-data");
11
13
  const pdbe_1 = require("molstar/lib/extensions/pdbe");
12
14
  const loci_1 = require("molstar/lib/mol-model/loci");
13
15
  const structure_1 = require("molstar/lib/mol-model/structure");
@@ -42,6 +44,7 @@ const rx_event_helper_1 = require("molstar/lib/mol-util/rx-event-helper");
42
44
  const custom_events_1 = require("./custom-events");
43
45
  const behavior_4 = require("./domain-annotations/behavior");
44
46
  const Foldseek = tslib_1.__importStar(require("./extensions/foldseek"));
47
+ const Interactions = tslib_1.__importStar(require("./extensions/interactions"));
45
48
  const behavior_5 = require("./extensions/state-gallery/behavior");
46
49
  const manager_1 = require("./extensions/state-gallery/manager");
47
50
  const ui_1 = require("./extensions/state-gallery/ui");
@@ -177,8 +180,8 @@ class PDBeMolstarPlugin {
177
180
  * If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!);
178
181
  * otherwise use the last added structure. */
179
182
  interactivityFocus: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
180
- var _b;
181
- const structureNumberOrId = (_b = params.structureId) !== null && _b !== void 0 ? _b : params.structureNumber;
183
+ var _a;
184
+ const structureNumberOrId = (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber;
182
185
  const loci = this.getLociForParams(params.data, structureNumberOrId);
183
186
  this.plugin.managers.structure.focus.setFromLoci(loci);
184
187
  }),
@@ -187,8 +190,8 @@ class PDBeMolstarPlugin {
187
190
  * If `focus`, also zoom on the highlighted part.
188
191
  * If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!); otherwise use the last added structure. */
189
192
  highlight: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
190
- var _c;
191
- const loci = this.getLociForParams(params.data, (_c = params.structureId) !== null && _c !== void 0 ? _c : params.structureNumber);
193
+ var _a;
194
+ const loci = this.getLociForParams(params.data, (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber);
192
195
  if (loci_1.Loci.isEmpty(loci))
193
196
  return;
194
197
  if (params.color) {
@@ -211,17 +214,17 @@ class PDBeMolstarPlugin {
211
214
  * If `structureNumber` is provided, apply to the specified structure (numbered from 1!); otherwise apply to all loaded structures.
212
215
  * Remove any previously added coloring and extra representations, unless `keepColors` and/or `keepRepresentations` is set. */
213
216
  select: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
214
- var _d, _e, _f, _g;
215
- const structureNumberOrId = (_d = params.structureId) !== null && _d !== void 0 ? _d : params.structureNumber;
217
+ var _a, _b, _c, _d;
218
+ const structureNumberOrId = (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber;
216
219
  yield this.visual.clearSelection(structureNumberOrId, { keepColors: params.keepColors, keepRepresentations: params.keepRepresentations });
217
220
  // Structure list to apply selection
218
221
  const structures = this.getStructures(structureNumberOrId);
219
222
  // Filter selection items that apply added representations
220
223
  const addedReprParams = {};
221
224
  for (const param of params.data) {
222
- const repr = (_e = param.representation) !== null && _e !== void 0 ? _e : (param.sideChain ? 'ball-and-stick' : undefined);
225
+ const repr = (_b = param.representation) !== null && _b !== void 0 ? _b : (param.sideChain ? 'ball-and-stick' : undefined);
223
226
  if (repr) {
224
- ((_f = addedReprParams[repr]) !== null && _f !== void 0 ? _f : (addedReprParams[repr] = [])).push(param);
227
+ ((_c = addedReprParams[repr]) !== null && _c !== void 0 ? _c : (addedReprParams[repr] = [])).push(param);
225
228
  }
226
229
  }
227
230
  const DefaultSelectColor = color_1.Color.fromRgb(255, 112, 3);
@@ -265,7 +268,7 @@ class PDBeMolstarPlugin {
265
268
  yield this.plugin.build()
266
269
  .to(struct.structureRef.cell)
267
270
  .apply(model_1.StructureComponent, { type: { name: 'bundle', params: bundle }, label: repr }, { tags: helpers_1.Tags.AddedComponent })
268
- .apply(representation_1.StructureRepresentation3D, (0, structure_representation_params_1.createStructureRepresentationParams)(this.plugin, (_g = struct.structureRef.cell.obj) === null || _g === void 0 ? void 0 : _g.data, { type: repr }))
271
+ .apply(representation_1.StructureRepresentation3D, (0, structure_representation_params_1.createStructureRepresentationParams)(this.plugin, (_d = struct.structureRef.cell.obj) === null || _d === void 0 ? void 0 : _d.data, { type: repr }))
269
272
  .apply(transforms_1.StateTransforms.Representation.OverpaintStructureRepresentation3DFromBundle, { layers: overpaintLayers }, { tags: helpers_1.Tags.Overpaint })
270
273
  .commit();
271
274
  // Track that reprs have been added (for later clearSelection)
@@ -309,9 +312,9 @@ class PDBeMolstarPlugin {
309
312
  * `structureNumber` counts from 1; if not provided, tooltips will be applied to all loaded structures.
310
313
  * Example: `await this.visual.tooltips({ data: [{ struct_asym_id: 'A', tooltip: 'Chain A' }, { struct_asym_id: 'B', tooltip: 'Chain B' }] });`. */
311
314
  tooltips: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
312
- var _h;
315
+ var _a;
313
316
  // Structure list to apply tooltips
314
- const structures = this.getStructures((_h = params.structureId) !== null && _h !== void 0 ? _h : params.structureNumber);
317
+ const structures = this.getStructures((_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber);
315
318
  for (const struct of structures) {
316
319
  const selections = this.getSelections(params.data, struct.number);
317
320
  const customTooltipProps = {
@@ -436,8 +439,8 @@ class PDBeMolstarPlugin {
436
439
  return (0, spec_from_html_1.initParamsFromHtmlAttributes)(element);
437
440
  }
438
441
  render(target, options) {
439
- var _a, _b;
440
442
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
443
+ var _a, _b;
441
444
  console.debug('Rendering PDBeMolstarPlugin instance with options:', options);
442
445
  // Validate options
443
446
  if (!options) {
@@ -604,7 +607,7 @@ class PDBeMolstarPlugin {
604
607
  assemblyId: this.initParams.assemblyId,
605
608
  isBinary: dataSource.isBinary,
606
609
  progressMessage: `Loading ${(_b = this.initParams.moleculeId) !== null && _b !== void 0 ? _b : ''} ...`,
607
- id: 'main',
610
+ id: PDBeMolstarPlugin.MAIN_STRUCTURE_ID,
608
611
  });
609
612
  }
610
613
  // Subscribe to events from other PDB Component
@@ -658,22 +661,17 @@ class PDBeMolstarPlugin {
658
661
  return this.plugin.state.data;
659
662
  }
660
663
  createLigandStructure(isBranched) {
661
- var _a, e_1, _b, _c;
662
- var _d, _e;
663
664
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
665
+ var _a, e_1, _b, _c;
666
+ var _d, _e;
664
667
  if (this.assemblyRef === '')
665
668
  return;
666
669
  try {
667
- for (var _f = true, _g = tslib_1.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups), _h; _h = yield _g.next(), _a = _h.done, !_a;) {
670
+ for (var _f = true, _g = tslib_1.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups), _h; _h = yield _g.next(), _a = _h.done, !_a; _f = true) {
668
671
  _c = _h.value;
669
672
  _f = false;
670
- try {
671
- const comp = _c;
672
- yield commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: comp[0].cell.parent, ref: comp[0].cell.transform.ref, removeParentGhosts: true });
673
- }
674
- finally {
675
- _f = true;
676
- }
673
+ const comp = _c;
674
+ yield commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: comp[0].cell.parent, ref: comp[0].cell.transform.ref, removeParentGhosts: true });
677
675
  }
678
676
  }
679
677
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -713,8 +711,8 @@ class PDBeMolstarPlugin {
713
711
  }
714
712
  });
715
713
  }
716
- load({ url, format = 'mmcif', isBinary = false, assemblyId = '', progressMessage, id }, fullLoad = true) {
717
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
714
+ load(_a) {
715
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, format = 'mmcif', isBinary = false, assemblyId = '', progressMessage, id }, fullLoad = true) {
718
716
  yield (0, helpers_1.runWithProgressMessage)(this.plugin, progressMessage, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
719
717
  var _a, _b;
720
718
  let success = false;
@@ -810,8 +808,8 @@ class PDBeMolstarPlugin {
810
808
  * E.g. `styles={polymer:'putty',nonStandard:'ball-and-stick'}` - apply only putty to polymer, only ball-and-stick to non-standard residues, leave other components untouched.
811
809
  * E.g. `styles='ball-and-stick'` - apply only ball-and-stick to all components. */
812
810
  applyVisualStyles(structureRef, styles) {
813
- var _a, _b;
814
811
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
812
+ var _a, _b;
815
813
  if (styles === undefined)
816
814
  return;
817
815
  const components = this.plugin.state.data.selectQ(q => q.byRef(structureRef).subtree().withTransformer(model_1.StructureComponent));
@@ -850,8 +848,8 @@ class PDBeMolstarPlugin {
850
848
  }
851
849
  /** Remove all structure components of the given structure which correspond to any component type listed in `deleteComponents`. */
852
850
  deleteStructureComponents(structureRef, deleteComponents) {
853
- var _a, _b;
854
851
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
852
+ var _a, _b;
855
853
  if (deleteComponents.length === 0)
856
854
  return;
857
855
  const comps = this.plugin.state.data.selectQ(q => q.byRef(structureRef).subtree().withTransformer(model_1.StructureComponent));
@@ -963,7 +961,10 @@ exports.PDBeMolstarPlugin = PDBeMolstarPlugin;
963
961
  /** Helper functions related to specific views or use cases */
964
962
  PDBeMolstarPlugin.extensions = {
965
963
  Foldseek: Foldseek,
964
+ Interactions: Interactions,
965
+ MVS: { MVSData: mvs_data_1.MVSData, loadMVS: load_1.loadMVS },
966
966
  StateGallery: behavior_5.StateGalleryExtensionFunctions,
967
967
  };
968
968
  /** Components for building custom UI layouts */
969
969
  PDBeMolstarPlugin.UIComponents = components_1.UIComponents;
970
+ PDBeMolstarPlugin.MAIN_STRUCTURE_ID = 'main';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdbe-molstar",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Molstar implementation for PDBe",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -65,7 +65,7 @@
65
65
  "sass": "^1.80.4",
66
66
  "sass-loader": "^16.0.2",
67
67
  "style-loader": "^4.0.0",
68
- "typescript": "^4.6.4",
68
+ "typescript": "^5.7.3",
69
69
  "typescript-eslint": "^8.2.0",
70
70
  "webpack": "^5.95.0",
71
71
  "webpack-cli": "^5.1.4"
@@ -78,7 +78,7 @@
78
78
  "d3-scale": "^4.0.2",
79
79
  "d3-selection": "^3.0.0",
80
80
  "lit": "^3.1.1",
81
- "molstar": "4.8.0",
81
+ "molstar": "4.17.0",
82
82
  "path-browserify": "^1.0.1",
83
83
  "stream-browserify": "^3.0.0",
84
84
  "vm-browserify": "^1.1.2"