@datagrok/hit-triage 1.10.4 → 1.10.6
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/CHANGELOG.md +5 -0
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +7 -6
- package/queries/vid.sql +15 -11
- package/src/app/accordeons/new-hit-design-template-accordeon.ts +4 -1
- package/src/app/dialogs/functions-dialog.ts +9 -0
- package/src/app/hit-design-app.ts +58 -1
- package/src/package-api.ts +4 -0
- package/src/package-test.ts +0 -4
- package/src/package.g.ts +5 -0
- package/src/package.ts +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/hit-triage",
|
|
3
3
|
"friendlyName": "Hit Triage",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
"directory": "packages/HitTriage"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@datagrok-libraries/bio": "^5.63.6",
|
|
19
20
|
"@datagrok-libraries/compute-utils": "^1.44.9",
|
|
20
|
-
"@datagrok-libraries/statistics": "^1.12.
|
|
21
|
+
"@datagrok-libraries/statistics": "^1.12.9",
|
|
22
|
+
"@datagrok-libraries/test": "^1.1.0",
|
|
21
23
|
"@datagrok-libraries/utils": "^4.6.5",
|
|
22
24
|
"cash-dom": "^8.1.5",
|
|
23
25
|
"css-loader": "^6.5.1",
|
|
@@ -28,9 +30,7 @@
|
|
|
28
30
|
"ts-loader": "^9.5.1",
|
|
29
31
|
"typeahead-standalone": "4.14.1",
|
|
30
32
|
"typescript": "^5.6.3",
|
|
31
|
-
"uuid": "^
|
|
32
|
-
"@datagrok-libraries/test": "^1.1.0",
|
|
33
|
-
"@datagrok-libraries/bio": "^5.63.6"
|
|
33
|
+
"uuid": "^11.1.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/uuid": "^9.0.2",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"sok": "HD_OBSFUS__k7#mP9@zL2$qR5!nX8"
|
|
100
100
|
},
|
|
101
101
|
"overrides": {
|
|
102
|
-
"datagrok-api": "$datagrok-api"
|
|
102
|
+
"datagrok-api": "$datagrok-api",
|
|
103
|
+
"uuid": "^11.1.1"
|
|
103
104
|
}
|
|
104
105
|
}
|
package/queries/vid.sql
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--name: addMolecule
|
|
2
|
+
--friendlyName: Add Molecule
|
|
2
3
|
--description: Add a molecule to the dictionary. Returns VID for new or existing molecule.
|
|
3
4
|
--connection: HitTriage:hitdesign
|
|
4
|
-
--input: string canonicalSmiles
|
|
5
|
-
--input: string appName
|
|
6
|
-
--input: string campaignId
|
|
7
|
-
--input: string createdBy
|
|
5
|
+
--input: string canonicalSmiles [Canonical SMILES of the molecule to register]
|
|
6
|
+
--input: string appName [Application the campaign belongs to]
|
|
7
|
+
--input: string campaignId [Campaign the molecule is added to]
|
|
8
|
+
--input: string createdBy [User registering the molecule]
|
|
8
9
|
WITH existing AS (
|
|
9
10
|
SELECT vid FROM hitdesign.vid_dictionary WHERE mh_string = @canonicalSmiles
|
|
10
11
|
),
|
|
@@ -26,12 +27,13 @@ SELECT vid FROM all_vids;
|
|
|
26
27
|
--end
|
|
27
28
|
|
|
28
29
|
--name: addMolecules
|
|
30
|
+
--friendlyName: Add Molecules
|
|
29
31
|
--description: Add multiple molecules to the dictionary. Returns VIDs for new or existing molecules.
|
|
30
32
|
--connection: HitTriage:hitdesign
|
|
31
|
-
--input: list<string> smiles
|
|
32
|
-
--input: string appName
|
|
33
|
-
--input: string campaignId
|
|
34
|
-
--input: string createdBy
|
|
33
|
+
--input: list<string> smiles [Canonical SMILES of the molecules to register]
|
|
34
|
+
--input: string appName [Application the campaign belongs to]
|
|
35
|
+
--input: string campaignId [Campaign the molecules are added to]
|
|
36
|
+
--input: string createdBy [User registering the molecules]
|
|
35
37
|
WITH input_order AS (
|
|
36
38
|
SELECT s AS mh_string, ROW_NUMBER() OVER () AS ord
|
|
37
39
|
FROM UNNEST(@smiles) AS s
|
|
@@ -69,19 +71,21 @@ ORDER BY i.ord;
|
|
|
69
71
|
--end
|
|
70
72
|
|
|
71
73
|
--name: getMoleculeByVid
|
|
74
|
+
--friendlyName: Get Molecule by VID
|
|
72
75
|
--description: Get a molecule's canonical SMILES by its VID.
|
|
73
76
|
--connection: HitTriage:hitdesign
|
|
74
|
-
--input: string vid
|
|
77
|
+
--input: string vid [Virtual ID (e.g. V000001) to look up]
|
|
75
78
|
SELECT mh_string
|
|
76
79
|
FROM hitdesign.vid_dictionary
|
|
77
80
|
WHERE vid = @vid;
|
|
78
81
|
--end
|
|
79
82
|
|
|
80
83
|
--name: getCampaignsByVid
|
|
84
|
+
--friendlyName: Get Campaigns by VID
|
|
81
85
|
--description: Get all campaigns and creators for a given VID.
|
|
82
86
|
--connection: HitTriage:hitdesign
|
|
83
|
-
--input: string vid
|
|
84
|
-
--input: string appName {optional: true; nullable: true;}
|
|
87
|
+
--input: string vid [Virtual ID (e.g. V000001) to look up]
|
|
88
|
+
--input: string appName {optional: true; nullable: true;} [Restrict results to this application]
|
|
85
89
|
SELECT campaign_id, created_by, app_name
|
|
86
90
|
FROM hitdesign.campaign_vids
|
|
87
91
|
WHERE
|
|
@@ -102,7 +102,7 @@ export async function newHitDesignTemplateAccordeon(app: HitAppBase<any>,
|
|
|
102
102
|
},
|
|
103
103
|
} as unknown as PeptiHitTemplate;
|
|
104
104
|
const funcInput = await chemFunctionsDialog(app, (res) => {funcDialogRes = res;}, () => null,
|
|
105
|
-
dummyTemplate, false);
|
|
105
|
+
dummyTemplate, false, true);
|
|
106
106
|
funcInput.root.classList.add('hit-triage-new-template-functions-input');
|
|
107
107
|
const fieldsEditor = getCampaignFieldEditors(preset?.campaignFields);
|
|
108
108
|
const tileCategoriesEditor = getTileCategoryEditor(preset?.stages);
|
|
@@ -167,6 +167,7 @@ export async function newHitDesignTemplateAccordeon(app: HitAppBase<any>,
|
|
|
167
167
|
name: splitFunc[1],
|
|
168
168
|
package: splitFunc[0],
|
|
169
169
|
args: args,
|
|
170
|
+
rerunOnOpen: !!funcDialogRes?.rerunOnOpen?.[funcName],
|
|
170
171
|
});
|
|
171
172
|
}),
|
|
172
173
|
scripts: Object.entries(funcDialogRes?.scripts ?? {})
|
|
@@ -177,6 +178,7 @@ export async function newHitDesignTemplateAccordeon(app: HitAppBase<any>,
|
|
|
177
178
|
name: scriptNameParts[1] ?? '',
|
|
178
179
|
id: scriptNameParts[2] ?? '',
|
|
179
180
|
args: args,
|
|
181
|
+
rerunOnOpen: !!funcDialogRes?.rerunOnOpen?.[scriptId],
|
|
180
182
|
});
|
|
181
183
|
}),
|
|
182
184
|
queries: Object.entries(funcDialogRes?.queries ?? {})
|
|
@@ -187,6 +189,7 @@ export async function newHitDesignTemplateAccordeon(app: HitAppBase<any>,
|
|
|
187
189
|
name: queryNameParts[1] ?? '',
|
|
188
190
|
id: queryNameParts[2] ?? '',
|
|
189
191
|
args: args,
|
|
192
|
+
rerunOnOpen: !!funcDialogRes?.rerunOnOpen?.[queryName],
|
|
190
193
|
});
|
|
191
194
|
}),
|
|
192
195
|
},
|
|
@@ -11,6 +11,9 @@ import {HTFunctionOrderingLSKey} from '../consts';
|
|
|
11
11
|
export async function chemFunctionsDialog(app: HitAppBase<any>,
|
|
12
12
|
onOk: (result: IComputeDialogResult) => void, onCancel: () => void,
|
|
13
13
|
template: Omit<HitTriageTemplate, 'dataSourceType'>, dialog?: boolean,
|
|
14
|
+
// When true, each function/script/query gets a "re-run when campaign opens" checkbox whose state
|
|
15
|
+
// is persisted in the campaign's compute config (see HitDesignApp.reComputeOnCampaignOpen).
|
|
16
|
+
rerunOnOpen?: boolean,
|
|
14
17
|
): Promise<IChemFunctionsDialogResult> {
|
|
15
18
|
return _chemFunctionsDialog(
|
|
16
19
|
app.computeFunctions,
|
|
@@ -19,5 +22,11 @@ export async function chemFunctionsDialog(app: HitAppBase<any>,
|
|
|
19
22
|
dialog,
|
|
20
23
|
() => grok.chem.descriptorsTree() as Promise<IDescriptorTree>,
|
|
21
24
|
HTFunctionOrderingLSKey,
|
|
25
|
+
undefined,
|
|
26
|
+
rerunOnOpen ? {
|
|
27
|
+
label: 'Re-run when campaign opens',
|
|
28
|
+
tooltip: 'Recompute this function for the whole molecule column every time this campaign is ' +
|
|
29
|
+
'opened. Useful for database lookups that may resolve after the molecule was first drawn.',
|
|
30
|
+
} : undefined,
|
|
22
31
|
);
|
|
23
32
|
}
|
|
@@ -326,6 +326,11 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
326
326
|
if (campaignId && this.campaign?.mergeConfig?.autoMergeOnOpen && this.campaign.mergeConfig.filePath)
|
|
327
327
|
await autoMergeOnCampaignOpen(this);
|
|
328
328
|
|
|
329
|
+
// Recompute any compute functions flagged "re-run when campaign opens" over the whole molecule
|
|
330
|
+
// column. Like the auto-merge pass, this runs only for existing campaigns and is not auto-saved.
|
|
331
|
+
if (campaignId && this.campaign)
|
|
332
|
+
await this.reComputeOnCampaignOpen();
|
|
333
|
+
|
|
329
334
|
const designV = this.designView;
|
|
330
335
|
this.currentDesignViewId = designV.name;
|
|
331
336
|
this.setBaseUrl();
|
|
@@ -451,6 +456,55 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
451
456
|
this.saveCampaign(false);
|
|
452
457
|
}
|
|
453
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Recomputes the compute functions/scripts/queries flagged with `rerunOnOpen` over the whole
|
|
461
|
+
* molecule column. Called once when an existing campaign is opened, before the design view is
|
|
462
|
+
* shown. Mirrors the auto-merge-on-open pass: values are updated in memory but the campaign is
|
|
463
|
+
* not auto-saved, and failures never bubble up so the campaign still opens.
|
|
464
|
+
*/
|
|
465
|
+
private async reComputeOnCampaignOpen(): Promise<void> {
|
|
466
|
+
const compute = this.template?.compute;
|
|
467
|
+
if (!compute || !this.dataFrame || !this.molColName)
|
|
468
|
+
return;
|
|
469
|
+
|
|
470
|
+
// Descriptors are deterministic from structure, so they are intentionally never re-run on open.
|
|
471
|
+
const functions = (compute.functions ?? []).filter((f) => f.rerunOnOpen);
|
|
472
|
+
const scripts = (compute.scripts ?? []).filter((s) => s.rerunOnOpen);
|
|
473
|
+
const queries = (compute.queries ?? []).filter((q) => q.rerunOnOpen);
|
|
474
|
+
if (!functions.length && !scripts.length && !queries.length)
|
|
475
|
+
return;
|
|
476
|
+
|
|
477
|
+
const molCol = this.dataFrame.col(this.molColName);
|
|
478
|
+
if (!molCol)
|
|
479
|
+
return;
|
|
480
|
+
|
|
481
|
+
try {
|
|
482
|
+
// Compute against a temporary molecule-only table, then merge the results back in. Merging by
|
|
483
|
+
// column name lets us overwrite an existing column in place instead of appending a duplicate
|
|
484
|
+
// "<name> (2)" column — e.g. a query that re-resolves a ChEMBL molregno already in the table.
|
|
485
|
+
const values = molCol.toList();
|
|
486
|
+
const calcDf = await calculateCellValues(values, [], functions, scripts, queries);
|
|
487
|
+
for (const resCol of calcDf.columns.toList()) {
|
|
488
|
+
if (resCol.name === this.molColName || resCol.name === HitDesignMolColName)
|
|
489
|
+
continue;
|
|
490
|
+
let targetCol = this.dataFrame.col(resCol.name);
|
|
491
|
+
if (!targetCol || targetCol.type !== resCol.type) {
|
|
492
|
+
if (targetCol) // existing column of a different type: replace it wholesale
|
|
493
|
+
this.dataFrame.columns.remove(resCol.name);
|
|
494
|
+
targetCol = this.dataFrame.columns.addNew(resCol.name, resCol.type);
|
|
495
|
+
}
|
|
496
|
+
targetCol.semType = resCol.semType;
|
|
497
|
+
const rows = Math.min(resCol.length, targetCol.length);
|
|
498
|
+
for (let i = 0; i < rows; i++)
|
|
499
|
+
targetCol.set(i, resCol.isNone(i) ? null : resCol.get(i), false);
|
|
500
|
+
}
|
|
501
|
+
this.dataFrame.fireValuesChanged();
|
|
502
|
+
} catch (e) {
|
|
503
|
+
_package.logger.error(e);
|
|
504
|
+
grok.shell.warning('Re-run on open failed for some functions; opening the campaign anyway.');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
454
508
|
private _refreshCampaignIcon: HTMLElement | null = null;
|
|
455
509
|
protected initDesignViewRibbons(view: DG.TableView, subs: Subscription[], addDesignerButton = false) {
|
|
456
510
|
const onRemoveSub = grok.events.onViewRemoved.subscribe((v) => {
|
|
@@ -489,6 +543,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
489
543
|
name: splitFunc[1],
|
|
490
544
|
package: splitFunc[0],
|
|
491
545
|
args: args,
|
|
546
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[funcName],
|
|
492
547
|
});
|
|
493
548
|
}),
|
|
494
549
|
scripts: Object.entries(resultMap?.scripts ?? {})
|
|
@@ -499,6 +554,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
499
554
|
name: scriptNameParts[1] ?? '',
|
|
500
555
|
id: scriptNameParts[2] ?? '',
|
|
501
556
|
args: args,
|
|
557
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[scriptId],
|
|
502
558
|
});
|
|
503
559
|
}),
|
|
504
560
|
queries: Object.entries(resultMap?.queries ?? {})
|
|
@@ -509,6 +565,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
509
565
|
name: queryNameParts[1] ?? '',
|
|
510
566
|
id: queryNameParts[2] ?? '',
|
|
511
567
|
args: args,
|
|
568
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[queryName],
|
|
512
569
|
});
|
|
513
570
|
}),
|
|
514
571
|
};
|
|
@@ -551,7 +608,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
551
608
|
ui.setUpdateIndicator(view.grid.root, false);
|
|
552
609
|
this.saveCampaign(false);
|
|
553
610
|
}
|
|
554
|
-
}, () => null, this.campaign?.template!, true);
|
|
611
|
+
}, () => null, this.campaign?.template!, true, true);
|
|
555
612
|
};
|
|
556
613
|
|
|
557
614
|
const calculateRibbon = ui.iconFA('wrench', getComputeDialog, 'Calculate additional properties');
|
package/src/package-api.ts
CHANGED
|
@@ -59,6 +59,10 @@ export namespace queries {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export namespace funcs {
|
|
62
|
+
export async function initHT(): Promise<void> {
|
|
63
|
+
return await grok.functions.call('HitTriage:InitHT', {});
|
|
64
|
+
}
|
|
65
|
+
|
|
62
66
|
export async function hitTriageAppTreeBrowser(treeNode: any ): Promise<void> {
|
|
63
67
|
return await grok.functions.call('HitTriage:HitTriageAppTreeBrowser', { treeNode });
|
|
64
68
|
}
|
package/src/package-test.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
3
|
|
|
4
|
-
// Do not import anything from JsDrawLite or HelmWebEditor, only to the main Helm package
|
|
5
|
-
// import {JSDraw2ModuleType} from '@datagrok/js-draw-lite/src/types/jsdraw2';
|
|
6
|
-
// import {HelmType, OrgHelmModuleType} from '@datagrok/helm-web-editor/src/types/org-helm';
|
|
7
|
-
|
|
8
4
|
import {runTests, tests, TestContext, initAutoTests as initTests } from '@datagrok-libraries/test/src/test';
|
|
9
5
|
|
|
10
6
|
export const _package = new DG.Package();
|
package/src/package.g.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {PackageFunctions} from './package';
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
|
|
4
|
+
//meta.role: init
|
|
5
|
+
export async function initHT() : Promise<void> {
|
|
6
|
+
await PackageFunctions.initHT();
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
//input: dynamic treeNode
|
|
5
10
|
//meta.app: Hit Triage
|
|
6
11
|
export async function hitTriageAppTreeBrowser(treeNode: any) : Promise<void> {
|
package/src/package.ts
CHANGED
|
@@ -132,6 +132,10 @@ async function hitAppTB(treeNode: DG.TreeViewGroup, name: AppName) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export class PackageFunctions {
|
|
135
|
+
@grok.decorators.init()
|
|
136
|
+
static async initHT() {
|
|
137
|
+
await grok.functions.call('Chem:init', {});
|
|
138
|
+
}
|
|
135
139
|
@grok.decorators.treeBrowser({meta: {app: 'Hit Triage'}})
|
|
136
140
|
static async hitTriageAppTreeBrowser(treeNode: DG.TreeViewGroup) {
|
|
137
141
|
await hitAppTB(treeNode, 'Hit Triage');
|