@datagrok/bio 2.22.7 → 2.22.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/src/package.ts CHANGED
@@ -82,6 +82,36 @@ export * from './package.g';
82
82
  // /** Avoid reassigning {@link monomerLib} because consumers subscribe to {@link IMonomerLib.onChanged} event */
83
83
  // let monomerLib: MonomerLib | null = null;
84
84
  let initBioPromise: Promise<void> | null = null;
85
+ /** Temporary polyfill */
86
+
87
+ function getDecoratorFunc() {
88
+ return function(args: any) {
89
+ return function(
90
+ target: any,
91
+ propertyKey: string,
92
+ descriptor: PropertyDescriptor
93
+ ) { };
94
+ };
95
+ }
96
+
97
+ // Ensure decorators object exists and polyfill missing decorators
98
+ if (!grok.decorators)
99
+ (grok as any).decorators = {};
100
+
101
+
102
+ const decorators = [
103
+ 'func', 'init', 'param', 'panel', 'editor', 'demo', 'app',
104
+ 'appTreeBrowser', 'fileHandler', 'fileExporter', 'model', 'viewer', 'filter', 'cellRenderer', 'autostart',
105
+ 'dashboard', 'folderViewer', 'semTypeDetector', 'packageSettingsEditor', 'functionAnalysis', 'converter',
106
+ 'fileViewer', 'model', 'treeBrowser', 'polyfill'
107
+ ];
108
+
109
+ decorators.forEach((decorator) => {
110
+ if (!(grok.decorators as any)[decorator])
111
+ (grok.decorators as any)[decorator] = getDecoratorFunc();
112
+ });
113
+
114
+ /** End temporary polyfill */
85
115
 
86
116
  export class PackageFunctions {
87
117
  @grok.decorators.func({description: 'Returns an instance of the monomer library helper', outputs: [{type: 'object', name: 'result'}]})
@@ -356,7 +386,7 @@ export class PackageFunctions {
356
386
  static async activityCliffs(
357
387
  @grok.decorators.param({options: {description: 'Input data table'}})table: DG.DataFrame,
358
388
  @grok.decorators.param({type: 'string', options: {semType: 'Macromolecule', description: 'Input data table'}}) molecules: DG.Column<string>,
359
- activities: DG.Column,
389
+ activities: DG.Column,
360
390
  @grok.decorators.param({options: {initialValue: '80', description: 'Similarity cutoff'}}) similarity: number,
361
391
  @grok.decorators.param({type: 'string', options: {choices: ['UMAP', 't-SNE']}}) methodName: DimReductionMethods,
362
392
  @grok.decorators.param({type: 'string', options: {choices: ['Hamming', 'Levenshtein', 'Monomer chemical distance']}}) similarityMetric: MmDistanceFunctionsNames | BitArrayMetrics,
@@ -410,30 +440,30 @@ export class PackageFunctions {
410
440
  return;
411
441
  }
412
442
 
413
- const pi = DG.TaskBarProgressIndicator.create(`Running sequence activity cliffs ...`);
414
- const scRes = (await new Promise<DG.Viewer | undefined>((resolve, reject) => {
415
- if (table.rowCount > fastRowCount && !options?.[BYPASS_LARGE_DATA_WARNING]) {
416
- ui.dialog().add(ui.divText(`Activity cliffs analysis might take several minutes.
443
+ const pi = DG.TaskBarProgressIndicator.create(`Running sequence activity cliffs ...`);
444
+ const scRes = (await new Promise<DG.Viewer | undefined>((resolve, reject) => {
445
+ if (table.rowCount > fastRowCount && !options?.[BYPASS_LARGE_DATA_WARNING]) {
446
+ ui.dialog().add(ui.divText(`Activity cliffs analysis might take several minutes.
417
447
  Do you want to continue?`))
418
- .onOK(async () => {
419
- runCliffs().then((res) => resolve(res)).catch((err) => reject(err));
420
- })
421
- .onCancel(() => { resolve(undefined); })
422
- .show();
423
- } else
424
- runCliffs().then((res) => resolve(res)).catch((err) => reject(err));
425
- }).catch((err: any) => {
426
- const [errMsg, errStack] = errInfo(err);
427
- _package.logger.error(errMsg, undefined, errStack);
428
- throw err;
429
- }).finally(() => { pi.close(); })) as DG.ScatterPlotViewer | undefined;
430
- if (scRes?.props?.xColumnName && scRes?.props?.yColumnName && table.col(scRes.props.xColumnName) && table.col(scRes.props.yColumnName)) {
448
+ .onOK(async () => {
449
+ runCliffs().then((res) => resolve(res)).catch((err) => reject(err));
450
+ })
451
+ .onCancel(() => { resolve(undefined); })
452
+ .show();
453
+ } else
454
+ runCliffs().then((res) => resolve(res)).catch((err) => reject(err));
455
+ }).catch((err: any) => {
456
+ const [errMsg, errStack] = errInfo(err);
457
+ _package.logger.error(errMsg, undefined, errStack);
458
+ throw err;
459
+ }).finally(() => { pi.close(); })) as DG.ScatterPlotViewer | undefined;
460
+ if (scRes?.props?.xColumnName && scRes?.props?.yColumnName && table.col(scRes.props.xColumnName) && table.col(scRes.props.yColumnName)) {
431
461
  table.col(scRes.props.xColumnName)!.set(0, table.col(scRes.props.xColumnName)!.get(0)); // to trigger rendering
432
462
  table.col(scRes.props.yColumnName)!.set(0, table.col(scRes.props.yColumnName)!.get(0)); // to trigger rendering
433
- }
463
+ }
434
464
 
435
- return scRes;
436
- }
465
+ return scRes;
466
+ }
437
467
 
438
468
  @grok.decorators.func({
439
469
  name: 'Encode Sequences',
@@ -969,8 +999,8 @@ export class PackageFunctions {
969
999
  return await showManageLibrariesView(false);
970
1000
  }
971
1001
 
972
- @grok.decorators.func({name: 'Monomer Manager Tree Browser'})
973
- static async manageMonomerLibrariesViewTreeBrowser(treeNode: DG.TreeViewGroup, browsePanel: DG.BrowsePanel) {
1002
+ @grok.decorators.func({name: 'Monomer Manager Tree Browser', meta: {role: 'appTreeBrowser'}})
1003
+ static async manageMonomerLibrariesViewTreeBrowser(treeNode: DG.TreeViewGroup) {
974
1004
  const libraries = (await (await MonomerLibManager.getInstance()).getFileManager()).getValidLibraryPaths();
975
1005
  libraries.forEach((libName) => {
976
1006
  const nodeName = libName.endsWith('.json') ? libName.substring(0, libName.length - 5) : libName;