@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.
package/dist/package.js CHANGED
@@ -7890,7 +7890,7 @@ function createFitFunctionEditor(table) {
7890
7890
  }
7891
7891
  };
7892
7892
  }
7893
- function createParentTableForm() {
7893
+ function createParentTableForm(onTableChange) {
7894
7894
  const tableInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.table('Parent Table', { value: undefined, nullable: true, tooltipText: 'Table with parent data' });
7895
7895
  const form = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.form([]);
7896
7896
  let fitFunctionEditor = null;
@@ -7902,6 +7902,7 @@ function createParentTableForm() {
7902
7902
  const onChanged = () => {
7903
7903
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
7904
7904
  form.appendChild(tableInput.root);
7905
+ onTableChange(tableInput.value);
7905
7906
  if (!tableInput.value) {
7906
7907
  fitFunctionEditor = null;
7907
7908
  return;
@@ -7964,7 +7965,7 @@ function createParentTableForm() {
7964
7965
  }
7965
7966
  };
7966
7967
  }
7967
- function createWellTableForm() {
7968
+ function createWellTableForm(onTableChange) {
7968
7969
  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' });
7969
7970
  let assayColInput;
7970
7971
  let concentrationColInput;
@@ -7979,6 +7980,7 @@ function createWellTableForm() {
7979
7980
  var _a, _b, _c, _d, _f, _g, _h, _j;
7980
7981
  const df = tableInput.value;
7981
7982
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
7983
+ onTableChange(tableInput.value);
7982
7984
  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' });
7983
7985
  concentrationColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('Concentration', { table: df, nullable: false, filter: (c) => c.isNumerical, tooltipText: 'Column with concentration values' });
7984
7986
  readoutColInput = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.input.column('Readout', { table: df, nullable: false, filter: (c) => c.isNumerical, tooltipText: 'Column with readout values' });
@@ -8022,19 +8024,84 @@ function createWellTableForm() {
8022
8024
  }
8023
8025
  };
8024
8026
  }
8027
+ function createJoinEditor() {
8028
+ const form = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.divH([], { style: { alignItems: 'center' } });
8029
+ let wellLevelColInput = null;
8030
+ let parentLevelColInput = null;
8031
+ let wellDataTable = null;
8032
+ let parentDataTable = null;
8033
+ const onTableChange = (wellLevelData, parentLevelData) => {
8034
+ datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.empty(form);
8035
+ if (!wellLevelData || !parentLevelData) {
8036
+ wellLevelColInput = null;
8037
+ parentLevelColInput = null;
8038
+ wellDataTable = null;
8039
+ parentDataTable = null;
8040
+ return;
8041
+ }
8042
+ wellDataTable = wellLevelData;
8043
+ parentDataTable = parentLevelData;
8044
+ 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' });
8045
+ 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' });
8046
+ const potentialParentCol = wu__WEBPACK_IMPORTED_MODULE_4___default()(parentLevelData.columns.categorical).map((c) => {
8047
+ let score = c.categories.length;
8048
+ if (c.name.toLowerCase().includes('id'))
8049
+ score += 10;
8050
+ if (c.name.toLowerCase().includes('unique'))
8051
+ score += 15;
8052
+ return { col: c, score: score };
8053
+ }).toArray().sort((a, b) => b.score - a.score)[0];
8054
+ if ((potentialParentCol === null || potentialParentCol === void 0 ? void 0 : potentialParentCol.col) && potentialParentCol.score > 0) {
8055
+ parentLevelColInput.value = potentialParentCol.col;
8056
+ const n = potentialParentCol.col.name.toLowerCase();
8057
+ const potentialWellCol = wu__WEBPACK_IMPORTED_MODULE_4___default()(wellLevelData.columns.categorical).filter((c) => c.name.toLowerCase().includes(n)).toArray()[0];
8058
+ if (potentialWellCol)
8059
+ wellLevelColInput.value = potentialWellCol;
8060
+ }
8061
+ 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.');
8062
+ datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.appendAll(form, [infoIcon, wellLevelColInput.root, parentLevelColInput.root]);
8063
+ };
8064
+ return {
8065
+ form,
8066
+ getValues: () => ((wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value) && (parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value)) ? ({
8067
+ wellLevelCol: wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value,
8068
+ parentLevelCol: parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value,
8069
+ }) : null,
8070
+ getHistory: () => {
8071
+ var _a, _b, _c, _d;
8072
+ return ((wellLevelColInput === null || wellLevelColInput === void 0 ? void 0 : wellLevelColInput.value) && (parentLevelColInput === null || parentLevelColInput === void 0 ? void 0 : parentLevelColInput.value)) ? ({
8073
+ 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,
8074
+ 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,
8075
+ }) : null;
8076
+ },
8077
+ applyHistory: (history) => {
8078
+ if (!history.wellLevelCol || !history.parentLevelCol || !wellDataTable || !parentDataTable)
8079
+ return;
8080
+ if (wellLevelColInput && parentLevelColInput) {
8081
+ wellLevelColInput.value = wellDataTable.col(history.wellLevelCol);
8082
+ parentLevelColInput.value = parentDataTable.col(history.parentLevelCol);
8083
+ }
8084
+ },
8085
+ onTableChange: (wellLevelData, parentLevelData) => onTableChange(wellLevelData, parentLevelData),
8086
+ };
8087
+ }
8025
8088
  function dataToCurvesUI() {
8026
8089
  const tv = datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.tv;
8027
8090
  if (!tv || !tv.dataFrame) {
8028
8091
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('No open tableview');
8029
8092
  return;
8030
8093
  }
8031
- const wellLevelForm = createWellTableForm();
8032
- const parentTableForm = createParentTableForm();
8094
+ let wellLevelForm = null;
8095
+ let parentTableForm = null;
8096
+ const joinEditor = createJoinEditor();
8097
+ 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); });
8098
+ 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); });
8033
8099
  const horzForm = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.divH([wellLevelForm.form, parentTableForm.form], { style: { minWidth: '400px', gap: '20px' } });
8034
8100
  datagrok_api_ui__WEBPACK_IMPORTED_MODULE_3__.dialog('Data to Curves')
8035
8101
  .add(horzForm)
8102
+ .add(joinEditor.form)
8036
8103
  .onOK(() => __awaiter(this, void 0, void 0, function* () {
8037
- var _a, _b, _c, _d, _f, _g, _h, _j, _k;
8104
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m;
8038
8105
  const formRes = wellLevelForm.getValues();
8039
8106
  let parentLevelData = undefined;
8040
8107
  const parentTable = parentTableForm.getTable();
@@ -8052,6 +8119,7 @@ function dataToCurvesUI() {
8052
8119
  additionalColumns: (_a = parentFormValues.additionalColumns) !== null && _a !== void 0 ? _a : [],
8053
8120
  };
8054
8121
  }
8122
+ const joinValues = joinEditor.getValues();
8055
8123
  const { table, assayCol, batchIDCol, concentrationCol, readoutCol, compoundIDCol, excludeOutliersCol, runIDCol, targetEntityCol } = formRes;
8056
8124
  const func = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Func.find({ name: 'dataToCurves' })[0];
8057
8125
  if (!func) {
@@ -8078,6 +8146,9 @@ function dataToCurvesUI() {
8078
8146
  experimentIDColumn: (_g = parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.experimentIDColumn) === null || _g === void 0 ? void 0 : _g.name,
8079
8147
  qualifierColumn: (_h = parentLevelData === null || parentLevelData === void 0 ? void 0 : parentLevelData.qualifierColumn) === null || _h === void 0 ? void 0 : _h.name,
8080
8148
  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 : [],
8149
+ // joinInfo
8150
+ wellLevelJoinCol: (_l = joinValues === null || joinValues === void 0 ? void 0 : joinValues.wellLevelCol) === null || _l === void 0 ? void 0 : _l.name,
8151
+ parentLevelJoinCol: (_m = joinValues === null || joinValues === void 0 ? void 0 : joinValues.parentLevelCol) === null || _m === void 0 ? void 0 : _m.name,
8081
8152
  });
8082
8153
  console.log(fc.toString());
8083
8154
  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]);
@@ -8094,7 +8165,7 @@ function dataToCurvesUI() {
8094
8165
  onClick: 'Select'
8095
8166
  });
8096
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);
8097
- 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 });
8098
8169
  tv.dockManager.dock(selectionGrid, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.FILL, tv.dockManager.findNode(tv.grid.root), 'Selected Curves');
8099
8170
  selectionGrid.props.title = 'Selected Curves';
8100
8171
  const multiCurveViewer = tv.addViewer('MultiCurveViewer', { showCurrentRowCurve: false, showMouseOverRowCurve: false, showSelectedRowsCurves: true });
@@ -8105,7 +8176,7 @@ function dataToCurvesUI() {
8105
8176
  }))
8106
8177
  .show()
8107
8178
  .history(() => {
8108
- var _a, _b;
8179
+ var _a, _b, _c;
8109
8180
  const formRes = wellLevelForm.getValues();
8110
8181
  const { assayCol, batchIDCol, concentrationCol, readoutCol, compoundIDCol, excludeOutliersCol, runIDCol, targetEntityCol } = formRes;
8111
8182
  const obj = {
@@ -8118,18 +8189,20 @@ function dataToCurvesUI() {
8118
8189
  runIDCol: runIDCol === null || runIDCol === void 0 ? void 0 : runIDCol.name,
8119
8190
  targetEntityCol: targetEntityCol === null || targetEntityCol === void 0 ? void 0 : targetEntityCol.name,
8120
8191
  };
8121
- 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 : {}) };
8192
+ 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 : {}) };
8122
8193
  }, (v) => {
8123
- var _a, _b;
8194
+ var _a, _b, _c;
8124
8195
  const wells = JSON.parse((_a = v === null || v === void 0 ? void 0 : v.wells) !== null && _a !== void 0 ? _a : '{}');
8125
8196
  const parent = JSON.parse((_b = v === null || v === void 0 ? void 0 : v.parent) !== null && _b !== void 0 ? _b : '{}');
8126
8197
  wellLevelForm.applyHistory(wells);
8127
8198
  parentTableForm.applyHistory(parent);
8199
+ const joinHistory = JSON.parse((_c = v === null || v === void 0 ? void 0 : v.join) !== null && _c !== void 0 ? _c : '{}');
8200
+ joinEditor.applyHistory(joinHistory);
8128
8201
  });
8129
8202
  }
8130
- function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData) {
8203
+ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData, joinInfo) {
8131
8204
  return __awaiter(this, void 0, void 0, function* () {
8132
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8205
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
8133
8206
  if (!concentrationCol || !readoutCol || !batchIDCol) {
8134
8207
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('Please fill all required fields');
8135
8208
  throw new Error('Please fill all required fields');
@@ -8170,21 +8243,27 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8170
8243
  return markerType;
8171
8244
  }
8172
8245
  };
8246
+ const hasJoinInfo = !!((joinInfo === null || joinInfo === void 0 ? void 0 : joinInfo.parentLevelCol) && (joinInfo === null || joinInfo === void 0 ? void 0 : joinInfo.wellLevelCol));
8247
+ const parentCompoundIDCol = (_a = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _a === void 0 ? void 0 : _a.col(compoundIDCol.name);
8248
+ const parentAssayCol = (_b = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _b === void 0 ? void 0 : _b.col(assayCol.name);
8249
+ const parentTargetEntityCol = (_c = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _c === void 0 ? void 0 : _c.col(targetEntityCol.name);
8250
+ const parentRunIDCol = (_d = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _d === void 0 ? void 0 : _d.col(runIDCol.name);
8251
+ const hasParentGrouppingCols = parentCompoundIDCol && parentAssayCol && parentTargetEntityCol && parentRunIDCol;
8173
8252
  const getGroupKey = (row) => `${getCompoundID(row)}||${getAssay(row)}||${getTargetEntity(row)}`;
8174
- const getCurveKey = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
8175
- 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) &&
8176
- 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)}`; } :
8177
- (_row) => null;
8253
+ const getCurveName = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
8254
+ const getCurveKey = !hasJoinInfo ? ((row) => getCurveName(row)) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
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)}`; }) :
8256
+ ((_row) => null)) : ((row) => `${joinInfo.parentLevelCol.get(row)}`);
8178
8257
  // put the parent data into the parentObj
8179
8258
  const parentObj = {};
8180
8259
  if (parentData) {
8181
- for (let i = 0; i < ((_c = (_b = parentData.table) === null || _b === void 0 ? void 0 : _b.rowCount) !== null && _c !== void 0 ? _c : 0); i++) {
8260
+ for (let i = 0; i < ((_g = (_f = parentData.table) === null || _f === void 0 ? void 0 : _f.rowCount) !== null && _g !== void 0 ? _g : 0); i++) {
8182
8261
  const curveKey = getParentDataCurveKey ? getParentDataCurveKey(i) : null;
8183
8262
  if (!curveKey || parentObj[curveKey])
8184
8263
  continue;
8185
8264
  parentObj[curveKey] = {
8186
- fitParams: (_f = (_d = parentData.fitParamColumns) === null || _d === void 0 ? void 0 : _d.map((c) => c.get(i))) !== null && _f !== void 0 ? _f : [],
8187
- 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,
8265
+ fitParams: (_j = (_h = parentData.fitParamColumns) === null || _h === void 0 ? void 0 : _h.map((c) => c.get(i))) !== null && _j !== void 0 ? _j : [],
8266
+ 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,
8188
8267
  reportedIC50: parentData.reportedIC50Column ? parentData.reportedIC50Column.get(i) : undefined,
8189
8268
  reportedQualifiedIC50: parentData.reportedQualifiedIC50Column ? parentData.reportedQualifiedIC50Column.get(i) : undefined,
8190
8269
  experimentID: parentData.experimentIDColumn ? parentData.experimentIDColumn.get(i) : undefined,
@@ -8201,16 +8280,18 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8201
8280
  const outlier = isOutlier(i);
8202
8281
  const compoundID = getCompoundID(i);
8203
8282
  const targetEntity = getTargetEntity(i);
8204
- const runID = (_h = getRunID(i)) !== null && _h !== void 0 ? _h : '';
8283
+ const runID = (_l = getRunID(i)) !== null && _l !== void 0 ? _l : '';
8205
8284
  const groupKey = getGroupKey(i);
8206
8285
  const curveKey = getCurveKey(i);
8286
+ const curveName = getCurveName(i);
8207
8287
  if (!curvesObj[curveKey]) {
8208
- curvesObj[curveKey] = { x: [], y: [], outliers: [], groupKey, runID: runID, info: {
8288
+ curvesObj[curveKey] = { name: curveName, x: [], y: [], outliers: [], groupKey, runID: runID, info: {
8209
8289
  'Assay Name': assay,
8210
8290
  'Batch ID': batchID,
8211
8291
  'Compound ID': compoundID,
8212
8292
  'Target Entity': targetEntity,
8213
8293
  'Run ID': runID,
8294
+ 'Max Percent Inhibition': null, // will be calculated later
8214
8295
  } };
8215
8296
  if (parentData && parentObj[curveKey]) {
8216
8297
  curvesObj[curveKey].info['Reported IC50'] = parentObj[curveKey].reportedIC50;
@@ -8220,7 +8301,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8220
8301
  if (parentObj[curveKey].additionalColumns)
8221
8302
  Object.assign(curvesObj[curveKey].info, parentObj[curveKey].additionalColumns);
8222
8303
  if (parentObj[curveKey].fitParams && parentObj[curveKey].fitParams.length > 0) {
8223
- for (let j = 0; j < ((_k = (_j = parentData.fitParamColumns) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0); j++) {
8304
+ for (let j = 0; j < ((_o = (_m = parentData.fitParamColumns) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0); j++) {
8224
8305
  const paramName = parentData.fitParamColumns[j].name;
8225
8306
  curvesObj[curveKey].info[paramName] = parentObj[curveKey].fitParams[j];
8226
8307
  }
@@ -8232,6 +8313,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8232
8313
  curve.x.push(concentration);
8233
8314
  curve.y.push(readout);
8234
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);
8235
8318
  }
8236
8319
  // create fit series
8237
8320
  const colorHash = {};
@@ -8246,7 +8329,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8246
8329
  const tableColList = [];
8247
8330
  const curvesCol = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.string('Fitted Curve', curvesObjsArray.length);
8248
8331
  curvesCol.init((i) => {
8249
- var _a, _b, _c;
8332
+ var _a, _b, _c, _d, _f, _g;
8250
8333
  const [curveKey, curve] = curvesObjsArray[i];
8251
8334
  const x = curve.x;
8252
8335
  const y = curve.y;
@@ -8254,9 +8337,9 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8254
8337
  const runID = curve.runID;
8255
8338
  const markerType = getMarkerType(runID);
8256
8339
  const params = parentObj[curveKey] ? parentObj[curveKey].fitParams : undefined;
8257
- 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 : '');
8258
8341
  const color = getColor(colorKey);
8259
- 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;
8260
8343
  const s = {
8261
8344
  fit: undefined, fitFunction: fitFunctionName, clickToToggle: true, droplines: ['IC50'], name: `${runID}`,
8262
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)
@@ -8266,7 +8349,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8266
8349
  xAxisName: concentrationCol.name,
8267
8350
  yAxisName: readoutCol.name,
8268
8351
  logX: true,
8269
- title: `${curveKey}`,
8352
+ title: `${(_g = (_f = curve.name) !== null && _f !== void 0 ? _f : curveKey) !== null && _g !== void 0 ? _g : ''}`,
8270
8353
  },
8271
8354
  series: [s],
8272
8355
  };
@@ -8298,7 +8381,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8298
8381
  grouppedValues[groupKey] = { maxYs: [], reportedIC50s: [], qualifiedIC50s: [] };
8299
8382
  grouppedValues[groupKey].maxYs.push(Math.max(...curve.y.filter((_, i) => !curve.outliers[i])));
8300
8383
  if (parentData && parentObj[curveKey]) {
8301
- if ((_l = parentObj[curveKey].reportedQualifiedIC50) !== null && _l !== void 0 ? _l : '' != '') {
8384
+ if ((_q = parentObj[curveKey].reportedQualifiedIC50) !== null && _q !== void 0 ? _q : '' != '') {
8302
8385
  grouppedValues[groupKey].qualifiedIC50s.push(parentObj[curveKey].reportedQualifiedIC50);
8303
8386
  let ic50 = getNumericValue(parentData.reportedQualifiedIC50Column ? parentObj[curveKey].reportedQualifiedIC50 : parentObj[curveKey].reportedIC50);
8304
8387
  if (ic50 == undefined) {
@@ -8316,11 +8399,11 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8316
8399
  const grouppedAggregations = {};
8317
8400
  for (const groupKey in grouppedValues) {
8318
8401
  const values = grouppedValues[groupKey];
8319
- 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 ? {
8320
- 'Number of total results': (_o = values.qualifiedIC50s.length) === null || _o === void 0 ? void 0 : _o.toString(),
8321
- 'Number of reported results': (_p = values.reportedIC50s.length) === null || _p === void 0 ? void 0 : _p.toString(),
8322
- '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
8323
- '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,
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,
8324
8407
  'All Results': values.qualifiedIC50s.join(', ')
8325
8408
  } : {}));
8326
8409
  }
@@ -9705,7 +9788,7 @@ let MultiCurveViewer = MultiCurveViewer_1 = class MultiCurveViewer extends datag
9705
9788
  this.rows.push(this.dataFrame.mouseOverRowIdx);
9706
9789
  if (this.showSelectedRowsCurves) {
9707
9790
  selectionStart = this.rows.length;
9708
- this.rows.push(...this.dataFrame.selection.getSelectedIndexes());
9791
+ this.rows.push(...this.dataFrame.selection.clone().and(this.dataFrame.filter).getSelectedIndexes());
9709
9792
  }
9710
9793
  }
9711
9794
  this.data = new _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_4__.FitChartData();
@@ -10362,12 +10445,12 @@ var queries;
10362
10445
  })(queries || (queries = {}));
10363
10446
  var funcs;
10364
10447
  (function (funcs) {
10365
- function platesAppTreeBrowser(treeNode, browseView) {
10448
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
10366
10449
  return __awaiter(this, void 0, void 0, function* () {
10367
- return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowser', { treeNode, browseView });
10450
+ return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode, browseView });
10368
10451
  });
10369
10452
  }
10370
- funcs.platesAppTreeBrowser = platesAppTreeBrowser;
10453
+ funcs.platesAppTreeBrowserTempDisabled = platesAppTreeBrowserTempDisabled;
10371
10454
  function fitChartCellRenderer() {
10372
10455
  return __awaiter(this, void 0, void 0, function* () {
10373
10456
  return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:FitChartCellRenderer', {});
@@ -10534,7 +10617,6 @@ __webpack_require__.r(__webpack_exports__);
10534
10617
  /* harmony export */ getPlateByBarcode: () => (/* binding */ getPlateByBarcode),
10535
10618
  /* harmony export */ importPlate: () => (/* binding */ importPlate),
10536
10619
  /* harmony export */ importPlateXlsx: () => (/* binding */ importPlateXlsx),
10537
- /* harmony export */ platesApp: () => (/* binding */ platesApp),
10538
10620
  /* harmony export */ platesFolderPreview: () => (/* binding */ platesFolderPreview),
10539
10621
  /* harmony export */ previewPlate: () => (/* binding */ previewPlate),
10540
10622
  /* harmony export */ previewPlateXlsx: () => (/* binding */ previewPlateXlsx)
@@ -10614,10 +10696,12 @@ function _initCurves() {
10614
10696
  //input: string experimentIDColumn { nullable: true }
10615
10697
  //input: string qualifierColumn { nullable: true }
10616
10698
  //input: list<string> additionalColumns { nullable: true }
10699
+ //input: string wellLevelJoinCol { nullable: true }
10700
+ //input: string parentLevelJoinCol { nullable: true }
10617
10701
  //output: dataframe result
10618
- function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
10702
+ function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
10619
10703
  return __awaiter(this, void 0, void 0, function* () {
10620
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns);
10704
+ 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);
10621
10705
  });
10622
10706
  }
10623
10707
  //name: dataToCurvesTopMenu
@@ -10715,13 +10799,6 @@ function checkExcelIsPlate(content) {
10715
10799
  function checkFileIsPlate(content) {
10716
10800
  return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.checkFileIsPlate(content);
10717
10801
  }
10718
- //name: Browse
10719
- //tags: app
10720
- //output: view result
10721
- //meta.browsePath: Plates
10722
- function platesApp() {
10723
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.platesApp();
10724
- }
10725
10802
  //name: getPlateByBarcode
10726
10803
  //input: string barcode
10727
10804
  //output: dynamic result
@@ -10783,8 +10860,7 @@ __webpack_require__.r(__webpack_exports__);
10783
10860
  /* harmony export */ getPlateByBarcode: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.getPlateByBarcode),
10784
10861
  /* harmony export */ importPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlate),
10785
10862
  /* harmony export */ importPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlateXlsx),
10786
- /* harmony export */ platesApp: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesApp),
10787
- /* harmony export */ platesAppTreeBrowser: () => (/* binding */ platesAppTreeBrowser),
10863
+ /* harmony export */ platesAppTreeBrowserTempDisabled: () => (/* binding */ platesAppTreeBrowserTempDisabled),
10788
10864
  /* harmony export */ platesFolderPreview: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesFolderPreview),
10789
10865
  /* harmony export */ previewPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlate),
10790
10866
  /* harmony export */ previewPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlateXlsx)
@@ -10891,10 +10967,14 @@ class PackageFunctions {
10891
10967
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plate_plate_cell_renderer__WEBPACK_IMPORTED_MODULE_8__.PlateCellHandler());
10892
10968
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plates_objects_plate_template_handler__WEBPACK_IMPORTED_MODULE_17__.PlateTemplateHandler());
10893
10969
  }
10894
- static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
10970
+ static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
10895
10971
  return __awaiter(this, void 0, void 0, function* () {
10896
10972
  var _a, _b, _c, _d;
10897
10973
  const pt = parentTable;
10974
+ const joinInfo = pt && wellLevelJoinCol && parentLevelJoinCol && df.col(wellLevelJoinCol) && pt.col(parentLevelJoinCol) ? {
10975
+ wellLevelCol: df.col(wellLevelJoinCol),
10976
+ parentLevelCol: pt.col(parentLevelJoinCol),
10977
+ } : undefined;
10898
10978
  // this needs to work with datasync so we use wide format
10899
10979
  return (0,_fit_data_to_curves__WEBPACK_IMPORTED_MODULE_19__.convertDataToCurves)(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, {
10900
10980
  table: pt,
@@ -10904,7 +10984,7 @@ class PackageFunctions {
10904
10984
  experimentIDColumn: experimentIDColumn ? (_c = pt === null || pt === void 0 ? void 0 : pt.col(experimentIDColumn)) !== null && _c !== void 0 ? _c : undefined : undefined,
10905
10985
  qualifierColumn: qualifierColumn ? (_d = pt === null || pt === void 0 ? void 0 : pt.col(qualifierColumn)) !== null && _d !== void 0 ? _d : undefined : undefined,
10906
10986
  additionalColumns: (additionalColumns !== null && additionalColumns !== void 0 ? additionalColumns : []).map((c) => pt === null || pt === void 0 ? void 0 : pt.col(c)).filter((c) => c != null),
10907
- });
10987
+ }, joinInfo);
10908
10988
  });
10909
10989
  }
10910
10990
  static dataToCurvesTopMenu() {
@@ -11050,6 +11130,7 @@ class PackageFunctions {
11050
11130
  return false;
11051
11131
  return _plate_plate_reader__WEBPACK_IMPORTED_MODULE_11__.PlateReader.getReader(content) != null;
11052
11132
  }
11133
+ // @grok.decorators.app({name: 'Browse', browsePath: 'Plates'})
11053
11134
  static platesApp() {
11054
11135
  return (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.platesAppView)();
11055
11136
  }
@@ -11103,8 +11184,10 @@ __decorate([
11103
11184
  __param(13, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11104
11185
  __param(14, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11105
11186
  __param(15, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11187
+ __param(16, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11188
+ __param(17, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11106
11189
  __metadata("design:type", Function),
11107
- __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]),
11190
+ __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]),
11108
11191
  __metadata("design:returntype", Promise)
11109
11192
  ], PackageFunctions, "dataToCurves", null);
11110
11193
  __decorate([
@@ -11168,12 +11251,6 @@ __decorate([
11168
11251
  __metadata("design:paramtypes", [String]),
11169
11252
  __metadata("design:returntype", Boolean)
11170
11253
  ], PackageFunctions, "checkFileIsPlate", null);
11171
- __decorate([
11172
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.app({ name: 'Browse', browsePath: 'Plates' }),
11173
- __metadata("design:type", Function),
11174
- __metadata("design:paramtypes", []),
11175
- __metadata("design:returntype", datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.View)
11176
- ], PackageFunctions, "platesApp", null);
11177
11254
  __decorate([
11178
11255
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({}),
11179
11256
  __metadata("design:type", Function),
@@ -11186,10 +11263,10 @@ __decorate([
11186
11263
  __metadata("design:paramtypes", []),
11187
11264
  __metadata("design:returntype", Promise)
11188
11265
  ], PackageFunctions, "createDummyPlateData", null);
11189
- //name: platesAppTreeBrowser
11266
+ //name: platesAppTreeBrowserTempDisabled
11190
11267
  //input: dynamic treeNode
11191
11268
  //input: view browseView
11192
- function platesAppTreeBrowser(treeNode, browseView) {
11269
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
11193
11270
  return __awaiter(this, void 0, void 0, function* () {
11194
11271
  yield (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.initPlatesAppTree)(treeNode);
11195
11272
  });