@datagrok/curves 1.10.4 → 1.10.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/curves",
3
3
  "friendlyName": "Curves",
4
- "version": "1.10.4",
4
+ "version": "1.10.5",
5
5
  "description": "Curves provides support for fitted curves (such as dose-response curves), including in-grid rendering, storing charts in cells, interactivity, and automatic fitting.",
6
6
  "author": {
7
7
  "name": "Dmytro Kovalyov",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@datagrok-libraries/statistics": "^1.9.1",
12
- "@datagrok-libraries/utils": "^4.6.0",
12
+ "@datagrok-libraries/utils": "^4.6.3",
13
13
  "@types/wu": "^2.1.42",
14
14
  "@typescript-eslint/eslint-plugin": "^5.62.0",
15
15
  "@typescript-eslint/parser": "^5.62.0",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "css-loader": "^5.0.0",
27
- "datagrok-tools": "^4.14.20",
27
+ "datagrok-tools": "^4.14.45",
28
28
  "source-map-loader": "^4.0.1",
29
29
  "style-loader": "^2.0.0",
30
30
  "ts-loader": "^9.5.1",
@@ -0,0 +1,353 @@
1
+ #name: calculateMSR
2
+ #description: Calculates Minimum Significant Ratio (MSR) for compounds based on IC50 values, run dates, assay names, and target entities.
3
+ #environment: channels: [Conda-forge], dependencies: [python=3.12, {pip: [statsmodels]}]
4
+ #language: python
5
+ #tags: Transform
6
+ #top-menu: Curves | Calculate MSR
7
+ #input: dataframe table [Input data table]
8
+ #input: column ic50Column [IC50 column]
9
+ #input: column compoundIdColumn [Compound ID column]
10
+ #input: column runDateColumn [Run date column]
11
+ #input: column assayNameColumn [Assay name column]
12
+ #input: column targetEntityColumn [Target entity column]
13
+ #output: dataframe res {action:join(table)}
14
+
15
+ import pandas as pd
16
+ import numpy as np
17
+ import warnings
18
+ from statsmodels.regression.mixed_linear_model import MixedLM
19
+ from typing import Dict, Tuple, Optional
20
+ from scipy import stats
21
+
22
+
23
+ def prepare_data(df, ic50_col, compound_col,
24
+ run_date_col, assay_col, target_col):
25
+ """Prepare and clean the data for MSR calculation."""
26
+
27
+ # Make a copy and select relevant columns
28
+ df_work = df[[ic50_col, compound_col, run_date_col, assay_col, target_col]].copy()
29
+
30
+ # Remove rows with missing values
31
+ df_work = df_work.dropna()
32
+ # remove rows where reported_ic50 is not a valid float or is zero
33
+ df_work = df_work[df[ic50_col].apply(lambda x: isinstance(x, (int, float)) and x > 0)]
34
+ # Remove non-positive IC50 values
35
+ df_work = df_work[df_work[ic50_col] > 0]
36
+
37
+ # Calculate log10 IC50
38
+ df_work['log10_ic50'] = np.log10(df_work[ic50_col])
39
+
40
+ # Convert run_date to datetime if it's not already
41
+ if not pd.api.types.is_datetime64_any_dtype(df_work[run_date_col]):
42
+ df_work[run_date_col] = pd.to_datetime(df_work[run_date_col])
43
+
44
+ # Create numeric run_date for modeling (days since first run per group)
45
+ min_date = df_work[run_date_col].min()
46
+ df_work['run_date_numeric'] = (df_work[run_date_col] - min_date).dt.days
47
+
48
+ return df_work
49
+
50
+ def calculate_msr_mixed_model(group, compound, assay, target,
51
+ n_runs, n_measurements):
52
+ """Calculate MSR using mixed effects model for compounds with sufficient runs."""
53
+
54
+ try:
55
+ with warnings.catch_warnings():
56
+ warnings.simplefilter("ignore")
57
+
58
+ # For a single compound, we don't need fixed effects for compound
59
+ # We just need to model the variance components
60
+ # Random effect: run_date, Fixed effectercept only
61
+
62
+ # Create design matrix (just intercept)
63
+ exog = np.ones((len(group), 1))
64
+
65
+ model = MixedLM(
66
+ endog=group['log10_ic50'].values,
67
+ exog=exog,
68
+ groups=group['run_date_numeric'].values
69
+ )
70
+
71
+ result = model.fit(method='lbfgs', maxiter=1000)
72
+ # Extract variance components
73
+ residual_variance = result.scale # Within-run variance
74
+ random_effect_variance = float(result.cov_re[0][0]) if len(result.cov_re) > 0 and len(result.cov_re[0]) > 0 else 0 # Between-run variance
75
+
76
+ # Calculate s as square root of sum of variance components
77
+ s = np.sqrt(random_effect_variance + residual_variance)
78
+
79
+ # Calculate MSR = 10^(2*sqrt(2)*s)
80
+ msr = 10**(2 * np.sqrt(2) * s)
81
+
82
+ return {
83
+ 'compound_id': compound,
84
+ 'assay_name': assay,
85
+ 'target_entity': target,
86
+ 'database_msr': msr,
87
+ 'residual_variance': residual_variance,
88
+ 'run_date_variance': random_effect_variance,
89
+ 'total_variance': random_effect_variance + residual_variance,
90
+ 's_value': s,
91
+ 'n_runs': n_runs,
92
+ 'n_measurements': n_measurements,
93
+ 'method': 'mixed_model',
94
+ 'mean_log10_ic50': group['log10_ic50'].mean(),
95
+ 'geometric_mean_ic50': 10**group['log10_ic50'].mean()
96
+ }
97
+
98
+ except Exception as e:
99
+ print(e)
100
+ # Fallback to simple method if mixed model fails
101
+ return calculate_msr_simple(group, compound, assay, target, n_runs, n_measurements)
102
+
103
+ def calculate_msr_simple(group, compound, assay, target,
104
+ n_runs, n_measurements):
105
+ """Calculate MSR using simple variance decomposition for compounds with fewer runs."""
106
+
107
+ # Calculate run means
108
+ run_means = group.groupby('run_date_numeric')['log10_ic50'].agg(['mean', 'count']).reset_index()
109
+ run_means.columns = ['run_date_numeric', 'run_mean', 'n_per_run']
110
+
111
+ # Calculate overall mean
112
+ overall_mean = group['log10_ic50'].mean()
113
+
114
+ # Calculate between-run variance (if multiple runs)
115
+ if len(run_means) > 1:
116
+ between_run_variance = np.var(run_means['run_mean'], ddof=1)
117
+ else:
118
+ between_run_variance = 0
119
+
120
+ # Calculate within-run variance
121
+ within_run_variances = []
122
+ for run_date in group['run_date_numeric'].unique():
123
+ run_data = group[group['run_date_numeric'] == run_date]['log10_ic50']
124
+ if len(run_data) > 1:
125
+ within_run_variances.append(np.var(run_data, ddof=1))
126
+
127
+ if within_run_variances:
128
+ within_run_variance = np.mean(within_run_variances)
129
+ else:
130
+ # If no within-run replicates, estimate from total variance
131
+ total_variance = np.var(group['log10_ic50'], ddof=1)
132
+ within_run_variance = max(0, total_variance - between_run_variance)
133
+
134
+ # Calculate s as square root of sum of variance components
135
+ s = np.sqrt(between_run_variance + within_run_variance)
136
+
137
+ # Calculate MSR = 10^(2*sqrt(2)*s)
138
+ msr = 10**(2 * np.sqrt(2) * s)
139
+
140
+ return {
141
+ 'compound_id': compound,
142
+ 'assay_name': assay,
143
+ 'target_entity': target,
144
+ 'database_msr': msr,
145
+ 'residual_variance': within_run_variance,
146
+ 'run_date_variance': between_run_variance,
147
+ 'total_variance': between_run_variance + within_run_variance,
148
+ 's_value': s,
149
+ 'n_runs': n_runs,
150
+ 'n_measurements': n_measurements,
151
+ 'method': 'simple_variance',
152
+ 'mean_log10_ic50': overall_mean,
153
+ 'geometric_mean_ic50': 10**overall_mean
154
+ }
155
+
156
+ def calculate_msr_for_compound(group, ic50_col, compound_col,
157
+ run_date_col, min_runs, min_measurements,
158
+ compound, assay, target):
159
+ """Calculate MSR for a specific compound/assay/target combination."""
160
+
161
+ # Check minimum requirements
162
+ n_runs = group['run_date_numeric'].nunique()
163
+ n_measurements = len(group)
164
+
165
+ if n_measurements < min_measurements:
166
+ return None
167
+
168
+ if n_runs < 2: # Need at least 2 different runs to estimate between-run variance
169
+ return None
170
+
171
+ try:
172
+ # Method 1: Use mixed effects model if we have enough runs
173
+ if n_runs >= min_runs:
174
+ return calculate_msr_mixed_model(group, compound, assay, target, n_runs, n_measurements)
175
+ else:
176
+ # Method 2: Simple variance decomposition for fewer runs
177
+ return calculate_msr_simple(group, compound, assay, target, n_runs, n_measurements)
178
+
179
+ except Exception as e:
180
+ print("Model fitting failed for {compound}/{assay}/{target}: {ee}".format(
181
+ compound=compound, assay=assay, target=target, ee=str(e)
182
+ ))
183
+ # If both methods fail, return None
184
+ return None
185
+
186
+ def calculate_compound_database_msr(df,
187
+ ic50_col = 'reported_ic50',
188
+ compound_col = 'compound_id',
189
+ run_date_col = 'run_date',
190
+ assay_col = 'assay_name',
191
+ target_col = 'target_entity',
192
+ min_runs = 6,
193
+ min_measurements = 2):
194
+ """
195
+ Calculate Database MSR for each unique combination of compound_id, assay_name, and target_entity.
196
+ Each compound must have multiple measurements across different runs.
197
+
198
+ Parameters:
199
+ -----------
200
+ df
201
+ Input dataframe with assay data
202
+ ic50_col
203
+ Column name for IC50 values
204
+ compound_col
205
+ Column name for compound identifiers
206
+ run_date_col
207
+ Column name for run dates
208
+ assay_col
209
+ Column name for assay names
210
+ target_col
211
+ Column name for target entities
212
+ min_runs
213
+ Minimum number of different runs required for a compound
214
+ min_measurements
215
+ Minimum number of measurements required for a compound
216
+
217
+ Returns:
218
+ --------
219
+ pd.DataFrame
220
+ DataFrame with MSR values for each compound/assay/target combination
221
+ """
222
+
223
+ # Prepare the data
224
+ df_clean = prepare_data(df, ic50_col, compound_col, run_date_col, assay_col, target_col)
225
+
226
+ # Group by compound, assay, and target
227
+ results = []
228
+
229
+ for (compound, assay, target), group in df_clean.groupby([compound_col, assay_col, target_col]):
230
+ try:
231
+ msr_result = calculate_msr_for_compound(
232
+ group, ic50_col, compound_col, run_date_col,
233
+ min_runs, min_measurements, compound, assay, target
234
+ )
235
+ if msr_result is not None:
236
+ results.append(msr_result)
237
+ except Exception as e:
238
+ print("Error calculating MSR for {compound}/{assay}/{target}: {ee}".format(
239
+ compound=compound, assay=assay, target=target, ee=str(e)
240
+ ))
241
+ # Continue to next group if there's an error
242
+ continue
243
+
244
+ if not results:
245
+ return pd.DataFrame()
246
+
247
+ return pd.DataFrame(results)
248
+
249
+ def calculate_control_compound_msr(df, control_compounds,
250
+ ic50_col = 'reported_ic50',
251
+ compound_col = 'compound_id',
252
+ run_date_col = 'run_date',
253
+ assay_col = 'assay_name',
254
+ target_col = 'target_entity'):
255
+ """
256
+ Calculate Control Compound MSR for specified control compounds.
257
+ This is useful for assay performance monitoring.
258
+ """
259
+
260
+ control_df = df[df[compound_col].isin(control_compounds)]
261
+ return calculate_compound_database_msr(
262
+ control_df, ic50_col, compound_col, run_date_col, assay_col, target_col,
263
+ min_runs=6, min_measurements=6
264
+ )
265
+
266
+ def generate_msr_summary(msr_results):
267
+ """Generate a summary of MSR results with additional statistics."""
268
+
269
+ if msr_results.empty:
270
+ return msr_results
271
+
272
+ summary = msr_results.copy()
273
+
274
+ # Add interpretation categories
275
+ summary['msr_category'] = pd.cut(
276
+ summary['database_msr'],
277
+ bins=[0, 3, 5, 10, float('inf')],
278
+ labels=['Excellent (<3)', 'Good (3-5)', 'Fair (5-10)', 'Poor (>10)']
279
+ )
280
+
281
+ # Add percentage of variance from each source
282
+ summary['pct_run_date_variance'] = (
283
+ summary['run_date_variance'] / summary['total_variance'] * 100
284
+ ).fillna(0)
285
+ summary['pct_residual_variance'] = (
286
+ summary['residual_variance'] / summary['total_variance'] * 100
287
+ ).fillna(0)
288
+
289
+ # Add 95% confidence interval for the compound potency
290
+ # CI width = MSR gives the range where we expect 95% of measurements
291
+ summary['ic50_lower_95ci'] = summary['geometric_mean_ic50'] / summary['database_msr']
292
+ summary['ic50_upper_95ci'] = summary['geometric_mean_ic50'] * summary['database_msr']
293
+
294
+ return summary
295
+
296
+ def get_compounds_for_msr(df,
297
+ compound_col = 'compound_id',
298
+ run_date_col = 'run_date',
299
+ assay_col = 'assay_name',
300
+ target_col = 'target_entity',
301
+ min_measurements = 2):
302
+ """
303
+ Identify which compounds have sufficient data for MSR calculation.
304
+ """
305
+
306
+ # Count measurements per compound/assay/target combination
307
+ compound_counts = (df.groupby([compound_col, assay_col, target_col])
308
+ .agg({
309
+ run_date_col: 'nunique',
310
+ compound_col: 'count' # total measurements
311
+ })
312
+ .rename(columns={
313
+ run_date_col: 'n_runs',
314
+ compound_col: 'n_measurements'
315
+ })
316
+ .reset_index())
317
+
318
+ # Filter compounds with sufficient data
319
+ sufficient_data = compound_counts[
320
+ (compound_counts['n_measurements'] >= min_measurements) &
321
+ (compound_counts['n_runs'] >= 2)
322
+ ]
323
+
324
+ return sufficient_data.sort_values('n_measurements', ascending=False)
325
+
326
+
327
+ np.random.seed(42)
328
+ odf = table
329
+ # odf = pd.read_csv("assay.csv")
330
+ # compoundIdColumn = 'compound_id'
331
+ # runDateColumn = 'run_date'
332
+ # assayNameColumn = 'assay_name'
333
+ # targetEntityColumn = 'cell_line'
334
+ # ic50Column = 'reported_ic50'
335
+ sufficient_compounds = get_compounds_for_msr(odf, compound_col=compoundIdColumn, run_date_col=runDateColumn, assay_col=assayNameColumn, target_col=targetEntityColumn)
336
+ msr_results = calculate_compound_database_msr(odf, min_runs=2, min_measurements=2, ic50_col=ic50Column, compound_col=compoundIdColumn, run_date_col=runDateColumn, assay_col=assayNameColumn, target_col=targetEntityColumn)
337
+
338
+ # generate a dataset which is the same length as the input data, and for each corresponding row, have the results from the msr_results dataset except the compound_id, assay_name and target_entity. use these three for matching between the two
339
+ # res = msr_results
340
+
341
+ msr_results = msr_results.rename(columns=lambda x: f"{x} (msr)" if x not in ['compound_id', 'assay_name', 'target_entity'] else x) # give postfix
342
+ # Merge the results back to the original dataframe
343
+ res = odf.merge(
344
+ msr_results,
345
+ left_on=[compoundIdColumn, assayNameColumn, targetEntityColumn],
346
+ right_on=['compound_id', 'assay_name', 'target_entity'],
347
+ how='left',
348
+ suffixes=('', ' (msr)')
349
+ )
350
+
351
+ orig_columns_names = odf.columns.tolist()
352
+
353
+ res = res.drop(columns=orig_columns_names)
@@ -437,7 +437,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
437
437
  for (let i = 0; i < data.series?.length!; i++) {
438
438
  const series = data.series![i];
439
439
  const containsParams = series.parameters && series.parameters.length > 0;
440
- if (series.points.some((point) => point.x === undefined || point.y === undefined))
440
+ if (series.points.some((point) => point.x === undefined || point.y === undefined) || series.points.length <= 1)
441
441
  continue;
442
442
  series.points.sort((a, b) => a.x - b.x);
443
443
 
@@ -7,6 +7,15 @@ import * as grok from 'datagrok-api/grok';
7
7
  import * as DG from 'datagrok-api/dg';
8
8
 
9
9
 
10
+ export namespace scripts {
11
+ /**
12
+ Calculates Minimum Significant Ratio (MSR) for compounds based on IC50 values, run dates, assay names, and target entities.
13
+ */
14
+ export async function calculateMSR(table: DG.DataFrame , ic50Column: DG.Column , compoundIdColumn: DG.Column , runDateColumn: DG.Column , assayNameColumn: DG.Column , targetEntityColumn: DG.Column ): Promise<DG.DataFrame> {
15
+ return await grok.functions.call('Curves:CalculateMSR', { table, ic50Column, compoundIdColumn, runDateColumn, assayNameColumn, targetEntityColumn });
16
+ }
17
+ }
18
+
10
19
  export namespace queries {
11
20
  export async function getPlates(): Promise<DG.DataFrame> {
12
21
  return await grok.data.query('Curves:GetPlates', {});
@@ -80,8 +89,8 @@ export namespace queries {
80
89
  }
81
90
 
82
91
  export namespace funcs {
83
- export async function platesAppTreeBrowserTempDisabled(treeNode: any , browseView: DG.View ): Promise<void> {
84
- return await grok.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode, browseView });
92
+ export async function platesAppTreeBrowserTempDisabled(treeNode: any ): Promise<void> {
93
+ return await grok.functions.call('Curves:PlatesAppTreeBrowserTempDisabled', { treeNode });
85
94
  }
86
95
 
87
96
  export async function fitChartCellRenderer(): Promise<any> {
package/src/package.g.ts CHANGED
@@ -28,21 +28,21 @@ export function _MultiCurveViewer() {
28
28
  //description: Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points
29
29
  //meta.demoPath: Curves | Curve Fitting
30
30
  //test: curveFitDemo() //wait: 2000
31
- export async function curveFitDemo() {
32
- return PackageFunctions.curveFitDemo();
31
+ export async function curveFitDemo() : Promise<void> {
32
+ PackageFunctions.curveFitDemo();
33
33
  }
34
34
 
35
35
  //name: Assay Plates
36
36
  //description: Assasy plates with concentration, layout and readout data
37
37
  //meta.demoPath: Curves | Assay Plates
38
- export async function assayPlatesDemo() {
39
- return PackageFunctions.assayPlatesDemo();
38
+ export async function assayPlatesDemo() : Promise<void> {
39
+ PackageFunctions.assayPlatesDemo();
40
40
  }
41
41
 
42
42
  //name: _initCurves
43
43
  //tags: init
44
- export function _initCurves() {
45
- return PackageFunctions._initCurves();
44
+ export function _initCurves() : void {
45
+ PackageFunctions._initCurves();
46
46
  }
47
47
 
48
48
  //name: dataToCurves
@@ -65,7 +65,7 @@ export function _initCurves() {
65
65
  //input: string wellLevelJoinCol { nullable: true }
66
66
  //input: string parentLevelJoinCol { nullable: true }
67
67
  //output: dataframe result
68
- export async function dataToCurves(df: DG.DataFrame, concentrationCol: DG.Column, readoutCol: DG.Column, batchIDCol: DG.Column, assayCol: DG.Column, runIDCol: DG.Column, compoundIDCol: DG.Column, targetEntityCol: DG.Column, excludeOutliersCol: DG.Column, parentTable: DG.DataFrame, fitParamColumns: string[], reportedIC50Column: string, reportedQualifiedIC50Column: string, experimentIDColumn: string, qualifierColumn: string, additionalColumns: string[], wellLevelJoinCol: string, parentLevelJoinCol: string) {
68
+ export async function dataToCurves(df: DG.DataFrame, concentrationCol: DG.Column, readoutCol: DG.Column, batchIDCol: DG.Column, assayCol: DG.Column, runIDCol: DG.Column, compoundIDCol: DG.Column, targetEntityCol: DG.Column, excludeOutliersCol?: DG.Column, parentTable?: DG.DataFrame, fitParamColumns?: string[], reportedIC50Column?: string, reportedQualifiedIC50Column?: string, experimentIDColumn?: string, qualifierColumn?: string, additionalColumns?: string[], wellLevelJoinCol?: string, parentLevelJoinCol?: string) : Promise<any> {
69
69
  return PackageFunctions.dataToCurves(df, concentrationCol, readoutCol, batchIDCol, assayCol, runIDCol, compoundIDCol, targetEntityCol, excludeOutliersCol, parentTable, fitParamColumns, reportedIC50Column, reportedQualifiedIC50Column, experimentIDColumn, qualifierColumn, additionalColumns, wellLevelJoinCol, parentLevelJoinCol);
70
70
  }
71
71
 
@@ -84,7 +84,7 @@ export async function dataToCurvesTopMenu() {
84
84
  //input: int seriesNumber
85
85
  //output: column result
86
86
  //meta.vectorFunc: true
87
- export function addStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, seriesNumber: number) {
87
+ export function addStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, seriesNumber: number) : any {
88
88
  return PackageFunctions.addStatisticsColumn(table, colName, propName, seriesNumber);
89
89
  }
90
90
 
@@ -96,7 +96,7 @@ export function addStatisticsColumn(table: DG.DataFrame, colName: string, propNa
96
96
  //input: string aggrType
97
97
  //output: column result
98
98
  //meta.vectorFunc: true
99
- export function addAggrStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, aggrType: string) {
99
+ export function addAggrStatisticsColumn(table: DG.DataFrame, colName: string, propName: string, aggrType: string) : any {
100
100
  return PackageFunctions.addAggrStatisticsColumn(table, colName, propName, aggrType);
101
101
  }
102
102
 
@@ -115,17 +115,17 @@ export async function platesFolderPreview(folder: DG.FileInfo, files: DG.FileInf
115
115
  //output: view result
116
116
  //meta.fileViewer: txt
117
117
  //meta.fileViewerCheck: Curves:checkFileIsPlate
118
- export function previewPlate(file: DG.FileInfo) {
118
+ export function previewPlate(file: DG.FileInfo) : any {
119
119
  return PackageFunctions.previewPlate(file);
120
120
  }
121
121
 
122
122
  //name: importPlate
123
123
  //tags: file-handler
124
124
  //input: string fileContent
125
- //output: list result
125
+ //output: list<dataframe> result
126
126
  //meta.ext: txt
127
127
  //meta.fileViewerCheck: Curves:checkFileIsPlate
128
- export async function importPlate(fileContent: string) {
128
+ export async function importPlate(fileContent: string) : Promise<any> {
129
129
  return PackageFunctions.importPlate(fileContent);
130
130
  }
131
131
 
@@ -134,7 +134,7 @@ export async function importPlate(fileContent: string) {
134
134
  //input: blob fileContent
135
135
  //meta.ext: xlsx
136
136
  //meta.fileViewerCheck: Curves:checkExcelIsPlate
137
- export async function importPlateXlsx(fileContent: Uint8Array) {
137
+ export async function importPlateXlsx(fileContent: Uint8Array) : Promise<any> {
138
138
  return PackageFunctions.importPlateXlsx(fileContent);
139
139
  }
140
140
 
@@ -144,34 +144,34 @@ export async function importPlateXlsx(fileContent: Uint8Array) {
144
144
  //output: view result
145
145
  //meta.fileViewer: xlsx
146
146
  //meta.fileViewerCheck: Curves:checkExcelIsPlate
147
- export async function previewPlateXlsx(file: DG.FileInfo) {
147
+ export async function previewPlateXlsx(file: DG.FileInfo) : Promise<any> {
148
148
  return PackageFunctions.previewPlateXlsx(file);
149
149
  }
150
150
 
151
151
  //name: checkExcelIsPlate
152
152
  //input: blob content
153
153
  //output: bool result
154
- export async function checkExcelIsPlate(content: Uint8Array) {
154
+ export async function checkExcelIsPlate(content: Uint8Array) : Promise<boolean> {
155
155
  return PackageFunctions.checkExcelIsPlate(content);
156
156
  }
157
157
 
158
158
  //name: checkFileIsPlate
159
159
  //input: string content
160
160
  //output: bool result
161
- export function checkFileIsPlate(content: string) {
161
+ export function checkFileIsPlate(content: string) : boolean {
162
162
  return PackageFunctions.checkFileIsPlate(content);
163
163
  }
164
164
 
165
165
  //name: getPlateByBarcode
166
166
  //input: string barcode
167
167
  //output: dynamic result
168
- export async function getPlateByBarcode(barcode: string) {
168
+ export async function getPlateByBarcode(barcode: string) : Promise<any> {
169
169
  return PackageFunctions.getPlateByBarcode(barcode);
170
170
  }
171
171
 
172
172
  //name: createDummyPlateData
173
- export async function createDummyPlateData() {
174
- return PackageFunctions.createDummyPlateData();
173
+ export async function createDummyPlateData() : Promise<void> {
174
+ PackageFunctions.createDummyPlateData();
175
175
  }
176
176
  //name: PlateGridCellRenderer
177
177
  //tags: cellRenderer
package/src/package.ts CHANGED
@@ -65,14 +65,14 @@ export class PackageFunctions {
65
65
  grok.shell.addView(await PackageFunctions.previewPlateXlsx(plateFile) as DG.ViewBase);
66
66
  }
67
67
 
68
- @grok.decorators.init({})
68
+ @grok.decorators.init()
69
69
  static _initCurves(): void {
70
70
  DG.ObjectHandler.register(new FitGridCellHandler());
71
71
  DG.ObjectHandler.register(new PlateCellHandler());
72
72
  DG.ObjectHandler.register(new PlateTemplateHandler());
73
73
  }
74
74
 
75
- @grok.decorators.func({})
75
+ @grok.decorators.func()
76
76
  static async dataToCurves(df: DG.DataFrame, concentrationCol: DG.Column, readoutCol: DG.Column, batchIDCol: DG.Column, assayCol: DG.Column,
77
77
  runIDCol: DG.Column, compoundIDCol: DG.Column, targetEntityCol: DG.Column, @grok.decorators.param({options: {nullable: true}})excludeOutliersCol?: DG.Column,
78
78
  // rest is parent level data
@@ -104,7 +104,7 @@ export class PackageFunctions {
104
104
  );
105
105
  }
106
106
 
107
- @grok.decorators.func({'top-menu': 'Data | Curves | Data to Curves'})
107
+ @grok.decorators.func({'top-menu': 'Data | Curves | Data to Curves', 'outputs': [{'name': 'result', 'type': 'dynamic'}]})
108
108
  static async dataToCurvesTopMenu() {
109
109
  dataToCurvesUI();
110
110
  }
@@ -175,7 +175,7 @@ export class PackageFunctions {
175
175
  return column;
176
176
  }
177
177
 
178
- @grok.decorators.folderViewer({})
178
+ @grok.decorators.folderViewer({outputs: [{'name': 'result', 'type': 'dynamic'}]})
179
179
  static async platesFolderPreview(folder: DG.FileInfo, files: DG.FileInfo[]): Promise<DG.Widget | DG.ViewBase | undefined> {
180
180
  const nameLowerCase = folder.name?.toLowerCase();
181
181
  if (!nameLowerCase?.includes('plate'))
@@ -226,7 +226,7 @@ export class PackageFunctions {
226
226
  return view;
227
227
  }
228
228
 
229
- @grok.decorators.func({})
229
+ @grok.decorators.func()
230
230
  static async checkExcelIsPlate(content: Uint8Array): Promise<boolean> {
231
231
  try {
232
232
  if (content.length > 1_000_000) // haven't really seen a plate file larger than 1MB
@@ -249,7 +249,7 @@ export class PackageFunctions {
249
249
  }
250
250
  }
251
251
 
252
- @grok.decorators.func({})
252
+ @grok.decorators.func()
253
253
  static checkFileIsPlate(content: string): boolean {
254
254
  if (content.length > 1_000_000)
255
255
  return false;
@@ -261,14 +261,14 @@ export class PackageFunctions {
261
261
  return platesAppView();
262
262
  }
263
263
 
264
- @grok.decorators.func({})
264
+ @grok.decorators.func()
265
265
  static async getPlateByBarcode(barcode: string): Promise<Plate> {
266
266
  await initPlates();
267
267
  const df: DG.DataFrame = await api.queries.getWellValuesByBarcode(barcode);
268
268
  return Plate.fromDbDataFrame(df);
269
269
  }
270
270
 
271
- @grok.decorators.func({})
271
+ @grok.decorators.func()
272
272
  static async createDummyPlateData(): Promise<void> {
273
273
  await __createDummyPlateData();
274
274
  }
@@ -276,7 +276,6 @@ export class PackageFunctions {
276
276
 
277
277
  //name: platesAppTreeBrowserTempDisabled
278
278
  //input: dynamic treeNode
279
- //input: view browseView
280
- export async function platesAppTreeBrowserTempDisabled(treeNode: DG.TreeViewGroup, browseView: DG.BrowsePanel) {
279
+ export async function platesAppTreeBrowserTempDisabled(treeNode: DG.TreeViewGroup) {
281
280
  await initPlatesAppTree(treeNode);
282
281
  }