@datagrok/curves 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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]);
@@ -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;
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,26 @@ 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 getCurveKey = !hasJoinInfo ? ((row) => `${getGroupKey(row)}||${getRunID(row)}`) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
8254
+ 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
+ ((_row) => null)) : ((row) => `${joinInfo.parentLevelCol.get(row)}`);
8178
8256
  // put the parent data into the parentObj
8179
8257
  const parentObj = {};
8180
8258
  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++) {
8259
+ 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
8260
  const curveKey = getParentDataCurveKey ? getParentDataCurveKey(i) : null;
8183
8261
  if (!curveKey || parentObj[curveKey])
8184
8262
  continue;
8185
8263
  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,
8264
+ fitParams: (_j = (_h = parentData.fitParamColumns) === null || _h === void 0 ? void 0 : _h.map((c) => c.get(i))) !== null && _j !== void 0 ? _j : [],
8265
+ 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
8266
  reportedIC50: parentData.reportedIC50Column ? parentData.reportedIC50Column.get(i) : undefined,
8189
8267
  reportedQualifiedIC50: parentData.reportedQualifiedIC50Column ? parentData.reportedQualifiedIC50Column.get(i) : undefined,
8190
8268
  experimentID: parentData.experimentIDColumn ? parentData.experimentIDColumn.get(i) : undefined,
@@ -8201,7 +8279,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8201
8279
  const outlier = isOutlier(i);
8202
8280
  const compoundID = getCompoundID(i);
8203
8281
  const targetEntity = getTargetEntity(i);
8204
- const runID = (_h = getRunID(i)) !== null && _h !== void 0 ? _h : '';
8282
+ const runID = (_l = getRunID(i)) !== null && _l !== void 0 ? _l : '';
8205
8283
  const groupKey = getGroupKey(i);
8206
8284
  const curveKey = getCurveKey(i);
8207
8285
  if (!curvesObj[curveKey]) {
@@ -8220,7 +8298,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8220
8298
  if (parentObj[curveKey].additionalColumns)
8221
8299
  Object.assign(curvesObj[curveKey].info, parentObj[curveKey].additionalColumns);
8222
8300
  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++) {
8301
+ 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
8302
  const paramName = parentData.fitParamColumns[j].name;
8225
8303
  curvesObj[curveKey].info[paramName] = parentObj[curveKey].fitParams[j];
8226
8304
  }
@@ -8277,7 +8355,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8277
8355
  curvesCol.setTag('cell.renderer', 'fit');
8278
8356
  // add group column
8279
8357
  tableColList.push(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.fromStrings(groupColumnName, curvesObjsArray.map((c) => c[1].groupKey)));
8280
- const otherColumns = Object.keys(curvesObjsArray[0][1].info);
8358
+ const otherColumns = curvesObjsArray.reduce((acc, c) => { Object.keys(c[1].info).forEach((k) => acc.add(k)); return acc; }, new Set());
8359
+ //Object.keys(curvesObjsArray[0][1].info);
8281
8360
  for (const colName of otherColumns) {
8282
8361
  const col = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.fromStrings(colName, curvesObjsArray.map((c) => { var _a, _b, _c; return (_c = (_b = (_a = c[1].info[colName]) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : ''; }));
8283
8362
  tableColList.push(col);
@@ -8297,7 +8376,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8297
8376
  grouppedValues[groupKey] = { maxYs: [], reportedIC50s: [], qualifiedIC50s: [] };
8298
8377
  grouppedValues[groupKey].maxYs.push(Math.max(...curve.y.filter((_, i) => !curve.outliers[i])));
8299
8378
  if (parentData && parentObj[curveKey]) {
8300
- if ((_l = parentObj[curveKey].reportedQualifiedIC50) !== null && _l !== void 0 ? _l : '' != '') {
8379
+ if ((_p = parentObj[curveKey].reportedQualifiedIC50) !== null && _p !== void 0 ? _p : '' != '') {
8301
8380
  grouppedValues[groupKey].qualifiedIC50s.push(parentObj[curveKey].reportedQualifiedIC50);
8302
8381
  let ic50 = getNumericValue(parentData.reportedQualifiedIC50Column ? parentObj[curveKey].reportedQualifiedIC50 : parentObj[curveKey].reportedIC50);
8303
8382
  if (ic50 == undefined) {
@@ -8315,11 +8394,11 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
8315
8394
  const grouppedAggregations = {};
8316
8395
  for (const groupKey in grouppedValues) {
8317
8396
  const values = grouppedValues[groupKey];
8318
- 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 ? {
8319
- 'Number of total results': (_o = values.qualifiedIC50s.length) === null || _o === void 0 ? void 0 : _o.toString(),
8320
- 'Number of reported results': (_p = values.reportedIC50s.length) === null || _p === void 0 ? void 0 : _p.toString(),
8321
- '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
8322
- '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,
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,
8323
8402
  'All Results': values.qualifiedIC50s.join(', ')
8324
8403
  } : {}));
8325
8404
  }
@@ -10361,12 +10440,12 @@ var queries;
10361
10440
  })(queries || (queries = {}));
10362
10441
  var funcs;
10363
10442
  (function (funcs) {
10364
- function platesAppTreeBrowser(treeNode, browseView) {
10443
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
10365
10444
  return __awaiter(this, void 0, void 0, function* () {
10366
- return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowser', { treeNode, browseView });
10445
+ return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode, browseView });
10367
10446
  });
10368
10447
  }
10369
- funcs.platesAppTreeBrowser = platesAppTreeBrowser;
10448
+ funcs.platesAppTreeBrowserTempDisabled = platesAppTreeBrowserTempDisabled;
10370
10449
  function fitChartCellRenderer() {
10371
10450
  return __awaiter(this, void 0, void 0, function* () {
10372
10451
  return yield datagrok_api_grok__WEBPACK_IMPORTED_MODULE_0__.functions.call('Curves:FitChartCellRenderer', {});
@@ -10533,7 +10612,6 @@ __webpack_require__.r(__webpack_exports__);
10533
10612
  /* harmony export */ getPlateByBarcode: () => (/* binding */ getPlateByBarcode),
10534
10613
  /* harmony export */ importPlate: () => (/* binding */ importPlate),
10535
10614
  /* harmony export */ importPlateXlsx: () => (/* binding */ importPlateXlsx),
10536
- /* harmony export */ platesApp: () => (/* binding */ platesApp),
10537
10615
  /* harmony export */ platesFolderPreview: () => (/* binding */ platesFolderPreview),
10538
10616
  /* harmony export */ previewPlate: () => (/* binding */ previewPlate),
10539
10617
  /* harmony export */ previewPlateXlsx: () => (/* binding */ previewPlateXlsx)
@@ -10613,10 +10691,12 @@ function _initCurves() {
10613
10691
  //input: string experimentIDColumn { nullable: true }
10614
10692
  //input: string qualifierColumn { nullable: true }
10615
10693
  //input: list<string> additionalColumns { nullable: true }
10694
+ //input: string wellLevelJoinCol { nullable: true }
10695
+ //input: string parentLevelJoinCol { nullable: true }
10616
10696
  //output: dataframe result
10617
- function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
10697
+ function dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
10618
10698
  return __awaiter(this, void 0, void 0, function* () {
10619
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns);
10699
+ 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);
10620
10700
  });
10621
10701
  }
10622
10702
  //name: dataToCurvesTopMenu
@@ -10714,13 +10794,6 @@ function checkExcelIsPlate(content) {
10714
10794
  function checkFileIsPlate(content) {
10715
10795
  return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.checkFileIsPlate(content);
10716
10796
  }
10717
- //name: Browse
10718
- //tags: app
10719
- //output: view result
10720
- //meta.browsePath: Plates
10721
- function platesApp() {
10722
- return _package__WEBPACK_IMPORTED_MODULE_2__.PackageFunctions.platesApp();
10723
- }
10724
10797
  //name: getPlateByBarcode
10725
10798
  //input: string barcode
10726
10799
  //output: dynamic result
@@ -10782,8 +10855,7 @@ __webpack_require__.r(__webpack_exports__);
10782
10855
  /* harmony export */ getPlateByBarcode: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.getPlateByBarcode),
10783
10856
  /* harmony export */ importPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlate),
10784
10857
  /* harmony export */ importPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.importPlateXlsx),
10785
- /* harmony export */ platesApp: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesApp),
10786
- /* harmony export */ platesAppTreeBrowser: () => (/* binding */ platesAppTreeBrowser),
10858
+ /* harmony export */ platesAppTreeBrowserTempDisabled: () => (/* binding */ platesAppTreeBrowserTempDisabled),
10787
10859
  /* harmony export */ platesFolderPreview: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.platesFolderPreview),
10788
10860
  /* harmony export */ previewPlate: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlate),
10789
10861
  /* harmony export */ previewPlateXlsx: () => (/* reexport safe */ _package_g__WEBPACK_IMPORTED_MODULE_0__.previewPlateXlsx)
@@ -10890,10 +10962,14 @@ class PackageFunctions {
10890
10962
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plate_plate_cell_renderer__WEBPACK_IMPORTED_MODULE_8__.PlateCellHandler());
10891
10963
  datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.ObjectHandler.register(new _plates_objects_plate_template_handler__WEBPACK_IMPORTED_MODULE_17__.PlateTemplateHandler());
10892
10964
  }
10893
- static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns) {
10965
+ static dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol) {
10894
10966
  return __awaiter(this, void 0, void 0, function* () {
10895
10967
  var _a, _b, _c, _d;
10896
10968
  const pt = parentTable;
10969
+ const joinInfo = pt && wellLevelJoinCol && parentLevelJoinCol && df.col(wellLevelJoinCol) && pt.col(parentLevelJoinCol) ? {
10970
+ wellLevelCol: df.col(wellLevelJoinCol),
10971
+ parentLevelCol: pt.col(parentLevelJoinCol),
10972
+ } : undefined;
10897
10973
  // this needs to work with datasync so we use wide format
10898
10974
  return (0,_fit_data_to_curves__WEBPACK_IMPORTED_MODULE_19__.convertDataToCurves)(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, {
10899
10975
  table: pt,
@@ -10903,7 +10979,7 @@ class PackageFunctions {
10903
10979
  experimentIDColumn: experimentIDColumn ? (_c = pt === null || pt === void 0 ? void 0 : pt.col(experimentIDColumn)) !== null && _c !== void 0 ? _c : undefined : undefined,
10904
10980
  qualifierColumn: qualifierColumn ? (_d = pt === null || pt === void 0 ? void 0 : pt.col(qualifierColumn)) !== null && _d !== void 0 ? _d : undefined : undefined,
10905
10981
  additionalColumns: (additionalColumns !== null && additionalColumns !== void 0 ? additionalColumns : []).map((c) => pt === null || pt === void 0 ? void 0 : pt.col(c)).filter((c) => c != null),
10906
- });
10982
+ }, joinInfo);
10907
10983
  });
10908
10984
  }
10909
10985
  static dataToCurvesTopMenu() {
@@ -11049,6 +11125,7 @@ class PackageFunctions {
11049
11125
  return false;
11050
11126
  return _plate_plate_reader__WEBPACK_IMPORTED_MODULE_11__.PlateReader.getReader(content) != null;
11051
11127
  }
11128
+ // @grok.decorators.app({name: 'Browse', browsePath: 'Plates'})
11052
11129
  static platesApp() {
11053
11130
  return (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.platesAppView)();
11054
11131
  }
@@ -11102,8 +11179,10 @@ __decorate([
11102
11179
  __param(13, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11103
11180
  __param(14, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11104
11181
  __param(15, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11182
+ __param(16, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11183
+ __param(17, datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.param({ options: { nullable: true } })),
11105
11184
  __metadata("design:type", Function),
11106
- __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]),
11185
+ __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]),
11107
11186
  __metadata("design:returntype", Promise)
11108
11187
  ], PackageFunctions, "dataToCurves", null);
11109
11188
  __decorate([
@@ -11167,12 +11246,6 @@ __decorate([
11167
11246
  __metadata("design:paramtypes", [String]),
11168
11247
  __metadata("design:returntype", Boolean)
11169
11248
  ], PackageFunctions, "checkFileIsPlate", null);
11170
- __decorate([
11171
- datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.app({ name: 'Browse', browsePath: 'Plates' }),
11172
- __metadata("design:type", Function),
11173
- __metadata("design:paramtypes", []),
11174
- __metadata("design:returntype", datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.View)
11175
- ], PackageFunctions, "platesApp", null);
11176
11249
  __decorate([
11177
11250
  datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.decorators.func({}),
11178
11251
  __metadata("design:type", Function),
@@ -11185,10 +11258,10 @@ __decorate([
11185
11258
  __metadata("design:paramtypes", []),
11186
11259
  __metadata("design:returntype", Promise)
11187
11260
  ], PackageFunctions, "createDummyPlateData", null);
11188
- //name: platesAppTreeBrowser
11261
+ //name: platesAppTreeBrowserTempDisabled
11189
11262
  //input: dynamic treeNode
11190
11263
  //input: view browseView
11191
- function platesAppTreeBrowser(treeNode, browseView) {
11264
+ function platesAppTreeBrowserTempDisabled(treeNode, browseView) {
11192
11265
  return __awaiter(this, void 0, void 0, function* () {
11193
11266
  yield (0,_plates_plates_app__WEBPACK_IMPORTED_MODULE_12__.initPlatesAppTree)(treeNode);
11194
11267
  });