@datagrok/hit-triage 1.10.5 → 1.10.7
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/.turbo/turbo-build.log +10 -0
- package/CHANGELOG.md +10 -0
- package/LICENSE.md +16 -0
- package/README_OLD.md +3 -3
- package/dist/package-test.js +34 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +430 -1
- package/dist/package.js.map +1 -1
- package/package.json +16 -42
- package/src/app/accordeons/new-hit-design-campaign-accordeon.ts +8 -2
- package/src/app/accordeons/new-hit-design-template-accordeon.ts +4 -1
- package/src/app/ai/view-functions.ts +549 -0
- package/src/app/base-view.ts +14 -2
- package/src/app/dialogs/functions-dialog.ts +9 -0
- package/src/app/hit-app-base.ts +1 -0
- package/src/app/hit-design-app.ts +66 -2
- package/src/app/hit-design-views/info-view.ts +4 -3
- package/src/app/hit-design-views/submit-view.ts +13 -4
- package/src/app/hit-triage-app.ts +8 -1
- package/src/app/hit-triage-views/info-view.ts +4 -3
- package/src/app/hit-triage-views/submit-view.ts +6 -4
- package/src/package-api.ts +29 -14
- package/src/package.g.ts +5 -0
- package/src/package.ts +8 -0
- package/src/packageSettingsEditor.ts +5 -11
- package/tsconfig.json +4 -69
- package/webpack.config.js +3 -46
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -45
|
@@ -25,6 +25,7 @@ import * as api from '../package-api';
|
|
|
25
25
|
import {registerMol} from './utils/molreg';
|
|
26
26
|
import {autoMergeOnCampaignOpen, mergeIntoCampaign} from './utils/merge-table';
|
|
27
27
|
import {openMergeTableDialog} from './dialogs/merge-table-dialog';
|
|
28
|
+
import {attachHitInfoAi, attachHitCampaignAi} from './ai/view-functions';
|
|
28
29
|
|
|
29
30
|
export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> extends HitAppBase<T> {
|
|
30
31
|
multiView: DG.MultiView;
|
|
@@ -32,6 +33,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
32
33
|
get infoView(): HitDesignInfoView {return this._infoView;}
|
|
33
34
|
protected _designView?: DG.TableView;
|
|
34
35
|
public _submitView?: HitDesignSubmitView;
|
|
36
|
+
get submitView(): HitDesignSubmitView | undefined {return this._submitView;}
|
|
35
37
|
protected _designViewName = 'Design';
|
|
36
38
|
protected _filePath = `System.AppData/HitTriage/${this.appName}/campaigns`;
|
|
37
39
|
protected _campaignId?: string;
|
|
@@ -54,6 +56,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
54
56
|
}));
|
|
55
57
|
|
|
56
58
|
this.multiView.parentCall = c;
|
|
59
|
+
attachHitInfoAi(this.multiView, this);
|
|
57
60
|
|
|
58
61
|
this.mainView = this.multiView;
|
|
59
62
|
this._initViewSubs();
|
|
@@ -326,6 +329,11 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
326
329
|
if (campaignId && this.campaign?.mergeConfig?.autoMergeOnOpen && this.campaign.mergeConfig.filePath)
|
|
327
330
|
await autoMergeOnCampaignOpen(this);
|
|
328
331
|
|
|
332
|
+
// Recompute any compute functions flagged "re-run when campaign opens" over the whole molecule
|
|
333
|
+
// column. Like the auto-merge pass, this runs only for existing campaigns and is not auto-saved.
|
|
334
|
+
if (campaignId && this.campaign)
|
|
335
|
+
await this.reComputeOnCampaignOpen();
|
|
336
|
+
|
|
329
337
|
const designV = this.designView;
|
|
330
338
|
this.currentDesignViewId = designV.name;
|
|
331
339
|
this.setBaseUrl();
|
|
@@ -383,7 +391,11 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
383
391
|
|
|
384
392
|
get campaignId(): string | undefined {return this._campaignId;}
|
|
385
393
|
|
|
386
|
-
get designView(): DG.TableView {
|
|
394
|
+
get designView(): DG.TableView {
|
|
395
|
+
const view = this.getDesignView();
|
|
396
|
+
attachHitCampaignAi(view, this, 'design');
|
|
397
|
+
return this._designView = view;
|
|
398
|
+
}
|
|
387
399
|
|
|
388
400
|
get designViewName(): string {return this._designViewName;}
|
|
389
401
|
|
|
@@ -451,6 +463,55 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
451
463
|
this.saveCampaign(false);
|
|
452
464
|
}
|
|
453
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Recomputes the compute functions/scripts/queries flagged with `rerunOnOpen` over the whole
|
|
468
|
+
* molecule column. Called once when an existing campaign is opened, before the design view is
|
|
469
|
+
* shown. Mirrors the auto-merge-on-open pass: values are updated in memory but the campaign is
|
|
470
|
+
* not auto-saved, and failures never bubble up so the campaign still opens.
|
|
471
|
+
*/
|
|
472
|
+
private async reComputeOnCampaignOpen(): Promise<void> {
|
|
473
|
+
const compute = this.template?.compute;
|
|
474
|
+
if (!compute || !this.dataFrame || !this.molColName)
|
|
475
|
+
return;
|
|
476
|
+
|
|
477
|
+
// Descriptors are deterministic from structure, so they are intentionally never re-run on open.
|
|
478
|
+
const functions = (compute.functions ?? []).filter((f) => f.rerunOnOpen);
|
|
479
|
+
const scripts = (compute.scripts ?? []).filter((s) => s.rerunOnOpen);
|
|
480
|
+
const queries = (compute.queries ?? []).filter((q) => q.rerunOnOpen);
|
|
481
|
+
if (!functions.length && !scripts.length && !queries.length)
|
|
482
|
+
return;
|
|
483
|
+
|
|
484
|
+
const molCol = this.dataFrame.col(this.molColName);
|
|
485
|
+
if (!molCol)
|
|
486
|
+
return;
|
|
487
|
+
|
|
488
|
+
try {
|
|
489
|
+
// Compute against a temporary molecule-only table, then merge the results back in. Merging by
|
|
490
|
+
// column name lets us overwrite an existing column in place instead of appending a duplicate
|
|
491
|
+
// "<name> (2)" column — e.g. a query that re-resolves a ChEMBL molregno already in the table.
|
|
492
|
+
const values = molCol.toList();
|
|
493
|
+
const calcDf = await calculateCellValues(values, [], functions, scripts, queries);
|
|
494
|
+
for (const resCol of calcDf.columns.toList()) {
|
|
495
|
+
if (resCol.name === this.molColName || resCol.name === HitDesignMolColName)
|
|
496
|
+
continue;
|
|
497
|
+
let targetCol = this.dataFrame.col(resCol.name);
|
|
498
|
+
if (!targetCol || targetCol.type !== resCol.type) {
|
|
499
|
+
if (targetCol) // existing column of a different type: replace it wholesale
|
|
500
|
+
this.dataFrame.columns.remove(resCol.name);
|
|
501
|
+
targetCol = this.dataFrame.columns.addNew(resCol.name, resCol.type);
|
|
502
|
+
}
|
|
503
|
+
targetCol.semType = resCol.semType;
|
|
504
|
+
const rows = Math.min(resCol.length, targetCol.length);
|
|
505
|
+
for (let i = 0; i < rows; i++)
|
|
506
|
+
targetCol.set(i, resCol.isNone(i) ? null : resCol.get(i), false);
|
|
507
|
+
}
|
|
508
|
+
this.dataFrame.fireValuesChanged();
|
|
509
|
+
} catch (e) {
|
|
510
|
+
_package.logger.error(e);
|
|
511
|
+
grok.shell.warning('Re-run on open failed for some functions; opening the campaign anyway.');
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
454
515
|
private _refreshCampaignIcon: HTMLElement | null = null;
|
|
455
516
|
protected initDesignViewRibbons(view: DG.TableView, subs: Subscription[], addDesignerButton = false) {
|
|
456
517
|
const onRemoveSub = grok.events.onViewRemoved.subscribe((v) => {
|
|
@@ -489,6 +550,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
489
550
|
name: splitFunc[1],
|
|
490
551
|
package: splitFunc[0],
|
|
491
552
|
args: args,
|
|
553
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[funcName],
|
|
492
554
|
});
|
|
493
555
|
}),
|
|
494
556
|
scripts: Object.entries(resultMap?.scripts ?? {})
|
|
@@ -499,6 +561,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
499
561
|
name: scriptNameParts[1] ?? '',
|
|
500
562
|
id: scriptNameParts[2] ?? '',
|
|
501
563
|
args: args,
|
|
564
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[scriptId],
|
|
502
565
|
});
|
|
503
566
|
}),
|
|
504
567
|
queries: Object.entries(resultMap?.queries ?? {})
|
|
@@ -509,6 +572,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
509
572
|
name: queryNameParts[1] ?? '',
|
|
510
573
|
id: queryNameParts[2] ?? '',
|
|
511
574
|
args: args,
|
|
575
|
+
rerunOnOpen: !!resultMap?.rerunOnOpen?.[queryName],
|
|
512
576
|
});
|
|
513
577
|
}),
|
|
514
578
|
};
|
|
@@ -551,7 +615,7 @@ export class HitDesignApp<T extends HitDesignTemplate = HitDesignTemplate> exten
|
|
|
551
615
|
ui.setUpdateIndicator(view.grid.root, false);
|
|
552
616
|
this.saveCampaign(false);
|
|
553
617
|
}
|
|
554
|
-
}, () => null, this.campaign?.template!, true);
|
|
618
|
+
}, () => null, this.campaign?.template!, true, true);
|
|
555
619
|
};
|
|
556
620
|
|
|
557
621
|
const calculateRibbon = ui.iconFA('wrench', getComputeDialog, 'Calculate additional properties');
|
|
@@ -20,6 +20,7 @@ import {newHitDesignCampaignAccordeon} from '../accordeons/new-hit-design-campai
|
|
|
20
20
|
import {newHitDesignTemplateAccordeon} from '../accordeons/new-hit-design-template-accordeon';
|
|
21
21
|
import {HitBaseView} from '../base-view';
|
|
22
22
|
import {defaultPermissions, PermissionsDialog} from '../dialogs/permissions-dialog';
|
|
23
|
+
import {hitInfoAiDescription} from '../ai/view-functions';
|
|
23
24
|
|
|
24
25
|
export class HitDesignInfoView
|
|
25
26
|
<T extends HitDesignTemplate = HitDesignTemplate, K extends HitDesignApp = HitDesignApp>
|
|
@@ -30,6 +31,8 @@ export class HitDesignInfoView
|
|
|
30
31
|
constructor(app: K) {
|
|
31
32
|
super(app);
|
|
32
33
|
this.name = 'Hit Design';
|
|
34
|
+
// TODO: Remove before api release
|
|
35
|
+
(this as any).aiDescription = hitInfoAiDescription(app.appName);
|
|
33
36
|
this._appHeader = this.getAppHeader();
|
|
34
37
|
this.root.appendChild(ui.div([this._appHeader], {style: {marginLeft: '10px'}}));
|
|
35
38
|
this.root.appendChild(this._contentRoot);
|
|
@@ -307,9 +310,7 @@ export class HitDesignInfoView
|
|
|
307
310
|
ui.dialog('Delete campaign')
|
|
308
311
|
.add(ui.divText(`Are you sure you want to delete campaign ${info.name}?`))
|
|
309
312
|
.onOK(async () => {
|
|
310
|
-
await this.
|
|
311
|
-
this.deletedCampaigns.push(info.name);
|
|
312
|
-
await this.init();
|
|
313
|
+
await this.deleteCampaignAndRefresh(this.app.appName, info.name);
|
|
313
314
|
})
|
|
314
315
|
.show();
|
|
315
316
|
}, 'Delete campaign');
|
|
@@ -48,6 +48,13 @@ export class HitDesignSubmitView extends HitBaseView<HitDesignTemplate, HitDesig
|
|
|
48
48
|
return this.statusInput.value ?? this.app.campaign?.status ?? 'No Status';
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/** Programmatic submit (used by the AI view functions): seeds the status the same
|
|
52
|
+
* way the dialog does, then runs the regular submit flow. */
|
|
53
|
+
public async submitWithStatus(status?: string): Promise<boolean> {
|
|
54
|
+
this.statusInput.value = status?.trim() ? status.trim() : (this.app.campaign?.status ?? 'Submitted');
|
|
55
|
+
return await this.submit();
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
render() {
|
|
52
59
|
this.statusInput.value = this.app.campaign?.status ?? '';
|
|
53
60
|
ui.empty(this.content);
|
|
@@ -106,22 +113,24 @@ export class HitDesignSubmitView extends HitBaseView<HitDesignTemplate, HitDesig
|
|
|
106
113
|
onActivated(): void {
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
|
|
116
|
+
/** Resolves to whether the submit function ran and the campaign was saved. */
|
|
117
|
+
async submit(): Promise<boolean> {
|
|
110
118
|
const submitParams= this.app.submitParams;
|
|
111
119
|
if (!submitParams) {
|
|
112
120
|
grok.shell.error('No submit function selected. Please select a function to submit the campaign.');
|
|
113
|
-
return;
|
|
121
|
+
return false;
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
const submitFn = DG.Func.find({name: submitParams.fName, package: submitParams.package})[0];
|
|
117
125
|
if (!submitFn) {
|
|
118
126
|
grok.shell.error(`Function ${submitParams.fName} not found.`);
|
|
119
|
-
return;
|
|
127
|
+
return false;
|
|
120
128
|
}
|
|
121
129
|
const filteredDf = DG.DataFrame.fromCsv(this.app.dataFrame!.toCsv({filteredRowsOnly: true}));
|
|
122
130
|
await submitFn.apply({df: filteredDf, molecules: this.app.molColName});
|
|
123
131
|
this.app.campaign!.status = this.getStatus();
|
|
124
|
-
this.app.saveCampaign();
|
|
132
|
+
await this.app.saveCampaign();
|
|
125
133
|
grok.shell.info('Submitted successfully.');
|
|
134
|
+
return true;
|
|
126
135
|
}
|
|
127
136
|
}
|
|
@@ -16,6 +16,7 @@ import {HitBaseView} from './base-view';
|
|
|
16
16
|
import {saveCampaignDialog} from './dialogs/save-campaign-dialog';
|
|
17
17
|
import {calculateColumns} from './utils/calculate-single-cell';
|
|
18
18
|
import {defaultPermissions, PermissionsDialog} from './dialogs/permissions-dialog';
|
|
19
|
+
import {attachHitInfoAi, attachHitCampaignAi} from './ai/view-functions';
|
|
19
20
|
// @ts-ignore
|
|
20
21
|
import '../../css/hit-triage.css';
|
|
21
22
|
|
|
@@ -26,6 +27,7 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
|
|
|
26
27
|
get infoView(): InfoView {return this._infoView;}
|
|
27
28
|
private _pickView?: DG.TableView;
|
|
28
29
|
private _submitView?: SubmitView;
|
|
30
|
+
get submitView(): SubmitView | undefined {return this._submitView;}
|
|
29
31
|
|
|
30
32
|
private _filterViewName = 'Hit Triage | Pick';
|
|
31
33
|
private _friendlyName?: string;
|
|
@@ -51,6 +53,7 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
|
|
|
51
53
|
(this.multiView.currentView as HitBaseView<HitTriageTemplate, HitTriageApp>).onActivated();
|
|
52
54
|
});
|
|
53
55
|
this.multiView.parentCall = c;
|
|
56
|
+
attachHitInfoAi(this.multiView, this);
|
|
54
57
|
//grok.shell.addView(this.multiView);
|
|
55
58
|
|
|
56
59
|
grok.events.onCurrentViewChanged.subscribe(() => {
|
|
@@ -177,7 +180,11 @@ export class HitTriageApp extends HitAppBase<HitTriageTemplate> {
|
|
|
177
180
|
|
|
178
181
|
get campaignId(): string | undefined {return this._campaignId;}
|
|
179
182
|
|
|
180
|
-
get pickView(): DG.TableView {
|
|
183
|
+
get pickView(): DG.TableView {
|
|
184
|
+
const view = this.getFilterView();
|
|
185
|
+
attachHitCampaignAi(view, this, 'pick');
|
|
186
|
+
return this._pickView = view;
|
|
187
|
+
}
|
|
181
188
|
|
|
182
189
|
get molColName() {return this._molColName ??= this.dataFrame?.columns.bySemType(DG.SEMTYPE.MOLECULE)?.name;}
|
|
183
190
|
|
|
@@ -21,6 +21,7 @@ import {createTemplateAccordeon} from '../accordeons/new-template-accordeon';
|
|
|
21
21
|
import {HitBaseView} from '../base-view';
|
|
22
22
|
import {u2} from '@datagrok-libraries/utils/src/u2';
|
|
23
23
|
import {defaultPermissions, PermissionsDialog} from '../dialogs/permissions-dialog';
|
|
24
|
+
import {hitInfoAiDescription} from '../ai/view-functions';
|
|
24
25
|
|
|
25
26
|
export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
|
|
26
27
|
public readmePath = _package.webRoot + 'README_HT.md';
|
|
@@ -31,6 +32,8 @@ export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
|
|
|
31
32
|
constructor(app: HitTriageApp) {
|
|
32
33
|
super(app);
|
|
33
34
|
this.name = 'Hit Triage';
|
|
35
|
+
// TODO: Remove before api release
|
|
36
|
+
(this as any).aiDescription = hitInfoAiDescription(app.appName);
|
|
34
37
|
this._appHeader = this.getAppHeader();
|
|
35
38
|
this.root.appendChild(ui.div([this._appHeader], {style: {marginLeft: '10px'}}));
|
|
36
39
|
this.root.appendChild(this._contentRoot);
|
|
@@ -324,9 +327,7 @@ export class InfoView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
|
|
|
324
327
|
ui.dialog('Delete campaign')
|
|
325
328
|
.add(ui.divText(`Are you sure you want to delete campaign ${info.friendlyName ?? info.name}?`))
|
|
326
329
|
.onOK(async () => {
|
|
327
|
-
await this.
|
|
328
|
-
this.deletedCampaigns.push(info.name);
|
|
329
|
-
await this.init();
|
|
330
|
+
await this.deleteCampaignAndRefresh(this.app.appName, info.name);
|
|
330
331
|
})
|
|
331
332
|
.show();
|
|
332
333
|
}, 'Delete campaign');
|
|
@@ -26,19 +26,21 @@ export class SubmitView extends HitBaseView<HitTriageTemplate, HitTriageApp> {
|
|
|
26
26
|
this.render();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/** Resolves to whether the submit function ran and the campaign was saved. */
|
|
30
|
+
public async submit(): Promise<boolean> {
|
|
30
31
|
const submitParams= this.app.submitParams;
|
|
31
32
|
if (!submitParams)
|
|
32
|
-
return;
|
|
33
|
+
return false;
|
|
33
34
|
const submitFn = DG.Func.find({name: submitParams.fName, package: submitParams.package})[0];
|
|
34
35
|
if (!submitFn) {
|
|
35
36
|
grok.shell.error(`Function ${submitParams.fName} not found.`);
|
|
36
|
-
return;
|
|
37
|
+
return false;
|
|
37
38
|
}
|
|
38
39
|
const filteredDf = DG.DataFrame.fromCsv(this.app.dataFrame!.toCsv({filteredRowsOnly: true}));
|
|
39
40
|
await submitFn.apply({df: filteredDf, molecules: this.app.molColName});
|
|
40
41
|
this.app.campaign && (this.app.campaign.status = 'Submitted');
|
|
41
|
-
this.app.saveCampaign('Submitted');
|
|
42
|
+
await this.app.saveCampaign('Submitted');
|
|
42
43
|
grok.shell.info('Submitted successfully.');
|
|
44
|
+
return true;
|
|
43
45
|
}
|
|
44
46
|
}
|
package/src/package-api.ts
CHANGED
|
@@ -9,56 +9,60 @@ import * as DG from 'datagrok-api/dg';
|
|
|
9
9
|
|
|
10
10
|
export namespace queries {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Acquire a lock for a campaign. If the lock is expired, it will be removed and a new lock will be created.
|
|
13
|
+
*/
|
|
14
14
|
export async function acquireCampaignLock(appName: string , campaignId: string , lockedBy?: string | null): Promise<DG.DataFrame> {
|
|
15
15
|
return await grok.data.query('HitTriage:AcquireCampaignLock', { appName, campaignId, lockedBy });
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* Release a lock for a campaign.
|
|
20
|
+
*/
|
|
21
21
|
export async function releaseCampaignLock(appName: string , campaignId: string ): Promise<DG.DataFrame> {
|
|
22
22
|
return await grok.data.query('HitTriage:ReleaseCampaignLock', { appName, campaignId });
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
* Get the last modified time of a campaign lock release (same as save).
|
|
27
|
+
*/
|
|
28
28
|
export async function getLastModified(appName: string , campaignId: string ): Promise<DG.DataFrame> {
|
|
29
29
|
return await grok.data.query('HitTriage:GetLastModified', { appName, campaignId });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
* Add a molecule to the dictionary. Returns VID for new or existing molecule.
|
|
34
|
+
*/
|
|
35
35
|
export async function addMolecule(canonicalSmiles: string , appName: string , campaignId: string , createdBy: string ): Promise<DG.DataFrame> {
|
|
36
36
|
return await grok.data.query('HitTriage:AddMolecule', { canonicalSmiles, appName, campaignId, createdBy });
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* Add multiple molecules to the dictionary. Returns VIDs for new or existing molecules.
|
|
41
|
+
*/
|
|
42
42
|
export async function addMolecules(smiles: any , appName: string , campaignId: string , createdBy: string ): Promise<DG.DataFrame> {
|
|
43
43
|
return await grok.data.query('HitTriage:AddMolecules', { smiles, appName, campaignId, createdBy });
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
* Get a molecule's canonical SMILES by its VID.
|
|
48
|
+
*/
|
|
49
49
|
export async function getMoleculeByVid(vid: string ): Promise<DG.DataFrame> {
|
|
50
50
|
return await grok.data.query('HitTriage:GetMoleculeByVid', { vid });
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
* Get all campaigns and creators for a given VID.
|
|
55
|
+
*/
|
|
56
56
|
export async function getCampaignsByVid(vid: string , appName?: string | null): Promise<DG.DataFrame> {
|
|
57
57
|
return await grok.data.query('HitTriage:GetCampaignsByVid', { vid, appName });
|
|
58
58
|
}
|
|
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
|
}
|
|
@@ -99,6 +103,9 @@ export namespace funcs {
|
|
|
99
103
|
return await grok.functions.call('HitTriage:DemoFileIngest1', {});
|
|
100
104
|
}
|
|
101
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @param {number} numberOfMolecules - Molecules counts
|
|
108
|
+
*/
|
|
102
109
|
export async function demoFileIngest2(numberOfMolecules: number ): Promise<DG.DataFrame> {
|
|
103
110
|
return await grok.functions.call('HitTriage:DemoFileIngest2', { numberOfMolecules });
|
|
104
111
|
}
|
|
@@ -107,6 +114,10 @@ export namespace funcs {
|
|
|
107
114
|
return await grok.functions.call('HitTriage:DemoPeptideSequences', { peptideCount });
|
|
108
115
|
}
|
|
109
116
|
|
|
117
|
+
/**
|
|
118
|
+
* @param {DG.DataFrame} df - Dataframe
|
|
119
|
+
* @param {string} molecules - Molecules column name
|
|
120
|
+
*/
|
|
110
121
|
export async function demoFileSubmit(df: DG.DataFrame , molecules: string ): Promise<void> {
|
|
111
122
|
return await grok.functions.call('HitTriage:DemoFileSubmit', { df, molecules });
|
|
112
123
|
}
|
|
@@ -115,6 +126,10 @@ export namespace funcs {
|
|
|
115
126
|
return await grok.functions.call('HitTriage:RegisterMoleculesToViD', {});
|
|
116
127
|
}
|
|
117
128
|
|
|
129
|
+
/**
|
|
130
|
+
* @param {any} vid
|
|
131
|
+
* semType: HIT_DESIGN_VID
|
|
132
|
+
*/
|
|
118
133
|
export async function hitDesignVidPanel(vid: any ): Promise<any> {
|
|
119
134
|
return await grok.functions.call('HitTriage:HitDesignVidPanel', { vid });
|
|
120
135
|
}
|
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,14 @@ 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
|
+
try {
|
|
138
|
+
await grok.functions.call('Chem:init', {});
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.error('error initializing chem package', e);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
135
143
|
@grok.decorators.treeBrowser({meta: {app: 'Hit Triage'}})
|
|
136
144
|
static async hitTriageAppTreeBrowser(treeNode: DG.TreeViewGroup) {
|
|
137
145
|
await hitAppTB(treeNode, 'Hit Triage');
|
|
@@ -32,18 +32,12 @@ export async function parseUserGroupString(s: string | null) {
|
|
|
32
32
|
|
|
33
33
|
export async function getDefaultSharingSettings(): Promise<HTDefaultCampaignSharing> {
|
|
34
34
|
try {
|
|
35
|
-
const ps =
|
|
35
|
+
const ps = _package.settings;
|
|
36
36
|
const settings: HTDefaultCampaignSharing = {view: [], edit: []};
|
|
37
37
|
if (!ps)
|
|
38
38
|
return settings;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
settings.view = await parseUserGroupString(ps.get('view') ?? '');
|
|
42
|
-
settings.edit = await parseUserGroupString(ps.get('edit') ?? '');
|
|
43
|
-
} else {
|
|
44
|
-
settings.view = await parseUserGroupString(ps.view ?? '');
|
|
45
|
-
settings.edit = await parseUserGroupString(ps.edit ?? '');
|
|
46
|
-
}
|
|
39
|
+
settings.view = await parseUserGroupString(ps.view ?? '');
|
|
40
|
+
settings.edit = await parseUserGroupString(ps.edit ?? '');
|
|
47
41
|
return settings;
|
|
48
42
|
} catch (e) {
|
|
49
43
|
console.error(e);
|
|
@@ -52,10 +46,10 @@ export async function getDefaultSharingSettings(): Promise<HTDefaultCampaignShar
|
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
export async function getDefaultCampaignStorageSettings(): Promise<string> {
|
|
55
|
-
const ps =
|
|
49
|
+
const ps = _package.settings;
|
|
56
50
|
if (!ps)
|
|
57
51
|
return defaultCampaignStorage;
|
|
58
|
-
const res =
|
|
52
|
+
const res = ps[defaultCampaignStoragePropName] ?? defaultCampaignStorage;
|
|
59
53
|
// check if it exists
|
|
60
54
|
if (!(await grok.dapi.files.exists(res)))
|
|
61
55
|
return defaultCampaignStorage;
|
package/tsconfig.json
CHANGED
|
@@ -1,71 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
"module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
"lib": ["ES2022", "dom"], /* Specify library files to be included in the compilation. */
|
|
10
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
|
13
|
-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
-
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
// "outDir": "./", /* Redirect output structure to the directory. */
|
|
18
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
-
// "composite": true, /* Enable project compilation */
|
|
20
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
-
|
|
27
|
-
/* Strict Type-Checking Options */
|
|
28
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
-
|
|
37
|
-
/* Additional Checks */
|
|
38
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
43
|
-
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
44
|
-
|
|
45
|
-
/* Module Resolution Options */
|
|
46
|
-
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
47
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
48
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
49
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
50
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
51
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
52
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
53
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
54
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
55
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
56
|
-
|
|
57
|
-
/* Source Map Options */
|
|
58
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
59
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
61
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
62
|
-
|
|
63
|
-
/* Experimental Options */
|
|
64
|
-
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
65
|
-
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
66
|
-
|
|
67
|
-
/* Advanced Options */
|
|
68
|
-
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
69
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
70
|
-
}
|
|
2
|
+
"extends": "@datagrok/build-config/tsconfig.base.json",
|
|
3
|
+
"include": [
|
|
4
|
+
"src"
|
|
5
|
+
]
|
|
71
6
|
}
|
package/webpack.config.js
CHANGED
|
@@ -1,46 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
cache: {
|
|
7
|
-
type: 'filesystem',
|
|
8
|
-
},
|
|
9
|
-
mode: 'production',
|
|
10
|
-
entry: {
|
|
11
|
-
package: './src/package.ts',
|
|
12
|
-
test: {
|
|
13
|
-
filename: 'package-test.js',
|
|
14
|
-
library: {type: 'var', name: `${packageName}_test`},
|
|
15
|
-
import: './src/package-test.ts',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
resolve: {
|
|
19
|
-
extensions: ['.wasm', '.mjs', '.ts', '.json', '.tsx', '.js'],
|
|
20
|
-
},
|
|
21
|
-
module: {
|
|
22
|
-
rules: [
|
|
23
|
-
{test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], exclude: /node_modules/},
|
|
24
|
-
{test: /\.ts(x?)$/, use: {loader: 'ts-loader', options: {allowTsInNodeModules: true}}},
|
|
25
|
-
{test: /\.css$/, use: ['style-loader', 'css-loader']},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
devtool: 'source-map',
|
|
29
|
-
externals: {
|
|
30
|
-
'datagrok-api/dg': 'DG',
|
|
31
|
-
'datagrok-api/grok': 'grok',
|
|
32
|
-
'datagrok-api/ui': 'ui',
|
|
33
|
-
'openchemlib/full.js': 'OCL',
|
|
34
|
-
'rxjs': 'rxjs',
|
|
35
|
-
'rxjs/operators': 'rxjs.operators',
|
|
36
|
-
},
|
|
37
|
-
output: {
|
|
38
|
-
filename: '[name].js',
|
|
39
|
-
library: 'hittriage',
|
|
40
|
-
libraryTarget: 'var',
|
|
41
|
-
path: path.resolve(__dirname, 'dist'),
|
|
42
|
-
},
|
|
43
|
-
plugins: [
|
|
44
|
-
new FuncGeneratorPlugin({outputPath: './src/package.g.ts'}),
|
|
45
|
-
],
|
|
46
|
-
};
|
|
1
|
+
// Generated at npm publish for servers before 1.28.0, which detect a bundled
|
|
2
|
+
// package by this file. The bundle itself is built by @datagrok/build-config.
|
|
3
|
+
module.exports = {};
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src/**/*.d.ts*
|
package/.eslintrc.json
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2022": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"google"
|
|
8
|
-
],
|
|
9
|
-
"parser": "@typescript-eslint/parser",
|
|
10
|
-
"parserOptions": {
|
|
11
|
-
"ecmaVersion": 12,
|
|
12
|
-
"sourceType": "module"
|
|
13
|
-
},
|
|
14
|
-
"plugins": [
|
|
15
|
-
"@typescript-eslint"
|
|
16
|
-
],
|
|
17
|
-
"rules": {
|
|
18
|
-
"no-unused-vars": "off",
|
|
19
|
-
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^(_|ui$|grok$|DG$)", "argsIgnorePattern": "^_"}],
|
|
20
|
-
"indent": [
|
|
21
|
-
"error",
|
|
22
|
-
2
|
|
23
|
-
],
|
|
24
|
-
"max-len": [
|
|
25
|
-
"error",
|
|
26
|
-
120
|
|
27
|
-
],
|
|
28
|
-
"require-jsdoc": "off",
|
|
29
|
-
"valid-jsdoc": "off",
|
|
30
|
-
"spaced-comment": "off",
|
|
31
|
-
"linebreak-style": "off",
|
|
32
|
-
"curly": [
|
|
33
|
-
"error",
|
|
34
|
-
"multi-or-nest"
|
|
35
|
-
],
|
|
36
|
-
"brace-style": [
|
|
37
|
-
"error",
|
|
38
|
-
"1tbs",
|
|
39
|
-
{
|
|
40
|
-
"allowSingleLine": true
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"block-spacing": 2
|
|
44
|
-
}
|
|
45
|
-
}
|