@datagrok/bio 2.22.3 → 2.22.4

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
@@ -2,10 +2,10 @@
2
2
  "name": "@datagrok/bio",
3
3
  "friendlyName": "Bio",
4
4
  "author": {
5
- "name": "Leonid Stolbov",
6
- "email": "lstolbov@datagrok.ai"
5
+ "name": "Davit Rizhinashvili",
6
+ "email": "drizhinashvili@datagrok.ai"
7
7
  },
8
- "version": "2.22.3",
8
+ "version": "2.22.4",
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",
@@ -44,12 +44,12 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@biowasm/aioli": "^3.1.0",
47
- "@datagrok-libraries/bio": "^5.54.1",
47
+ "@datagrok-libraries/bio": "^5.54.4",
48
48
  "@datagrok-libraries/chem-meta": "^1.2.7",
49
49
  "@datagrok-libraries/math": "^1.2.4",
50
- "@datagrok-libraries/ml": "^6.10.2",
50
+ "@datagrok-libraries/ml": "^6.10.4",
51
51
  "@datagrok-libraries/tutorials": "^1.6.1",
52
- "@datagrok-libraries/utils": "^4.5.7",
52
+ "@datagrok-libraries/utils": "^4.6.3",
53
53
  "@webgpu/types": "^0.1.40",
54
54
  "ajv": "^8.12.0",
55
55
  "ajv-errors": "^3.0.0",
@@ -73,7 +73,7 @@
73
73
  "@types/wu": "^2.1.44",
74
74
  "@typescript-eslint/eslint-plugin": "^8.8.1",
75
75
  "@typescript-eslint/parser": "^8.8.1",
76
- "datagrok-tools": "^4.14.29",
76
+ "datagrok-tools": "^4.14.37",
77
77
  "eslint": "^8.57.1",
78
78
  "eslint-config-google": "^0.14.0",
79
79
  "eslint-plugin-rxjs": "^5.0.3",
@@ -133,7 +133,7 @@ export namespace funcs {
133
133
  /**
134
134
  Detects pairs of molecules with similar structure and significant difference in any given property
135
135
  */
136
- export async function activityCliffs(table: DG.DataFrame , molecules: DG.Column , activities: DG.Column , similarity: number , methodName: string , similarityMetric: string , preprocessingFunction: any , options?: any , demo?: boolean ): Promise<any> {
136
+ export async function activityCliffs(table: DG.DataFrame , molecules: DG.Column , activities: DG.Column , similarity: number , methodName: string , similarityMetric: string , preprocessingFunction: any , options?: any , demo?: boolean ): Promise<void> {
137
137
  return await grok.functions.call('Bio:ActivityCliffs', { table, molecules, activities, similarity, methodName, similarityMetric, preprocessingFunction, options, demo });
138
138
  }
139
139
 
package/src/package.ts CHANGED
@@ -455,17 +455,17 @@ export async function getRegionTopMenu(
455
455
  //input: func preprocessingFunction
456
456
  //input: object options {optional: true}
457
457
  //input: bool demo {optional: true}
458
- //output: viewer result
459
458
  //editor: Bio:SeqActivityCliffsEditor
460
459
  export async function activityCliffs(table: DG.DataFrame, molecules: DG.Column<string>, activities: DG.Column,
461
460
  similarity: number, methodName: DimReductionMethods,
462
461
  similarityMetric: MmDistanceFunctionsNames | BitArrayMetrics, preprocessingFunction: DG.Func,
463
462
  options?: (IUMAPOptions | ITSNEOptions) & Options, demo?: boolean): Promise<DG.Viewer | undefined> {
464
463
  //workaround for functions which add viewers to tableView (can be run only on active table view)
465
- if (table.name !== grok.shell.tv.dataFrame.name) {
464
+ if (table !== grok.shell.tv.dataFrame) {
466
465
  grok.shell.error(`Table ${table.name} is not a current table view`);
467
466
  return;
468
467
  }
468
+ const tv = grok.shell.tv;
469
469
  if (!checkInputColumnUI(molecules, 'Activity Cliffs'))
470
470
  return;
471
471
  const axesNames = getEmbeddingColsNames(table);
@@ -509,7 +509,7 @@ export async function activityCliffs(table: DG.DataFrame, molecules: DG.Column<s
509
509
  }
510
510
 
511
511
  const pi = DG.TaskBarProgressIndicator.create(`Running sequence activity cliffs ...`);
512
- return new Promise<DG.Viewer | undefined>((resolve, reject) => {
512
+ const scRes = (await new Promise<DG.Viewer | undefined>((resolve, reject) => {
513
513
  if (table.rowCount > fastRowCount && !options?.[BYPASS_LARGE_DATA_WARNING]) {
514
514
  ui.dialog().add(ui.divText(`Activity cliffs analysis might take several minutes.
515
515
  Do you want to continue?`))
@@ -524,7 +524,13 @@ export async function activityCliffs(table: DG.DataFrame, molecules: DG.Column<s
524
524
  const [errMsg, errStack] = errInfo(err);
525
525
  _package.logger.error(errMsg, undefined, errStack);
526
526
  throw err;
527
- }).finally(() => { pi.close(); });
527
+ }).finally(() => { pi.close(); })) as DG.ScatterPlotViewer | undefined;
528
+ if (scRes?.props?.xColumnName && scRes?.props?.yColumnName && table.col(scRes.props.xColumnName) && table.col(scRes.props.yColumnName)) {
529
+ table.col(scRes.props.xColumnName)!.set(0, table.col(scRes.props.xColumnName)!.get(0)); // to trigger rendering
530
+ table.col(scRes.props.yColumnName)!.set(0, table.col(scRes.props.yColumnName)!.get(0)); // to trigger rendering
531
+ }
532
+
533
+ return scRes;
528
534
  }
529
535
 
530
536
  //name: Encode Sequences
@@ -12,7 +12,7 @@ export async function _testActivityCliffsOpen(df: DG.DataFrame, drMethod: DimRed
12
12
  similarityMetric: MmDistanceFunctionsNames | BitArrayMetrics, preprocessingFunction: DG.Func,
13
13
  ): Promise<void> {
14
14
  await grok.data.detectSemanticTypes(df);
15
- const scatterPlot = (await grok.functions.call('Bio:activityCliffs', {
15
+ (await grok.functions.call('Bio:activityCliffs', {
16
16
  table: df,
17
17
  molecules: df.getCol(seqColName),
18
18
  activities: df.getCol(activityColName),
@@ -23,7 +23,8 @@ export async function _testActivityCliffsOpen(df: DG.DataFrame, drMethod: DimRed
23
23
  options: {[`${BYPASS_LARGE_DATA_WARNING}`]: true},
24
24
  demo: false,
25
25
  })) as DG.Viewer | undefined;
26
- expect(scatterPlot != null, true);
26
+ const scatterPlot = Array.from(grok.shell.tv.viewers)[1];
27
+ expect(scatterPlot?.type === DG.VIEWER.SCATTER_PLOT, true);
27
28
 
28
29
  await awaitCheck(() => {
29
30
  const link = Array.from(scatterPlot!.root.getElementsByClassName('scatter_plot_link'));
@@ -15,6 +15,7 @@ import {ISeqHandler} from '@datagrok-libraries/bio/src/utils/macromolecule/seq-h
15
15
  import * as RxJs from 'rxjs';
16
16
  import {filter} from 'rxjs/operators';
17
17
  import {IMonomerLib} from '@datagrok-libraries/bio/src/types';
18
+ import wu from 'wu';
18
19
 
19
20
  // ============================================================================
20
21
  // OPTIMIZED VIEWPORT-AWARE CACHING WITH FORCE UPDATE SUPPORT
@@ -462,7 +463,7 @@ export function handleSequenceHeaderRendering() {
462
463
 
463
464
  if (cur !== scrollerCur) {
464
465
  seqCol.setTag(bioTAGS.selectedPosition, (scrollerCur).toString());
465
- if (scrollerCur >= 0 && !positionStatsViewerAddedOnce && grid.tableView) {
466
+ if (scrollerCur >= 0 && !positionStatsViewerAddedOnce && grid.tableView && wu(grid.dataFrame?.columns.numerical).find((_c) => true)) {
466
467
  positionStatsViewerAddedOnce = true;
467
468
  const v = grid.tableView.addViewer('Sequence Position Statistics', {sequenceColumnName: seqCol.name});
468
469
  grid.tableView.dockManager.dock(v, DG.DOCK_TYPE.DOWN, null, 'Sequence Position Statistics', 0.4);
@@ -475,7 +476,7 @@ export function handleSequenceHeaderRendering() {
475
476
  if (grid.isDetached || _newHeight < STRICT_THRESHOLDS.WITH_TITLE) return;
476
477
  setTimeout(() => grid.props.colHeaderHeight = _newHeight);
477
478
  },
478
- });
479
+ }, gCol);
479
480
 
480
481
  scroller.setupTooltipHandling();
481
482
 
@@ -511,12 +512,12 @@ export function handleSequenceHeaderRendering() {
511
512
  scroller.positionWidth = font + 8; // MSA always has padding
512
513
 
513
514
  const start = getStart();
514
- const startPadding = 0; // MSA doesn't need extra padding
515
+
515
516
 
516
517
  scroller.draw(
517
- cellBounds.x + startPadding,
518
+ cellBounds.x,
518
519
  cellBounds.y,
519
- cellBounds.width - startPadding,
520
+ cellBounds.width,
520
521
  cellBounds.height,
521
522
  getCurrent(),
522
523
  start,