@datagrok/curves 1.12.1 → 1.12.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Curves changelog
2
2
 
3
+ ## v.next
4
+
5
+ * GROK-20232: Fit renderer: degrade gracefully on malformed fit-cell JSON instead of throwing on every grid redraw
6
+
3
7
  ## 1.12.0 (2026-04-02)
4
8
 
5
9
  ### Features
@@ -9475,7 +9475,15 @@ function parseCellValue(cellValue, column) {
9475
9475
  if (!cellValue || cellValue === '')
9476
9476
  return { series: [] };
9477
9477
  const jsonStr = column ? convertCellValue(cellValue, column) : cellValue;
9478
- return (_a = JSON.parse(jsonStr !== null && jsonStr !== void 0 ? jsonStr : '{}')) !== null && _a !== void 0 ? _a : {};
9478
+ try {
9479
+ return (_a = JSON.parse(jsonStr !== null && jsonStr !== void 0 ? jsonStr : '{}')) !== null && _a !== void 0 ? _a : {};
9480
+ }
9481
+ catch (_e) {
9482
+ // Cell value is not valid fit JSON (e.g. a column mis-detected as 'fit' via a substring match).
9483
+ // Degrade to an empty chart so the renderer hits the existing 'No series to show' path and draws the
9484
+ // incorrect-fit marker, instead of throwing a SyntaxError on every grid redraw.
9485
+ return { series: [] };
9486
+ }
9479
9487
  }
9480
9488
  /** Returns true if the column uses a non-native format (has a converter). */
9481
9489
  function hasConverter(column) {
@@ -12356,15 +12364,17 @@ function _initCurves() {
12356
12364
  yield _package__WEBPACK_IMPORTED_MODULE_0__.PackageFunctions._initCurves();
12357
12365
  });
12358
12366
  }
12367
+ //name: Fit Dose-Response Curves
12368
+ //description: Group well-level assay data by compound, assay, target, and run, then fit a dose-response curve per group.
12359
12369
  //input: dataframe df
12360
- //input: column concentrationCol
12361
- //input: column readoutCol
12362
- //input: column batchIDCol
12363
- //input: column assayCol
12364
- //input: column runIDCol
12365
- //input: column compoundIDCol
12366
- //input: column targetEntityCol
12367
- //input: column excludeOutliersCol { nullable: true }
12370
+ //input: column concentrationCol { description: Concentration (dose) column }
12371
+ //input: column readoutCol { description: Readout (response) column }
12372
+ //input: column batchIDCol { description: Batch identifier column }
12373
+ //input: column assayCol { description: Assay name column }
12374
+ //input: column runIDCol { description: Run identifier column }
12375
+ //input: column compoundIDCol { description: Compound identifier column }
12376
+ //input: column targetEntityCol { description: Target entity column }
12377
+ //input: column excludeOutliersCol { nullable: true; description: Boolean column marking points to exclude as outliers }
12368
12378
  //input: dataframe parentTable { nullable: true }
12369
12379
  //input: list<string> fitParamColumns { nullable: true }
12370
12380
  //input: string reportedIC50Column { nullable: true }
@@ -12388,20 +12398,24 @@ function dataToCurvesTopMenu() {
12388
12398
  return yield _package__WEBPACK_IMPORTED_MODULE_0__.PackageFunctions.dataToCurvesTopMenu();
12389
12399
  });
12390
12400
  }
12401
+ //name: Add Curve Statistic Column
12402
+ //description: Extract a fit statistic (e.g. IC50, AUC, R²) from a specific curve series into a new column.
12391
12403
  //input: dataframe table
12392
- //input: string colName
12393
- //input: string propName
12394
- //input: int seriesNumber
12404
+ //input: string colName { description: Name of the curve column to read }
12405
+ //input: string propName { description: Fit statistic to extract (e.g. IC50, AUC, R²) }
12406
+ //input: int seriesNumber { description: Zero-based index of the curve series }
12395
12407
  //output: column result
12396
12408
  //meta.vectorFunc: true
12397
12409
  //meta.role: transform
12398
12410
  function addStatisticsColumn(table, colName, propName, seriesNumber) {
12399
12411
  return _package__WEBPACK_IMPORTED_MODULE_0__.PackageFunctions.addStatisticsColumn(table, colName, propName, seriesNumber);
12400
12412
  }
12413
+ //name: Add Aggregated Curve Statistic Column
12414
+ //description: Aggregate a fit statistic across all series of a curve into a new column.
12401
12415
  //input: dataframe table
12402
- //input: string colName
12403
- //input: string propName
12404
- //input: string aggrType
12416
+ //input: string colName { description: Name of the curve column to read }
12417
+ //input: string propName { description: Fit statistic to aggregate (e.g. IC50, AUC, R²) }
12418
+ //input: string aggrType { description: Aggregation type applied across series (e.g. avg, min, max) }
12405
12419
  //output: column result
12406
12420
  //meta.vectorFunc: true
12407
12421
  //meta.role: transform
@@ -12438,7 +12452,8 @@ function previewPzfx(file) {
12438
12452
  return yield _package__WEBPACK_IMPORTED_MODULE_0__.PackageFunctions.previewPzfx(file);
12439
12453
  });
12440
12454
  }
12441
- //input: list bytes
12455
+ //description: Open a GraphPad Prism (.pzfx) file as data tables, fitting XY curve tables.
12456
+ //input: list bytes { description: Raw bytes of the .pzfx file }
12442
12457
  //output: list<dataframe> result
12443
12458
  //meta.role: fileHandler
12444
12459
  //meta.ext: pzfx
@@ -12728,8 +12743,18 @@ __decorate([
12728
12743
  __metadata("design:returntype", Promise)
12729
12744
  ], PackageFunctions, "_initCurves", null);
12730
12745
  __decorate([
12731
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func(),
12732
- __param(8, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12746
+ datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({
12747
+ name: 'Fit Dose-Response Curves',
12748
+ description: 'Group well-level assay data by compound, assay, target, and run, then fit a dose-response curve per group.',
12749
+ }),
12750
+ __param(1, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Concentration (dose) column' } })),
12751
+ __param(2, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Readout (response) column' } })),
12752
+ __param(3, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Batch identifier column' } })),
12753
+ __param(4, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Assay name column' } })),
12754
+ __param(5, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Run identifier column' } })),
12755
+ __param(6, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Compound identifier column' } })),
12756
+ __param(7, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Target entity column' } })),
12757
+ __param(8, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true, description: 'Boolean column marking points to exclude as outliers' } })),
12733
12758
  __param(9, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12734
12759
  __param(10, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12735
12760
  __param(11, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
@@ -12751,14 +12776,27 @@ __decorate([
12751
12776
  __metadata("design:returntype", Promise)
12752
12777
  ], PackageFunctions, "dataToCurvesTopMenu", null);
12753
12778
  __decorate([
12754
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({ meta: { vectorFunc: 'true', role: 'transform' } }),
12755
- __param(3, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ type: 'int' })),
12779
+ datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({
12780
+ name: 'Add Curve Statistic Column',
12781
+ description: 'Extract a fit statistic (e.g. IC50, AUC, R²) from a specific curve series into a new column.',
12782
+ meta: { vectorFunc: 'true', role: 'transform' },
12783
+ }),
12784
+ __param(1, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Name of the curve column to read' } })),
12785
+ __param(2, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Fit statistic to extract (e.g. IC50, AUC, R²)' } })),
12786
+ __param(3, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ type: 'int', options: { description: 'Zero-based index of the curve series' } })),
12756
12787
  __metadata("design:type", Function),
12757
12788
  __metadata("design:paramtypes", [datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, String, String, Number]),
12758
12789
  __metadata("design:returntype", datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column)
12759
12790
  ], PackageFunctions, "addStatisticsColumn", null);
12760
12791
  __decorate([
12761
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({ meta: { vectorFunc: 'true', role: 'transform' } }),
12792
+ datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({
12793
+ name: 'Add Aggregated Curve Statistic Column',
12794
+ description: 'Aggregate a fit statistic across all series of a curve into a new column.',
12795
+ meta: { vectorFunc: 'true', role: 'transform' },
12796
+ }),
12797
+ __param(1, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Name of the curve column to read' } })),
12798
+ __param(2, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Fit statistic to aggregate (e.g. IC50, AUC, R²)' } })),
12799
+ __param(3, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { description: 'Aggregation type applied across series (e.g. avg, min, max)' } })),
12762
12800
  __metadata("design:type", Function),
12763
12801
  __metadata("design:paramtypes", [datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, String, String, String]),
12764
12802
  __metadata("design:returntype", datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column)
@@ -12788,8 +12826,11 @@ __decorate([
12788
12826
  __metadata("design:returntype", Promise)
12789
12827
  ], PackageFunctions, "previewPzfx", null);
12790
12828
  __decorate([
12791
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.fileHandler({ ext: 'pzfx' }),
12792
- __param(0, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ type: 'list' })),
12829
+ datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.fileHandler({
12830
+ ext: 'pzfx',
12831
+ description: 'Open a GraphPad Prism (.pzfx) file as data tables, fitting XY curve tables.',
12832
+ }),
12833
+ __param(0, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ type: 'list', options: { description: 'Raw bytes of the .pzfx file' } })),
12793
12834
  __metadata("design:type", Function),
12794
12835
  __metadata("design:paramtypes", [Uint8Array]),
12795
12836
  __metadata("design:returntype", Array)
@@ -12987,6 +13028,11 @@ const SAMPLE_PZFX_WITH_EXCLUSION = `<?xml version="1.0" encoding="UTF-8"?>
12987
13028
  const chartData = (0,_fit_curve_converter__WEBPACK_IMPORTED_MODULE_7__.parseCellValue)('', null);
12988
13029
  (0,_datagrok_libraries_test_src_test__WEBPACK_IMPORTED_MODULE_2__.expect)(chartData.series !== undefined && chartData.series.length === 0, true);
12989
13030
  }));
13031
+ (0,_datagrok_libraries_test_src_test__WEBPACK_IMPORTED_MODULE_2__.test)('parseCellValue.malformedJson', () => __awaiter(void 0, void 0, void 0, function* () {
13032
+ // Unquoted-key value that passes the substring-based fit detection but is not valid JSON.
13033
+ const chartData = (0,_fit_curve_converter__WEBPACK_IMPORTED_MODULE_7__.parseCellValue)('{series: [{name: "A", points: [{x:0,y:50}]}]}', null);
13034
+ (0,_datagrok_libraries_test_src_test__WEBPACK_IMPORTED_MODULE_2__.expect)(chartData.series !== undefined && chartData.series.length === 0, true);
13035
+ }));
12990
13036
  (0,_datagrok_libraries_test_src_test__WEBPACK_IMPORTED_MODULE_2__.test)('converterCaching', () => __awaiter(void 0, void 0, void 0, function* () {
12991
13037
  (0,_fit_curve_converter__WEBPACK_IMPORTED_MODULE_7__.registerCurveConverter)('compact-dr', _fit_converters_compact_dr_converter__WEBPACK_IMPORTED_MODULE_5__.convertCompactDrToJson);
12992
13038
  const df = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.DataFrame.fromColumns([datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.Column.fromStrings('curves', [SAMPLE_COMPACT_DR])]);