@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/plate/utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as DG from 'datagrok-api/dg';
|
|
2
|
-
import {
|
|
3
|
+
import {PLATE_OUTLIER_WELL_NAME} from './plate';
|
|
3
4
|
import wu from 'wu';
|
|
4
5
|
//@ts-ignore
|
|
5
6
|
import * as jStat from 'jstat';
|
|
@@ -13,9 +14,10 @@ export function assure(condition: boolean, errorMessage: string | (() => string)
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
export function firstWhere<T>(items: Iterable<T>, check: ((item: T) => boolean)): T | null {
|
|
16
|
-
for (const x of items)
|
|
17
|
+
for (const x of items) {
|
|
17
18
|
if (check(x))
|
|
18
19
|
return x;
|
|
20
|
+
}
|
|
19
21
|
return null;
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -61,12 +63,17 @@ export function excelToNum(row: string): number {
|
|
|
61
63
|
export function parseExcelPosition(cell: string): [number, number] {
|
|
62
64
|
const match = cell.match(/^([A-Za-z]+)(\d+)$/);
|
|
63
65
|
if (!match)
|
|
64
|
-
throw new Error(
|
|
66
|
+
throw new Error('Invalid cell format. Expected format like \'A3\'.');
|
|
65
67
|
|
|
66
68
|
const row = excelToNum(match[1].toUpperCase());
|
|
67
69
|
const col = parseInt(match[2]) - 1;
|
|
68
70
|
|
|
69
|
-
return [
|
|
71
|
+
return [row, col];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Converts 0-based {row, col} to Excel position notation. */
|
|
75
|
+
export function toExcelPosition(row: number, col: number): string {
|
|
76
|
+
return `${numToExcel(row)}${col + 1}`;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
export function getMaxPosition(positions: Iterable<[number, number]>): [number, number] {
|
|
@@ -80,7 +87,13 @@ export function toStandardSize([rows, cols]: number[]): [number, number] {
|
|
|
80
87
|
return [16, 24];
|
|
81
88
|
if (rows <= 32 && cols <= 48)
|
|
82
89
|
return [32, 48];
|
|
83
|
-
throw `${rows}x${cols} exceeds maximum plate size 32x48
|
|
90
|
+
throw new Error(`${rows}x${cols} exceeds maximum plate size 32x48`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const standardPlateSizes: { [index: number]: [rows: number, cols: number] } = {
|
|
94
|
+
96: [8, 12],
|
|
95
|
+
384: [16, 24],
|
|
96
|
+
1536: [32, 48]
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
export function safeLog(num: number) {
|
|
@@ -100,17 +113,16 @@ export function mapFromRow(row: DG.Row, outlierSetFunc?: (row: number, checkBoxS
|
|
|
100
113
|
check.checked = check.value = currentVal;
|
|
101
114
|
check.onchange = (e) => outlierSetFunc(row.idx, check.checked);
|
|
102
115
|
res[column.name] = check;
|
|
103
|
-
} else
|
|
104
|
-
res[column.name] = column.isNone(idx) ? 'No data' : column.isNumerical && column.type !== DG.COLUMN_TYPE.DATE_TIME ? formatTableNumber(column.get(idx)) : column.get(idx);
|
|
116
|
+
} else { res[column.name] = column.isNone(idx) ? 'No data' : column.isNumerical && column.type !== DG.COLUMN_TYPE.DATE_TIME ? formatTableNumber(column.get(idx)) : column.get(idx); }
|
|
105
117
|
}
|
|
106
118
|
return res;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
export function formatTableNumber(num: number): string | number {
|
|
110
|
-
if (num === 0)
|
|
122
|
+
if (num === 0)
|
|
111
123
|
return '0';
|
|
112
124
|
if (Math.abs(num) < 1e-3)
|
|
113
|
-
|
|
125
|
+
return DG.format(num, 'scientific');
|
|
114
126
|
else if (Math.abs(num) < 1)
|
|
115
127
|
return DG.format(num, '0.0000');
|
|
116
128
|
return num;
|
|
@@ -126,4 +138,4 @@ export const jstatStatistics: Record<JSTATStatistics, (val: number[]) => number>
|
|
|
126
138
|
max: jStat.max,
|
|
127
139
|
meansqerr: jStat.meansqerr,
|
|
128
140
|
geomean: jStat.geomean
|
|
129
|
-
}
|
|
141
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
type Nullable<T> = T | null;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export abstract class Matcher {
|
|
5
|
+
abstract match(x: any): boolean;
|
|
6
|
+
abstract toSql(variable: string): string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class StringInListMatcher extends Matcher {
|
|
10
|
+
values: string[];
|
|
11
|
+
|
|
12
|
+
constructor(values: string[]) {
|
|
13
|
+
super();
|
|
14
|
+
this.values = values;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
match(x: string | null): boolean {
|
|
18
|
+
if (x === null || x === undefined)
|
|
19
|
+
return false;
|
|
20
|
+
return this.values.includes(x);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toSql(variable: string): string {
|
|
24
|
+
if (this.values.length === 0)
|
|
25
|
+
return '(1 = 1)';
|
|
26
|
+
|
|
27
|
+
const escapedValues = this.values
|
|
28
|
+
.map(v => `'${v.replace(/'/g, "''")}'`)
|
|
29
|
+
.join(", ");
|
|
30
|
+
return `(${variable} IN (${escapedValues}))`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class NumericMatcher {
|
|
35
|
+
static readonly NONE = 'none';
|
|
36
|
+
static readonly EQUALS = '=';
|
|
37
|
+
static readonly NOT_EQUALS = '!=';
|
|
38
|
+
static readonly GT = '>';
|
|
39
|
+
static readonly GTOE = '>=';
|
|
40
|
+
static readonly LT = '<';
|
|
41
|
+
static readonly LTOE = '<=';
|
|
42
|
+
static readonly IN = 'in';
|
|
43
|
+
static readonly NOT_IN = 'not in';
|
|
44
|
+
static readonly RANGE = '-';
|
|
45
|
+
static readonly IS_NULL = 'is null';
|
|
46
|
+
static readonly IS_NOT_NULL = 'is not null';
|
|
47
|
+
|
|
48
|
+
static readonly _num = '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?';
|
|
49
|
+
static readonly numRegex = new RegExp(`^${NumericMatcher._num}`);
|
|
50
|
+
static readonly unaryRegex = /(?:[$]{.*})?\s*(!=|>=|<=|=|>|<|\bnot in\b|\bin\b)+/;
|
|
51
|
+
static readonly rangeRegex = new RegExp(`(${NumericMatcher._num})\\s?(?:-|\\.\\.)\\s?(${NumericMatcher._num})`);
|
|
52
|
+
static readonly inRegex = /\((.*)\)/;
|
|
53
|
+
static readonly isNullRegExp = /(^is null|^is not null|\sis null|\sis not null)$/;
|
|
54
|
+
|
|
55
|
+
static readonly unaryOperators = [
|
|
56
|
+
NumericMatcher.EQUALS, NumericMatcher.NOT_EQUALS,
|
|
57
|
+
NumericMatcher.GT, NumericMatcher.GTOE,
|
|
58
|
+
NumericMatcher.LT, NumericMatcher.LTOE,
|
|
59
|
+
NumericMatcher.IN, NumericMatcher.NOT_IN
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
static recentMatchers = new Map<string, NumericMatcher>();
|
|
63
|
+
|
|
64
|
+
op?: string;
|
|
65
|
+
v1?: number;
|
|
66
|
+
v2?: number;
|
|
67
|
+
values: number[] = [];
|
|
68
|
+
expression?: string;
|
|
69
|
+
allowedPatterns?: string[];
|
|
70
|
+
|
|
71
|
+
constructor(op?: string, v1?: number, v2?: number) {
|
|
72
|
+
this.op = op;
|
|
73
|
+
this.v1 = v1;
|
|
74
|
+
this.v2 = v2;
|
|
75
|
+
if (v1 !== undefined) this.values.push(v1);
|
|
76
|
+
if (v2 !== undefined) this.values.push(v2);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static parse(query: string, options?: {
|
|
80
|
+
orElse?: () => NumericMatcher,
|
|
81
|
+
matchEmptyPattern?: boolean
|
|
82
|
+
}): Nullable<NumericMatcher> {
|
|
83
|
+
const { orElse, matchEmptyPattern } = options || {};
|
|
84
|
+
const fail = () => orElse ? orElse() : null;
|
|
85
|
+
|
|
86
|
+
if (matchEmptyPattern && (!query || query.trim() === ''))
|
|
87
|
+
return new NumericMatcher(NumericMatcher.NONE);
|
|
88
|
+
|
|
89
|
+
const x = parseFloat(query);
|
|
90
|
+
if (!isNaN(x))
|
|
91
|
+
return new NumericMatcher(NumericMatcher.EQUALS, x);
|
|
92
|
+
|
|
93
|
+
const match = NumericMatcher.unaryRegex.exec(query);
|
|
94
|
+
if (match && NumericMatcher.unaryOperators.includes(match[1])) {
|
|
95
|
+
const op = match[1];
|
|
96
|
+
const matcher = new NumericMatcher(op);
|
|
97
|
+
matcher.expression = query;
|
|
98
|
+
const rest = query.substring(match.index + match[0].length).trim();
|
|
99
|
+
|
|
100
|
+
if (op === NumericMatcher.IN || op === NumericMatcher.NOT_IN) {
|
|
101
|
+
const matchValues = NumericMatcher.inRegex.exec(rest);
|
|
102
|
+
if (matchValues) {
|
|
103
|
+
const values = matchValues[1].split(',').map(s => parseFloat(s.trim()));
|
|
104
|
+
if (values.some(isNaN)) return fail();
|
|
105
|
+
matcher.values = values;
|
|
106
|
+
return matcher;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
const matchValue1 = NumericMatcher.numRegex.exec(rest.toLowerCase());
|
|
110
|
+
if (matchValue1) {
|
|
111
|
+
matcher.v1 = parseFloat(matchValue1[0]);
|
|
112
|
+
matcher.values = [matcher.v1];
|
|
113
|
+
return matcher;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const upQuery = query.toUpperCase();
|
|
119
|
+
if (['NONE', 'EMPTY', 'NA', 'N/A'].includes(upQuery))
|
|
120
|
+
return new NumericMatcher(NumericMatcher.NONE);
|
|
121
|
+
|
|
122
|
+
const rangeMatch = NumericMatcher.rangeRegex.exec(query);
|
|
123
|
+
if (rangeMatch)
|
|
124
|
+
return new NumericMatcher(
|
|
125
|
+
NumericMatcher.RANGE,
|
|
126
|
+
parseFloat(rangeMatch[1]),
|
|
127
|
+
parseFloat(rangeMatch[2])
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const nullMatch = NumericMatcher.isNullRegExp.exec(query);
|
|
131
|
+
if (nullMatch)
|
|
132
|
+
return new NumericMatcher(nullMatch[1].trim());
|
|
133
|
+
|
|
134
|
+
return fail();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static matches(query: string, x: number, matchEmptyPattern = false): boolean {
|
|
138
|
+
let matcher: NumericMatcher | undefined | null = this.recentMatchers.get(query);
|
|
139
|
+
if (!matcher) {
|
|
140
|
+
matcher = this.parse(query, { matchEmptyPattern });
|
|
141
|
+
if (matcher)
|
|
142
|
+
this.recentMatchers.set(query, matcher);
|
|
143
|
+
}
|
|
144
|
+
return matcher?.match(x) === true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
match(x?: number | null): boolean {
|
|
148
|
+
if (x === null || x === undefined)
|
|
149
|
+
return this.op === NumericMatcher.NONE || this.op === NumericMatcher.IS_NULL;
|
|
150
|
+
|
|
151
|
+
switch ((this.op || '').trim()) {
|
|
152
|
+
case NumericMatcher.NONE: return false; // we already know x != null;
|
|
153
|
+
case NumericMatcher.GT: return x > this.v1!;
|
|
154
|
+
case NumericMatcher.GTOE: return x >= this.v1!;
|
|
155
|
+
case NumericMatcher.LT: return x < this.v1!;
|
|
156
|
+
case NumericMatcher.LTOE: return x <= this.v1!;
|
|
157
|
+
case NumericMatcher.EQUALS: return x === this.v1!;
|
|
158
|
+
case NumericMatcher.NOT_EQUALS: return x !== this.v1!;
|
|
159
|
+
case NumericMatcher.IN: return this.values.includes(x);
|
|
160
|
+
case NumericMatcher.NOT_IN: return !this.values.includes(x);
|
|
161
|
+
case NumericMatcher.RANGE: return x >= this.v1! && x <= this.v2!;
|
|
162
|
+
case NumericMatcher.IS_NULL: return false;
|
|
163
|
+
case NumericMatcher.IS_NOT_NULL: return true;
|
|
164
|
+
default: throw new Error(`Unknown operation "${this.op}"`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
validatePattern(): string | null {
|
|
169
|
+
if ((!this.allowedPatterns || this.allowedPatterns.includes(this.op!)) &&
|
|
170
|
+
(NumericMatcher.unaryOperators.includes(this.op!) ||
|
|
171
|
+
[NumericMatcher.NONE, NumericMatcher.RANGE, NumericMatcher.IS_NULL, NumericMatcher.IS_NOT_NULL].includes(this.op!)))
|
|
172
|
+
return null;
|
|
173
|
+
return `Unknown operation "${this.op}"`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
toSql(variable: string): string {
|
|
177
|
+
switch (this.op) {
|
|
178
|
+
case NumericMatcher.RANGE:
|
|
179
|
+
return `(${variable} >= ${this.v1} AND ${variable} <= ${this.v2})`;
|
|
180
|
+
case NumericMatcher.IN:
|
|
181
|
+
return `(${variable} IN (${this.values.join(',')}))`;
|
|
182
|
+
case NumericMatcher.NONE:
|
|
183
|
+
return `(1 = 1)`;
|
|
184
|
+
case NumericMatcher.IS_NULL:
|
|
185
|
+
case NumericMatcher.IS_NOT_NULL:
|
|
186
|
+
return `(${variable} ${this.op})`;
|
|
187
|
+
default:
|
|
188
|
+
return `(${variable} ${this.op} ${this.v1})`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as crud from "../plates-crud";
|
|
5
|
+
import { propertySchemaView } from '../views/plates-schema-view';
|
|
6
|
+
|
|
7
|
+
export class PlateTemplateHandler extends DG.ObjectHandler<DG.SemanticValue<crud.PlateTemplate>> {
|
|
8
|
+
|
|
9
|
+
get type() { return crud.TYPE.TEMPLATE; }
|
|
10
|
+
get description() { return 'A set of properties for plates and wells'; }
|
|
11
|
+
|
|
12
|
+
isApplicable(x: any): boolean {
|
|
13
|
+
return x instanceof DG.SemanticValue && crud.TYPE.TEMPLATE === x.semType;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
renderView(x: DG.SemanticValue<crud.PlateTemplate>, context: any): HTMLElement {
|
|
17
|
+
return propertySchemaView(x.value).root;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
renderTooltip(x: DG.SemanticValue<crud.PlateTemplate>, context: any): HTMLElement {
|
|
21
|
+
return ui.div(x.value.description);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
|
|
27
|
+
this.registerParamFunc('Edit...', (template: DG.SemanticValue<crud.PlateTemplate>) => PlateTemplateHandler.editTemplate(template.value));
|
|
28
|
+
this.registerParamFunc('Clone...', (template: DG.SemanticValue<crud.PlateTemplate>) => PlateTemplateHandler.openCloneTemplateView(template.value));
|
|
29
|
+
this.registerParamFunc('Delete', async (template: DG.SemanticValue<crud.PlateTemplate>) => await PlateTemplateHandler.tryDeleteTemplate(template.value));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static editTemplate(template: crud.PlateTemplate) {
|
|
33
|
+
grok.shell.addPreview(propertySchemaView(template));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static async openCloneTemplateView(template: crud.PlateTemplate) {
|
|
37
|
+
grok.shell.addPreview(propertySchemaView({...template, id: -1}));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static async tryDeleteTemplate(template: crud.PlateTemplate): Promise<boolean> {
|
|
41
|
+
if (await crud.plateTemplatePropertiesUsed(template)) {
|
|
42
|
+
grok.shell.info('Template is used in plates, cannot delete');
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
await crud.deletePlateTemplate(template);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import {createPlatesView} from "./views/plates-create-view";
|
|
5
|
+
|
|
6
|
+
import * as crud from "./plates-crud";
|
|
7
|
+
import { searchWellsView } from './views/plates-search-view';
|
|
8
|
+
import { searchPlatesView } from './views/plates-search-view';
|
|
9
|
+
import { propertySchemaView as templateView } from './views/plates-schema-view';
|
|
10
|
+
import { createTemplatesView } from './views/plates-templates-view';
|
|
11
|
+
import { filter } from 'rxjs/operators';
|
|
12
|
+
|
|
13
|
+
export function platesAppView(): DG.View {
|
|
14
|
+
const dummy = DG.DataFrame.create(5);
|
|
15
|
+
const view = DG.TableView.create(dummy);
|
|
16
|
+
|
|
17
|
+
crud.queryPlates({plateMatchers: [], wellMatchers: []}).then((df: DG.DataFrame) => {
|
|
18
|
+
df.col('barcode')!.semType = 'Plate Barcode';
|
|
19
|
+
view.dataFrame = df;
|
|
20
|
+
view.grid.columns.add({gridColumnName: 'plate', cellType: 'Plate'})
|
|
21
|
+
.onPrepareValueScript = `return (await curves.getPlateByBarcode(gridCell.tableRow.get('barcode'))).data;`;
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return view;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export async function initPlatesAppTree(treeNode: DG.TreeViewGroup): Promise<void> {
|
|
29
|
+
await crud.initPlates();
|
|
30
|
+
|
|
31
|
+
const createPlatesNode = treeNode.item('Create');
|
|
32
|
+
const searchPlatesNode = treeNode.item('Search plates');
|
|
33
|
+
const searchWellsNode = treeNode.item('Search wells');
|
|
34
|
+
createPlatesNode.onSelected.subscribe(async (_) => grok.shell.addPreview(createPlatesView()));
|
|
35
|
+
searchPlatesNode.onSelected.subscribe(async (_) => grok.shell.addPreview(searchPlatesView()));
|
|
36
|
+
searchWellsNode.onSelected.subscribe(async (_) => grok.shell.addPreview(searchWellsView()));
|
|
37
|
+
|
|
38
|
+
const templatesNode = treeNode.group('Templates');
|
|
39
|
+
templatesNode.onSelected.subscribe(async (_) => grok.shell.addPreview(createTemplatesView()));
|
|
40
|
+
|
|
41
|
+
const plateTemplatesNode = templatesNode.group('Plates');
|
|
42
|
+
const wellTemplatesNode = templatesNode.group('Wells');
|
|
43
|
+
|
|
44
|
+
for (const template of crud.plateTemplates) {
|
|
45
|
+
const plateTemplateNode = plateTemplatesNode.item(template.name, DG.SemanticValue.fromValueType(template, crud.TYPE.TEMPLATE));
|
|
46
|
+
plateTemplateNode.onSelected.subscribe(async (_) => grok.shell.addPreview(templateView(template)));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// auto-delete templates from the tree when they are deleted
|
|
50
|
+
crud.events.pipe(filter(event => event.eventType === 'deleted')).subscribe((event) => {
|
|
51
|
+
treeNode.removeChildrenWhere((node) => node.value instanceof DG.SemanticValue &&
|
|
52
|
+
crud.entityTypes.includes(node.value.semType) &&
|
|
53
|
+
node.value.value.id && node.value.value.id === event.object.id);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// const queriesNode = treeNode.group('Queries');
|
|
57
|
+
// const nameCol = plateUniquePropertyValues.col('name')!;
|
|
58
|
+
// const valueCol = plateUniquePropertyValues.col('value_string')!;
|
|
59
|
+
// for (const propertyName of nameCol.categories) {
|
|
60
|
+
// const propertyNode = queriesNode.group(propertyName);
|
|
61
|
+
// for (const i of plateUniquePropertyValues.rows.where(i => nameCol.get(i) == propertyName))
|
|
62
|
+
// propertyNode.item(valueCol.get(i), () => grok.shell.info('foo!'));
|
|
63
|
+
// }
|
|
64
|
+
}
|