@datagrok/helm 1.0.0 → 1.0.1

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
@@ -2,13 +2,16 @@
2
2
  "name": "@datagrok/helm",
3
3
  "beta": false,
4
4
  "friendlyName": "Helm",
5
- "version": "1.0.0",
5
+ "version": "1.0.1",
6
6
  "description": "",
7
7
  "dependencies": {
8
- "datagrok-api": "^1.4.12",
9
- "cash-dom": "latest",
10
- "dayjs": "latest",
11
- "@datagrok-libraries/utils": "latest <1.2.0"
8
+ "datagrok-api": "latest",
9
+ "cash-dom": "latest",
10
+ "dayjs": "latest",
11
+ "@datagrok-libraries/utils": "latest",
12
+ "@datagrok-libraries/bio": "^2.8.2",
13
+ "ts-loader": "^9.2.5",
14
+ "typescript": "^4.4.2"
12
15
  },
13
16
  "sources": [
14
17
  "css/helm.css",
package/src/package.ts CHANGED
@@ -2,11 +2,16 @@
2
2
  import * as grok from 'datagrok-api/grok';
3
3
  import * as ui from 'datagrok-api/ui';
4
4
  import * as DG from 'datagrok-api/dg';
5
+ //import {lru} from '../../Bio/src/utils/cell-renderer';
6
+ import {NotationConverter, NOTATION} from '@datagrok-libraries/bio/src/utils/notation-converter';
7
+ //import {ConverterFunc, DfReaderFunc} from '../../Bio/src/tests/types';
5
8
 
6
9
  export const _package = new DG.Package();
7
10
 
8
11
  const lru = new DG.LruCache<any, any>();
9
12
 
13
+
14
+
10
15
  //tags: init
11
16
  export async function initChem(): Promise<void> {
12
17
  // apparently HELMWebEditor requires dojo to be initialized first
@@ -35,15 +40,30 @@ export function editMoleculeCell(cell: DG.GridCell): void {
35
40
  scil.apply(app.properties.parent.style, s);
36
41
  app.structureview.resize(sizes.rightwidth, sizes.bottomheight + app.toolbarheight);
37
42
  app.mex.resize(sizes.topheight - 80);
38
- setTimeout(function() {
39
- app.canvas.helm.setSequence(cell.cell.value , 'HELM');
40
- }, 200);
41
- //@ts-ignore
42
- ui.dialog({ showHeader: false, showFooter: true })
43
- .add(view)
44
- .onOK(() => {
45
- cell.cell.value = app.canvas.getHelm(true);
46
- }).show({ modal: true, fullScreen: true});
43
+ if (cell.gridColumn.column.tags[DG.TAGS.UNITS] === "HELM"){
44
+ setTimeout(function() {
45
+ app.canvas.helm.setSequence(cell.cell.value , 'HELM');
46
+ }, 200);
47
+ //@ts-ignore
48
+ ui.dialog({ showHeader: false, showFooter: true })
49
+ .add(view)
50
+ .onOK(() => {
51
+ cell.cell.value = app.canvas.getHelm(true);
52
+ }).show({ modal: true, fullScreen: true});
53
+ }
54
+ else if (cell.gridColumn.column.tags[DG.TAGS.UNITS] === "fasta:SEQ:PT") {
55
+ const converter = new NotationConverter(cell.gridColumn.column);
56
+ const resStr = converter.convertFastaStringToHelm(null, null, cell.cell.value);
57
+ setTimeout(function() {
58
+ app.canvas.helm.setSequence(resStr , 'HELM');
59
+ }, 200);
60
+ //@ts-ignore
61
+ ui.dialog({ showHeader: false, showFooter: true })
62
+ .add(view)
63
+ .onOK(() => {
64
+ cell.cell.value;
65
+ }).show({ modal: true, fullScreen: true});
66
+ }
47
67
  }
48
68
 
49
69
  //name: Details
@@ -59,10 +79,10 @@ export function detailsPanel(helmString: string){
59
79
  'molecular weight': result[1],
60
80
  'extinction coefficient': result[2],
61
81
  'molfile': result[3],
62
- /*'fasta': ui.wait(async () => ui.divText(await helmToFasta(helmString))),
82
+ 'fasta': ui.wait(async () => ui.divText(await helmToFasta(helmString))),
63
83
  'rna analogue sequence': ui.wait(async () => ui.divText(await helmToRNA(helmString))),
64
84
  'smiles': ui.wait(async () => ui.divText(await helmToSmiles(helmString))),
65
- 'peptide analogue sequence': ui.wait(async () => ui.divText(await helmToPeptide(helmString))),*/
85
+ //'peptide analogue sequence': ui.wait(async () => ui.divText(await helmToPeptide(helmString))),
66
86
  })
67
87
  )
68
88
  }
@@ -75,9 +95,13 @@ async function loadDialog () {
75
95
  res = res.map((e) => e.path);
76
96
  //@ts-ignore
77
97
  let FilesList = await ui.choiceInput('Monomer Libraries', ' ', res);
98
+ let grid = grok.shell.tv.grid;
78
99
  ui.dialog('Load library from file')
79
100
  .add(FilesList)
80
- .onOK(() => monomerManager(FilesList.value)).show();
101
+ .onOK(async () => {
102
+ await monomerManager(FilesList.value);
103
+ grid.invalidate()
104
+ }).show();
81
105
  };
82
106
 
83
107
  //name: Library
package/webpack.config.js CHANGED
@@ -16,7 +16,16 @@ module.exports = {
16
16
  },
17
17
  module: {
18
18
  rules: [
19
- { test: /\.tsx?$/, loader: 'ts-loader' }
19
+ {
20
+ test: /\.ts(x?)$/,
21
+ use: 'ts-loader',
22
+ exclude: /node_modules/,
23
+ },
24
+ {
25
+ test: /\.css$/,
26
+ use: ['style-loader', 'css-loader'],
27
+ exclude: /node_modules/,
28
+ },
20
29
  ],
21
30
  },
22
31
  devtool: 'inline-source-map',