@datagrok/curves 1.10.1 → 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.
@@ -9404,7 +9404,7 @@ function createFitFunctionEditor(table) {
9404
9404
  }
9405
9405
  };
9406
9406
  }
9407
- function createParentTableForm() {
9407
+ function createParentTableForm(onTableChange) {
9408
9408
  const tableInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.table('Parent Table', { value: undefined, nullable: true, tooltipText: 'Table with parent data' });
9409
9409
  const form = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.form([]);
9410
9410
  let fitFunctionEditor = null;
@@ -9416,6 +9416,7 @@ function createParentTableForm() {
9416
9416
  const onChanged = () => {
9417
9417
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
9418
9418
  form.appendChild(tableInput.root);
9419
+ onTableChange(tableInput.value);
9419
9420
  if (!tableInput.value) {
9420
9421
  fitFunctionEditor = null;
9421
9422
  return;
@@ -9478,7 +9479,7 @@ function createParentTableForm() {
9478
9479
  }
9479
9480
  };
9480
9481
  }
9481
- function createWellTableForm() {
9482
+ function createWellTableForm(onTableChange) {
9482
9483
  const tableInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.table('Well Table', { value: datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.tv.dataFrame, nullable: false, tooltipText: 'Table with well level data' });
9483
9484
  let assayColInput;
9484
9485
  let concentrationColInput;
@@ -9493,6 +9494,7 @@ function createWellTableForm() {
9493
9494
  var _a, _b, _c, _d, _f, _g, _h, _j;
9494
9495
  const df = tableInput.value;
9495
9496
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
9497
+ onTableChange(tableInput.value);
9496
9498
  assayColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('Assay Name', { table: df, nullable: true, filter: (c) => c.isCategorical, tooltipText: 'Column with assay names' });
9497
9499
  concentrationColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('Concentration', { table: df, nullable: false, filter: (c) => c.isNumerical, tooltipText: 'Column with concentration values' });
9498
9500
  readoutColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('Readout', { table: df, nullable: false, filter: (c) => c.isNumerical, tooltipText: 'Column with readout values' });
@@ -9536,19 +9538,84 @@ function createWellTableForm() {
9536
9538
  }
9537
9539
  };
9538
9540
  }
9541
+ function createJoinEditor() {
9542
+ const form = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.divH([], { style: { alignItems: 'center' } });
9543
+ let wellLevelColInput = null;
9544
+ let parentLevelColInput = null;
9545
+ let wellDataTable = null;
9546
+ let parentDataTable = null;
9547
+ const onTableChange = (wellLevelData, parentLevelData) => {
9548
+ datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
9549
+ if (!wellLevelData || !parentLevelData) {
9550
+ wellLevelColInput = null;
9551
+ parentLevelColInput = null;
9552
+ wellDataTable = null;
9553
+ parentDataTable = null;
9554
+ return;
9555
+ }
9556
+ wellDataTable = wellLevelData;
9557
+ parentDataTable = parentLevelData;
9558
+ wellLevelColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('JOIN', { table: wellLevelData, nullable: true, tooltipText: 'Column to join on from the well level data' });
9559
+ parentLevelColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('ON', { table: parentLevelData, nullable: true, tooltipText: 'Column to join on from the parent level data' });
9560
+ const potentialParentCol = wu__WEBPACK_IMPORTED_MODULE_4___default()(parentLevelData.columns.categorical).map((c) => {
9561
+ let score = c.categories.length;
9562
+ if (c.name.toLowerCase().includes('id'))
9563
+ score += 10;
9564
+ if (c.name.toLowerCase().includes('unique'))
9565
+ score += 15;
9566
+ return { col: c, score: score };
9567
+ }).toArray().sort((a, b) => b.score - a.score)[0];
9568
+ if ((potentialParentCol === null || potentialParentCol === void 0 ? void 0 : potentialParentCol.col) && potentialParentCol.score > 0) {
9569
+ parentLevelColInput.value = potentialParentCol.col;
9570
+ const n = potentialParentCol.col.name.toLowerCase();
9571
+ const potentialWellCol = wu__WEBPACK_IMPORTED_MODULE_4___default()(wellLevelData.columns.categorical).filter((c) => c.name.toLowerCase().includes(n)).toArray()[0];
9572
+ if (potentialWellCol)
9573
+ wellLevelColInput.value = potentialWellCol;
9574
+ }
9575
+ const infoIcon = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.icons.info(() => { }, 'Specify the columns that will be used to join the well level data with the parent level data. if not specified, combination of the compound ID, assay name, target entity and run ID will be used for joining.');
9576
+ datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.appendAll(form, [infoIcon, wellLevelColInput.root, parentLevelColInput.root]);
9577
+ };
9578
+ return {
9579
+ form,
9580
+ getValues: () => ((wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value) && (parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value)) ? ({
9581
+ wellLevelCol: wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value,
9582
+ parentLevelCol: parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value,
9583
+ }) : null,
9584
+ getHistory: () => {
9585
+ var _a, _b, _c, _d;
9586
+ return ((wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value) && (parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value)) ? ({
9587
+ wellLevelCol: (_b = (_a = wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : null,
9588
+ parentLevelCol: (_d = (_c = parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null,
9589
+ }) : null;
9590
+ },
9591
+ applyHistory: (history) => {
9592
+ if (!history.wellLevelCol || !history.parentLevelCol || !wellDataTable || !parentDataTable)
9593
+ return;
9594
+ if (wellLevelColInput && parentLevelColInput) {
9595
+ wellLevelColInput.value = wellDataTable.col(history.wellLevelCol);
9596
+ parentLevelColInput.value = parentDataTable.col(history.parentLevelCol);
9597
+ }
9598
+ },
9599
+ onTableChange: (wellLevelData, parentLevelData) => onTableChange(wellLevelData, parentLevelData),
9600
+ };
9601
+ }
9539
9602
  function dataToCurvesUI() {
9540
9603
  const tv = datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.tv;
9541
9604
  if (!tv || !tv.dataFrame) {
9542
9605
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('No open tableview');
9543
9606
  return;
9544
9607
  }
9545
- const wellLevelForm = createWellTableForm();
9546
- const parentTableForm = createParentTableForm();
9608
+ let wellLevelForm = null;
9609
+ let parentTableForm = null;
9610
+ const joinEditor = createJoinEditor();
9611
+ wellLevelForm = createWellTableForm(() => { var _a, _b, _c; return joinEditor.onTableChange((_b = (_a = wellLevelForm === null || wellLevelForm === void 0 ? void 0 : wellLevelForm.getValues()) === null || _a === void 0 ? void 0 : _a.table) !== null && _b !== void 0 ? _b : null, (_c = parentTableForm === null || parentTableForm === void 0 ? void 0 : parentTableForm.getTable()) !== null && _c !== void 0 ? _c : null); });
9612
+ parentTableForm = createParentTableForm(() => { var _a, _b, _c; return joinEditor.onTableChange((_b = (_a = wellLevelForm === null || wellLevelForm === void 0 ? void 0 : wellLevelForm.getValues()) === null || _a === void 0 ? void 0 : _a.table) !== null && _b !== void 0 ? _b : null, (_c = parentTableForm === null || parentTableForm === void 0 ? void 0 : parentTableForm.getTable()) !== null && _c !== void 0 ? _c : null); });
9547
9613
  const horzForm = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.divH([wellLevelForm.form, parentTableForm.form], { style: { minWidth: '400px', gap: '20px' } });
9548
9614
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.dialog('Data to Curves')
9549
9615
  .add(horzForm)
9616
+ .add(joinEditor.form)
9550
9617
  .onOK(() => __awaiter(this, void 0, void 0, function* () {
9551
- var _a, _b, _c, _d, _f, _g, _h, _j, _k;
9618
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m;
9552
9619
  const formRes = wellLevelForm.getValues();
9553
9620
  let parentLevelData = undefined;
9554
9621
  const parentTable = parentTableForm.getTable();
@@ -9566,6 +9633,7 @@ function dataToCurvesUI() {
9566
9633
  additionalColumns: (_a = parentFormValues.additionalColumns) !== null && _a !== void 0 ? _a : [],
9567
9634
  };
9568
9635
  }
9636
+ const joinValues = joinEditor.getValues();
9569
9637
  const { table, assayCol, batchIDCol, concentrationCol, readoutCol, compoundIDCol, excludeOutliersCol, runIDCol, targetEntityCol } = formRes;
9570
9638
  const func = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Func.find({ name: 'dataToCurves' })[0];
9571
9639
  if (!func) {
@@ -9592,6 +9660,9 @@ function dataToCurvesUI() {
9592
9660
  experimentIDColumn: (_g = parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.experimentIDColumn) === null || _g === void 0 ? void 0 : _g.name,
9593
9661
  qualifierColumn: (_h = parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.qualifierColumn) === null || _h === void 0 ? void 0 : _h.name,
9594
9662
  additionalColumns: (_k = (_j = parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.additionalColumns) === null || _j === void 0 ? void 0 : _j.map((c) => c.name)) !== null && _k !== void 0 ? _k : [],
9663
+ // joinInfo
9664
+ wellLevelJoinCol: (_l = joinValues === null || joinValues === void 0 ? void 0 : joinValues.wellLevelCol) === null || _l === void 0 ? void 0 : _l.name,
9665
+ parentLevelJoinCol: (_m = joinValues === null || joinValues === void 0 ? void 0 : joinValues.parentLevelCol) === null || _m === void 0 ? void 0 : _m.name,
9595
9666
  });
9596
9667
  console.log(fc.toString());
9597
9668
  const needsCreationScript = table.tags[datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Tags.CreationScript] && (!(parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.table) || parentLevelData.table.tags[datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Tags.CreationScript]);
@@ -9608,7 +9679,7 @@ function dataToCurvesUI() {
9608
9679
  onClick: 'Select'
9609
9680
  });
9610
9681
  tv.dockManager.dock(trellis, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.TOP, tv.dockManager.findNode(tv.grid.root), 'Fitted Curves', 0.5);
9611
- 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 });
9682
+ 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 });
9612
9683
  tv.dockManager.dock(selectionGrid, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.FILL, tv.dockManager.findNode(tv.grid.root), 'Selected Curves');
9613
9684
  selectionGrid.props.title = 'Selected Curves';
9614
9685
  const multiCurveViewer = tv.addViewer('MultiCurveViewer', { showCurrentRowCurve: false, showMouseOverRowCurve: false, showSelectedRowsCurves: true });
@@ -9619,7 +9690,7 @@ function dataToCurvesUI() {
9619
9690
  }))
9620
9691
  .show()
9621
9692
  .history(() => {
9622
- var _a, _b;
9693
+ var _a, _b, _c;
9623
9694
  const formRes = wellLevelForm.getValues();
9624
9695
  const { assayCol, batchIDCol, concentrationCol, readoutCol, compoundIDCol, excludeOutliersCol, runIDCol, targetEntityCol } = formRes;
9625
9696
  const obj = {
@@ -9632,18 +9703,20 @@ function dataToCurvesUI() {
9632
9703
  runIDCol: runIDCol === null || runIDCol === void 0 ? void 0 : runIDCol.name,
9633
9704
  targetEntityCol: targetEntityCol === null || targetEntityCol === void 0 ? void 0 : targetEntityCol.name,
9634
9705
  };
9635
- return { wells: JSON.stringify((_a = Object.fromEntries(Object.entries(obj).filter(([_, v]) => !!v))) !== null && _a !== void 0 ? _a : {}), parent: JSON.stringify((_b = parentTableForm.getHistory()) !== null && _b !== void 0 ? _b : {}) };
9706
+ return { wells: JSON.stringify((_a = Object.fromEntries(Object.entries(obj).filter(([_, v]) => !!v))) !== null && _a !== void 0 ? _a : {}), parent: JSON.stringify((_b = parentTableForm.getHistory()) !== null && _b !== void 0 ? _b : {}), join: JSON.stringify((_c = joinEditor.getHistory()) !== null && _c !== void 0 ? _c : {}) };
9636
9707
  }, (v) => {
9637
- var _a, _b;
9708
+ var _a, _b, _c;
9638
9709
  const wells = JSON.parse((_a = v === null || v === void 0 ? void 0 : v.wells) !== null && _a !== void 0 ? _a : '{}');
9639
9710
  const parent = JSON.parse((_b = v === null || v === void 0 ? void 0 : v.parent) !== null && _b !== void 0 ? _b : '{}');
9640
9711
  wellLevelForm.applyHistory(wells);
9641
9712
  parentTableForm.applyHistory(parent);
9713
+ const joinHistory = JSON.parse((_c = v === null || v === void 0 ? void 0 : v.join) !== null && _c !== void 0 ? _c : '{}');
9714
+ joinEditor.applyHistory(joinHistory);
9642
9715
  });
9643
9716
  }
9644
- function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData) {
9717
+ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData, joinInfo) {
9645
9718
  return __awaiter(this, void 0, void 0, function* () {
9646
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
9719
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
9647
9720
  if (!concentrationCol || !readoutCol || !batchIDCol) {
9648
9721
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('Please fill all required fields');
9649
9722
  throw new Error('Please fill all required fields');
@@ -9684,21 +9757,27 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9684
9757
  return markerType;
9685
9758
  }
9686
9759
  };
9760
+ const hasJoinInfo = !!((joinInfo === null || joinInfo === void 0 ? void 0 : joinInfo.parentLevelCol) && (joinInfo === null || joinInfo === void 0 ? void 0 : joinInfo.wellLevelCol));
9761
+ const parentCompoundIDCol = (_a = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _a === void 0 ? void 0 : _a.col(compoundIDCol.name);
9762
+ const parentAssayCol = (_b = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _b === void 0 ? void 0 : _b.col(assayCol.name);
9763
+ const parentTargetEntityCol = (_c = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _c === void 0 ? void 0 : _c.col(targetEntityCol.name);
9764
+ const parentRunIDCol = (_d = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _d === void 0 ? void 0 : _d.col(runIDCol.name);
9765
+ const hasParentGrouppingCols = parentCompoundIDCol && parentAssayCol && parentTargetEntityCol && parentRunIDCol;
9687
9766
  const getGroupKey = (row) => `${getCompoundID(row)}||${getAssay(row)}||${getTargetEntity(row)}`;
9688
- const getCurveKey = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
9689
- const getParentDataCurveKey = parentData && ((_a = parentData.table) === null || _a === void 0 ? void 0 : _a.col(compoundIDCol.name)) && parentData.table.col(assayCol.name) && parentData.table.col(targetEntityCol.name) &&
9690
- parentData.table.col(runIDCol.name) ? (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)}`; } :
9691
- (_row) => null;
9767
+ const getCurveName = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
9768
+ const getCurveKey = !hasJoinInfo ? ((row) => getCurveName(row)) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
9769
+ 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)}`; }) :
9770
+ ((_row) => null)) : ((row) => `${joinInfo.parentLevelCol.get(row)}`);
9692
9771
  // put the parent data into the parentObj
9693
9772
  const parentObj = {};
9694
9773
  if (parentData) {
9695
- for (let i = 0; i < ((_c = (_b = parentData.table) === null || _b === void 0 ? void 0 : _b.rowCount) !== null && _c !== void 0 ? _c : 0); i++) {
9774
+ for (let i = 0; i < ((_g = (_f = parentData.table) === null || _f === void 0 ? void 0 : _f.rowCount) !== null && _g !== void 0 ? _g : 0); i++) {
9696
9775
  const curveKey = getParentDataCurveKey ? getParentDataCurveKey(i) : null;
9697
9776
  if (!curveKey || parentObj[curveKey])
9698
9777
  continue;
9699
9778
  parentObj[curveKey] = {
9700
- fitParams: (_f = (_d = parentData.fitParamColumns) === null || _d === void 0 ? void 0 : _d.map((c) => c.get(i))) !== null && _f !== void 0 ? _f : [],
9701
- fitFunction: (_g = parentData.fitFunction) !== null && _g !== void 0 ? _g : _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_0__.FIT_FUNCTION_4PL_DOSE_RESPONSE,
9779
+ fitParams: (_j = (_h = parentData.fitParamColumns) === null || _h === void 0 ? void 0 : _h.map((c) => c.get(i))) !== null && _j !== void 0 ? _j : [],
9780
+ fitFunction: (_k = parentData.fitFunction) !== null && _k !== void 0 ? _k : _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_0__.FIT_FUNCTION_4PL_DOSE_RESPONSE,
9702
9781
  reportedIC50: parentData.reportedIC50Column ? parentData.reportedIC50Column.get(i) : undefined,
9703
9782
  reportedQualifiedIC50: parentData.reportedQualifiedIC50Column ? parentData.reportedQualifiedIC50Column.get(i) : undefined,
9704
9783
  experimentID: parentData.experimentIDColumn ? parentData.experimentIDColumn.get(i) : undefined,
@@ -9715,16 +9794,18 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9715
9794
  const outlier = isOutlier(i);
9716
9795
  const compoundID = getCompoundID(i);
9717
9796
  const targetEntity = getTargetEntity(i);
9718
- const runID = (_h = getRunID(i)) !== null && _h !== void 0 ? _h : '';
9797
+ const runID = (_l = getRunID(i)) !== null && _l !== void 0 ? _l : '';
9719
9798
  const groupKey = getGroupKey(i);
9720
9799
  const curveKey = getCurveKey(i);
9800
+ const curveName = getCurveName(i);
9721
9801
  if (!curvesObj[curveKey]) {
9722
- curvesObj[curveKey] = { x: [], y: [], outliers: [], groupKey, runID: runID, info: {
9802
+ curvesObj[curveKey] = { name: curveName, x: [], y: [], outliers: [], groupKey, runID: runID, info: {
9723
9803
  'Assay Name': assay,
9724
9804
  'Batch ID': batchID,
9725
9805
  'Compound ID': compoundID,
9726
9806
  'Target Entity': targetEntity,
9727
9807
  'Run ID': runID,
9808
+ 'Max Percent Inhibition': null, // will be calculated later
9728
9809
  } };
9729
9810
  if (parentData && parentObj[curveKey]) {
9730
9811
  curvesObj[curveKey].info['Reported IC50'] = parentObj[curveKey].reportedIC50;
@@ -9734,7 +9815,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9734
9815
  if (parentObj[curveKey].additionalColumns)
9735
9816
  Object.assign(curvesObj[curveKey].info, parentObj[curveKey].additionalColumns);
9736
9817
  if (parentObj[curveKey].fitParams && parentObj[curveKey].fitParams.length > 0) {
9737
- for (let j = 0; j < ((_k = (_j = parentData.fitParamColumns) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0); j++) {
9818
+ for (let j = 0; j < ((_o = (_m = parentData.fitParamColumns) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0); j++) {
9738
9819
  const paramName = parentData.fitParamColumns[j].name;
9739
9820
  curvesObj[curveKey].info[paramName] = parentObj[curveKey].fitParams[j];
9740
9821
  }
@@ -9746,6 +9827,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9746
9827
  curve.x.push(concentration);
9747
9828
  curve.y.push(readout);
9748
9829
  curve.outliers.push(outlier);
9830
+ if (!outlier && readout != null || readout != datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.FLOAT_NULL && readout != datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.INT_NULL)
9831
+ curve.info['Max Percent Inhibition'] = Math.max((_p = curve.info['Max Percent Inhibition']) !== null && _p !== void 0 ? _p : -Infinity, readout);
9749
9832
  }
9750
9833
  // create fit series
9751
9834
  const colorHash = {};
@@ -9760,7 +9843,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9760
9843
  const tableColList = [];
9761
9844
  const curvesCol = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.string('Fitted Curve', curvesObjsArray.length);
9762
9845
  curvesCol.init((i) => {
9763
- var _a, _b, _c;
9846
+ var _a, _b, _c, _d, _f, _g;
9764
9847
  const [curveKey, curve] = curvesObjsArray[i];
9765
9848
  const x = curve.x;
9766
9849
  const y = curve.y;
@@ -9768,9 +9851,9 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9768
9851
  const runID = curve.runID;
9769
9852
  const markerType = getMarkerType(runID);
9770
9853
  const params = parentObj[curveKey] ? parentObj[curveKey].fitParams : undefined;
9771
- const colorKey = ((_a = curve.info['Assay Name']) !== null && _a !== void 0 ? _a : '') + '||' + ((_b = curve.info['Target Entity']) !== null && _b !== void 0 ? _b : '');
9854
+ 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 : '');
9772
9855
  const color = getColor(colorKey);
9773
- 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;
9856
+ 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;
9774
9857
  const s = {
9775
9858
  fit: undefined, fitFunction: fitFunctionName, clickToToggle: true, droplines: ['IC50'], name: `${runID}`,
9776
9859
  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)
@@ -9780,7 +9863,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9780
9863
  xAxisName: concentrationCol.name,
9781
9864
  yAxisName: readoutCol.name,
9782
9865
  logX: true,
9783
- title: `${curveKey}`,
9866
+ title: `${(_g = (_f = curve.name) !== null && _f !== void 0 ? _f : curveKey) !== null && _g !== void 0 ? _g : ''}`,
9784
9867
  },
9785
9868
  series: [s],
9786
9869
  };
@@ -9812,7 +9895,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9812
9895
  grouppedValues[groupKey] = { maxYs: [], reportedIC50s: [], qualifiedIC50s: [] };
9813
9896
  grouppedValues[groupKey].maxYs.push(Math.max(...curve.y.filter((_, i) => !curve.outliers[i])));
9814
9897
  if (parentData && parentObj[curveKey]) {
9815
- if ((_l = parentObj[curveKey].reportedQualifiedIC50) !== null && _l !== void 0 ? _l : '' != '') {
9898
+ if ((_q = parentObj[curveKey].reportedQualifiedIC50) !== null && _q !== void 0 ? _q : '' != '') {
9816
9899
  grouppedValues[groupKey].qualifiedIC50s.push(parentObj[curveKey].reportedQualifiedIC50);
9817
9900
  let ic50 = getNumericValue(parentData.reportedQualifiedIC50Column ? parentObj[curveKey].reportedQualifiedIC50 : parentObj[curveKey].reportedIC50);
9818
9901
  if (ic50 == undefined) {
@@ -9830,11 +9913,11 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
9830
9913
  const grouppedAggregations = {};
9831
9914
  for (const groupKey in grouppedValues) {
9832
9915
  const values = grouppedValues[groupKey];
9833
- grouppedAggregations[groupKey] = Object.assign({ 'Max Percent Inhibition': values.maxYs.length ? (_m = Math.max(...values.maxYs)) === null || _m === void 0 ? void 0 : _m.toString() : null }, (parentData && parentData.table ? {
9834
- 'Number of total results': (_o = values.qualifiedIC50s.length) === null || _o === void 0 ? void 0 : _o.toString(),
9835
- 'Number of reported results': (_p = values.reportedIC50s.length) === null || _p === void 0 ? void 0 : _p.toString(),
9836
- 'Geomean IC50': values.reportedIC50s.length ? (_q = (Math.exp(values.reportedIC50s.reduce((a, b) => a + Math.log(b), 0) / values.reportedIC50s.length) || null)) === null || _q === void 0 ? void 0 : _q.toString() : null, // log based, better for small values
9837
- 'Standard Deviation': values.reportedIC50s.length > 1 ? (_r = 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 || _r === void 0 ? void 0 : _r.toString() : null,
9916
+ 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 ? {
9917
+ 'Number of total results': (_s = values.qualifiedIC50s.length) === null || _s === void 0 ? void 0 : _s.toString(),
9918
+ 'Number of reported results': (_t = values.reportedIC50s.length) === null || _t === void 0 ? void 0 : _t.toString(),
9919
+ '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
9920
+ '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,
9838
9921
  'All Results': values.qualifiedIC50s.join(', ')
9839
9922
  } : {}));
9840
9923
  }
@@ -11219,7 +11302,7 @@ let MultiCurveViewer = MultiCurveViewer_1 = class MultiCurveViewer extends datag
11219
11302
  this.rows.push(this.dataFrame.mouseOverRowIdx);
11220
11303
  if (this.showSelectedRowsCurves) {
11221
11304
  selectionStart = this.rows.length;
11222
- this.rows.push(...this.dataFrame.selection.getSelectedIndexes());
11305
+ this.rows.push(...this.dataFrame.selection.clone().and(this.dataFrame.filter).getSelectedIndexes());
11223
11306
  }
11224
11307
  }
11225
11308
  this.data = new _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_4__.FitChartData();
@@ -11876,12 +11959,12 @@ var queries;
11876
11959
  })(queries || (queries = {}));
11877
11960
  var funcs;
11878
11961
  (function (funcs) {
11879
- function platesAppTreeBrowser(treeNode, browseView) {
11962
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
11880
11963
  return __awaiter(this, void 0, void 0, function* () {
11881
- return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowser', { treeNode, browseView });
11964
+ return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode, browseView });
11882
11965
  });
11883
11966
  }
11884
- funcs.platesAppTreeBrowser = platesAppTreeBrowser;
11967
+ funcs.platesAppTreeBrowserTempDisabled = platesAppTreeBrowserTempDisabled;
11885
11968
  function fitChartCellRenderer() {
11886
11969
  return __awaiter(this, void 0, void 0, function* () {
11887
11970
  return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:FitChartCellRenderer', {});
@@ -12048,7 +12131,6 @@ __webpack_require__.r(__webpack_exports__);
12048
12131
  /* harmony export */ getPlateByBarcode: () => (/* binding */ getPlateByBarcode),
12049
12132
  /* harmony export */ importPlate: () => (/* binding */ importPlate),
12050
12133
  /* harmony export */ importPlateXlsx: () => (/* binding */ importPlateXlsx),
12051
- /* harmony export */ platesApp: () => (/* binding */ platesApp),
12052
12134
  /* harmony export */ platesFolderPreview: () => (/* binding */ platesFolderPreview),
12053
12135
  /* harmony export */ previewPlate: () => (/* binding */ previewPlate),
12054
12136
  /* harmony export */ previewPlateXlsx: () => (/* binding */ previewPlateXlsx)
@@ -12128,10 +12210,12 @@ function _initCurves() {
12128
12210
  //input: string experimentIDColumn { nullable: true }
12129
12211
  //input: string qualifierColumn { nullable: true }
12130
12212
  //input: list<string> additionalColumns { nullable: true }
12213
+ //input: string wellLevelJoinCol { nullable: true }
12214
+ //input: string parentLevelJoinCol { nullable: true }
12131
12215
  //output: dataframe result
12132
- function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
12216
+ function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
12133
12217
  return __awaiter(this, void 0, void 0, function* () {
12134
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns);
12218
+ return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol);
12135
12219
  });
12136
12220
  }
12137
12221
  //name: dataToCurvesTopMenu
@@ -12229,13 +12313,6 @@ function checkExcelIsPlate(content) {
12229
12313
  function checkFileIsPlate(content) {
12230
12314
  return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.checkFileIsPlate(content);
12231
12315
  }
12232
- //name: Browse
12233
- //tags: app
12234
- //output: view result
12235
- //meta.browsePath: Plates
12236
- function platesApp() {
12237
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.platesApp();
12238
- }
12239
12316
  //name: getPlateByBarcode
12240
12317
  //input: string barcode
12241
12318
  //output: dynamic result
@@ -12297,8 +12374,7 @@ __webpack_require__.r(__webpack_exports__);
12297
12374
  /* harmony export */ getPlateByBarcode: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.getPlateByBarcode),
12298
12375
  /* harmony export */ importPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlate),
12299
12376
  /* harmony export */ importPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlateXlsx),
12300
- /* harmony export */ platesApp: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesApp),
12301
- /* harmony export */ platesAppTreeBrowser: () => (/* binding */ platesAppTreeBrowser),
12377
+ /* harmony export */ platesAppTreeBrowserTempDisabled: () => (/* binding */ platesAppTreeBrowserTempDisabled),
12302
12378
  /* harmony export */ platesFolderPreview: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesFolderPreview),
12303
12379
  /* harmony export */ previewPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlate),
12304
12380
  /* harmony export */ previewPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlateXlsx)
@@ -12405,10 +12481,14 @@ class PackageFunctions {
12405
12481
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plate_plate_cell_renderer__WEBPACK_IMPORTED_MODULE_8__.PlateCellHandler());
12406
12482
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plates_objects_plate_template_handler__WEBPACK_IMPORTED_MODULE_17__.PlateTemplateHandler());
12407
12483
  }
12408
- static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
12484
+ static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
12409
12485
  return __awaiter(this, void 0, void 0, function* () {
12410
12486
  var _a, _b, _c, _d;
12411
12487
  const pt = parentTable;
12488
+ const joinInfo = pt && wellLevelJoinCol && parentLevelJoinCol && df.col(wellLevelJoinCol) && pt.col(parentLevelJoinCol) ? {
12489
+ wellLevelCol: df.col(wellLevelJoinCol),
12490
+ parentLevelCol: pt.col(parentLevelJoinCol),
12491
+ } : undefined;
12412
12492
  // this needs to work with datasync so we use wide format
12413
12493
  return (0,_fit_data_to_curves__WEBPACK_IMPORTED_MODULE_19__.convertDataToCurves)(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, {
12414
12494
  table: pt,
@@ -12418,7 +12498,7 @@ class PackageFunctions {
12418
12498
  experimentIDColumn: experimentIDColumn ? (_c = pt === null || pt === void 0 ? void 0 : pt.col(experimentIDColumn)) !== null && _c !== void 0 ? _c : undefined : undefined,
12419
12499
  qualifierColumn: qualifierColumn ? (_d = pt === null || pt === void 0 ? void 0 : pt.col(qualifierColumn)) !== null && _d !== void 0 ? _d : undefined : undefined,
12420
12500
  additionalColumns: (additionalColumns !== null && additionalColumns !== void 0 ? additionalColumns : []).map((c) => pt === null || pt === void 0 ? void 0 : pt.col(c)).filter((c) => c != null),
12421
- });
12501
+ }, joinInfo);
12422
12502
  });
12423
12503
  }
12424
12504
  static dataToCurvesTopMenu() {
@@ -12564,6 +12644,7 @@ class PackageFunctions {
12564
12644
  return false;
12565
12645
  return _plate_plate_reader__WEBPACK_IMPORTED_MODULE_11__.PlateReader.getReader(content) != null;
12566
12646
  }
12647
+ // @grok.decorators.app({name: 'Browse', browsePath: 'Plates'})
12567
12648
  static platesApp() {
12568
12649
  return (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.platesAppView)();
12569
12650
  }
@@ -12617,8 +12698,10 @@ __decorate([
12617
12698
  __param(13, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12618
12699
  __param(14, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12619
12700
  __param(15, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12701
+ __param(16, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12702
+ __param(17, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
12620
12703
  __metadata("design:type", Function),
12621
- __metadata("design:paramtypes", [datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, Array, String, String, String, String, Array]),
12704
+ __metadata("design:paramtypes", [datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DataFrame, Array, String, String, String, String, Array, String, String]),
12622
12705
  __metadata("design:returntype", Promise)
12623
12706
  ], PackageFunctions, "dataToCurves", null);
12624
12707
  __decorate([
@@ -12682,12 +12765,6 @@ __decorate([
12682
12765
  __metadata("design:paramtypes", [String]),
12683
12766
  __metadata("design:returntype", Boolean)
12684
12767
  ], PackageFunctions, "checkFileIsPlate", null);
12685
- __decorate([
12686
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.app({ name: 'Browse', browsePath: 'Plates' }),
12687
- __metadata("design:type", Function),
12688
- __metadata("design:paramtypes", []),
12689
- __metadata("design:returntype", datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.View)
12690
- ], PackageFunctions, "platesApp", null);
12691
12768
  __decorate([
12692
12769
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({}),
12693
12770
  __metadata("design:type", Function),
@@ -12700,10 +12777,10 @@ __decorate([
12700
12777
  __metadata("design:paramtypes", []),
12701
12778
  __metadata("design:returntype", Promise)
12702
12779
  ], PackageFunctions, "createDummyPlateData", null);
12703
- //name: platesAppTreeBrowser
12780
+ //name: platesAppTreeBrowserTempDisabled
12704
12781
  //input: dynamic treeNode
12705
12782
  //input: view browseView
12706
- function platesAppTreeBrowser(treeNode, browseView) {
12783
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
12707
12784
  return __awaiter(this, void 0, void 0, function* () {
12708
12785
  yield (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.initPlatesAppTree)(treeNode);
12709
12786
  });