@datagrok/peptides 1.17.26 → 1.17.28

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/peptides",
3
3
  "friendlyName": "Peptides",
4
- "version": "1.17.26",
4
+ "version": "1.17.28",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "@datagrok-libraries/bio": "^5.40.0",
17
17
  "@datagrok-libraries/math": "1.1.12",
18
- "@datagrok-libraries/ml": "^6.6.16",
18
+ "@datagrok-libraries/ml": "^6.6.17",
19
19
  "@datagrok-libraries/statistics": "^1.2.12",
20
20
  "@datagrok-libraries/tutorials": "^1.3.13",
21
21
  "@datagrok-libraries/utils": "^4.2.20",
22
- "datagrok-api": "^1.20.1",
22
+ "datagrok-api": "^1.20.0",
23
23
  "@webgpu/types": "^0.1.40",
24
24
  "cash-dom": "latest",
25
25
  "file-loader": "latest",
package/src/demo/fasta.ts CHANGED
@@ -20,7 +20,7 @@ export async function macromoleculeSarFastaDemoUI(): Promise<void> {
20
20
  const simpleAlignedSeqCol = simpleTable.getCol(alignedSequenceCol);
21
21
  simpleAlignedSeqCol.semType = DG.SEMTYPE.MACROMOLECULE;
22
22
  simpleAlignedSeqCol.setTag(C.TAGS.ALPHABET, ALPHABET.PT);
23
- simpleAlignedSeqCol.setTag(DG.TAGS.UNITS, NOTATION.FASTA);
23
+ simpleAlignedSeqCol.meta.units = NOTATION.FASTA;
24
24
  simpleAlignedSeqCol.setTag(bioTAGS.aligned, ALIGNMENT.SEQ_MSA);
25
25
  const simpleScaledCol = scaleActivity(simpleActivityCol, C.SCALING_METHODS.MINUS_LG);
26
26
  const clustersCol = DG.Column.string('Cluster', simpleTable.rowCount).init('0');
package/src/model.ts CHANGED
@@ -147,7 +147,7 @@ export class PeptidesModel {
147
147
  this._analysisView = grok.shell.addTableView(this.df);
148
148
  }
149
149
 
150
- if (this.df.getTag(C.TAGS.MULTIPLE_VIEWS) !== '1' && !this._layoutEventInitialized)
150
+ if (this.df.getTag(C.TAGS.MULTIPLE_VIEWS) !== '1' && !this._layoutEventInitialized && !grok.shell.isInDemo)
151
151
  grok.shell.v = this._analysisView;
152
152
 
153
153
 
package/src/package.ts CHANGED
@@ -167,7 +167,7 @@ export function manualAlignment(_monomer: string): DG.Widget {
167
167
  //meta.demoPath: Bioinformatics | Macromolecule SAR Analysis
168
168
  //meta.isDemoScript: False
169
169
  export async function macromoleculeSarFastaDemo(): Promise<void> {
170
- return macromoleculeSarFastaDemoUI();
170
+ return await macromoleculeSarFastaDemoUI();
171
171
  }
172
172
 
173
173
  //name: LST Pie Chart
@@ -79,7 +79,7 @@ export enum PROPERTY_CATEGORIES {
79
79
  }
80
80
 
81
81
  const MUTATION_CLIFFS_CELL_WIDTH = 40;
82
- const AAR_CELL_WIDTH = 30;
82
+ const AAR_CELL_WIDTH = 40;
83
83
 
84
84
  export interface ISARViewer {
85
85
  sequenceColumnName: string;
@@ -30,6 +30,7 @@ export function getSelectionWidget(table: DG.DataFrame, options: SelectionWidget
30
30
  newTable.name = 'Selected compounds';
31
31
  newTable.filter.copyFrom(options.tableSelection);
32
32
  const numericalCols = wu(table.columns.numerical);
33
+ let gridSortOrder: {cols: DG.Column[], types: boolean[]} | null = null;
33
34
  for (let gridColIdx = 1; gridColIdx < options.gridColumns.length; gridColIdx++) {
34
35
  const gridCol = options.gridColumns.byIndex(gridColIdx)!;
35
36
  if (!gridCol.visible)
@@ -40,15 +41,29 @@ export function getSelectionWidget(table: DG.DataFrame, options: SelectionWidget
40
41
  if (sourceCol.type === DG.COLUMN_TYPE.BOOL)
41
42
  continue;
42
43
 
44
+ // restore sorting
45
+ if (gridSortOrder === null && gridCol.grid && gridCol.grid.sortByColumns?.length > 0 &&
46
+ gridCol.grid.sortTypes?.length === gridCol.grid.sortByColumns.length)
47
+ gridSortOrder = {cols: gridCol.grid.sortByColumns, types: gridCol.grid.sortTypes};
43
48
 
44
- const sourceColRawData = sourceCol.getRawData();
45
- const sourceColCategories = sourceCol.categories;
46
- const getValue = numericalCols
47
- .some((col) => col.name === sourceCol.name) ? (i: number): number => sourceColRawData[i] :
48
- (i: number): string => sourceColCategories[sourceColRawData[i]];
49
+
50
+ // bigint or qnum columns can throw an error when getting raw data (might be fixed in future versions)
51
+ let sourceColRawData: ArrayLike<number> | null = null;
52
+ let sourceColCategories: string[] | null = null;
53
+
54
+ try {
55
+ sourceColRawData = sourceCol.getRawData();
56
+ sourceColCategories = sourceCol.categories;
57
+ } catch (_e) {
58
+ }
59
+ const getValue = !sourceColRawData || !sourceColCategories ?
60
+ (i: number): any => sourceCol.get(i) :
61
+ numericalCols
62
+ .some((col) => col.name === sourceCol.name) ? (i: number): number => sourceColRawData[i] :
63
+ (i: number): string => sourceColCategories[sourceColRawData[i]];
49
64
  const col = sourceCol.name === options.activityColumn.name ?
50
- newTable.columns.addNewFloat(gridCol.name).init((i) => getValue(i)) :
51
- newTable.columns.addNewVirtual(gridCol.name, (i) => getValue(i), sourceCol.type as DG.TYPE);
65
+ newTable.columns.addNewFloat(gridCol.name).init((i) => getValue(i) as number) :
66
+ newTable.columns.addNewVirtual(gridCol.name, (i) => getValue(i) as unknown, sourceCol.type as DG.TYPE);
52
67
  for (const [tag, value] of sourceCol.tags)
53
68
  col.setTag(tag, value);
54
69
  }
@@ -72,6 +87,8 @@ export function getSelectionWidget(table: DG.DataFrame, options: SelectionWidget
72
87
  const gridHost = ui.box(grid.root);
73
88
  gridHost.style.marginLeft = '0px';
74
89
  setTimeout(() => {
90
+ if (gridSortOrder !== null)
91
+ grid.sort(gridSortOrder.cols, gridSortOrder.types);
75
92
  for (let gridColIdx = 1; gridColIdx < options.gridColumns.length; gridColIdx++) {
76
93
  const originalGridCol = options.gridColumns.byIndex(gridColIdx)!;
77
94
  if (!originalGridCol.visible)