@datagrok/curves 1.13.4 → 1.14.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/.grokignore +2 -0
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +6 -0
- package/bdd/bindings/curves.ts +0 -6
- package/bdd/features/MISSING.md +9 -7
- package/bdd/features/data/data-to-curves.feature +50 -0
- package/bdd/generated/data/data-to-curves.test.ts +45 -0
- package/bdd/generated/guides/curves-legend-cells.test.ts +3 -2
- package/detectors.js +4 -4
- package/dist/package-test.js +28 -16
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +6 -6
- package/src/package-test.ts +1 -0
- package/src/tests/data-to-curves-tests.ts +34 -0
- package/src/tests/fit-tests.ts +12 -0
- package/test-console-output-1.log +351 -343
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/curves",
|
|
3
3
|
"friendlyName": "Curves",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"description": "Curves provides support for fitted curves (such as dose-response curves), including in-grid rendering, storing charts in cells, interactivity, and automatic fitting.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Dmytro Kovalyov",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@types/wu": "^2.1.44",
|
|
12
12
|
"cash-dom": "8.1.5",
|
|
13
|
-
"datagrok-api": "^1.27.0",
|
|
14
13
|
"dayjs": "1.11.23",
|
|
15
14
|
"exceljs": "4.4.0",
|
|
16
15
|
"jstat": "^1.9.6",
|
|
17
16
|
"rxjs": "6.6.7",
|
|
18
|
-
"@datagrok-libraries/
|
|
19
|
-
"@datagrok-libraries/
|
|
20
|
-
"@datagrok-libraries/utils": "^4.
|
|
17
|
+
"@datagrok-libraries/statistics": "^1.13.0",
|
|
18
|
+
"@datagrok-libraries/test": "^1.6.0",
|
|
19
|
+
"@datagrok-libraries/utils": "^4.8.0",
|
|
20
|
+
"datagrok-api": "^1.28.1"
|
|
21
21
|
},
|
|
22
22
|
"overrides": {
|
|
23
23
|
"uuid": "^11.1.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@playwright/test": "^1.48.0",
|
|
27
|
-
"@datagrok-libraries/bdd": "^
|
|
27
|
+
"@datagrok-libraries/bdd": "^1.0.0"
|
|
28
28
|
},
|
|
29
29
|
"canEdit": [
|
|
30
30
|
"Administrators"
|
package/src/package-test.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
|
|
3
|
+
import {category, expect, test} from '@datagrok-libraries/test/src/test';
|
|
4
|
+
import {convertDataToCurves} from '../fit/data-to-curves';
|
|
5
|
+
|
|
6
|
+
const WELLS = `compound_id,assay_name,target_entity,batch_id,run_id,concentration_uM,inhibition
|
|
7
|
+
C1,A,T,B1,R1,0.1,5
|
|
8
|
+
C1,A,T,B1,R1,1,20
|
|
9
|
+
C1,A,T,B1,R1,10,60
|
|
10
|
+
C1,A,T,B1,R1,100,95
|
|
11
|
+
C1,A,T,B1,R2,0.1,4
|
|
12
|
+
C1,A,T,B1,R2,1,25
|
|
13
|
+
C1,A,T,B1,R2,10,55
|
|
14
|
+
C1,A,T,B1,R2,100,90
|
|
15
|
+
C2,A,T,B2,R1,0.1,2
|
|
16
|
+
C2,A,T,B2,R1,1,10
|
|
17
|
+
C2,A,T,B2,R1,10,30
|
|
18
|
+
C2,A,T,B2,R1,100,50`;
|
|
19
|
+
|
|
20
|
+
category('Data to Curves', () => {
|
|
21
|
+
test('wells group into one curve per compound, assay, target and run', async () => {
|
|
22
|
+
const wells = DG.DataFrame.fromCsv(WELLS);
|
|
23
|
+
const col = (name: string) => wells.col(name)!;
|
|
24
|
+
const curves = await convertDataToCurves(wells, col('concentration_uM'), col('inhibition'), col('batch_id'),
|
|
25
|
+
col('assay_name'), col('run_id'), col('compound_id'), col('target_entity'));
|
|
26
|
+
const values = (name: string) => curves.col(name)!.toList().join(', ');
|
|
27
|
+
expect(curves.rowCount, 3);
|
|
28
|
+
expect(curves.col('Fitted Curve')!.semType, 'fit');
|
|
29
|
+
expect(values('Compound|Assay|Target'), 'C1 | A | T, C1 | A | T, C2 | A | T');
|
|
30
|
+
expect(values('Run ID'), 'R1, R2, R1');
|
|
31
|
+
expect(values('Max Percent Inhibition'), '95, 90, 50');
|
|
32
|
+
expect(values('Max Percent Inhibition (Compound | Assay | Target)'), '95, 95, 50');
|
|
33
|
+
});
|
|
34
|
+
});
|
package/src/tests/fit-tests.ts
CHANGED
|
@@ -241,6 +241,18 @@ category('fit', () => {
|
|
|
241
241
|
expect(fit.bottom, curve.parameters[3]);
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
+
test('4PL dose-response fits the Hill slope of a dilution series', async () => {
|
|
245
|
+
// a falling curve sampled at 3-fold dilutions: started at a Hill slope of 10, the fit stayed a step
|
|
246
|
+
const series: IFitSeries = {fitFunction: FIT_FUNCTION_4PL_DOSE_RESPONSE, points: Array.from({length: 8}, (_, i) => {
|
|
247
|
+
const x = 10 / Math.pow(3, i);
|
|
248
|
+
return {x, y: 600 + 3600 / (1 + Math.pow(x / 0.3, 1.2))};
|
|
249
|
+
})};
|
|
250
|
+
const fitFunc = fitFunctions[FIT_FUNCTION_4PL_DOSE_RESPONSE];
|
|
251
|
+
const curve = fitSeries(series, fitFunc, undefined, {logX: true, logY: false});
|
|
252
|
+
expectFloat(curve.parameters[1], -1.2, 0.05);
|
|
253
|
+
expectFloat(Math.pow(10, curve.parameters[2]), 0.3, 0.01);
|
|
254
|
+
});
|
|
255
|
+
|
|
244
256
|
test('fillParams custom function', async () => {
|
|
245
257
|
const curve = fitSeries(polynomialSeries, polynomialFitFunc);
|
|
246
258
|
const fit = polynomialFitFunc.fillParams(curve, polynomialSeries) as JSFunctionFit;
|