@datagrok/bio 2.12.0 → 2.12.2
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/CHANGELOG.md +13 -1
- package/dist/36.js +1 -1
- package/dist/36.js.map +1 -1
- package/dist/709.js +1 -1
- package/dist/709.js.map +1 -1
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/files/tests/libraries/HELMmonomerSchema.json +1 -1
- package/package.json +3 -3
- package/src/analysis/sequence-space.ts +7 -24
- package/src/package.ts +4 -7
- package/src/tests/substructure-filters-tests.ts +143 -1
- package/src/utils/poly-tool/ui.ts +46 -135
- package/src/widgets/bio-substructure-filter-types.ts +19 -45
- package/src/widgets/bio-substructure-filter.ts +42 -20
|
@@ -44,9 +44,10 @@ class FilterState {
|
|
|
44
44
|
export class SeparatorFilterProps extends BioFilterProps {
|
|
45
45
|
constructor(
|
|
46
46
|
substructure: string,
|
|
47
|
-
public separator?: string
|
|
47
|
+
public readonly separator?: string,
|
|
48
48
|
) {
|
|
49
|
-
super(substructure);
|
|
49
|
+
super(substructure, false);
|
|
50
|
+
this.readOnly = true;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -119,7 +120,13 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
119
120
|
const logPrefix = `${this.filterToLog()}.attach()`;
|
|
120
121
|
this.filterSyncer.sync(logPrefix, async () => {
|
|
121
122
|
superAttach(dataFrame);
|
|
122
|
-
|
|
123
|
+
|
|
124
|
+
if (!this.column) {
|
|
125
|
+
if (this.columnName)
|
|
126
|
+
this.column = this.dataFrame!.getCol(this.columnName);
|
|
127
|
+
else
|
|
128
|
+
this.column = dataFrame.columns.bySemType(DG.SEMTYPE.MACROMOLECULE);
|
|
129
|
+
}
|
|
123
130
|
const sh = SeqHandler.forColumn(this.column!);
|
|
124
131
|
this.columnName ??= this.column?.name;
|
|
125
132
|
this.notation ??= this.column?.getTag(DG.TAGS.UNITS);
|
|
@@ -134,7 +141,7 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
134
141
|
this.viewSubs.push(DG.debounce(this.bioFilter!.onChanged, this.debounceTime)
|
|
135
142
|
.subscribe(this.bioFilterOnChangedDebounced.bind(this)));
|
|
136
143
|
this.viewSubs.push(grok.events.onResetFilterRequest
|
|
137
|
-
.subscribe(
|
|
144
|
+
.subscribe(this.grokEventsOnResetFilterRequest.bind(this)));
|
|
138
145
|
this.viewSubs.push(grok.events.onCustomEvent(FILTER_SYNC_EVENT)
|
|
139
146
|
.subscribe(this.filterOnSync.bind(this)));
|
|
140
147
|
});
|
|
@@ -164,6 +171,8 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
164
171
|
// -- Layout --
|
|
165
172
|
|
|
166
173
|
applyFilter(): void {
|
|
174
|
+
const logPrefix = `${this.filterToLog()}.applyFilter()`;
|
|
175
|
+
this.logger.debug(`${logPrefix}, IN`);
|
|
167
176
|
if (this.bitset && !this.isDetached)
|
|
168
177
|
this.dataFrame?.filter.and(this.bitset);
|
|
169
178
|
}
|
|
@@ -172,8 +181,10 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
172
181
|
* @return {any} - filter state
|
|
173
182
|
*/
|
|
174
183
|
saveState(): any {
|
|
184
|
+
const logPrefix = `${this.filterToLog()}.saveState()`;
|
|
175
185
|
const state = super.saveState();
|
|
176
|
-
|
|
186
|
+
this.logger.debug(`${logPrefix}, super.state = ${JSON.stringify(state)}`);
|
|
187
|
+
state.props = this.bioFilter!.saveProps();
|
|
177
188
|
return state;
|
|
178
189
|
}
|
|
179
190
|
|
|
@@ -181,21 +192,20 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
181
192
|
* @param {any} state - filter state
|
|
182
193
|
*/
|
|
183
194
|
applyState(state: any): void {
|
|
195
|
+
const logPrefix = `${this.filterToLog()}.applyState()`;
|
|
184
196
|
super.applyState(state); //column, columnName
|
|
185
|
-
if (state.props)
|
|
186
|
-
this.bioFilter!.props.apply(state.props);
|
|
187
197
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
this.filterSyncer.sync(logPrefix, async () => {
|
|
199
|
+
if (state.props && this.bioFilter)
|
|
200
|
+
this.bioFilter.props = state.props;
|
|
201
|
+
});
|
|
192
202
|
}
|
|
193
203
|
|
|
194
204
|
private fireFilterSync(): void {
|
|
195
205
|
const logPrefix = `${this.filterToLog()}.fireFilterSync()`;
|
|
196
206
|
_package.logger.debug(`${logPrefix}, ` +
|
|
197
207
|
`bioFilter = ${!!this.bioFilter ? this.bioFilter.constructor.name : 'null'}` +
|
|
198
|
-
(!!this.bioFilter ? `, props = ${JSON.stringify(this.bioFilter!.
|
|
208
|
+
(!!this.bioFilter ? `, props = ${JSON.stringify(this.bioFilter!.saveProps())}` : ''));
|
|
199
209
|
|
|
200
210
|
grok.events.fireCustomEvent(FILTER_SYNC_EVENT, new FilterState(
|
|
201
211
|
this.bioFilter!.props, this.filterId, this.dataFrame!.id, this.columnName!, this.bitset));
|
|
@@ -213,7 +223,7 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
213
223
|
const logPrefix = `${this.filterToLog()}.bioFilterOnChangedDebounced()`;
|
|
214
224
|
_package.logger.debug(`${logPrefix}, start, ` +
|
|
215
225
|
`isFiltering = ${this.isFiltering}, ` +
|
|
216
|
-
`props = ${JSON.stringify(this.bioFilter!.
|
|
226
|
+
`props = ${JSON.stringify(this.bioFilter!.saveProps())}`);
|
|
217
227
|
|
|
218
228
|
if (!this.isFiltering) {
|
|
219
229
|
this.bitset = null;
|
|
@@ -241,6 +251,12 @@ export class BioSubstructureFilter extends DG.Filter implements IRenderer {
|
|
|
241
251
|
});
|
|
242
252
|
}
|
|
243
253
|
|
|
254
|
+
grokEventsOnResetFilterRequest(): void {
|
|
255
|
+
const logPrefix = `${this.filterToLog()}.grokEventsOnResetFilterRequest()`;
|
|
256
|
+
_package.logger.debug(`${logPrefix}`);
|
|
257
|
+
this.bioFilter?.resetFilter();
|
|
258
|
+
}
|
|
259
|
+
|
|
244
260
|
// -- IRenderer --
|
|
245
261
|
|
|
246
262
|
private _onRendered = new Subject<void>();
|
|
@@ -282,13 +298,14 @@ export class FastaBioFilter extends BioFilterBase<BioFilterProps> {
|
|
|
282
298
|
super();
|
|
283
299
|
|
|
284
300
|
this.substructureInput = ui.stringInput('', '', () => {
|
|
285
|
-
this.props
|
|
301
|
+
this.props = new BioFilterProps(this.substructureInput.value);
|
|
286
302
|
if (!this._propsChanging) this.onChanged.next();
|
|
287
303
|
}, {placeholder: 'Substructure'});
|
|
288
304
|
}
|
|
289
305
|
|
|
290
306
|
public applyProps() {
|
|
291
|
-
this.substructureInput.value
|
|
307
|
+
if (this.substructureInput.value !== this.props.substructure)
|
|
308
|
+
this.substructureInput.value = this.props.substructure;
|
|
292
309
|
}
|
|
293
310
|
|
|
294
311
|
get filterPanel() {
|
|
@@ -309,7 +326,7 @@ export class FastaBioFilter extends BioFilterBase<BioFilterProps> {
|
|
|
309
326
|
}
|
|
310
327
|
|
|
311
328
|
export class SeparatorBioFilter extends BioFilterBase<SeparatorFilterProps> {
|
|
312
|
-
readonly emptyProps = new SeparatorFilterProps('');
|
|
329
|
+
readonly emptyProps = new SeparatorFilterProps('', undefined);
|
|
313
330
|
|
|
314
331
|
readonly substructureInput: DG.InputBase<string>;
|
|
315
332
|
readonly separatorInput: DG.InputBase<string>;
|
|
@@ -321,18 +338,23 @@ export class SeparatorBioFilter extends BioFilterBase<SeparatorFilterProps> {
|
|
|
321
338
|
super();
|
|
322
339
|
|
|
323
340
|
this.substructureInput = ui.stringInput('', '', () => {
|
|
324
|
-
this.props
|
|
341
|
+
this.props = new SeparatorFilterProps(this.substructureInput.value, this.props.separator);
|
|
325
342
|
if (!this._propsChanging) this.onChanged.next();
|
|
326
343
|
}, {placeholder: 'Substructure'});
|
|
327
344
|
this.separatorInput = ui.stringInput('', this.colSeparator = colSeparator, () => {
|
|
328
|
-
|
|
345
|
+
const separator: string | undefined = !!this.separatorInput.value ? this.separatorInput.value : undefined;
|
|
346
|
+
this.props = new SeparatorFilterProps(this.props.substructure, separator);
|
|
329
347
|
if (!this._propsChanging) this.onChanged.next();
|
|
330
348
|
}, {placeholder: 'Separator'});
|
|
331
349
|
}
|
|
332
350
|
|
|
333
351
|
applyProps(): void {
|
|
334
|
-
this.substructureInput.value
|
|
335
|
-
|
|
352
|
+
if (this.substructureInput.value !== this.props.substructure)
|
|
353
|
+
this.substructureInput.value = this.props.substructure;
|
|
354
|
+
|
|
355
|
+
const separatorValue = this.props.separator ?? this.colSeparator;
|
|
356
|
+
if (this.separatorInput.value !== separatorValue)
|
|
357
|
+
this.separatorInput.value = separatorValue;
|
|
336
358
|
}
|
|
337
359
|
|
|
338
360
|
get filterSummary(): string {
|