@datagrok/bio 2.25.8 → 2.25.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.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Davit Rizhinashvili",
6
6
  "email": "drizhinashvili@datagrok.ai"
7
7
  },
8
- "version": "2.25.8",
8
+ "version": "2.25.9",
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",
@@ -62,7 +62,7 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
62
62
  set calculating(value: boolean) { this.loader.style.display = value ? 'initial' : 'none'; }
63
63
 
64
64
  get filterSummary(): string {
65
- return this.bioFilter!.filterSummary;
65
+ return this.bioFilter?.filterSummary ?? '';
66
66
  }
67
67
 
68
68
  get isFiltering(): boolean {
@@ -108,6 +108,9 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
108
108
  const superAttach = super.attach.bind(this);
109
109
  const logPrefix = `${this.filterToLog()}.attach()`;
110
110
  this.filterSyncer.sync(logPrefix, async () => {
111
+ // make sure semtypes are detected
112
+ if (dataFrame)
113
+ await dataFrame.meta.detectSemanticTypes();
111
114
  superAttach(dataFrame);
112
115
 
113
116
  if (!this.column) {
@@ -116,18 +119,18 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
116
119
  else
117
120
  this.column = dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE);
118
121
  }
119
- const sh = this.seqHelper.getSeqHandler(this.column!);
122
+ const _sh = this.seqHelper.getSeqHandler(this.column!);
120
123
  this.columnName ??= this.column?.name;
121
124
  this.notation ??= this.column?.meta.units!;
122
125
 
123
126
  this.bioFilter = this.notation === NOTATION.FASTA ?
124
127
  new FastaBioFilter() : this.notation === NOTATION.SEPARATOR ?
125
128
  new SeparatorBioFilter(this.column!.getTag(bioTAGS.separator)) : new HelmBioFilter(this.seqHelper);
126
- this.root.appendChild(this.bioFilter!.filterPanel);
129
+ this.root.appendChild(this.bioFilter.filterPanel);
127
130
  this.root.appendChild(this.loader);
128
131
  await this.bioFilter.attach(); // may await waitForElementInDom
129
132
 
130
- this.viewSubs.push(DG.debounce(this.bioFilter!.onChanged, this.debounceTime)
133
+ this.viewSubs.push(DG.debounce(this.bioFilter.onChanged, this.debounceTime)
131
134
  .subscribe(this.bioFilterOnChangedDebounced.bind(this)));
132
135
  this.viewSubs.push(grok.events.onResetFilterRequest
133
136
  .subscribe(this.grokEventsOnResetFilterRequest.bind(this)));
@@ -151,10 +154,10 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
151
154
  // -- Sync -
152
155
 
153
156
  private filterOnSync(state: FilterState): void {
154
- if (state.filterId === this.filterId) return;
157
+ if (state.filterId === this.filterId || !this.bioFilter) return;
155
158
  if (state.dataFrameId !== this.dataFrame!.id || state.columnName !== this.columnName) return;
156
159
 
157
- this.bioFilter!.props = state.props;
160
+ this.bioFilter.props = state.props;
158
161
  }
159
162
 
160
163
  // -- Layout --
@@ -173,7 +176,8 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
173
176
  const logPrefix = `${this.filterToLog()}.saveState()`;
174
177
  const state = super.saveState();
175
178
  this.logger.debug(`${logPrefix}, super.state = ${JSON.stringify(state)}`);
176
- state.props = this.bioFilter!.saveProps();
179
+ if (this.bioFilter)
180
+ state.props = this.bioFilter.saveProps();
177
181
  return state;
178
182
  }
179
183
 
@@ -194,10 +198,12 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
194
198
  const logPrefix = `${this.filterToLog()}.fireFilterSync()`;
195
199
  this.logger.debug(`${logPrefix}, ` +
196
200
  `bioFilter = ${!!this.bioFilter ? this.bioFilter.constructor.name : 'null'}` +
197
- (!!this.bioFilter ? `, props = ${JSON.stringify(this.bioFilter!.saveProps())}` : ''));
201
+ (!!this.bioFilter ? `, props = ${JSON.stringify(this.bioFilter.saveProps())}` : ''));
198
202
 
203
+ if (!this.bioFilter)
204
+ return;
199
205
  grok.events.fireCustomEvent(FILTER_SYNC_EVENT, new FilterState(
200
- this.bioFilter!.props, this.filterId, this.dataFrame!.id, this.columnName!, this.bitset));
206
+ this.bioFilter.props, this.filterId, this.dataFrame!.id, this.columnName!, this.bitset));
201
207
  }
202
208
 
203
209
  // -- Handle events
@@ -212,7 +218,7 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
212
218
  const logPrefix = `${this.filterToLog()}.bioFilterOnChangedDebounced()`;
213
219
  this.logger.debug(`${logPrefix}, start, ` +
214
220
  `isFiltering = ${this.isFiltering}, ` +
215
- `props = ${JSON.stringify(this.bioFilter!.saveProps())}`);
221
+ `props = ${this.bioFilter ? JSON.stringify(this.bioFilter?.saveProps()) : 'null'}`);
216
222
 
217
223
  if (!this.isFiltering) {
218
224
  this.bitset = null;