@datagrok/curves 1.10.2 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package-test.js +20 -15
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +20 -15
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/fit/data-to-curves.ts +12 -7
- package/src/fit/multi-curve-viewer.ts +1 -1
- package/test-console-output-1.log +26 -26
- package/test-record-1.mp4 +0 -0
package/dist/package-test.js
CHANGED
|
@@ -9679,7 +9679,7 @@ function dataToCurvesUI() {
|
|
|
9679
9679
|
onClick: 'Select'
|
|
9680
9680
|
});
|
|
9681
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);
|
|
9682
|
-
const selectionGrid = tv.addViewer(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.VIEWER.GRID, { rowSource:
|
|
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 });
|
|
9683
9683
|
tv.dockManager.dock(selectionGrid, datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.DOCK_TYPE.FILL, tv.dockManager.findNode(tv.grid.root), 'Selected Curves');
|
|
9684
9684
|
selectionGrid.props.title = 'Selected Curves';
|
|
9685
9685
|
const multiCurveViewer = tv.addViewer('MultiCurveViewer', { showCurrentRowCurve: false, showMouseOverRowCurve: false, showSelectedRowsCurves: true });
|
|
@@ -9716,7 +9716,7 @@ function dataToCurvesUI() {
|
|
|
9716
9716
|
}
|
|
9717
9717
|
function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentData, joinInfo) {
|
|
9718
9718
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9719
|
-
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
9719
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
9720
9720
|
if (!concentrationCol || !readoutCol || !batchIDCol) {
|
|
9721
9721
|
datagrok_api_grok__WEBPACK_IMPORTED_MODULE_2__.shell.warning('Please fill all required fields');
|
|
9722
9722
|
throw new Error('Please fill all required fields');
|
|
@@ -9764,7 +9764,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9764
9764
|
const parentRunIDCol = (_d = parentData === null || parentData === void 0 ? void 0 : parentData.table) === null || _d === void 0 ? void 0 : _d.col(runIDCol.name);
|
|
9765
9765
|
const hasParentGrouppingCols = parentCompoundIDCol && parentAssayCol && parentTargetEntityCol && parentRunIDCol;
|
|
9766
9766
|
const getGroupKey = (row) => `${getCompoundID(row)}||${getAssay(row)}||${getTargetEntity(row)}`;
|
|
9767
|
-
const
|
|
9767
|
+
const getCurveName = (row) => `${getGroupKey(row)}||${getRunID(row)}`;
|
|
9768
|
+
const getCurveKey = !hasJoinInfo ? ((row) => getCurveName(row)) : ((row) => `${joinInfo.wellLevelCol.get(row)}`);
|
|
9768
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)}`; }) :
|
|
9769
9770
|
((_row) => null)) : ((row) => `${joinInfo.parentLevelCol.get(row)}`);
|
|
9770
9771
|
// put the parent data into the parentObj
|
|
@@ -9796,13 +9797,15 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9796
9797
|
const runID = (_l = getRunID(i)) !== null && _l !== void 0 ? _l : '';
|
|
9797
9798
|
const groupKey = getGroupKey(i);
|
|
9798
9799
|
const curveKey = getCurveKey(i);
|
|
9800
|
+
const curveName = getCurveName(i);
|
|
9799
9801
|
if (!curvesObj[curveKey]) {
|
|
9800
|
-
curvesObj[curveKey] = { x: [], y: [], outliers: [], groupKey, runID: runID, info: {
|
|
9802
|
+
curvesObj[curveKey] = { name: curveName, x: [], y: [], outliers: [], groupKey, runID: runID, info: {
|
|
9801
9803
|
'Assay Name': assay,
|
|
9802
9804
|
'Batch ID': batchID,
|
|
9803
9805
|
'Compound ID': compoundID,
|
|
9804
9806
|
'Target Entity': targetEntity,
|
|
9805
9807
|
'Run ID': runID,
|
|
9808
|
+
'Max Percent Inhibition': null, // will be calculated later
|
|
9806
9809
|
} };
|
|
9807
9810
|
if (parentData && parentObj[curveKey]) {
|
|
9808
9811
|
curvesObj[curveKey].info['Reported IC50'] = parentObj[curveKey].reportedIC50;
|
|
@@ -9824,6 +9827,8 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9824
9827
|
curve.x.push(concentration);
|
|
9825
9828
|
curve.y.push(readout);
|
|
9826
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);
|
|
9827
9832
|
}
|
|
9828
9833
|
// create fit series
|
|
9829
9834
|
const colorHash = {};
|
|
@@ -9838,7 +9843,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9838
9843
|
const tableColList = [];
|
|
9839
9844
|
const curvesCol = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_1__.Column.string('Fitted Curve', curvesObjsArray.length);
|
|
9840
9845
|
curvesCol.init((i) => {
|
|
9841
|
-
var _a, _b, _c;
|
|
9846
|
+
var _a, _b, _c, _d, _f, _g;
|
|
9842
9847
|
const [curveKey, curve] = curvesObjsArray[i];
|
|
9843
9848
|
const x = curve.x;
|
|
9844
9849
|
const y = curve.y;
|
|
@@ -9846,9 +9851,9 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9846
9851
|
const runID = curve.runID;
|
|
9847
9852
|
const markerType = getMarkerType(runID);
|
|
9848
9853
|
const params = parentObj[curveKey] ? parentObj[curveKey].fitParams : undefined;
|
|
9849
|
-
const colorKey = ((_a = curve.info['
|
|
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 : '');
|
|
9850
9855
|
const color = getColor(colorKey);
|
|
9851
|
-
const fitFunctionName = ((
|
|
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;
|
|
9852
9857
|
const s = {
|
|
9853
9858
|
fit: undefined, fitFunction: fitFunctionName, clickToToggle: true, droplines: ['IC50'], name: `${runID}`,
|
|
9854
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)
|
|
@@ -9858,7 +9863,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9858
9863
|
xAxisName: concentrationCol.name,
|
|
9859
9864
|
yAxisName: readoutCol.name,
|
|
9860
9865
|
logX: true,
|
|
9861
|
-
title: `${curveKey}`,
|
|
9866
|
+
title: `${(_g = (_f = curve.name) !== null && _f !== void 0 ? _f : curveKey) !== null && _g !== void 0 ? _g : ''}`,
|
|
9862
9867
|
},
|
|
9863
9868
|
series: [s],
|
|
9864
9869
|
};
|
|
@@ -9890,7 +9895,7 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9890
9895
|
grouppedValues[groupKey] = { maxYs: [], reportedIC50s: [], qualifiedIC50s: [] };
|
|
9891
9896
|
grouppedValues[groupKey].maxYs.push(Math.max(...curve.y.filter((_, i) => !curve.outliers[i])));
|
|
9892
9897
|
if (parentData && parentObj[curveKey]) {
|
|
9893
|
-
if ((
|
|
9898
|
+
if ((_q = parentObj[curveKey].reportedQualifiedIC50) !== null && _q !== void 0 ? _q : '' != '') {
|
|
9894
9899
|
grouppedValues[groupKey].qualifiedIC50s.push(parentObj[curveKey].reportedQualifiedIC50);
|
|
9895
9900
|
let ic50 = getNumericValue(parentData.reportedQualifiedIC50Column ? parentObj[curveKey].reportedQualifiedIC50 : parentObj[curveKey].reportedIC50);
|
|
9896
9901
|
if (ic50 == undefined) {
|
|
@@ -9908,11 +9913,11 @@ function convertDataToCurves(df, concentrationCol, readoutCol, batchIDCol, assay
|
|
|
9908
9913
|
const grouppedAggregations = {};
|
|
9909
9914
|
for (const groupKey in grouppedValues) {
|
|
9910
9915
|
const values = grouppedValues[groupKey];
|
|
9911
|
-
grouppedAggregations[groupKey] = Object.assign({ 'Max Percent Inhibition': values.maxYs.length ? (
|
|
9912
|
-
'Number of total results': (
|
|
9913
|
-
'Number of reported results': (
|
|
9914
|
-
'Geomean IC50': values.reportedIC50s.length ? (
|
|
9915
|
-
'Standard Deviation': values.reportedIC50s.length > 1 ? (
|
|
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,
|
|
9916
9921
|
'All Results': values.qualifiedIC50s.join(', ')
|
|
9917
9922
|
} : {}));
|
|
9918
9923
|
}
|
|
@@ -11297,7 +11302,7 @@ let MultiCurveViewer = MultiCurveViewer_1 = class MultiCurveViewer extends datag
|
|
|
11297
11302
|
this.rows.push(this.dataFrame.mouseOverRowIdx);
|
|
11298
11303
|
if (this.showSelectedRowsCurves) {
|
|
11299
11304
|
selectionStart = this.rows.length;
|
|
11300
|
-
this.rows.push(...this.dataFrame.selection.getSelectedIndexes());
|
|
11305
|
+
this.rows.push(...this.dataFrame.selection.clone().and(this.dataFrame.filter).getSelectedIndexes());
|
|
11301
11306
|
}
|
|
11302
11307
|
}
|
|
11303
11308
|
this.data = new _datagrok_libraries_statistics_src_fit_fit_curve__WEBPACK_IMPORTED_MODULE_4__.FitChartData();
|