@datagrok/curves 1.8.0 → 1.10.0
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/.eslintrc.json +39 -0
- package/.vscode/launch.json +10 -9
- package/.vscode/tasks.json +14 -0
- package/CHANGELOG.md +39 -0
- package/databases/plates/0000_init.sql +167 -0
- package/detectors.js +18 -2
- package/dist/package-test.js +16647 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +14467 -1
- package/dist/package.js.map +1 -1
- package/package.json +13 -9
- package/queries/plates-crud.sql +148 -0
- package/src/fit/const.ts +60 -60
- package/src/fit/data-to-curves.ts +592 -0
- package/src/fit/fit-demo.ts +6 -6
- package/src/fit/fit-grid-cell-handler.ts +49 -45
- package/src/fit/fit-renderer.ts +58 -57
- package/src/fit/multi-curve-viewer.ts +43 -21
- package/src/fit/render-utils.ts +315 -315
- package/src/package-api.ts +179 -0
- package/src/package-test.ts +1 -1
- package/src/package.g.ts +171 -3
- package/src/package.ts +227 -298
- package/src/plate/excel-plates.ts +1 -1
- package/src/plate/plate-cell-renderer.ts +20 -12
- package/src/plate/plate-drc-analysis.ts +262 -0
- package/src/plate/plate-reader.ts +5 -5
- package/src/plate/plate-well-validators.ts +41 -0
- package/src/plate/plate-widget.ts +132 -368
- package/src/plate/plate.ts +168 -57
- package/src/plate/plates-folder-preview.ts +63 -0
- package/src/plate/readers/bmg-pherastar-96.ts +7 -7
- package/src/plate/readers/delfia-envision-96-max-rlu.ts +4 -3
- package/src/plate/readers/delfia-envision-by-row.ts +3 -3
- package/src/plate/readers/spectramax.ts +7 -8
- package/src/plate/utils.ts +22 -10
- package/src/plates/numeric_matcher.ts +191 -0
- package/src/plates/objects/plate-template-handler.ts +48 -0
- package/src/plates/plates-app.ts +64 -0
- package/src/plates/plates-crud.ts +502 -0
- package/src/plates/plates-demo.ts +107 -0
- package/src/plates/plates.sql +169 -0
- package/src/plates/views/plates-create-view.ts +123 -0
- package/src/plates/views/plates-schema-view.ts +58 -0
- package/src/plates/views/plates-search-view.ts +137 -0
- package/src/plates/views/plates-templates-view.ts +37 -0
- package/src/pngRenderer.ts +98 -0
- package/src/tests/curves-cell-renderer-tests.ts +93 -92
- package/src/tests/detector-tests.ts +3 -2
- package/src/tests/fit-tests.ts +199 -198
- package/src/tests/plate-tests.ts +6 -7
- package/src/tests/transform-tests.ts +4 -4
- package/test-console-output-1.log +436 -0
- package/test-record-1.mp4 +0 -0
- package/tsconfig.json +1 -1
package/src/package.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
//@ts-ignore
|
|
3
|
+
export * from './package.g';
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
/* Do not change these import lines to match external modules in webpack configuration */
|
|
5
7
|
import * as DG from 'datagrok-api/dg';
|
|
6
8
|
import * as grok from 'datagrok-api/grok';
|
|
@@ -13,13 +15,18 @@ import {convertXMLToIFitChartData} from './fit/fit-parser';
|
|
|
13
15
|
import {LogOptions} from '@datagrok-libraries/statistics/src/fit/fit-data';
|
|
14
16
|
import {FitStatistics} from '@datagrok-libraries/statistics/src/fit/fit-curve';
|
|
15
17
|
import {FitConstants} from './fit/const';
|
|
16
|
-
import {PlateCellHandler} from
|
|
17
|
-
import {FitSeries} from '@datagrok-libraries/statistics/src/fit/new-fit-API';
|
|
18
|
+
import {PlateCellHandler} from './plate/plate-cell-renderer';
|
|
18
19
|
import {Plate} from './plate/plate';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
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';
|
|
28
|
+
import * as api from './package-api';
|
|
29
|
+
import {convertDataToCurves, dataToCurvesUI, WellTableParentData} from './fit/data-to-curves';
|
|
23
30
|
|
|
24
31
|
export const _package = new DG.Package();
|
|
25
32
|
const SOURCE_COLUMN_TAG = '.sourceColumn';
|
|
@@ -27,319 +34,241 @@ const SERIES_NUMBER_TAG = '.seriesNumber';
|
|
|
27
34
|
const SERIES_AGGREGATION_TAG = '.seriesAggregation';
|
|
28
35
|
const STATISTICS_TAG = '.statistics';
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
A,,,,,,,,,,,,,,,,,,,,,,,,
|
|
38
|
-
B,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
39
|
-
C,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
40
|
-
D,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
41
|
-
E,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
42
|
-
F,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
43
|
-
G,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
44
|
-
H,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
45
|
-
I,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
46
|
-
J,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
47
|
-
K,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
48
|
-
L,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
49
|
-
M,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
50
|
-
N,,0.00001,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,
|
|
51
|
-
O,,0.00000,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00001,0.00000403,0.00000163,0.000000656,0.000000265,0.000000107,0.0000000431,0.0000000174,0.00000000701,0.00000000183,0.00000,
|
|
52
|
-
P,,,,,,,,,,,,,,,,,,,,,,,,`;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const layoutCsv = `col 1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
|
|
56
|
-
A,,,,,,,,,,,,,,,,,,,,,,,,
|
|
57
|
-
B,,Low Control,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,High Control,
|
|
58
|
-
C,,High Control,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 1,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Compound 41,Low Control,
|
|
59
|
-
D,,Low Control,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,High Control,
|
|
60
|
-
E,,High Control,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 42,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Compound 43,Low Control,
|
|
61
|
-
F,,Low Control,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,High Control,
|
|
62
|
-
G,,High Control,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 44,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Compound 45,Low Control,
|
|
63
|
-
H,,Low Control,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,High Control,
|
|
64
|
-
I,,High Control,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 46,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Compound 47,Low Control,
|
|
65
|
-
J,,Low Control,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,High Control,
|
|
66
|
-
K,,High Control,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 48,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Compound 49,Low Control,
|
|
67
|
-
L,,Low Control,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,High Control,
|
|
68
|
-
M,,High Control,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 50,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Compound 51,Low Control,
|
|
69
|
-
N,,Low Control,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,High Control,
|
|
70
|
-
O,,High Control,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 52,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Compound 53,Low Control,
|
|
71
|
-
P,,,,,,,,,,,,,,,,,,,,,,,,`;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const readoutCsv = `col 1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
|
|
75
|
-
A,,,,,,,,,,,,,,,,,,,,,,,,
|
|
76
|
-
B,,0.07219099668,0.06947737465,0.07019976172,0.07263956168,0.07334269904,0.07654089128,0.07628940202,0.08834969214,0.13557287840,0.1486864679,0.1503697113,0.15200083420,0.15061775480,0.15309907440,0.15286653780,0.15379914010,0.15155727890,0.15232794460,0.15298766400,0.1538730651,0.1542393465,0.15071555580,
|
|
77
|
-
C,,0.14996855360,0.07212290660,0.06957076093,0.07069321642,0.07227733865,0.07664359412,0.07918610560,0.07808503586,0.12496495030,0.1378908893,0.1465698921,0.15578283900,0.15186884230,0.15151635070,0.15141401530,0.15052587190,0.15486747600,0.15294037650,0.15241116130,0.1546532344,0.1537365814,0.07231605295,
|
|
78
|
-
D,,0.07023863668,0.07030474895,0.07086594623,0.07378772619,0.07813099195,0.08443275691,0.10024937710,0.11821695280,0.14031173800,0.1505845411,0.1505987702,0.07099481653,0.07322787956,0.07588648236,0.08377558210,0.09888790085,0.11395358370,0.12947949180,0.14055841590,0.1493699333,0.1540055735,0.15226875140,
|
|
79
|
-
E,,0.14929130930,0.06932695867,0.07157716491,0.07214187679,0.07721194315,0.08504549754,0.10174360480,0.11748417490,0.13321393730,0.1456650512,0.1483001297,0.07167267085,0.07383087952,0.07670410142,0.08204578635,0.09386326869,0.11296832520,0.30900000000,0.13807843210,0.1487301787,0.1519785410,0.07219836243,
|
|
80
|
-
F,,0.07063914398,0.07039007372,0.07078597316,0.07132027961,0.07222210814,0.07442561862,0.08135627908,0.09196745273,0.11146019360,0.1364485205,0.1450632971,0.08126099235,0.09318398047,0.10961914380,0.12860206080,0.14110717340,0.14655533300,0.15212245890,0.15233422070,0.1521740437,0.1539843278,0.15514745160,
|
|
81
|
-
G,,0.15147635060,0.07238581078,0.06968522213,0.07128524617,0.07252406181,0.07567350355,0.07943235275,0.09117074615,0.10537654310,0.1344820888,0.1400224330,0.08242500433,0.09563371204,0.10936069820,0.12848949680,0.14108995770,0.14405660970,0.15031406210,0.15131600980,0.1522018720,0.1534152011,0.07219962790,
|
|
82
|
-
H,,0.07201551934,0.14139074650,0.10970399700,0.14927003800,0.15153471030,0.15239784500,0.15275285200,0.15300022370,0.15204696770,0.1499048651,0.1522479639,0.08013306126,0.08511773454,0.09873312909,0.11965236570,0.13423325770,0.14790643020,0.14787378410,0.15121033310,0.1516832849,0.1546688514,0.15391338010,
|
|
83
|
-
I,,0.15106747120,0.14298828240,0.14478508750,0.14400005770,0.12812788070,0.15020659840,0.15070640480,0.14981230230,0.15107167610,0.1525554191,0.1492535524,0.08018720930,0.08601155699,0.09880353225,0.11672648890,0.13325225690,0.14354164670,0.14463708830,0.15318329890,0.1521327032,0.1512182552,0.07244861048,
|
|
84
|
-
J,,0.07134151692,0.07106139536,0.07290563639,0.07320964199,0.07531163459,0.08077714646,0.08726929940,0.10068593880,0.11914215450,0.1418191958,0.1443463920,0.07247201272,0.06999750950,0.07076991276,0.07228675508,0.07237591892,0.07201251723,0.07741640477,0.08773368972,0.1219768071,0.1387552698,0.15192226570,
|
|
85
|
-
K,,0.15000436380,0.07156625599,0.07087075250,0.07123659002,0.07345421874,0.07832545577,0.08734304748,0.09985159477,0.11591447310,0.1397237122,0.1459823861,0.07214517236,0.07005683091,0.07016838344,0.07131776580,0.07200174821,0.07350492337,0.07785311421,0.08866229169,0.1234911377,0.1371697196,0.07064796366,
|
|
86
|
-
L,,0.07054096934,0.07004726921,0.07201825002,0.07179815990,0.07268889103,0.07379454514,0.07427085340,0.07982570255,0.08854676858,0.1198873673,0.1322562498,0.07034679393,0.07523627163,0.07582258339,0.08392782907,0.09669262374,0.11261560310,0.12874291890,0.14171585180,0.1491004443,0.1502214336,0.15198125010,
|
|
87
|
-
M,,0.15232172270,0.07166689716,0.07099964730,0.07172948942,0.07140356089,0.07359647053,0.07391627346,0.07872536050,0.08793247921,0.1177668597,0.1316288144,0.06733039177,0.07260462946,0.07516068933,0.08359475310,0.09611904399,0.11364151330,0.12772328380,0.14070692820,0.1486696188,0.1541842928,0.07174453270,
|
|
88
|
-
N,,0.07126884935,0.07332587669,0.07786873273,0.08482253378,0.10140499840,0.11854947500,0.13401382360,0.14613488070,0.15066237370,0.1545757395,0.1510962397,0.07286614211,0.07215169457,0.07227939024,0.07337505876,0.07530546981,0.08265249465,0.09167518260,0.11122719660,0.1391977320,0.1459690588,0.15291802550,
|
|
89
|
-
O,,0.15243482930,0.07280165939,0.07688708790,0.31500000000,0.09886803400,0.11454911710,0.12960429510,0.14047477320,0.14718270040,0.1509524590,0.1501338551,0.07212897291,0.07072700474,0.07059273173,0.07088234657,0.07421414395,0.08105493058,0.09094554089,0.10660934950,0.1358113503,0.1432621746,0.07009305748,
|
|
90
|
-
P,,,,,,,,,,,,,,,,,,,,,,,,`;
|
|
91
|
-
|
|
92
|
-
//@ts-ignore
|
|
93
|
-
window.readoutCsv = readoutCsv;
|
|
94
|
-
//@ts-ignore
|
|
95
|
-
window.concentrationCsv = concentrationCsv;
|
|
96
|
-
//@ts-ignore
|
|
97
|
-
window.layoutCsv = layoutCsv;
|
|
98
|
-
|
|
99
|
-
function getPlate(): Plate {
|
|
100
|
-
const concentration = Plate.fromCsvTable(concentrationCsv, 'concentration');
|
|
101
|
-
const layout = Plate.fromCsvTable(layoutCsv, 'role');
|
|
102
|
-
const readout = Plate.fromCsvTable(readoutCsv, 'readout');
|
|
103
|
-
|
|
104
|
-
return Plate.fromPlates([concentration, layout, readout]);
|
|
37
|
+
export class Sync {
|
|
38
|
+
private static _currentPromise: Promise<any> = Promise.resolve();
|
|
39
|
+
public static async runWhenDone<T>(func: () => Promise<T>): Promise<T> {
|
|
40
|
+
Sync._currentPromise = Sync._currentPromise.then(async () => { try { return await func(); } catch (e) { _package.logger.error(e); } });
|
|
41
|
+
return Sync._currentPromise;
|
|
42
|
+
}
|
|
43
|
+
// the number at the end is the column version
|
|
105
44
|
}
|
|
106
45
|
|
|
107
|
-
//@ts-ignore
|
|
108
|
-
window.getPlate = getPlate;
|
|
109
46
|
|
|
110
|
-
|
|
111
|
-
|
|
47
|
+
export class PackageFunctions {
|
|
48
|
+
@grok.decorators.demo({
|
|
49
|
+
name: 'Curve fitting',
|
|
50
|
+
description: 'Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points',
|
|
51
|
+
meta: {demoPath: 'Curves | Curve Fitting'},
|
|
52
|
+
test: {test: 'curveFitDemo()', wait: '2000'}
|
|
53
|
+
})
|
|
54
|
+
static async curveFitDemo(): Promise<void> {
|
|
55
|
+
await curveDemo();
|
|
56
|
+
}
|
|
112
57
|
|
|
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
|
+
}
|
|
113
67
|
|
|
114
|
-
}
|
|
68
|
+
@grok.decorators.init({})
|
|
69
|
+
static _initCurves(): void {
|
|
70
|
+
DG.ObjectHandler.register(new FitGridCellHandler());
|
|
71
|
+
DG.ObjectHandler.register(new PlateCellHandler());
|
|
72
|
+
DG.ObjectHandler.register(new PlateTemplateHandler());
|
|
73
|
+
}
|
|
115
74
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
75
|
+
@grok.decorators.func({})
|
|
76
|
+
static async dataToCurves(df: DG.DataFrame, concentrationCol: DG.Column, readoutCol: DG.Column, batchIDCol: DG.Column, assayCol: DG.Column,
|
|
77
|
+
runIDCol: DG.Column, compoundIDCol: DG.Column, targetEntityCol: DG.Column, @grok.decorators.param({options: {nullable: true}})excludeOutliersCol?: DG.Column,
|
|
78
|
+
// rest is parent level data
|
|
79
|
+
@grok.decorators.param({options: {nullable: true}})parentTable?: DG.DataFrame, // these inputs need to be string and resolved here bellow, because this function is used in datasync, otherwise context is lost
|
|
80
|
+
@grok.decorators.param({options: {nullable: true}})fitParamColumns?: string[],
|
|
81
|
+
@grok.decorators.param({options: {nullable: true}})reportedIC50Column?: string,
|
|
82
|
+
@grok.decorators.param({options: {nullable: true}})reportedQualifiedIC50Column?: string,
|
|
83
|
+
@grok.decorators.param({options: {nullable: true}})experimentIDColumn?: string, @grok.decorators.param({options: {nullable: true}})qualifierColumn?: string,
|
|
84
|
+
@grok.decorators.param({options: {nullable: true}})additionalColumns?: string[]
|
|
85
|
+
): Promise<DG.DataFrame> {
|
|
86
|
+
const pt = parentTable;
|
|
87
|
+
// this needs to work with datasync so we use wide format
|
|
88
|
+
return convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, {
|
|
89
|
+
table: pt,
|
|
90
|
+
fitParamColumns: (fitParamColumns ?? []).map((c) => pt?.col(c)).filter((c) => c != null) as DG.Column[],
|
|
91
|
+
reportedIC50Column: reportedIC50Column ? pt?.col(reportedIC50Column) ?? undefined : undefined,
|
|
92
|
+
reportedQualifiedIC50Column: reportedQualifiedIC50Column ? pt?.col(reportedQualifiedIC50Column) ?? undefined : undefined,
|
|
93
|
+
experimentIDColumn: experimentIDColumn ? pt?.col(experimentIDColumn) ?? undefined : undefined,
|
|
94
|
+
qualifierColumn: qualifierColumn ? pt?.col(qualifierColumn) ?? undefined : undefined,
|
|
95
|
+
additionalColumns: (additionalColumns ?? []).map((c) => pt?.col(c)).filter((c) => c != null) as DG.Column[],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
123
98
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const plateFile = (await grok.dapi.files.list('System:DemoFiles/hts/xlsx_plates'))[0];
|
|
129
|
-
grok.shell.addView(await previewPlateXlsx(plateFile) as DG.ViewBase);
|
|
130
|
-
}
|
|
99
|
+
@grok.decorators.func({'top-menu': 'Data | Curves | Data to Curves'})
|
|
100
|
+
static async dataToCurvesTopMenu() {
|
|
101
|
+
dataToCurvesUI();
|
|
102
|
+
}
|
|
131
103
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
104
|
+
@grok.decorators.func({meta: {vectorFunc: 'true'}, tags: ['Transform']})
|
|
105
|
+
static addStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, @grok.decorators.param({type: 'int'}) seriesNumber: number): DG.Column {
|
|
106
|
+
const df = table;
|
|
107
|
+
const col = df.col(colName)!;
|
|
108
|
+
const sourceColName = col.name;
|
|
109
|
+
const initialName = df.columns.getUnusedName(`${colName} ${seriesNumber + 1} ${propName}`);
|
|
110
|
+
|
|
111
|
+
//const grid = DG.Viewer.grid(df);
|
|
112
|
+
const column = DG.Column.float(initialName, col.length);
|
|
113
|
+
|
|
114
|
+
column.tags[SOURCE_COLUMN_TAG] = col.name;
|
|
115
|
+
column.tags[SERIES_NUMBER_TAG] = seriesNumber?.toString();
|
|
116
|
+
column.tags[STATISTICS_TAG] = propName;
|
|
117
|
+
|
|
118
|
+
column
|
|
119
|
+
.init((i) => {
|
|
120
|
+
//const gridCell = DG.GridCell.fromColumnRow(grid, colName, grid.tableRowToGrid(i));
|
|
121
|
+
const cell = df.cell(i, sourceColName);
|
|
122
|
+
if (!cell || !cell.value)
|
|
123
|
+
return null;
|
|
124
|
+
const chartData = cell.column.getTag(FitConstants.TAG_FIT_CHART_FORMAT) === FitConstants.TAG_FIT_CHART_FORMAT_3DX ?
|
|
125
|
+
convertXMLToIFitChartData(cell.value) : getOrCreateParsedChartData(cell, true); // false because there is no dataframe
|
|
126
|
+
if (chartData.series![seriesNumber] === undefined || chartData.series![seriesNumber].points.every((p) => p.outlier))
|
|
127
|
+
return null;
|
|
128
|
+
if (chartData.chartOptions?.allowXZeroes && chartData.chartOptions?.logX &&
|
|
129
|
+
chartData.series?.some((series) => series.points.some((p) => p.x === 0)))
|
|
130
|
+
substituteZeroes(chartData);
|
|
131
|
+
const chartLogOptions: LogOptions = {logX: chartData.chartOptions?.logX, logY: chartData.chartOptions?.logY};
|
|
132
|
+
const fitResult = calculateSeriesStats(chartData.series![seriesNumber], seriesNumber, chartLogOptions, cell, true);
|
|
133
|
+
return fitResult[propName as keyof FitStatistics];
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
df.columns.insert(column, df.columns.names().indexOf(colName) + 1);
|
|
137
|
+
return column;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@grok.decorators.func({meta: {vectorFunc: 'true'}, tags: ['Transform']})
|
|
141
|
+
static addAggrStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, aggrType: string): DG.Column {
|
|
142
|
+
const df = table;
|
|
143
|
+
const col = df.col(colName)!;
|
|
144
|
+
const nName = `${colName} ${aggrType} ${propName}`;
|
|
145
|
+
const column = DG.Column.float(df.columns.getUnusedName(nName), col?.length);
|
|
146
|
+
|
|
147
|
+
column.tags[SOURCE_COLUMN_TAG] = colName;
|
|
148
|
+
column.tags[SERIES_AGGREGATION_TAG] = aggrType;
|
|
149
|
+
column.tags[STATISTICS_TAG] = propName;
|
|
150
|
+
column
|
|
151
|
+
.init((i) => {
|
|
152
|
+
const cell = df.cell(i, colName);
|
|
153
|
+
if (!cell || !cell.value)
|
|
154
|
+
return null;
|
|
155
|
+
const chartData =
|
|
156
|
+
cell.column.getTag(FitConstants.TAG_FIT_CHART_FORMAT) === FitConstants.TAG_FIT_CHART_FORMAT_3DX ?
|
|
157
|
+
convertXMLToIFitChartData(cell.value) : getOrCreateParsedChartData(cell);
|
|
158
|
+
if (chartData.series?.every((series) => series.points.every((p) => p.outlier)))
|
|
159
|
+
return null;
|
|
160
|
+
if (chartData.chartOptions?.allowXZeroes && chartData.chartOptions?.logX &&
|
|
161
|
+
chartData.series?.some((series) => series.points.some((p) => p.x === 0)))
|
|
162
|
+
substituteZeroes(chartData);
|
|
163
|
+
const fitResult = getChartDataAggrStats(chartData, aggrType, cell);
|
|
164
|
+
return fitResult[propName as keyof FitStatistics];
|
|
165
|
+
});
|
|
166
|
+
df.columns.insert(column, df.columns.names().indexOf(colName) + 1);
|
|
167
|
+
return column;
|
|
168
|
+
}
|
|
137
169
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
//input: string newColName
|
|
146
|
-
export function addStatisticsColumn(df: DG.DataFrame, colName: string, propName: string, seriesName: string, seriesNumber: number, newColName?: string): void {
|
|
147
|
-
const grid = DG.Viewer.grid(df);
|
|
148
|
-
const chartColumn = grid.col(colName)!;
|
|
149
|
-
const column = DG.Column.float(newColName ?? `${colName} ${seriesName} ${propName}`, chartColumn.column?.length);
|
|
150
|
-
column.tags[SOURCE_COLUMN_TAG] = colName;
|
|
151
|
-
column.tags[SERIES_NUMBER_TAG] = seriesNumber;
|
|
152
|
-
column.tags[STATISTICS_TAG] = propName;
|
|
170
|
+
@grok.decorators.folderViewer({})
|
|
171
|
+
static async platesFolderPreview(folder: DG.FileInfo, files: DG.FileInfo[]): Promise<DG.Widget | DG.ViewBase | undefined> {
|
|
172
|
+
const nameLowerCase = folder.name?.toLowerCase();
|
|
173
|
+
if (!nameLowerCase?.includes('plate'))
|
|
174
|
+
return undefined;
|
|
175
|
+
return getPlatesFolderPreview(files);
|
|
176
|
+
}
|
|
153
177
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return null;
|
|
163
|
-
if (chartData.chartOptions?.allowXZeroes && chartData.chartOptions?.logX &&
|
|
164
|
-
chartData.series?.some((series) => series.points.some((p) => p.x === 0)))
|
|
165
|
-
substituteZeroes(chartData);
|
|
166
|
-
const chartLogOptions: LogOptions = {logX: chartData.chartOptions?.logX, logY: chartData.chartOptions?.logY};
|
|
167
|
-
const fitResult = calculateSeriesStats(chartData.series![seriesNumber], seriesNumber, chartLogOptions, gridCell);
|
|
168
|
-
return fitResult[propName as keyof FitStatistics];
|
|
178
|
+
@grok.decorators.fileViewer({fileViewer: 'txt', fileViewerCheck: 'Curves:checkFileIsPlate'})
|
|
179
|
+
static previewPlate(file: DG.FileInfo): DG.View {
|
|
180
|
+
const view = DG.View.create();
|
|
181
|
+
view.name = file.name;
|
|
182
|
+
file.readAsString().then((content) => {
|
|
183
|
+
const plate = PlateReader.read(content);
|
|
184
|
+
if (plate !== null)
|
|
185
|
+
view.root.appendChild(PlateWidget.fromPlate(plate).root);
|
|
169
186
|
});
|
|
170
|
-
|
|
171
|
-
}
|
|
187
|
+
return view;
|
|
188
|
+
}
|
|
172
189
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
export function addAggrStatisticsColumn(df: DG.DataFrame, colName: string, propName: string, aggrType: string): void {
|
|
180
|
-
const grid = DG.Viewer.grid(df);
|
|
181
|
-
const chartColumn = grid.col(colName)!;
|
|
182
|
-
const column = DG.Column.float(`${colName} ${aggrType} ${propName}`, chartColumn.column?.length);
|
|
183
|
-
column.tags[SOURCE_COLUMN_TAG] = colName;
|
|
184
|
-
column.tags[SERIES_AGGREGATION_TAG] = aggrType;
|
|
185
|
-
column.tags[STATISTICS_TAG] = propName;
|
|
190
|
+
@grok.decorators.fileHandler({ext: 'txt', fileViewerCheck: 'Curves:checkFileIsPlate'})
|
|
191
|
+
static async importPlate(fileContent: string): Promise<DG.DataFrame[]> {
|
|
192
|
+
const plate = PlateReader.read(fileContent);
|
|
193
|
+
const view = DG.View.create();
|
|
194
|
+
if (plate !== null)
|
|
195
|
+
view.root.appendChild(PlateWidget.fromPlate(plate).root);
|
|
186
196
|
|
|
187
|
-
|
|
188
|
-
.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return null;
|
|
192
|
-
const chartData = gridCell.cell.column.getTag(FitConstants.TAG_FIT_CHART_FORMAT) === FitConstants.TAG_FIT_CHART_FORMAT_3DX ?
|
|
193
|
-
convertXMLToIFitChartData(gridCell.cell.value) : getOrCreateParsedChartData(gridCell);
|
|
194
|
-
if (chartData.series?.every((series) => series.points.every((p) => p.outlier)))
|
|
195
|
-
return null;
|
|
196
|
-
if (chartData.chartOptions?.allowXZeroes && chartData.chartOptions?.logX &&
|
|
197
|
-
chartData.series?.some((series) => series.points.some((p) => p.x === 0)))
|
|
198
|
-
substituteZeroes(chartData);
|
|
199
|
-
const fitResult = getChartDataAggrStats(chartData, aggrType, gridCell);
|
|
200
|
-
return fitResult[propName as keyof FitStatistics];
|
|
201
|
-
});
|
|
202
|
-
df.columns.insert(column, chartColumn.idx);
|
|
203
|
-
}
|
|
197
|
+
view.name = 'Plate';
|
|
198
|
+
grok.shell.addView(view);
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
204
201
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return getPlatesFolderPreview(files);
|
|
215
|
-
}
|
|
202
|
+
@grok.decorators.fileHandler({outputs: [], ext: 'xlsx', fileViewerCheck: 'Curves:checkExcelIsPlate'})
|
|
203
|
+
static async importPlateXlsx(fileContent: Uint8Array): Promise<any[]> {
|
|
204
|
+
const view = DG.View.create();
|
|
205
|
+
const plate = await PackageFunctions.parseExcelPlate(fileContent);
|
|
206
|
+
view.root.appendChild(PlateDrcAnalysis.analysisView(plate).root);
|
|
207
|
+
view.name = 'Plate';
|
|
208
|
+
grok.shell.addView(view);
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
216
211
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// grok.shell.warning('Please, select an Excel file with plates');
|
|
226
|
-
// return;
|
|
227
|
-
// }
|
|
228
|
-
//
|
|
229
|
-
// try {
|
|
230
|
-
// const plate = await Plate.fromExcelFileInfo(file);
|
|
231
|
-
// const pw = PlateWidget.analysisView(plate);
|
|
232
|
-
// const view = DG.View.fromRoot(pw.root);
|
|
233
|
-
// view.name = file.name;
|
|
234
|
-
// grok.shell.addView(view);
|
|
235
|
-
// } catch (e) {
|
|
236
|
-
// grok.shell.error('Error parsing plate file');
|
|
237
|
-
// _package.logger.error(e);
|
|
238
|
-
// }
|
|
239
|
-
// }).show();
|
|
240
|
-
// // if (file.extension !== 'xlsx') {
|
|
241
|
-
// // grok.shell.warning('Please, select an Excel file with plates');
|
|
242
|
-
// // return;
|
|
243
|
-
// // }
|
|
244
|
-
// // console.log(file);
|
|
245
|
-
// // const plate = Plate.fromExcel(file.fullPath);
|
|
246
|
-
// }
|
|
212
|
+
@grok.decorators.fileViewer({name: 'viewPlateXlsx', fileViewer: 'xlsx', fileViewerCheck: 'Curves:checkExcelIsPlate'})
|
|
213
|
+
static async previewPlateXlsx(file: DG.FileInfo): Promise<DG.View> {
|
|
214
|
+
const view = DG.View.create();
|
|
215
|
+
view.name = file.friendlyName;
|
|
216
|
+
const plate = await PackageFunctions.parseExcelPlate(await file.readAsBytes());
|
|
217
|
+
view.root.appendChild(PlateDrcAnalysis.analysisView(plate).root);
|
|
218
|
+
return view;
|
|
219
|
+
}
|
|
247
220
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (plate !== null) {
|
|
258
|
-
view.root.appendChild(PlateWidget.fromPlate(plate).root);
|
|
221
|
+
@grok.decorators.func({})
|
|
222
|
+
static async checkExcelIsPlate(content: Uint8Array): Promise<boolean> {
|
|
223
|
+
try {
|
|
224
|
+
if (content.length > 1_000_000) // haven't really seen a plate file larger than 1MB
|
|
225
|
+
return false;
|
|
226
|
+
const plate = await PackageFunctions.parseExcelPlate(content);
|
|
227
|
+
return plate !== null;
|
|
228
|
+
} catch (e) {
|
|
229
|
+
return false;
|
|
259
230
|
}
|
|
260
|
-
}
|
|
261
|
-
return view;
|
|
262
|
-
}
|
|
231
|
+
}
|
|
263
232
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (plate !== null) {
|
|
274
|
-
view.root.appendChild(PlateWidget.fromPlate(plate).root);
|
|
233
|
+
static async parseExcelPlate(content: string | Uint8Array, name?: string) {
|
|
234
|
+
if (typeof content === 'string') {
|
|
235
|
+
const blob = new Blob([content], {type: 'application/octet-binary'});
|
|
236
|
+
const buf = await blob.arrayBuffer();
|
|
237
|
+
const plate = await Plate.fromExcel(new Uint8Array(buf), name);
|
|
238
|
+
return plate;
|
|
239
|
+
} else {
|
|
240
|
+
return await Plate.fromExcel(content, name);
|
|
241
|
+
}
|
|
275
242
|
}
|
|
276
|
-
view.name = 'Plate';
|
|
277
|
-
grok.shell.addView(view);
|
|
278
|
-
return [];
|
|
279
|
-
}
|
|
280
243
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
export async function importPlateXlsx(fileContent: Uint8Array) {
|
|
288
|
-
const view = DG.View.create();
|
|
289
|
-
const plate = await parseExcelPlate(fileContent);
|
|
290
|
-
view.root.appendChild(PlateWidget.analysisView(plate).root);
|
|
291
|
-
view.name = 'Plate';
|
|
292
|
-
grok.shell.addView(view);
|
|
293
|
-
return [];
|
|
294
|
-
}
|
|
244
|
+
@grok.decorators.func({})
|
|
245
|
+
static checkFileIsPlate(content: string): boolean {
|
|
246
|
+
if (content.length > 1_000_000)
|
|
247
|
+
return false;
|
|
248
|
+
return PlateReader.getReader(content) != null;
|
|
249
|
+
}
|
|
295
250
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
//output: view result
|
|
301
|
-
export async function previewPlateXlsx(file: DG.FileInfo): Promise<DG.View> {
|
|
302
|
-
const view = DG.View.create();
|
|
303
|
-
view.name = file.friendlyName;
|
|
304
|
-
const plate = await parseExcelPlate(await file.readAsBytes());
|
|
305
|
-
view.root.appendChild(PlateWidget.analysisView(plate).root);
|
|
306
|
-
return view;
|
|
307
|
-
}
|
|
251
|
+
@grok.decorators.app({name: 'Browse', browsePath: 'Plates'})
|
|
252
|
+
static platesApp(): DG.View {
|
|
253
|
+
return platesAppView();
|
|
254
|
+
}
|
|
308
255
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (content.length > 1_000_000) // haven't really seen a plate file larger than 1MB
|
|
315
|
-
return false;
|
|
316
|
-
const plate = await parseExcelPlate(content);
|
|
317
|
-
return plate !== null;
|
|
318
|
-
} catch (e) {
|
|
319
|
-
return false;
|
|
256
|
+
@grok.decorators.func({})
|
|
257
|
+
static async getPlateByBarcode(barcode: string): Promise<Plate> {
|
|
258
|
+
await initPlates();
|
|
259
|
+
const df: DG.DataFrame = await api.queries.getWellValuesByBarcode(barcode);
|
|
260
|
+
return Plate.fromDbDataFrame(df);
|
|
320
261
|
}
|
|
321
|
-
}
|
|
322
262
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const plate = await Plate.fromExcel(new Uint8Array(buf), name);
|
|
328
|
-
return plate;
|
|
329
|
-
} else
|
|
330
|
-
return await Plate.fromExcel(content, name);
|
|
263
|
+
@grok.decorators.func({})
|
|
264
|
+
static async createDummyPlateData(): Promise<void> {
|
|
265
|
+
await __createDummyPlateData();
|
|
266
|
+
}
|
|
331
267
|
}
|
|
332
268
|
|
|
333
|
-
//name:
|
|
334
|
-
//input:
|
|
335
|
-
//
|
|
336
|
-
export function
|
|
337
|
-
|
|
338
|
-
return false;
|
|
339
|
-
return PlateReader.getReader(content) != null;
|
|
269
|
+
//name: platesAppTreeBrowser
|
|
270
|
+
//input: dynamic treeNode
|
|
271
|
+
//input: view browseView
|
|
272
|
+
export async function platesAppTreeBrowser(treeNode: DG.TreeViewGroup, browseView: DG.BrowsePanel) {
|
|
273
|
+
await initPlatesAppTree(treeNode);
|
|
340
274
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
export {_FitChartCellRenderer};
|
|
344
|
-
export {_MultiCurveViewer};
|
|
345
|
-
export {_PlateGridCellRenderer};
|
|
@@ -108,5 +108,5 @@ export function getPlateFromSheet(p: ExcelPlatePosition): Plate {
|
|
|
108
108
|
const strings = DG.range(p.rows).map(i => p.sheet.getCell(p.startRow + i + 1, col).toString()).toArray();
|
|
109
109
|
df.columns.add(DG.Column.fromStrings(`${col - p.startCol + 1}`, strings));
|
|
110
110
|
}
|
|
111
|
-
return Plate.
|
|
111
|
+
return Plate.fromGridDataFrame(df, p.sheet.name);
|
|
112
112
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
3
|
import * as grok from 'datagrok-api/grok';
|
|
4
|
-
import {PlateWidget} from
|
|
5
|
-
import {GridColumn, x} from
|
|
4
|
+
import {PlateWidget} from './plate-widget';
|
|
5
|
+
import {GridColumn, x} from 'datagrok-api/dg';
|
|
6
|
+
import {Plate} from "./plate";
|
|
6
7
|
|
|
7
8
|
export class PlateCellHandler extends DG.ObjectHandler {
|
|
8
9
|
get type(): string { return 'Plate'; }
|
|
@@ -17,24 +18,31 @@ export class PlateCellHandler extends DG.ObjectHandler {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
@grok.decorators.cellRenderer({cellType: 'Plate'})
|
|
21
|
+
@grok.decorators.cellRenderer({cellType: 'Plate', name: 'PlateGridCellRenderer'})
|
|
21
22
|
export class PlateGridCellRenderer extends DG.GridCellRenderer {
|
|
22
|
-
|
|
23
|
+
plateWidget = new PlateWidget();
|
|
23
24
|
|
|
24
25
|
get name(): string { return 'Plate'; }
|
|
25
26
|
get cellType(): string { return 'Plate'; }
|
|
26
27
|
|
|
27
|
-
getDefaultSize(
|
|
28
|
+
getDefaultSize(_gridColumn: GridColumn) { return {width: 240, height: 160}; }
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// eslint-disable-next-line max-len
|
|
31
|
+
render(g: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, gridCell: DG.GridCell<DG.DataFrame | null>, _cellStyle: DG.GridCellStyle) {
|
|
32
|
+
if (gridCell.value == null) {
|
|
33
|
+
g.fillStyle = 'white';
|
|
34
|
+
g.fillRect(x, y, w, h);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
33
37
|
|
|
34
|
-
this.plate
|
|
38
|
+
this.plateWidget.plate = Plate.fromTableByRow(gridCell.value!);
|
|
39
|
+
this.plateWidget.grid.props.colHeaderHeight = h > 120 ? 16 : 0;
|
|
40
|
+
this.plateWidget.grid.props.showRowHeader = w > 100;
|
|
41
|
+
|
|
42
|
+
this.plateWidget.grid.render(g, new DG.Rect(x, y, w, h).cutTop(Math.min(h / 20, 5)).cutRight(Math.min(w / 20, 5)));
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
onClick(gridCell: DG.GridCell,
|
|
38
|
-
grok.shell.o = PlateWidget.detailedView(gridCell.value).root;
|
|
45
|
+
onClick(gridCell: DG.GridCell, _e: MouseEvent) {
|
|
46
|
+
grok.shell.o = PlateWidget.detailedView(Plate.fromTableByRow(gridCell.value!)).root;
|
|
39
47
|
}
|
|
40
48
|
}
|