drugflow-molstar 0.4.6 → 0.4.8

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.8.css +1 -0
  2. package/build/drugflow-molstar-component-0.4.8.js +25 -0
  3. package/build/drugflow-molstar-plugin-0.4.8.js +2 -0
  4. package/build/drugflow-molstar-plugin-0.4.8.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.7.js +2 -0
  14. package/lib/drugflow-molstar-component-build-0.4.7.js.LICENSE.txt +24 -0
  15. package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
  16. package/lib/drugflow-molstar-component-build-0.4.8.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 +2836 -1806
  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.6.css +0 -1
  52. package/build/drugflow-molstar-component-0.4.6.js +0 -25
  53. package/build/drugflow-molstar-plugin-0.4.6.js +0 -2
  54. package/build/drugflow-molstar-plugin-0.4.6.js.LICENSE.txt +0 -64
package/lib/index.d.ts CHANGED
@@ -1 +1,902 @@
1
- export {};
1
+ import { PluginContext } from 'molstar/lib/mol-plugin/context';
2
+ import { StateObject } from 'molstar/lib/mol-state';
3
+ import { PluginStateObject } from 'molstar/lib/mol-plugin-state/objects';
4
+ import { StateBuilder } from 'molstar/lib/mol-state';
5
+ import { Loci } from 'molstar/lib/mol-model/loci';
6
+ import { QueryParam } from './helpers';
7
+ import { Structure } from "molstar/lib/mol-model/structure";
8
+ import { StructureElement } from 'molstar/lib/mol-model/structure';
9
+ import { Representation } from 'molstar/lib/mol-repr/representation';
10
+ import { StructureRepresentationProvider } from 'molstar/lib/mol-repr/structure/representation';
11
+ import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
12
+ declare class DrugflowMolstarPlugin {
13
+ private _ev;
14
+ readonly events: {
15
+ loadComplete: import("rxjs").Subject<boolean>;
16
+ };
17
+ plugin: PluginContext;
18
+ assemblyRef: string;
19
+ granularity: string;
20
+ selected_info: any;
21
+ selectedParams: any;
22
+ isHighlightColorUpdated: boolean;
23
+ private hiddenState;
24
+ init(targetElement: HTMLElement, params?: any): Promise<void>;
25
+ get state(): import("Molstar/mol-state/state").State;
26
+ private applyState;
27
+ private create_ligand_view;
28
+ create_tmp_label_comp(): Promise<void>;
29
+ create_surf_comp(name?: string): Promise<void>;
30
+ create_tmp_ligand_comp(chain_id: string, ligand_res_id: number): Promise<void>;
31
+ remove_tmp_comp(comp_ref: string, _structure_id?: string): Promise<void>;
32
+ /**
33
+ * 创建配体查询(排除水分子)
34
+ */
35
+ private createLigandQuery;
36
+ /**
37
+ * 创建多肽链查询(auth_asym_id包含'p')
38
+ */
39
+ private createPeptideQuery;
40
+ /**
41
+ * 创建非多肽聚合物查询(排除多肽链)
42
+ */
43
+ private createNonPeptidePolymerQuery;
44
+ /**
45
+ * 创建基础结构(从model)
46
+ */
47
+ createBaseStructure(model: any, structureId: string): StateBuilder.To<PluginStateObject.Molecule.Structure, import("Molstar/mol-state/transformer").StateTransformer<PluginStateObject.Molecule.Model, PluginStateObject.Molecule.Structure, PD.Normalize<{
48
+ type: PD.NamedParams<PD.Normalize<{
49
+ dynamicBonds: any;
50
+ }>, "auto"> | PD.NamedParams<PD.Normalize<{
51
+ dynamicBonds: any;
52
+ id: any;
53
+ }>, "assembly"> | PD.NamedParams<PD.Normalize<{
54
+ dynamicBonds: any;
55
+ ijkMin: any;
56
+ ijkMax: any;
57
+ }>, "symmetry"> | PD.NamedParams<PD.Normalize<{
58
+ dynamicBonds: any;
59
+ }>, "model"> | PD.NamedParams<PD.Normalize<{
60
+ dynamicBonds: any;
61
+ radius: any;
62
+ }>, "symmetry-mates"> | PD.NamedParams<PD.Normalize<{
63
+ dynamicBonds: any;
64
+ generators: any;
65
+ }>, "symmetry-assembly">;
66
+ }>>>;
67
+ /**
68
+ * 异步构建完整蛋白结构(推荐使用)
69
+ * 使用 createComponent API,结构更清晰
70
+ */
71
+ buildFullProteinStructureAsync(structureId?: string, options?: {
72
+ polymer?: boolean;
73
+ ligand?: boolean;
74
+ water?: boolean;
75
+ }): Promise<string[]>;
76
+ /**
77
+ * 异步构建配体口袋组件
78
+ * 创建配体和周围环境两个组件
79
+ */
80
+ private buildLigandPocketComponentsAsync;
81
+ /**
82
+ * 异步构建多肽链组件
83
+ * 创建多肽链组件和可选的背景组件
84
+ */
85
+ private buildPeptideComponentsAsync;
86
+ /**
87
+ * 加载数据(从URL或字符串)
88
+ */
89
+ loadData(params: {
90
+ url?: string;
91
+ pdbString?: string;
92
+ isBinary?: boolean;
93
+ }): Promise<import("Molstar/mol-state/object").StateObjectSelector<PluginStateObject.Data.String | PluginStateObject.Data.Binary, import("Molstar/mol-state/transformer").StateTransformer<StateObject<any, StateObject.Type<any>>, StateObject<any, StateObject.Type<any>>, any>>>;
94
+ /**
95
+ * 解析轨迹并创建模型
96
+ */
97
+ parseAndCreateModel(data: any, format: 'mmcif' | 'pdb' | 'sdf' | 'mol' | 'mol2' | 'xyz' | 'gro' | 'pdbqt' | 'cifCore', modelIndex?: number): Promise<import("Molstar/mol-state/object").StateObjectSelector<PluginStateObject.Molecule.Model, import("Molstar/mol-state/transformer").StateTransformer<StateObject<any, StateObject.Type<any>>, StateObject<any, StateObject.Type<any>>, any>>>;
98
+ /**
99
+ * 更新assemblyRef
100
+ */
101
+ private updateAssemblyRef;
102
+ /**
103
+ * 获取所有已加载的结构列表
104
+ * @returns 结构信息数组
105
+ */
106
+ getLoadedStructures(): {
107
+ index: number;
108
+ ref: string;
109
+ label: string;
110
+ components: {
111
+ key: string | undefined;
112
+ ref: string;
113
+ label: string | undefined;
114
+ }[];
115
+ }[];
116
+ /**
117
+ * 获取指定组件的所有表示
118
+ * @param componentRef - 组件引用
119
+ * @returns 表示信息数组
120
+ */
121
+ getRepresentations(componentRef: string): any[];
122
+ /**
123
+ * 获取指定 Structure 的所有 contact
124
+ * @param structureRef - Structure 引用(如 'Structure_0')
125
+ * @returns Contact 信息数组
126
+ */
127
+ getContacts(structureRef: string): any[];
128
+ /**
129
+ * 获取所有组件及其表示的完整树形结构
130
+ * @returns 完整的结构树
131
+ */
132
+ getStructureTree(): {
133
+ components: {
134
+ representations: any[];
135
+ key: string | undefined;
136
+ ref: string;
137
+ label: string | undefined;
138
+ }[];
139
+ contacts: any[];
140
+ index: number;
141
+ ref: string;
142
+ label: string;
143
+ }[];
144
+ /**
145
+ * 更新表示参数
146
+ * @param reprRef - 表示引用
147
+ * @param params - 新的参数
148
+ */
149
+ updateRepresentation(reprRef: string, params: any): Promise<void>;
150
+ /**
151
+ * 删除指定的表示
152
+ * @param reprRef - 表示引用
153
+ */
154
+ deleteRepresentation(reprRef: string): Promise<void>;
155
+ /**
156
+ * 切换表示的可见性
157
+ * @param reprRef - 表示引用
158
+ */
159
+ toggleRepresentationVisibility(reprRef: string): void;
160
+ /**
161
+ * 切换 contact 的可见性
162
+ * @param contactRef - contact 引用
163
+ */
164
+ toggleContactVisibility(contactRef: string): void;
165
+ /**
166
+ * 删除组件及其所有表示
167
+ * @param componentRef - 组件引用
168
+ */
169
+ deleteComponent(componentRef: string): Promise<void>;
170
+ /**
171
+ * 删除整个结构(Structure)及其所有组件和表示
172
+ * @param structureId - 结构ID(如 '0', '1', 'ref-1' 等)
173
+ * @returns 是否成功删除
174
+ */
175
+ deleteStructure(structureId: string): Promise<boolean>;
176
+ /**
177
+ * 创建新组件
178
+ * @param options - 组件配置选项
179
+ * @returns 组件引用
180
+ */
181
+ createComponent(options: {
182
+ /** 组件类型: 'polymer', 'ligand', 'water', 'ion', 'all', 'custom' */
183
+ type: 'polymer' | 'ligand' | 'water' | 'ion' | 'all' | 'custom';
184
+ /** 组件引用(可选,自动生成) */
185
+ componentRef?: string;
186
+ /** 结构ID(可选,默认'0') */
187
+ structureId?: string;
188
+ /** 自定义查询表达式(type='custom'时使用) */
189
+ expression?: any;
190
+ /** 组件标签(可选) */
191
+ label?: string;
192
+ }): Promise<string | null>;
193
+ /**
194
+ * 获取当前用户选择的 Expression
195
+ * @returns 选择的 MolScript Expression,如果没有选择则返回 null
196
+ */
197
+ getSelectionExpression(): Promise<any | null>;
198
+ /**
199
+ * 修改表示的显示类型
200
+ * @param reprRef - 表示引用
201
+ * @param type - 新的类型 (cartoon, ball-and-stick, surface等)
202
+ * @param params - 额外参数
203
+ */
204
+ changeRepresentationType(reprRef: string, type: string, params?: any): Promise<void>;
205
+ /**
206
+ * 修改表示的颜色主题
207
+ * @param reprRef - 表示引用
208
+ * @param colorTheme - 颜色主题名称
209
+ */
210
+ changeRepresentationColor(reprRef: string, colorTheme: string): Promise<void>;
211
+ /**
212
+ * 修改表示的透明度
213
+ * @param reprRef - 表示引用
214
+ * @param alpha - 透明度 (0-1)
215
+ */
216
+ changeRepresentationAlpha(reprRef: string, alpha: number): Promise<void>;
217
+ /**
218
+ * 加载并渲染完整蛋白结构
219
+ * @param url - PDB文件URL
220
+ * @param format - 文件格式 (mmcif, pdb, sdf等)
221
+ * @param options - 可选参数
222
+ */
223
+ /**
224
+ * 加载完整蛋白结构
225
+ * 流程:Load Data → Parse Model → Add Structure → Create Components
226
+ *
227
+ * @param url - 蛋白文件URL
228
+ * @param format - 文件格式
229
+ * @param options - 加载选项
230
+ * @returns 创建的组件引用列表
231
+ */
232
+ loadFullProtein(url: string, format?: 'mmcif' | 'pdb' | 'sdf' | 'mol' | 'mol2' | 'xyz' | 'gro' | 'pdbqt' | 'cifCore', options?: {
233
+ isBinary?: boolean;
234
+ modelIndex?: number;
235
+ showPolymer?: boolean;
236
+ showLigand?: boolean;
237
+ showWater?: boolean;
238
+ pdbString?: string;
239
+ }): Promise<{
240
+ componentRefs: string[];
241
+ structureId: string;
242
+ }>;
243
+ /**
244
+ * 加载并渲染配体口袋
245
+ * 流程:Load Data → Parse Model → Add Structure → Create Ligand Pocket Components
246
+ *
247
+ * 支持多次调用创建多个配体口袋叠加视图进行比较
248
+ *
249
+ * @param url - PDB文件URL
250
+ * @param ligandInfo - 配体信息
251
+ * @param format - 文件格式
252
+ * @param options - 可选参数
253
+ * @returns 创建的组件引用列表 [ligandRef, surroundingsRef]
254
+ *
255
+ */
256
+ loadLigandPocket(url: string, ligandInfo: {
257
+ name?: string;
258
+ site?: string;
259
+ ligandId?: string;
260
+ }, format?: 'mmcif' | 'pdb' | 'sdf' | 'mol' | 'mol2' | 'xyz' | 'gro' | 'pdbqt' | 'cifCore', options?: {
261
+ isBinary?: boolean;
262
+ modelIndex?: number;
263
+ pdbString?: string;
264
+ clearPrevious?: boolean;
265
+ radius?: number;
266
+ }): Promise<{
267
+ componentRefs: string[];
268
+ structureId: string;
269
+ }>;
270
+ /**
271
+ * 加载并渲染多肽链
272
+ * 流程:Load Data → Parse Model → Add Structure → Create Peptide Components
273
+ *
274
+ * @param url - PDB文件URL
275
+ * @param format - 文件格式
276
+ * @param options - 可选参数
277
+ * @returns 创建的组件引用列表
278
+ *
279
+ * @example
280
+ * ```javascript
281
+ * // 只显示多肽链
282
+ * const components = await viewer.loadPeptide('protein.pdb', 'pdb', {
283
+ * showBackground: false,
284
+ * showLigand: true
285
+ * });
286
+ *
287
+ * // 显示多肽链和背景
288
+ * const components = await viewer.loadPeptide('protein.pdb', 'pdb', {
289
+ * showBackground: true,
290
+ * showLigand: true,
291
+ * showWater: false
292
+ * });
293
+ * ```
294
+ */
295
+ loadPeptide(url: string, format?: 'mmcif' | 'pdb' | 'sdf' | 'mol' | 'mol2' | 'xyz' | 'gro' | 'pdbqt' | 'cifCore', options?: {
296
+ isBinary?: boolean;
297
+ modelIndex?: number;
298
+ showBackground?: boolean;
299
+ showLigand?: boolean;
300
+ showWater?: boolean;
301
+ pdbString?: string;
302
+ clearPrevious?: boolean;
303
+ peptideId?: string;
304
+ }): Promise<{
305
+ componentRefs: string[];
306
+ structureId: string;
307
+ }>;
308
+ private getObj;
309
+ /**
310
+ * 为组件添加3D表示
311
+ *
312
+ * @example
313
+ * ```javascript
314
+ * // 添加cartoon表示
315
+ * await viewer.add_repr({
316
+ * componentRef: 'Polymer',
317
+ * type: 'cartoon',
318
+ * colorTheme: 'secondary-structure'
319
+ * });
320
+ *
321
+ * // 添加半透明surface
322
+ * await viewer.add_repr({
323
+ * componentRef: 'Polymer',
324
+ * type: 'molecular-surface',
325
+ * colorTheme: 'hydrophobicity',
326
+ * alpha: 0.5
327
+ * });
328
+ * ```
329
+ *
330
+ * @param options - 表示配置选项
331
+ * @returns 表示引用
332
+ */
333
+ add_repr(options: {
334
+ /** 组件引用,如 'Polymer', 'Ligand' */
335
+ componentRef: string;
336
+ /** 表示引用(可选,自动生成) */
337
+ reprRef?: string;
338
+ /**
339
+ * 表示类型
340
+ * 常用值: 'cartoon', 'ball-and-stick', 'spacefill', 'molecular-surface', 'line', 'point'
341
+ */
342
+ type: string;
343
+ /**
344
+ * 颜色主题(可选)
345
+ * 常用值: 'secondary-structure', 'element-symbol', 'chain-id', 'residue-name',
346
+ * 'uniform', 'hydrophobicity', 'atom-id', 'residue-index'
347
+ */
348
+ colorTheme?: string;
349
+ /** 透明度 0-1(可选,默认1) */
350
+ alpha?: number;
351
+ /** 是否初始可见(默认true) */
352
+ visible?: boolean;
353
+ /** 结构ID(可选,默认'0') */
354
+ structureId?: string;
355
+ /** 额外的类型参数(可选) */
356
+ params?: any;
357
+ }): Promise<string | null>;
358
+ private visual_tree;
359
+ private parse_selection_info;
360
+ private update_selected_info;
361
+ set_visibility(ref: string): void;
362
+ clear(): Promise<void>;
363
+ add_click_listener(): void;
364
+ add_mouse_event(func: any): void;
365
+ private add_selection_info;
366
+ /**
367
+ * 根据参数获取 Loci
368
+ * @param params - 查询参数
369
+ * @param structureNumber - 结构编号(1-based,可选)
370
+ * @param _expand - 扩展范围(可选,保留用于兼容性)
371
+ * @param structureRef - 结构引用(如 'Structure_0',可选)
372
+ * @returns Loci 对象
373
+ */
374
+ getLociForParams(params: QueryParam[], structureNumber?: number, _expand?: number, structureRef?: string): {
375
+ kind: "empty-loci";
376
+ } | StructureElement.Loci;
377
+ get_basic_info(): any;
378
+ canvas: {
379
+ toggleControls: (isVisible?: boolean) => void;
380
+ toggleExpanded: (isExpanded?: boolean) => void;
381
+ setBgColor: (color?: {
382
+ r: number;
383
+ g: number;
384
+ b: number;
385
+ }) => void;
386
+ applySettings: (settings?: {
387
+ color?: {
388
+ r: number;
389
+ g: number;
390
+ b: number;
391
+ };
392
+ lighting?: string;
393
+ }) => void;
394
+ toggleSelect: (isSelect?: boolean) => void;
395
+ };
396
+ measure: {
397
+ add_distance: () => Promise<void>;
398
+ add_angle: () => Promise<void>;
399
+ add_dihedral: () => Promise<void>;
400
+ add_orientation: () => Promise<void>;
401
+ add_plane: () => Promise<void>;
402
+ clean_all_measure: () => Promise<void>;
403
+ };
404
+ visual: {
405
+ select_all: () => Promise<void>;
406
+ select_none: () => void;
407
+ expand_select: (expand: number, type?: string) => Promise<void>;
408
+ deselect_current: () => Promise<void>;
409
+ inverse_select: () => Promise<void>;
410
+ hideSelect: () => Promise<void>;
411
+ _showSelect: (type?: string) => Promise<0 | -1>;
412
+ changeProps: (val: any) => Promise<void>;
413
+ toggleSpin: (isSpinning?: boolean, resetCamera?: boolean, speed?: number) => void;
414
+ focus: (params: QueryParam[], structureNumber?: number, expand_num?: number) => void;
415
+ get_current_loci: () => Promise<{
416
+ kind: "empty-loci";
417
+ }>;
418
+ focus_loci: (loci: Loci | Loci[]) => void;
419
+ focus_now: () => Promise<void>;
420
+ select: (params: QueryParam[], deselect?: boolean) => void;
421
+ camera_reset: () => Promise<void>;
422
+ /**
423
+ * 应用所有隐藏状态(内部方法)
424
+ */
425
+ _applyHiddenState: () => Promise<void>;
426
+ /**
427
+ * 使用透明度隐藏指定的链
428
+ * @param chainId 链ID,例如 'A', 'B'
429
+ */
430
+ hideChain: (chainId: string) => Promise<void>;
431
+ /**
432
+ * 清除指定链的透明度来显示
433
+ * @param chainId 链ID,例如 'A', 'B'
434
+ */
435
+ showChain: (chainId: string) => Promise<void>;
436
+ /**
437
+ * 使用透明度隐藏指定链中的残基
438
+ * @param chainId 链ID,例如 'A', 'B'
439
+ * @param residueIds 残基序号数组,例如 [10, 15, 20] 或范围 { start: 10, end: 20 }
440
+ */
441
+ hideResidues: (chainId: string, residueIds: number[] | {
442
+ start: number;
443
+ end: number;
444
+ }) => Promise<void>;
445
+ /**
446
+ * 清除指定链中残基的透明度来显示
447
+ * @param chainId 链ID,例如 'A', 'B'
448
+ * @param residueIds 残基序号数组,例如 [10, 15, 20] 或范围 { start: 10, end: 20 }
449
+ */
450
+ showResidues: (chainId: string, residueIds: number[] | {
451
+ start: number;
452
+ end: number;
453
+ }) => Promise<void>;
454
+ /**
455
+ * 切换残基的显示/隐藏状态
456
+ * @param chainId 链ID
457
+ * @param residueIds 残基序号数组或范围
458
+ * @param visible true显示,false隐藏
459
+ */
460
+ toggleResidues: (chainId: string, residueIds: number[] | {
461
+ start: number;
462
+ end: number;
463
+ }, visible: boolean) => Promise<void>;
464
+ /**
465
+ * 使用透明度隐藏指定的配体
466
+ * @param chainId 链ID
467
+ * @param resId 残基序号(可选)
468
+ * @param resName 残基名称(可选)
469
+ */
470
+ hideLigand: (chainId: string, resId?: number, resName?: string) => Promise<void>;
471
+ /**
472
+ * 清除指定配体的透明度来显示
473
+ * @param chainId 链ID
474
+ * @param resId 残基序号(可选)
475
+ * @param resName 残基名称(可选)
476
+ */
477
+ showLigand: (chainId: string, resId?: number, resName?: string) => Promise<void>;
478
+ /**
479
+ * 批量隐藏多个链
480
+ * @param chainIds 链ID数组,例如 ['A', 'B', 'C']
481
+ */
482
+ hideChains: (chainIds: string[]) => Promise<void>;
483
+ /**
484
+ * 批量显示多个链
485
+ * @param chainIds 链ID数组,例如 ['A', 'B', 'C']
486
+ */
487
+ showChains: (chainIds: string[]) => Promise<void>;
488
+ /**
489
+ * 切换链的显示/隐藏状态
490
+ * @param chainId 链ID
491
+ * @param visible true显示,false隐藏
492
+ */
493
+ toggleChain: (chainId: string, visible: boolean) => Promise<void>;
494
+ /**
495
+ * 切换配体的显示/隐藏状态
496
+ * @param chainId 链ID
497
+ * @param visible true显示,false隐藏
498
+ * @param resId 残基序号(可选)
499
+ * @param resName 残基名称(可选)
500
+ */
501
+ toggleLigand: (chainId: string, visible: boolean, resId?: number, resName?: string) => Promise<void>;
502
+ /**
503
+ * 清除所有透明度,恢复所有被隐藏的元素
504
+ */
505
+ clearAllTransparency: () => Promise<void>;
506
+ /**
507
+ * 获取当前隐藏状态
508
+ */
509
+ getHiddenState: () => {
510
+ chains: string[];
511
+ ligands: string[];
512
+ residues: {
513
+ [chainId: string]: number[];
514
+ };
515
+ };
516
+ };
517
+ add_shape(structure: any, params: any): Promise<import("Molstar/mol-state/object").StateObjectSelector<PluginStateObject.Molecule.Structure.Representation3D, import("Molstar/mol-state/transformer").StateTransformer<StateObject<any, StateObject.Type<any>>, StateObject<any, StateObject.Type<any>>, any>>>;
518
+ remove_shape(selector: any): void;
519
+ add_contact(contactPair: {
520
+ structure_ref: string;
521
+ start_query: QueryParam[];
522
+ end_query: QueryParam[];
523
+ interactionType: string;
524
+ color: number;
525
+ id: string;
526
+ }): Promise<void>;
527
+ /**
528
+ * 添加自动计算的相互作用表示(使用 molstar 内置的 Interactions)
529
+ * 此方法会自动计算和显示选定区域的所有相互作用(氢键、疏水作用、π-π堆积等)
530
+ *
531
+ * @param componentRef - 组件引用(如 'Ligand_0')
532
+ * @param options - 可选参数
533
+ * @returns 表示引用
534
+ *
535
+ * @example
536
+ * ```javascript
537
+ * // 为配体添加相互作用表示
538
+ * await viewer.add_interactions_repr({
539
+ * componentRef: 'Ligand_0',
540
+ * structureId: '0'
541
+ * });
542
+ *
543
+ * // 自定义相互作用参数
544
+ * await viewer.add_interactions_repr({
545
+ * componentRef: 'Ligand_plus_0',
546
+ * structureId: '0',
547
+ * interactionTypes: ['hydrogen-bond', 'hydrophobic', 'pi-stacking']
548
+ * });
549
+ *
550
+ * // 只显示跨链相互作用(多肽场景)
551
+ * await viewer.add_interactions_repr({
552
+ * componentRef: 'Polymer_p_plus_1',
553
+ * structureId: '1',
554
+ * interChainOnly: true // 只显示不同链之间的相互作用
555
+ * });
556
+ * ```
557
+ */
558
+ add_interactions_repr(options: {
559
+ /** 组件引用 */
560
+ componentRef: string;
561
+ /** 表示引用(可选,自动生成) */
562
+ reprRef?: string;
563
+ /** 结构ID(可选,默认'0') */
564
+ structureId?: string;
565
+ /**
566
+ * 相互作用类型(可选)
567
+ * 可用值: 'hydrogen-bond', 'halogen-bond', 'ionic', 'metal-coordination',
568
+ * 'cation-pi', 'pi-stacking', 'hydrophobic', 'weak-hydrogen-bond'
569
+ */
570
+ interactionTypes?: string[];
571
+ /** 是否只显示跨链相互作用(默认false) */
572
+ interChainOnly?: boolean;
573
+ /** 是否初始可见(默认true) */
574
+ visible?: boolean;
575
+ /** 额外参数(可选) */
576
+ params?: any;
577
+ }): Promise<string | null>;
578
+ /**
579
+ * 为指定组件自动计算并显示相互作用
580
+ * 这是一个通用方法,可用于任意组件(配体、多肽、聚合物等)
581
+ *
582
+ * @param componentRef - 组件引用(如 'Polymer_p1', 'Ligand_plus_0' 等)
583
+ * @param structureId - 结构ID(可选,默认'0')
584
+ * @param interactionTypes - 相互作用类型(可选)
585
+ * @param interChainOnly - 是否只显示跨链相互作用(可选,默认自动判断)
586
+ * @returns 创建的 interactions 表示引用
587
+ *
588
+ * @example
589
+ * ```javascript
590
+ * // 为多肽显示相互作用(自动启用跨链过滤)
591
+ * await viewer.show_component_interactions('Polymer_p_plus_1', '1');
592
+ *
593
+ * // 为配体显示相互作用
594
+ * await viewer.show_component_interactions('Ligand_plus_0', '0');
595
+ *
596
+ * // 自定义相互作用类型
597
+ * await viewer.show_component_interactions('Polymer_p2', '2', ['hydrogen-bond', 'ionic']);
598
+ * ```
599
+ */
600
+ show_component_interactions(componentRef: string, structureId?: string, interactionTypes?: string[], interChainOnly?: boolean): Promise<string | null>;
601
+ /**
602
+ * 创建多肽周围环境组件(包含多肽本身+周围残基)
603
+ * 用于计算多肽与周围残基之间的相互作用
604
+ *
605
+ * @param options - 配置选项
606
+ * @returns 周围环境组件引用
607
+ *
608
+ * @example
609
+ * ```javascript
610
+ * await viewer.create_peptide_surroundings_component({
611
+ * peptideId: '1',
612
+ * peptideChainName: 'p',
613
+ * structureId: '1',
614
+ * radius: 5
615
+ * });
616
+ * ```
617
+ */
618
+ create_peptide_surroundings_component(options: {
619
+ peptideId: string;
620
+ peptideChainName: string;
621
+ structureId: string;
622
+ radius?: number;
623
+ }): Promise<string | null>;
624
+ /**
625
+ * 创建背景肽链周围环境组件(包含背景肽链+背景蛋白)
626
+ * 用于计算背景肽链与背景蛋白之间的相互作用
627
+ *
628
+ * @param options - 配置选项
629
+ * @returns 周围环境组件引用
630
+ *
631
+ * @example
632
+ * ```javascript
633
+ * await viewer.create_peptide_background_surroundings_component({
634
+ * structureId: 'Original',
635
+ * radius: 5
636
+ * });
637
+ * ```
638
+ */
639
+ create_peptide_background_surroundings_component(options: {
640
+ structureId: string;
641
+ radius?: number;
642
+ }): Promise<string | null>;
643
+ /**
644
+ * 导出 Molstar 内置计算的 Interaction 数据
645
+ * 可用于绘制 2D interaction 图
646
+ *
647
+ * @param componentRef - 组件引用(如 'Ligand_plus_0')
648
+ * @param structureId - 结构ID(可选,默认'0')
649
+ * @param filterResId - 可选的残基ID,如果提供则只返回与该残基相关的相互作用
650
+ * @returns Interaction 数据数组
651
+ *
652
+ * @example
653
+ * ```javascript
654
+ * // 导出配体周围的所有相互作用数据
655
+ * const interactions = await viewer.exportInteractionsData('Ligand_plus_0');
656
+ *
657
+ * // 只导出与残基 1102 相关的相互作用
658
+ * const ligandInteractions = await viewer.exportInteractionsData('Ligand_plus_0', '0', 1102);
659
+ * console.log(ligandInteractions);
660
+ * // [
661
+ * // {
662
+ * // type: 'hydrogen-bond',
663
+ * // atomA: { chainId: 'A', resId: 1102, resName: 'KY9', atomName: 'O38', atomId: 38 },
664
+ * // atomB: { chainId: 'A', resId: 745, resName: 'LYS', atomName: 'NZ', atomId: null },
665
+ * // distance: 2.87
666
+ * // },
667
+ * // ...
668
+ * // ]
669
+ * ```
670
+ */
671
+ exportInteractionsData(componentRef: string, structureId?: string, filterResId?: number): Promise<any[]>;
672
+ /**
673
+ * 辅助方法:从 structure、unit、features 和 feature index 获取原子信息
674
+ * @private
675
+ */
676
+ private getAtomInfoFromFeature;
677
+ /**
678
+ * 导出配体为 SDF 格式(用于 RDKit.js 等)
679
+ *
680
+ * @param ligandComponentRef - 配体组件引用(如 'Ligand_MK1')
681
+ * @param structureId - 结构ID(可选,默认'0')
682
+ * @returns SDF 格式字符串
683
+ *
684
+ * @example
685
+ * ```javascript
686
+ * // 导出配体为 SDF
687
+ * const sdf = await viewer.exportLigandAsSDF('Ligand_MK1', '0');
688
+ *
689
+ * // 然后用 RDKit.js 生成 2D 坐标
690
+ * const mol = RDKit.get_mol(sdf);
691
+ * mol.generate_2d_coords();
692
+ * ```
693
+ */
694
+ exportLigandAsSDF(ligandComponentRef: string, structureId?: string): Promise<string>;
695
+ /**
696
+ * 导出配体为 MOL 格式(备用方案)
697
+ *
698
+ * @param ligandComponentRef - 配体组件引用
699
+ * @param structureId - 结构ID
700
+ * @returns MOL 格式字符串
701
+ */
702
+ exportLigandAsMOL(ligandComponentRef: string, structureId?: string): Promise<string>;
703
+ /**
704
+ * 导出配体的完整信息(包括原子、键、坐标)
705
+ * 返回更结构化的数据,方便后续处理
706
+ *
707
+ * @param ligandComponentRef - 配体组件引用
708
+ * @param structureId - 结构ID
709
+ * @returns 配体信息对象
710
+ */
711
+ exportLigandStructure(ligandComponentRef: string, structureId?: string): Promise<any>;
712
+ /**
713
+ * 删除指定的 contact/interaction 表示
714
+ * @param contactId - contact 的 ID(通常是 prolif_id)
715
+ */
716
+ remove_contact(contactId: string): Promise<void>;
717
+ addInteractionRepr(a: any, b: any, s_ref: string, options?: any): Promise<void>;
718
+ ArbitrarySphereVisuals: {
719
+ 'arbitrary-sphere': (ctx: any, getParams: any) => import("molstar/lib/mol-repr/structure/representation").StructureRepresentation<{
720
+ x: PD.Numeric;
721
+ y: PD.Numeric;
722
+ z: PD.Numeric;
723
+ l1: PD.Numeric;
724
+ l2: PD.Numeric;
725
+ l3: PD.Numeric;
726
+ unitKinds: PD.MultiSelect<"spheres" | "gaussians" | "atomic">;
727
+ includeParent: PD.BooleanParam;
728
+ doubleSided: PD.BooleanParam;
729
+ flipSided: PD.BooleanParam;
730
+ flatShaded: PD.BooleanParam;
731
+ ignoreLight: PD.BooleanParam;
732
+ xrayShaded: PD.Select<boolean | "inverted">;
733
+ transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
734
+ bumpFrequency: PD.Numeric;
735
+ bumpAmplitude: PD.Numeric;
736
+ alpha: PD.Numeric;
737
+ quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
738
+ material: PD.Group<PD.Normalize<{
739
+ metalness: number;
740
+ roughness: number;
741
+ bumpiness: number;
742
+ }>>;
743
+ clip: PD.Group<PD.Normalize<{
744
+ variant: import("Molstar/mol-util/clip").Clip.Variant;
745
+ objects: PD.Normalize<{
746
+ type: any;
747
+ invert: any;
748
+ position: any;
749
+ rotation: any;
750
+ scale: any;
751
+ }>[];
752
+ }>>;
753
+ instanceGranularity: PD.BooleanParam;
754
+ }>;
755
+ };
756
+ ArbitrarySphereParams: {
757
+ x: PD.Numeric;
758
+ y: PD.Numeric;
759
+ z: PD.Numeric;
760
+ l1: PD.Numeric;
761
+ l2: PD.Numeric;
762
+ l3: PD.Numeric;
763
+ unitKinds: PD.MultiSelect<"spheres" | "gaussians" | "atomic">;
764
+ includeParent: PD.BooleanParam;
765
+ doubleSided: PD.BooleanParam;
766
+ flipSided: PD.BooleanParam;
767
+ flatShaded: PD.BooleanParam;
768
+ ignoreLight: PD.BooleanParam;
769
+ xrayShaded: PD.Select<boolean | "inverted">;
770
+ transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
771
+ bumpFrequency: PD.Numeric;
772
+ bumpAmplitude: PD.Numeric;
773
+ alpha: PD.Numeric;
774
+ quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
775
+ material: PD.Group<PD.Normalize<{
776
+ metalness: number;
777
+ roughness: number;
778
+ bumpiness: number;
779
+ }>>;
780
+ clip: PD.Group<PD.Normalize<{
781
+ variant: import("Molstar/mol-util/clip").Clip.Variant;
782
+ objects: PD.Normalize<{
783
+ type: any;
784
+ invert: any;
785
+ position: any;
786
+ rotation: any;
787
+ scale: any;
788
+ }>[];
789
+ }>>;
790
+ instanceGranularity: PD.BooleanParam;
791
+ };
792
+ ArbitrarySphereVisual: (materialId: any) => import("molstar/lib/mol-repr/structure/units-visual").UnitsVisual<{
793
+ x: PD.Numeric;
794
+ y: PD.Numeric;
795
+ z: PD.Numeric;
796
+ l1: PD.Numeric;
797
+ l2: PD.Numeric;
798
+ l3: PD.Numeric;
799
+ unitKinds: PD.MultiSelect<"spheres" | "gaussians" | "atomic">;
800
+ includeParent: PD.BooleanParam;
801
+ doubleSided: PD.BooleanParam;
802
+ flipSided: PD.BooleanParam;
803
+ flatShaded: PD.BooleanParam;
804
+ ignoreLight: PD.BooleanParam;
805
+ xrayShaded: PD.Select<boolean | "inverted">;
806
+ transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
807
+ bumpFrequency: PD.Numeric;
808
+ bumpAmplitude: PD.Numeric;
809
+ alpha: PD.Numeric;
810
+ quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
811
+ material: PD.Group<PD.Normalize<{
812
+ metalness: number;
813
+ roughness: number;
814
+ bumpiness: number;
815
+ }>>;
816
+ clip: PD.Group<PD.Normalize<{
817
+ variant: import("Molstar/mol-util/clip").Clip.Variant;
818
+ objects: PD.Normalize<{
819
+ type: any;
820
+ invert: any;
821
+ position: any;
822
+ rotation: any;
823
+ scale: any;
824
+ }>[];
825
+ }>>;
826
+ instanceGranularity: PD.BooleanParam;
827
+ }>;
828
+ ConfalPyramidsRepresentation: (ctx: any, getParams: any) => Representation<Structure, {
829
+ x: PD.Numeric;
830
+ y: PD.Numeric;
831
+ z: PD.Numeric;
832
+ l1: PD.Numeric;
833
+ l2: PD.Numeric;
834
+ l3: PD.Numeric;
835
+ unitKinds: PD.MultiSelect<"spheres" | "gaussians" | "atomic">;
836
+ includeParent: PD.BooleanParam;
837
+ doubleSided: PD.BooleanParam;
838
+ flipSided: PD.BooleanParam;
839
+ flatShaded: PD.BooleanParam;
840
+ ignoreLight: PD.BooleanParam;
841
+ xrayShaded: PD.Select<boolean | "inverted">;
842
+ transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
843
+ bumpFrequency: PD.Numeric;
844
+ bumpAmplitude: PD.Numeric;
845
+ alpha: PD.Numeric;
846
+ quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
847
+ material: PD.Group<PD.Normalize<{
848
+ metalness: number;
849
+ roughness: number;
850
+ bumpiness: number;
851
+ }>>;
852
+ clip: PD.Group<PD.Normalize<{
853
+ variant: import("Molstar/mol-util/clip").Clip.Variant;
854
+ objects: PD.Normalize<{
855
+ type: any;
856
+ invert: any;
857
+ position: any;
858
+ rotation: any;
859
+ scale: any;
860
+ }>[];
861
+ }>>;
862
+ instanceGranularity: PD.BooleanParam;
863
+ }, import("molstar/lib/mol-repr/structure/representation").StructureRepresentationState>;
864
+ ArbitrarySphereRepresentationProvider: StructureRepresentationProvider<{
865
+ x: PD.Numeric;
866
+ y: PD.Numeric;
867
+ z: PD.Numeric;
868
+ l1: PD.Numeric;
869
+ l2: PD.Numeric;
870
+ l3: PD.Numeric;
871
+ unitKinds: PD.MultiSelect<"spheres" | "gaussians" | "atomic">;
872
+ includeParent: PD.BooleanParam;
873
+ doubleSided: PD.BooleanParam;
874
+ flipSided: PD.BooleanParam;
875
+ flatShaded: PD.BooleanParam;
876
+ ignoreLight: PD.BooleanParam;
877
+ xrayShaded: PD.Select<boolean | "inverted">;
878
+ transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
879
+ bumpFrequency: PD.Numeric;
880
+ bumpAmplitude: PD.Numeric;
881
+ alpha: PD.Numeric;
882
+ quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
883
+ material: PD.Group<PD.Normalize<{
884
+ metalness: number;
885
+ roughness: number;
886
+ bumpiness: number;
887
+ }>>;
888
+ clip: PD.Group<PD.Normalize<{
889
+ variant: import("Molstar/mol-util/clip").Clip.Variant;
890
+ objects: PD.Normalize<{
891
+ type: any;
892
+ invert: any;
893
+ position: any;
894
+ rotation: any;
895
+ scale: any;
896
+ }>[];
897
+ }>>;
898
+ instanceGranularity: PD.BooleanParam;
899
+ }, "arbitrary-sphere">;
900
+ createArbitrarySphereMesh: (ctx: any, unit: any, structure: any, theme: any, props: any, mesh: any) => import("Molstar/mol-geo/geometry/mesh/mesh").Mesh;
901
+ }
902
+ export default DrugflowMolstarPlugin;