@datagrok/curves 1.10.11 → 1.10.13

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/package-test.js +470 -4268
  3. package/dist/package-test.js.map +1 -1
  4. package/dist/package.js +254 -3893
  5. package/dist/package.js.map +1 -1
  6. package/package.json +4 -4
  7. package/scripts/calculateMSR.py +65 -65
  8. package/src/fit/fit-demo.ts +1 -1
  9. package/src/fit/fit-grid-cell-handler.ts +385 -385
  10. package/src/fit/fit-inspection.ts +39 -0
  11. package/src/fit/fit-renderer.ts +1 -8
  12. package/src/fit/multi-curve-viewer.ts +1 -3
  13. package/src/fit/render-utils.ts +4 -2
  14. package/src/package-api.ts +3 -126
  15. package/src/package-test.ts +2 -3
  16. package/src/package.g.ts +0 -82
  17. package/src/package.ts +21 -128
  18. package/src/tests/curves-cell-renderer-tests.ts +15 -15
  19. package/src/tests/detector-tests.ts +1 -1
  20. package/src/tests/transform-tests.ts +1 -1
  21. package/test-console-output-1.log +21 -241
  22. package/test-record-1.mp4 +0 -0
  23. package/databases/plates/0000_init.sql +0 -167
  24. package/queries/plates-crud.sql +0 -148
  25. package/src/fit/const.ts +0 -73
  26. package/src/plate/excel-plates.ts +0 -112
  27. package/src/plate/plate-cell-renderer.ts +0 -48
  28. package/src/plate/plate-drc-analysis.ts +0 -262
  29. package/src/plate/plate-reader.ts +0 -28
  30. package/src/plate/plate-well-validators.ts +0 -41
  31. package/src/plate/plate-widget.ts +0 -242
  32. package/src/plate/plate.ts +0 -557
  33. package/src/plate/plates-folder-preview.ts +0 -63
  34. package/src/plate/readers/bmg-pherastar-96.ts +0 -42
  35. package/src/plate/readers/delfia-envision-96-max-rlu.ts +0 -16
  36. package/src/plate/readers/delfia-envision-by-row.ts +0 -18
  37. package/src/plate/readers/spectramax.ts +0 -42
  38. package/src/plate/utils.ts +0 -141
  39. package/src/plates/numeric_matcher.ts +0 -191
  40. package/src/plates/objects/plate-template-handler.ts +0 -48
  41. package/src/plates/plates-app.ts +0 -64
  42. package/src/plates/plates-crud.ts +0 -502
  43. package/src/plates/plates-demo.ts +0 -107
  44. package/src/plates/plates.sql +0 -169
  45. package/src/plates/views/plates-create-view.ts +0 -123
  46. package/src/plates/views/plates-schema-view.ts +0 -58
  47. package/src/plates/views/plates-search-view.ts +0 -137
  48. package/src/plates/views/plates-templates-view.ts +0 -37
  49. package/src/tests/plate-tests.ts +0 -153
@@ -0,0 +1,39 @@
1
+ /* eslint-disable max-len */
2
+ import * as DG from 'datagrok-api/dg';
3
+ import {FitSeries, FitFunctionType} from '@datagrok-libraries/statistics/src/fit/new-fit-API';
4
+ import {inspectCurve} from './fit-renderer';
5
+ import * as grok from 'datagrok-api/grok';
6
+
7
+ export function randomizeTableId() {
8
+ return `${Math.random()}-${Math.random()}-${Math.random()}-${Math.random()}-${Math.random()}-${Math.random()}-${Math.random()}-${Math.random()}`;
9
+ }
10
+
11
+ export function inspectSeriesByName(records: Record<string, FitSeries>, seriesName: string, fitFunctionName: FitFunctionType): void {
12
+ if (!seriesName || !fitFunctionName)
13
+ return;
14
+ inspectSeries(records[seriesName], fitFunctionName);
15
+ }
16
+
17
+ export function inspectSeries(series: FitSeries, fitFunctionName: FitFunctionType) {
18
+ const seriesName = series?.name ?? 'Series';
19
+ if (!series || !fitFunctionName)
20
+ return;
21
+ const curveCol = DG.Column.string('Curve', 1);
22
+ curveCol.set(0, JSON.stringify({
23
+ chartOptions: {
24
+ logX: true,
25
+ title: seriesName,
26
+ },
27
+ series: [{...series, fit: undefined, fitFunction: fitFunctionName, clickToToggle: true, droplines: ['IC50'], name: seriesName}],
28
+ }), false);
29
+ const df = DG.DataFrame.fromColumns([curveCol]);
30
+ df.name = seriesName;
31
+ df.id = randomizeTableId();
32
+ curveCol.semType = 'fit';
33
+ curveCol.tags[DG.Tags.CellRenderer] = 'fit';
34
+ const grid = DG.Viewer.grid(df);
35
+ const gridCell = grid.cell('Curve', 0);
36
+ grok.shell.windows.showContextPanel = true;
37
+ grok.shell.o = gridCell;
38
+ inspectCurve(gridCell, {width: 480, height: 370}, true);
39
+ }
@@ -21,7 +21,7 @@ import {
21
21
  } from '@datagrok-libraries/statistics/src/fit/fit-data';
22
22
 
23
23
  import {convertXMLToIFitChartData} from './fit-parser';
24
- import {FitConstants} from './const';
24
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
25
25
  import {
26
26
  renderAxesLabels,
27
27
  renderConfidenceIntervals, renderConnectDots,
@@ -34,13 +34,6 @@ import {calculateSeriesStats, getChartDataAggrStats} from './fit-grid-cell-handl
34
34
  import {Fit, FitFunction, FitFunctionTypes, fitSeriesProperties} from '@datagrok-libraries/statistics/src/fit/new-fit-API';
35
35
 
36
36
 
37
- export interface FitCellOutlierToggleArgs {
38
- gridCell: DG.GridCell;
39
- series: IFitSeries;
40
- seriesIdx: number;
41
- pointIdx: number;
42
- }
43
-
44
37
  function clamp(value: number, min: number, max: number): number {
45
38
  return Math.min(Math.max(value, min), max);
46
39
  }
@@ -6,11 +6,9 @@ import * as grok from 'datagrok-api/grok';
6
6
  import {mergeChartOptions, mergeSeries} from './fit-renderer';
7
7
  import {getOrCreateParsedChartData, mergeProperties} from './fit-renderer';
8
8
  import {FitChartData, fitChartDataProperties, IFitChartData, IFitChartOptions} from '@datagrok-libraries/statistics/src/fit/fit-curve';
9
-
10
9
  import {debounce} from 'rxjs/operators';
11
10
  import {interval, merge} from 'rxjs';
12
- import {FitConstants} from './const';
13
-
11
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
14
12
 
15
13
  const ERROR_CLASS = 'd4-viewer-error';
16
14
 
@@ -12,7 +12,7 @@ import {
12
12
  LogOptions
13
13
  } from '@datagrok-libraries/statistics/src/fit/fit-data';
14
14
  import {Viewport} from '@datagrok-libraries/utils/src/transform';
15
- import {FitConstants} from './const';
15
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
16
16
  import {BoxPlotStatistics, calculateBoxPlotStatistics} from '@datagrok-libraries/statistics/src/box-plot-statistics';
17
17
  import {StringUtils} from '@datagrok-libraries/utils/src/string-utils';
18
18
  import {FitFunction} from '@datagrok-libraries/statistics/src/fit/new-fit-API';
@@ -479,7 +479,9 @@ function renderLegendSeries(g: CanvasRenderingContext2D, series: IFitSeries, ren
479
479
  dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN - FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN +
480
480
  (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT * (columnIdx + 1) : 0) +
481
481
  FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend);
482
- const marker = series.markerType ? series.markerType as DG.MARKER_TYPE : DG.MARKER_TYPE.CIRCLE;
482
+ let pointsMarkerValue = series.points && series.points.length > 0 ? series.points[0].marker : null;
483
+ pointsMarkerValue = series.points && series.points.every((p) => p.marker === pointsMarkerValue && p.marker != null) ? pointsMarkerValue : null;
484
+ const marker = pointsMarkerValue != null ? pointsMarkerValue as DG.MARKER_TYPE : series.markerType ? series.markerType as DG.MARKER_TYPE : DG.MARKER_TYPE.CIRCLE;
483
485
  DG.Paint.marker(g, marker, dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN -
484
486
  FitConstants.LEGEND_RECORD_LINE_PX_WIDTH / 2, dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN -
485
487
  FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN + (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT *
@@ -9,90 +9,14 @@ import * as DG from 'datagrok-api/dg';
9
9
 
10
10
  export namespace scripts {
11
11
  /**
12
- Calculates Minimum Significant Ratio (MSR) for compounds based on IC50 values, run dates, assay names, and target entities.
12
+ Calculates Minimum Significant Ratio (MSR) for compounds based on IC50 values, run dates, assay names, and target entities.
13
13
  */
14
14
  export async function calculateMSR(table: DG.DataFrame , ic50Column: DG.Column , compoundIdColumn: DG.Column , runDateColumn: DG.Column , assayNameColumn: DG.Column , targetEntityColumn: DG.Column ): Promise<DG.DataFrame> {
15
15
  return await grok.functions.call('Curves:CalculateMSR', { table, ic50Column, compoundIdColumn, runDateColumn, assayNameColumn, targetEntityColumn });
16
16
  }
17
17
  }
18
18
 
19
- export namespace queries {
20
- export async function getPlates(): Promise<DG.DataFrame> {
21
- return await grok.data.query('Curves:GetPlates', {});
22
- }
23
-
24
- /**
25
- Get all well level properties (either used in a well or specified in a template)
26
- */
27
- export async function getWellLevelProperties(): Promise<DG.DataFrame> {
28
- return await grok.data.query('Curves:GetWellLevelProperties', {});
29
- }
30
-
31
- /**
32
- Get all plate level properties (either used in a plate or specified in a template)
33
- */
34
- export async function getPlateLevelProperties(): Promise<DG.DataFrame> {
35
- return await grok.data.query('Curves:GetPlateLevelProperties', {});
36
- }
37
-
38
- export async function getPropertyNames(): Promise<DG.DataFrame> {
39
- return await grok.data.query('Curves:GetPropertyNames', {});
40
- }
41
-
42
- export async function getPlateTypes(): Promise<DG.DataFrame> {
43
- return await grok.data.query('Curves:GetPlateTypes', {});
44
- }
45
-
46
- export async function getPlateTemplates(): Promise<DG.DataFrame> {
47
- return await grok.data.query('Curves:GetPlateTemplates', {});
48
- }
49
-
50
- export async function getWellRoles(): Promise<DG.DataFrame> {
51
- return await grok.data.query('Curves:GetWellRoles', {});
52
- }
53
-
54
- export async function getWellValuesByBarcode(barcode: string ): Promise<DG.DataFrame> {
55
- return await grok.data.query('Curves:GetWellValuesByBarcode', { barcode });
56
- }
57
-
58
- export async function getWellValuesById(id: number ): Promise<DG.DataFrame> {
59
- return await grok.data.query('Curves:GetWellValuesById', { id });
60
- }
61
-
62
- export async function getAllowedValues(propertyName: string ): Promise<DG.DataFrame> {
63
- return await grok.data.query('Curves:GetAllowedValues', { propertyName });
64
- }
65
-
66
- export async function getUniquePlatePropertyValues(): Promise<DG.DataFrame> {
67
- return await grok.data.query('Curves:GetUniquePlatePropertyValues', {});
68
- }
69
-
70
- export async function getUniqueWellPropertyValues(): Promise<DG.DataFrame> {
71
- return await grok.data.query('Curves:GetUniqueWellPropertyValues', {});
72
- }
73
-
74
- export async function createProperty(propertyName: string , valueType: string ): Promise<number> {
75
- return await grok.data.query('Curves:CreateProperty', { propertyName, valueType });
76
- }
77
-
78
- export async function createTemplate(name: string , description: string ): Promise<number> {
79
- return await grok.data.query('Curves:CreateTemplate', { name, description });
80
- }
81
-
82
- export async function getTemplateWellProperties(): Promise<DG.DataFrame> {
83
- return await grok.data.query('Curves:GetTemplateWellProperties', {});
84
- }
85
-
86
- export async function getTemplatePlateProperties(): Promise<DG.DataFrame> {
87
- return await grok.data.query('Curves:GetTemplatePlateProperties', {});
88
- }
89
- }
90
-
91
19
  export namespace funcs {
92
- export async function platesAppTreeBrowserTempDisabled(treeNode: any ): Promise<void> {
93
- return await grok.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode });
94
- }
95
-
96
20
  export async function fitChartCellRenderer(): Promise<any> {
97
21
  return await grok.functions.call('Curves:FitChartCellRenderer', {});
98
22
  }
@@ -111,19 +35,12 @@ export namespace funcs {
111
35
  return await grok.functions.call('Curves:CurveFitDemo', {});
112
36
  }
113
37
 
114
- /**
115
- Assasy plates with concentration, layout and readout data
116
- */
117
- export async function assayPlatesDemo(): Promise<void> {
118
- return await grok.functions.call('Curves:AssayPlatesDemo', {});
119
- }
120
-
121
38
  export async function initCurves(): Promise<void> {
122
39
  return await grok.functions.call('Curves:InitCurves', {});
123
40
  }
124
41
 
125
- export async function dataToCurves(df: DG.DataFrame , concentrationCol: DG.Column , readoutCol: DG.Column , batchIDCol: DG.Column , assayCol: DG.Column , runIDCol: DG.Column , compoundIDCol: DG.Column , targetEntityCol: DG.Column , excludeOutliersCol: DG.Column | null, parentTable: DG.DataFrame | null, fitParamColumns: any | null, reportedIC50Column: string | null, reportedQualifiedIC50Column: string | null, experimentIDColumn: string | null, qualifierColumn: string | null, additionalColumns: any | null, wellLevelJoinCol: string | null, parentLevelJoinCol: string | null): Promise<DG.DataFrame> {
126
- return await grok.functions.call('Curves:DataToCurves', { df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol });
42
+ export async function dataToCurves(df: DG.DataFrame , concentrationCol: DG.Column , readoutCol: DG.Column , batchIDCol: DG.Column , assayCol: DG.Column , runIDCol: DG.Column , compoundIDCol: DG.Column , targetEntityCol: DG.Column , excludeOutliersCol: DG.Column | null, parentTable: DG.DataFrame | null, fitParamColumns: any | null, reportedIC50Column: string | null, reportedQualifiedIC50Column: string | null, experimentIDColumn: string | null, qualifierColumn: string | null, additionalColumns: any | null, wellLevelJoinCol: string | null, parentLevelJoinCol: string | null, wellLevelAdditionalColumns?: any | null): Promise<DG.DataFrame> {
43
+ return await grok.functions.call('Curves:DataToCurves', { df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol, wellLevelAdditionalColumns });
127
44
  }
128
45
 
129
46
  export async function dataToCurvesTopMenu(): Promise<any> {
@@ -138,46 +55,6 @@ export namespace funcs {
138
55
  return await grok.functions.call('Curves:AddAggrStatisticsColumn', { table, colName, propName, aggrType });
139
56
  }
140
57
 
141
- export async function platesFolderPreview(folder: DG.FileInfo , files: any ): Promise<any> {
142
- return await grok.functions.call('Curves:PlatesFolderPreview', { folder, files });
143
- }
144
-
145
- export async function previewPlate(file: DG.FileInfo ): Promise<DG.View> {
146
- return await grok.functions.call('Curves:PreviewPlate', { file });
147
- }
148
-
149
- export async function importPlate(fileContent: string ): Promise<any> {
150
- return await grok.functions.call('Curves:ImportPlate', { fileContent });
151
- }
152
-
153
- export async function importPlateXlsx(fileContent: any ): Promise<void> {
154
- return await grok.functions.call('Curves:ImportPlateXlsx', { fileContent });
155
- }
156
-
157
- export async function previewPlateXlsx(file: DG.FileInfo ): Promise<DG.View> {
158
- return await grok.functions.call('Curves:PreviewPlateXlsx', { file });
159
- }
160
-
161
- export async function checkExcelIsPlate(content: any ): Promise<boolean> {
162
- return await grok.functions.call('Curves:CheckExcelIsPlate', { content });
163
- }
164
-
165
- export async function checkFileIsPlate(content: string ): Promise<boolean> {
166
- return await grok.functions.call('Curves:CheckFileIsPlate', { content });
167
- }
168
-
169
- export async function getPlateByBarcode(barcode: string ): Promise<any> {
170
- return await grok.functions.call('Curves:GetPlateByBarcode', { barcode });
171
- }
172
-
173
- export async function createDummyPlateData(): Promise<void> {
174
- return await grok.functions.call('Curves:CreateDummyPlateData', {});
175
- }
176
-
177
- export async function plateGridCellRenderer(): Promise<any> {
178
- return await grok.functions.call('Curves:PlateGridCellRenderer', {});
179
- }
180
-
181
58
  export async function rawPNGRenderer(): Promise<any> {
182
59
  return await grok.functions.call('Curves:RawPNGRenderer', {});
183
60
  }
@@ -1,12 +1,11 @@
1
- import * as DG from "datagrok-api/dg";
1
+ import * as DG from 'datagrok-api/dg';
2
2
 
3
- import {runTests, tests, TestContext, initAutoTests as initTests } from '@datagrok-libraries/utils/src/test';
3
+ import {runTests, tests, TestContext, initAutoTests as initTests} from '@datagrok-libraries/utils/src/test';
4
4
 
5
5
  import './tests/detector-tests';
6
6
  import './tests/curves-cell-renderer-tests';
7
7
  import './tests/transform-tests';
8
8
  import './tests/fit-tests';
9
- import './tests/plate-tests';
10
9
 
11
10
  export const _package = new DG.Package();
12
11
  export {tests};
package/src/package.g.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import {RawPNGRenderer} from './pngRenderer';
2
- import {PlateGridCellRenderer} from './plate/plate-cell-renderer';
3
2
  import {PackageFunctions} from './package';
4
3
  import {MultiCurveViewer} from './fit/multi-curve-viewer';
5
4
  import {FitChartCellRenderer} from './fit/fit-renderer';
@@ -32,13 +31,6 @@ export async function curveFitDemo() : Promise<void> {
32
31
  await PackageFunctions.curveFitDemo();
33
32
  }
34
33
 
35
- //name: Assay Plates
36
- //description: Assasy plates with concentration, layout and readout data
37
- //meta.demoPath: Curves | Assay Plates
38
- export async function assayPlatesDemo() : Promise<void> {
39
- await PackageFunctions.assayPlatesDemo();
40
- }
41
-
42
34
  //tags: init
43
35
  export function _initCurves() : void {
44
36
  PackageFunctions._initCurves();
@@ -95,80 +87,6 @@ export function addStatisticsColumn(table: DG.DataFrame, colName: string, propNa
95
87
  export function addAggrStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, aggrType: string) : any {
96
88
  return PackageFunctions.addAggrStatisticsColumn(table, colName, propName, aggrType);
97
89
  }
98
-
99
- //tags: folderViewer
100
- //input: file folder
101
- //input: list<file> files
102
- //output: dynamic result
103
- export async function platesFolderPreview(folder: DG.FileInfo, files: DG.FileInfo[]) {
104
- return await PackageFunctions.platesFolderPreview(folder, files);
105
- }
106
-
107
- //tags: fileViewer
108
- //input: file file
109
- //output: view result
110
- //meta.fileViewer: txt
111
- //meta.fileViewerCheck: Curves:checkFileIsPlate
112
- export function previewPlate(file: DG.FileInfo) : any {
113
- return PackageFunctions.previewPlate(file);
114
- }
115
-
116
- //tags: file-handler
117
- //input: string fileContent
118
- //output: list<dataframe> result
119
- //meta.ext: txt
120
- //meta.fileViewerCheck: Curves:checkFileIsPlate
121
- export async function importPlate(fileContent: string) : Promise<any> {
122
- return await PackageFunctions.importPlate(fileContent);
123
- }
124
-
125
- //tags: file-handler
126
- //input: blob fileContent
127
- //meta.ext: xlsx
128
- //meta.fileViewerCheck: Curves:checkExcelIsPlate
129
- export async function importPlateXlsx(fileContent: Uint8Array) : Promise<any> {
130
- return await PackageFunctions.importPlateXlsx(fileContent);
131
- }
132
-
133
- //name: viewPlateXlsx
134
- //tags: fileViewer
135
- //input: file file
136
- //output: view result
137
- //meta.fileViewer: xlsx
138
- //meta.fileViewerCheck: Curves:checkExcelIsPlate
139
- export async function previewPlateXlsx(file: DG.FileInfo) : Promise<any> {
140
- return await PackageFunctions.previewPlateXlsx(file);
141
- }
142
-
143
- //input: blob content
144
- //output: bool result
145
- export async function checkExcelIsPlate(content: Uint8Array) : Promise<boolean> {
146
- return await PackageFunctions.checkExcelIsPlate(content);
147
- }
148
-
149
- //input: string content
150
- //output: bool result
151
- export function checkFileIsPlate(content: string) : boolean {
152
- return PackageFunctions.checkFileIsPlate(content);
153
- }
154
-
155
- //input: string barcode
156
- //output: dynamic result
157
- export async function getPlateByBarcode(barcode: string) : Promise<any> {
158
- return await PackageFunctions.getPlateByBarcode(barcode);
159
- }
160
-
161
- export async function createDummyPlateData() : Promise<void> {
162
- await PackageFunctions.createDummyPlateData();
163
- }
164
- //name: PlateGridCellRenderer
165
- //tags: cellRenderer
166
- //output: grid_cell_renderer renderer
167
- //meta.cellType: Plate
168
- export function _PlateGridCellRenderer() {
169
- return new PlateGridCellRenderer();
170
- }
171
-
172
90
  //name: rawPng
173
91
  //tags: cellRenderer
174
92
  //output: grid_cell_renderer renderer
package/src/package.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  //@ts-ignore
3
3
  export * from './package.g';
4
4
 
5
-
6
5
  /* Do not change these import lines to match external modules in webpack configuration */
7
6
  import * as DG from 'datagrok-api/dg';
8
7
  import * as grok from 'datagrok-api/grok';
@@ -14,21 +13,21 @@ import {curveDemo} from './fit/fit-demo';
14
13
  import {convertXMLToIFitChartData} from './fit/fit-parser';
15
14
  import {LogOptions} from '@datagrok-libraries/statistics/src/fit/fit-data';
16
15
  import {FitStatistics} from '@datagrok-libraries/statistics/src/fit/fit-curve';
17
- import {FitConstants} from './fit/const';
18
- import {PlateCellHandler} from './plate/plate-cell-renderer';
19
- import {Plate} from './plate/plate';
20
- import {PlateWidget} from './plate/plate-widget';
21
- import {PlateReader} from './plate/plate-reader';
22
- import {initPlatesAppTree, platesAppView} from './plates/plates-app';
23
- import {initPlates} from './plates/plates-crud';
24
- import {__createDummyPlateData} from './plates/plates-demo';
25
- import {getPlatesFolderPreview} from './plate/plates-folder-preview';
26
- import {PlateDrcAnalysis} from './plate/plate-drc-analysis';
27
- import {PlateTemplateHandler} from './plates/objects/plate-template-handler';
16
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
17
+
18
+ // import {PlateWidget} from './plate/plate-widget';
19
+
28
20
  import * as api from './package-api';
29
- import {convertDataToCurves, dataToCurvesUI, WellTableParentData} from './fit/data-to-curves';
21
+ import {convertDataToCurves, dataToCurvesUI} from './fit/data-to-curves';
30
22
 
31
23
  export const _package = new DG.Package();
24
+
25
+
26
+ // //tags: autostart
27
+ // export async function autostart(): Promise<void> {
28
+ // }
29
+
30
+
32
31
  const SOURCE_COLUMN_TAG = '.sourceColumn';
33
32
  const SERIES_NUMBER_TAG = '.seriesNumber';
34
33
  const SERIES_AGGREGATION_TAG = '.seriesAggregation';
@@ -55,21 +54,19 @@ export class PackageFunctions {
55
54
  await curveDemo();
56
55
  }
57
56
 
58
- @grok.decorators.func({
59
- name: 'Assay Plates',
60
- description: 'Assasy plates with concentration, layout and readout data',
61
- meta: {demoPath: 'Curves | Assay Plates'},
62
- })
63
- static async assayPlatesDemo(): Promise<void> {
64
- const plateFile = (await grok.dapi.files.list('System:DemoFiles/hts/xlsx_plates'))[0];
65
- grok.shell.addView(await PackageFunctions.previewPlateXlsx(plateFile) as DG.ViewBase);
66
- }
57
+ // @grok.decorators.func({
58
+ // name: 'Assay Plates',
59
+ // description: 'Assasy plates with concentration, layout and readout data',
60
+ // meta: {demoPath: 'Curves | Assay Plates'},
61
+ // })
62
+ // static async assayPlatesDemo(): Promise<void> {
63
+ // const plateFile = (await grok.dapi.files.list('System:DemoFiles/hts/xlsx_plates'))[0];
64
+ // grok.shell.addView(await PackageFunctions.previewPlateXlsx(plateFile) as DG.ViewBase);
65
+ // }
67
66
 
68
67
  @grok.decorators.init()
69
68
  static _initCurves(): void {
70
69
  DG.ObjectHandler.register(new FitGridCellHandler());
71
- DG.ObjectHandler.register(new PlateCellHandler());
72
- DG.ObjectHandler.register(new PlateTemplateHandler());
73
70
  }
74
71
 
75
72
  @grok.decorators.func()
@@ -176,108 +173,4 @@ export class PackageFunctions {
176
173
  df.columns.insert(column, df.columns.names().indexOf(colName) + 1);
177
174
  return column;
178
175
  }
179
-
180
- @grok.decorators.folderViewer({outputs: [{'name': 'result', 'type': 'dynamic'}]})
181
- static async platesFolderPreview(folder: DG.FileInfo, files: DG.FileInfo[]): Promise<DG.Widget | DG.ViewBase | undefined> {
182
- const nameLowerCase = folder.name?.toLowerCase();
183
- if (!nameLowerCase?.includes('plate'))
184
- return undefined;
185
- return getPlatesFolderPreview(files);
186
- }
187
-
188
- @grok.decorators.fileViewer({fileViewer: 'txt', fileViewerCheck: 'Curves:checkFileIsPlate'})
189
- static previewPlate(file: DG.FileInfo): DG.View {
190
- const view = DG.View.create();
191
- view.name = file.name;
192
- file.readAsString().then((content) => {
193
- const plate = PlateReader.read(content);
194
- if (plate !== null)
195
- view.root.appendChild(PlateWidget.fromPlate(plate).root);
196
- });
197
- return view;
198
- }
199
-
200
- @grok.decorators.fileHandler({ext: 'txt', fileViewerCheck: 'Curves:checkFileIsPlate'})
201
- static async importPlate(fileContent: string): Promise<DG.DataFrame[]> {
202
- const plate = PlateReader.read(fileContent);
203
- const view = DG.View.create();
204
- if (plate !== null)
205
- view.root.appendChild(PlateWidget.fromPlate(plate).root);
206
-
207
- view.name = 'Plate';
208
- grok.shell.addView(view);
209
- return [];
210
- }
211
-
212
- @grok.decorators.fileHandler({outputs: [], ext: 'xlsx', fileViewerCheck: 'Curves:checkExcelIsPlate'})
213
- static async importPlateXlsx(fileContent: Uint8Array): Promise<any[]> {
214
- const view = DG.View.create();
215
- const plate = await PackageFunctions.parseExcelPlate(fileContent);
216
- view.root.appendChild(PlateDrcAnalysis.analysisView(plate).root);
217
- view.name = 'Plate';
218
- grok.shell.addView(view);
219
- return [];
220
- }
221
-
222
- @grok.decorators.fileViewer({name: 'viewPlateXlsx', fileViewer: 'xlsx', fileViewerCheck: 'Curves:checkExcelIsPlate'})
223
- static async previewPlateXlsx(file: DG.FileInfo): Promise<DG.View> {
224
- const view = DG.View.create();
225
- view.name = file.friendlyName;
226
- const plate = await PackageFunctions.parseExcelPlate(await file.readAsBytes());
227
- view.root.appendChild(PlateDrcAnalysis.analysisView(plate).root);
228
- return view;
229
- }
230
-
231
- @grok.decorators.func()
232
- static async checkExcelIsPlate(content: Uint8Array): Promise<boolean> {
233
- try {
234
- if (content.length > 1_000_000) // haven't really seen a plate file larger than 1MB
235
- return false;
236
- const plate = await PackageFunctions.parseExcelPlate(content);
237
- return plate !== null;
238
- } catch (e) {
239
- return false;
240
- }
241
- }
242
-
243
- static async parseExcelPlate(content: string | Uint8Array, name?: string) {
244
- if (typeof content === 'string') {
245
- const blob = new Blob([content], {type: 'application/octet-binary'});
246
- const buf = await blob.arrayBuffer();
247
- const plate = await Plate.fromExcel(new Uint8Array(buf), name);
248
- return plate;
249
- } else {
250
- return await Plate.fromExcel(content, name);
251
- }
252
- }
253
-
254
- @grok.decorators.func()
255
- static checkFileIsPlate(content: string): boolean {
256
- if (content.length > 1_000_000)
257
- return false;
258
- return PlateReader.getReader(content) != null;
259
- }
260
-
261
- // @grok.decorators.app({name: 'Browse', browsePath: 'Plates'})
262
- static platesApp(): DG.View {
263
- return platesAppView();
264
- }
265
-
266
- @grok.decorators.func()
267
- static async getPlateByBarcode(barcode: string): Promise<Plate> {
268
- await initPlates();
269
- const df: DG.DataFrame = await api.queries.getWellValuesByBarcode(barcode);
270
- return Plate.fromDbDataFrame(df);
271
- }
272
-
273
- @grok.decorators.func()
274
- static async createDummyPlateData(): Promise<void> {
275
- await __createDummyPlateData();
276
- }
277
- }
278
-
279
- //name: platesAppTreeBrowserTempDisabled
280
- //input: dynamic treeNode
281
- export async function platesAppTreeBrowserTempDisabled(treeNode: DG.TreeViewGroup) {
282
- await initPlatesAppTree(treeNode);
283
176
  }
@@ -8,7 +8,7 @@ import {createSigmoidPoints, createDemoDataFrame} from '../fit/fit-demo';
8
8
  import {category, test, delay} from '@datagrok-libraries/utils/src/test';
9
9
  import {FitChartCellRenderer} from '../fit/fit-renderer';
10
10
  import {IFitChartData} from '@datagrok-libraries/statistics/src/fit/fit-curve';
11
- import {FitConstants} from '../fit/const';
11
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
12
12
 
13
13
 
14
14
  export function createIFitChartData(seriesLength: number): IFitChartData {
@@ -20,20 +20,20 @@ export function createIFitChartData(seriesLength: number): IFitChartData {
20
20
 
21
21
  const points = createSigmoidPoints(seriesLength, step);
22
22
  const color = DG.Color.toHtml(DG.Color.scatterPlotMarker);
23
- chartData.series![0] = {
24
- fitLineColor: color,
25
- pointColor: color,
26
- markerType: DG.MARKER_TYPE.CIRCLE,
27
- showFitLine: true,
28
- showPoints: 'points',
29
- showCurveConfidenceInterval: true,
30
- fitFunction: 'sigmoid',
31
- points: wu.count().take(seriesLength)
32
- .map(function(i) { return {x: points.x[i], y: points.y[i]}; })
33
- .toArray()
34
- };
35
-
36
- return chartData;
23
+ chartData.series![0] = {
24
+ fitLineColor: color,
25
+ pointColor: color,
26
+ markerType: DG.MARKER_TYPE.CIRCLE,
27
+ showFitLine: true,
28
+ showPoints: 'points',
29
+ showCurveConfidenceInterval: true,
30
+ fitFunction: 'sigmoid',
31
+ points: wu.count().take(seriesLength)
32
+ .map(function(i) { return {x: points.x[i], y: points.y[i]}; })
33
+ .toArray()
34
+ };
35
+
36
+ return chartData;
37
37
  }
38
38
 
39
39
  export async function scrollTable(el: HTMLElement, delta: number, cycles: number, secDelay: number) {
@@ -3,7 +3,7 @@ import * as DG from 'datagrok-api/dg';
3
3
  import * as grok from 'datagrok-api/grok';
4
4
 
5
5
  import {category, expect, test} from '@datagrok-libraries/utils/src/test';
6
- import {FitConstants} from '../fit/const';
6
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
7
7
 
8
8
 
9
9
  category('detectors', () => {
@@ -4,7 +4,7 @@ import {Viewport} from '@datagrok-libraries/utils/src/transform';
4
4
  import {FitChartCellRenderer, layoutChart} from '../fit/fit-renderer';
5
5
 
6
6
  import {category, expect, test} from '@datagrok-libraries/utils/src/test';
7
- import {FitConstants} from '../fit/const';
7
+ import {FitConstants} from '@datagrok-libraries/statistics/src/fit/const';
8
8
 
9
9
 
10
10
  category('viewport', () => {