@datagrok/curves 1.10.2 → 1.10.3

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/dist/package.js CHANGED
@@ -8165,7 +8165,7 @@ function dataToCurvesUI() {
8165
8165
  onClick: 'Select'
8166
8166
  });
8167
8167
  tv.dockManager.dock(trellis, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.TOP, tv.dockManager.findNode(tv.grid.root), 'Fitted Curves', 0.5);
8168
- const selectionGrid = tv.addViewer(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.VIEWER.GRID, { rowSource: 'Selected', selectedRowsColor: datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Color.white });
8168
+ const selectionGrid = tv.addViewer(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.VIEWER.GRID, { rowSource: datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.RowSet.FilteredSelected, selectedRowsColor: datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Color.white });
8169
8169
  tv.dockManager.dock(selectionGrid, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.FILL, tv.dockManager.findNode(tv.grid.root), 'Selected Curves');
8170
8170
  selectionGrid.props.title = 'Selected Curves';
8171
8171
  const multiCurveViewer = tv.addViewer('MultiCurveViewer', { showCurrentRowCurve: false, showMouseOverRowCurve: false, showSelectedRowsCurves: true });
@@ -8202,7 +8202,7 @@ function dataToCurvesUI() {
8202
8202
  }
8203
8203
  function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData, joinInfo) {
8204
8204
  return __awaiter(this, void 0, void 0, function* () {
8205
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
8205
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
8206
8206
  if (!concentrationCol || !readoutCol || !batchIDCol) {
8207
8207
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('Please fill all required fields');
8208
8208
  throw new Error('Please fill all required fields');
@@ -8250,7 +8250,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8250
8250
  const parentRunIDCol = (_d = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _d === void 0 ? void 0 : _d.col(runIDCol.name);
8251
8251
  const hasParentGrouppingCols = parentCompoundIDCol && parentAssayCol && parentTargetEntityCol && parentRunIDCol;
8252
8252
  const getGroupKey = (row) => `${getCompoundID(row)}||${getAssay(row)}||${getTargetEntity(row)}`;
8253
- const getCurveKey = !hasJoinInfo ? ((row) => `${getGroupKey(row)}||${getRunID(row)}`) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
8253
+ const getCurveName = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
8254
+ const getCurveKey = !hasJoinInfo ? ((row) => getCurveName(row)) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
8254
8255
  const getParentDataCurveKey = !hasJoinInfo ? (hasParentGrouppingCols ? ((row) => { var _a, _b, _c, _d; return `${(_a = parentData.table) === null || _a === void 0 ? void 0 : _a.col(compoundIDCol.name).get(row)}||${(_b = parentData.table) === null || _b === void 0 ? void 0 : _b.col(assayCol.name).get(row)}||${(_c = parentData.table) === null || _c === void 0 ? void 0 : _c.col(targetEntityCol.name).get(row)}||${(_d = parentData.table) === null || _d === void 0 ? void 0 : _d.col(runIDCol.name).get(row)}`; }) :
8255
8256
  ((_row) => null)) : ((row) => `${joinInfo.parentLevelCol.get(row)}`);
8256
8257
  // put the parent data into the parentObj
@@ -8282,13 +8283,15 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8282
8283
  const runID = (_l = getRunID(i)) !== null && _l !== void 0 ? _l : '';
8283
8284
  const groupKey = getGroupKey(i);
8284
8285
  const curveKey = getCurveKey(i);
8286
+ const curveName = getCurveName(i);
8285
8287
  if (!curvesObj[curveKey]) {
8286
- curvesObj[curveKey] = { x: [], y: [], outliers: [], groupKey, runID: runID, info: {
8288
+ curvesObj[curveKey] = { name: curveName, x: [], y: [], outliers: [], groupKey, runID: runID, info: {
8287
8289
  'Assay Name': assay,
8288
8290
  'Batch ID': batchID,
8289
8291
  'Compound ID': compoundID,
8290
8292
  'Target Entity': targetEntity,
8291
8293
  'Run ID': runID,
8294
+ 'Max Percent Inhibition': null, // will be calculated later
8292
8295
  } };
8293
8296
  if (parentData && parentObj[curveKey]) {
8294
8297
  curvesObj[curveKey].info['Reported IC50'] = parentObj[curveKey].reportedIC50;
@@ -8310,6 +8313,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8310
8313
  curve.x.push(concentration);
8311
8314
  curve.y.push(readout);
8312
8315
  curve.outliers.push(outlier);
8316
+ if (!outlier && readout != null || readout != datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.FLOAT_NULL && readout != datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.INT_NULL)
8317
+ curve.info['Max Percent Inhibition'] = Math.max((_p = curve.info['Max Percent Inhibition']) !== null && _p !== void 0 ? _p : -Infinity, readout);
8313
8318
  }
8314
8319
  // create fit series
8315
8320
  const colorHash = {};
@@ -8324,7 +8329,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8324
8329
  const tableColList = [];
8325
8330
  const curvesCol = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.string('Fitted Curve', curvesObjsArray.length);
8326
8331
  curvesCol.init((i) => {
8327
- var _a, _b, _c;
8332
+ var _a, _b, _c, _d, _f, _g;
8328
8333
  const [curveKey, curve] = curvesObjsArray[i];
8329
8334
  const x = curve.x;
8330
8335
  const y = curve.y;
@@ -8332,9 +8337,9 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8332
8337
  const runID = curve.runID;
8333
8338
  const markerType = getMarkerType(runID);
8334
8339
  const params = parentObj[curveKey] ? parentObj[curveKey].fitParams : undefined;
8335
- const colorKey = ((_a = curve.info['Assay Name']) !== null && _a !== void 0 ? _a : '') + '||' + ((_b = curve.info['Target Entity']) !== null && _b !== void 0 ? _b : '');
8340
+ const colorKey = ((_a = curve.info['Compound ID']) !== null && _a !== void 0 ? _a : '') + '||' + ((_b = curve.info['Assay Name']) !== null && _b !== void 0 ? _b : '') + '||' + ((_c = curve.info['Target Entity']) !== null && _c !== void 0 ? _c : '');
8336
8341
  const color = getColor(colorKey);
8337
- const fitFunctionName = ((_c = parentObj === null || parentObj === void 0 ? void 0 : parentObj[curveKey]) === null || _c === void 0 ? void 0 : _c.fitFunction) ? parentObj[curveKey].fitFunction : _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_0__.FIT_FUNCTION_4PL_DOSE_RESPONSE;
8342
+ const fitFunctionName = ((_d = parentObj === null || parentObj === void 0 ? void 0 : parentObj[curveKey]) === null || _d === void 0 ? void 0 : _d.fitFunction) ? parentObj[curveKey].fitFunction : _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_0__.FIT_FUNCTION_4PL_DOSE_RESPONSE;
8338
8343
  const s = {
8339
8344
  fit: undefined, fitFunction: fitFunctionName, clickToToggle: true, droplines: ['IC50'], name: `${runID}`,
8340
8345
  points: x.map((xv, i) => ({ x: xv, y: y[i], outlier: outliers[i], marker: markerType, size: 5 })).sort((a, b) => a.x - b.x), parameters: params, fitLineColor: color, pointColor: datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Color.toHtml(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Color.gray)
@@ -8344,7 +8349,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8344
8349
  xAxisName: concentrationCol.name,
8345
8350
  yAxisName: readoutCol.name,
8346
8351
  logX: true,
8347
- title: `${curveKey}`,
8352
+ title: `${(_g = (_f = curve.name) !== null && _f !== void 0 ? _f : curveKey) !== null && _g !== void 0 ? _g : ''}`,
8348
8353
  },
8349
8354
  series: [s],
8350
8355
  };
@@ -8376,7 +8381,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8376
8381
  grouppedValues[groupKey] = { maxYs: [], reportedIC50s: [], qualifiedIC50s: [] };
8377
8382
  grouppedValues[groupKey].maxYs.push(Math.max(...curve.y.filter((_, i) => !curve.outliers[i])));
8378
8383
  if (parentData && parentObj[curveKey]) {
8379
- if ((_p = parentObj[curveKey].reportedQualifiedIC50) !== null && _p !== void 0 ? _p : '' != '') {
8384
+ if ((_q = parentObj[curveKey].reportedQualifiedIC50) !== null && _q !== void 0 ? _q : '' != '') {
8380
8385
  grouppedValues[groupKey].qualifiedIC50s.push(parentObj[curveKey].reportedQualifiedIC50);
8381
8386
  let ic50 = getNumericValue(parentData.reportedQualifiedIC50Column ? parentObj[curveKey].reportedQualifiedIC50 : parentObj[curveKey].reportedIC50);
8382
8387
  if (ic50 == undefined) {
@@ -8394,11 +8399,11 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8394
8399
  const grouppedAggregations = {};
8395
8400
  for (const groupKey in grouppedValues) {
8396
8401
  const values = grouppedValues[groupKey];
8397
- grouppedAggregations[groupKey] = Object.assign({ 'Max Percent Inhibition': values.maxYs.length ? (_q = Math.max(...values.maxYs)) === null || _q === void 0 ? void 0 : _q.toString() : null }, (parentData && parentData.table ? {
8398
- 'Number of total results': (_r = values.qualifiedIC50s.length) === null || _r === void 0 ? void 0 : _r.toString(),
8399
- 'Number of reported results': (_s = values.reportedIC50s.length) === null || _s === void 0 ? void 0 : _s.toString(),
8400
- 'Geomean IC50': values.reportedIC50s.length ? (_t = (Math.exp(values.reportedIC50s.reduce((a, b) => a + Math.log(b), 0) / values.reportedIC50s.length) || null)) === null || _t === void 0 ? void 0 : _t.toString() : null, // log based, better for small values
8401
- 'Standard Deviation': values.reportedIC50s.length > 1 ? (_u = Math.sqrt(values.reportedIC50s.reduce((a, b) => a + Math.pow((b - values.reportedIC50s.reduce((c, d) => c + d, 0) / values.reportedIC50s.length), 2), 0) / (values.reportedIC50s.length - 1))) === null || _u === void 0 ? void 0 : _u.toString() : null,
8402
+ grouppedAggregations[groupKey] = Object.assign({ 'Max Percent Inhibition (Compound | Assay | Target)': values.maxYs.length ? (_r = Math.max(...values.maxYs)) === null || _r === void 0 ? void 0 : _r.toString() : null }, (parentData && parentData.table ? {
8403
+ 'Number of total results': (_s = values.qualifiedIC50s.length) === null || _s === void 0 ? void 0 : _s.toString(),
8404
+ 'Number of reported results': (_t = values.reportedIC50s.length) === null || _t === void 0 ? void 0 : _t.toString(),
8405
+ 'Geomean IC50': values.reportedIC50s.length ? (_u = (Math.exp(values.reportedIC50s.reduce((a, b) => a + Math.log(b), 0) / values.reportedIC50s.length) || null)) === null || _u === void 0 ? void 0 : _u.toString() : null, // log based, better for small values
8406
+ 'Standard Deviation': values.reportedIC50s.length > 1 ? (_v = Math.sqrt(values.reportedIC50s.reduce((a, b) => a + Math.pow((b - values.reportedIC50s.reduce((c, d) => c + d, 0) / values.reportedIC50s.length), 2), 0) / (values.reportedIC50s.length - 1))) === null || _v === void 0 ? void 0 : _v.toString() : null,
8402
8407
  'All Results': values.qualifiedIC50s.join(', ')
8403
8408
  } : {}));
8404
8409
  }
@@ -9783,7 +9788,7 @@ let MultiCurveViewer = MultiCurveViewer_1 = class MultiCurveViewer extends datag
9783
9788
  this.rows.push(this.dataFrame.mouseOverRowIdx);
9784
9789
  if (this.showSelectedRowsCurves) {
9785
9790
  selectionStart = this.rows.length;
9786
- this.rows.push(...this.dataFrame.selection.getSelectedIndexes());
9791
+ this.rows.push(...this.dataFrame.selection.clone().and(this.dataFrame.filter).getSelectedIndexes());
9787
9792
  }
9788
9793
  }
9789
9794
  this.data = new _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_4__.FitChartData();