@datagrok/bio 2.10.15 → 2.10.16

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Leonid Stolbov",
6
6
  "email": "lstolbov@datagrok.ai"
7
7
  },
8
- "version": "2.10.15",
8
+ "version": "2.10.16",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@biowasm/aioli": "^3.1.0",
37
- "@datagrok-libraries/bio": "^5.38.7",
37
+ "@datagrok-libraries/bio": "^5.38.8",
38
38
  "@datagrok-libraries/chem-meta": "^1.0.1",
39
39
  "@datagrok-libraries/ml": "^6.3.43",
40
40
  "@datagrok-libraries/tutorials": "^1.3.6",
@@ -60,6 +60,9 @@ export enum PROPS {
60
60
  fitWidth = 'fitWidth',
61
61
  positionWidth = 'positionWidth',
62
62
  positionHeight = 'positionHeight',
63
+
64
+ // -- Behavior --
65
+ filterSource = 'filterSource',
63
66
  }
64
67
 
65
68
  const defaults: VdRegionsProps = VdRegionsPropsDefault;
@@ -88,6 +91,8 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
88
91
  public positionWidth: number;
89
92
  public positionHeight: PositionHeight;
90
93
 
94
+ public filterSource: FilterSources;
95
+
91
96
  constructor() {
92
97
  super();
93
98
 
@@ -111,6 +116,10 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
111
116
  });
112
117
  this.positionHeight = this.string(PROPS.positionHeight, defaults.positionHeight,
113
118
  {category: PROPS_CATS.LAYOUT, choices: Object.keys(PositionHeight)}) as PositionHeight;
119
+
120
+ // -- Behavior --
121
+ this.filterSource = this.string(PROPS.filterSource, defaults.filterSource,
122
+ {category: PROPS_CATS.BEHAVIOR, choices: Object.values(FilterSources)}) as FilterSources;
114
123
  }
115
124
 
116
125
  public async init() {
@@ -197,6 +206,10 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
197
206
  this.calcSize();
198
207
  break;
199
208
 
209
+ case PROPS.filterSource:
210
+ this.filterSourceInput.value = this.filterSource;
211
+ break;
212
+
200
213
  default:
201
214
  this.setData(this.dataFrame, this.regions); // onPropertyChanged
202
215
  break;
@@ -244,7 +257,7 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
244
257
  private setDataInProgress: boolean = false;
245
258
 
246
259
  private host: HTMLElement | null = null;
247
- private filterSourceInput: DG.InputBase<boolean | null> | null = null;
260
+ private filterSourceInput!: DG.InputBase<FilterSources | null>;
248
261
  private mainLayout: HTMLTableElement | null = null;
249
262
  private logos: { [chain: string]: WebLogoViewer }[] = [];
250
263
 
@@ -350,12 +363,13 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
350
363
  // this.mainLayout.style.height = '100%';
351
364
  // this.mainLayout.style.border = '1px solid black';
352
365
 
353
- this.filterSourceInput = ui.boolInput('', false, this.filterSourceInputOnValueChanged.bind(this));
366
+ this.filterSourceInput = ui.choiceInput<FilterSources>('Data source', defaults.filterSource,
367
+ Object.values(FilterSources), this.filterSourceInputOnValueChanged.bind(this));
354
368
  this.filterSourceInput.root.style.position = 'absolute';
355
- this.filterSourceInput.root.style.left = '10px';
356
- this.filterSourceInput.root.style.top = '-3px';
369
+ this.filterSourceInput.root.style.right = '9px';
370
+ this.filterSourceInput.root.style.top = '-4px';
357
371
  //this.filterSourceInput.setTooltip('Check to filter sequences for selected VRs'); // TODO: GROK-13614
358
- ui.tooltip.bind(this.filterSourceInput.input, 'Check to filter sequences for selected VRs');
372
+ //ui.tooltip.bind(this.filterSourceInput.input, 'Check to filter sequences for selected VRs');
359
373
 
360
374
  const _color: string = `#ffbb${Math.ceil(Math.random() * 255).toString(16)}`;
361
375
  this.host = ui.div([this.mainLayout, this.filterSourceInput!.root],
@@ -440,15 +454,20 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
440
454
  }
441
455
 
442
456
  private filterSourceInputOnValueChanged(): void {
443
- const filterSource: FilterSources = this.filterSourceInput!.value == true ?
444
- FilterSources.Selected : FilterSources.Filtered;
445
-
446
- for (let orderI = 0; orderI < this.logos.length; orderI++) {
447
- for (let chainI = 0; chainI < this.chains.length; chainI++) {
448
- const chain: string = this.chains[chainI];
449
- const wl: DG.JsViewer = this.logos[orderI][chain];
450
- wl.setOptions({[wlPROPS.filterSource]: filterSource});
457
+ const filterSourceValue = this.filterSourceInput.value;
458
+ // Using promise to prevent 'Bad state: Cannot fire new event. Controller is already firing an event'
459
+ this.viewPromise = this.viewPromise.then(() => {
460
+ if (this.filterSource !== filterSourceValue) {
461
+ this.props.getProperty(PROPS.filterSource).set(this, filterSourceValue); // to update value in property panel
462
+
463
+ for (let orderI = 0; orderI < this.logos.length; orderI++) {
464
+ for (let chainI = 0; chainI < this.chains.length; chainI++) {
465
+ const chain: string = this.chains[chainI];
466
+ const wl: DG.JsViewer = this.logos[orderI][chain];
467
+ wl.setOptions({[wlPROPS.filterSource]: this.filterSource});
468
+ }
469
+ }
451
470
  }
452
- }
471
+ });
453
472
  }
454
473
  }