@datagrok/sequence-translator 1.6.2 → 1.6.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/sequence-translator",
3
3
  "friendlyName": "Sequence Translator",
4
- "version": "1.6.2",
4
+ "version": "1.6.3",
5
5
  "author": {
6
6
  "name": "Leonid Stolbov",
7
7
  "email": "lstolbov@datagrok.ai"
package/src/package.ts CHANGED
@@ -22,7 +22,6 @@ import {polyToolEnumerateHelmUI} from './polytool/pt-enumerate-seq-dialog';
22
22
  import {_setPeptideColumn} from './polytool/utils';
23
23
  import {PolyToolCsvLibHandler} from './polytool/csv-to-json-monomer-lib-converter';
24
24
  import {ITranslationHelper} from './types';
25
- import {addContextMenuUI} from './utils/context-menu';
26
25
  import {PolyToolConvertFuncEditor} from './polytool/pt-convert-editor';
27
26
  import {CyclizedNotationProvider} from './utils/cyclized';
28
27
  import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
@@ -248,14 +247,6 @@ export async function createMonomerLibraryForPolyTool(file: DG.FileInfo) {
248
247
  DG.Utils.download(jsonFileName, jsonFileContent);
249
248
  }
250
249
 
251
- // -- Handle context menu --
252
-
253
- //name: addContextMenu
254
- //input: object event
255
- export function addContextMenu(event: DG.EventData): void {
256
- addContextMenuUI(event);
257
- }
258
-
259
250
  // //name: PolyTool Converter
260
251
  // //meta.icon: img/icons/structure.png
261
252
  // //meta.browsePath: PolyTool
@@ -298,6 +289,20 @@ export async function ptEnumeratorChemApp(): Promise<void> {
298
289
  polyToolEnumerateChemUI();
299
290
  }
300
291
 
292
+
293
+ //name: Polytool Helm Enumerator dialog
294
+ //input: object cell {nullable: true}
295
+ export async function getPtHelmEnumeratorDialog(cell?: DG.Cell) {
296
+ return polyToolEnumerateHelmUI(cell);
297
+ }
298
+
299
+ //name: Polytool Chem Enumerator dialog
300
+ //input: object cell {nullable: true}
301
+ export async function getPtChemEnumeratorDialog(cell?: DG.Cell) {
302
+ return polyToolEnumerateChemUI(cell);
303
+ }
304
+
305
+
301
306
  //name: applyNotationProviderForHarmonizedSequence
302
307
  //input: column col
303
308
  //input: string separator
@@ -1,53 +0,0 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as DG from 'datagrok-api/dg';
3
- import * as ui from 'datagrok-api/ui';
4
-
5
- import {defaultErrorHandler} from './err-info';
6
- import {polyToolEnumerateHelmUI} from '../polytool/pt-enumerate-seq-dialog';
7
- import {polyToolEnumerateChemUI} from '../polytool/pt-dialog';
8
-
9
- import {_package} from '../package';
10
-
11
- export type SequenceTranslatorWindowType = Window & {
12
- $sequenceTranslator?: {
13
- contextMenuError?: any
14
- },
15
- };
16
- declare const window: SequenceTranslatorWindowType;
17
-
18
- export function addContextMenuUI(event: DG.EventData): void {
19
- try {
20
- const item = event.args.item;
21
- if (item) {
22
- const menu: DG.Menu = event.args.menu;
23
- if (item instanceof DG.GridCell || item.constructor.name == 'GridCell') {
24
- const gridCell: DG.GridCell = item;
25
- if (addContextMenuForCell(gridCell, menu))
26
- event.preventDefault();
27
- }
28
- }
29
- } catch (err: any) {
30
- defaultErrorHandler(err);
31
- if (!window.$sequenceTranslator) window.$sequenceTranslator = {};
32
- window.$sequenceTranslator.contextMenuError = err;
33
- }
34
- }
35
-
36
- function addContextMenuForCell(gridCell: DG.GridCell, menu: DG.Menu): boolean {
37
- const logPrefix: string = `ST: addContextMenuForCell()`;
38
- _package.logger.debug(`${logPrefix}, start`);
39
-
40
- if (gridCell && gridCell.tableColumn) {
41
- switch (gridCell.tableColumn.semType) {
42
- case DG.SEMTYPE.MACROMOLECULE: {
43
- menu.item('PolyTool-Enumerate', () => { polyToolEnumerateHelmUI(gridCell.cell).then(() => {}); });
44
- return true;
45
- }
46
- case DG.SEMTYPE.MOLECULE: {
47
- menu.item('PolyTool-Enumerate', () => { polyToolEnumerateChemUI(gridCell.cell).then(() => {}); });
48
- return true;
49
- }
50
- }
51
- }
52
- return false;
53
- }