@datagrok/helm 2.4.4 → 2.4.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/helm",
3
3
  "friendlyName": "Helm",
4
- "version": "2.4.4",
4
+ "version": "2.4.6",
5
5
  "author": {
6
6
  "name": "Oleksandra Serhiienko",
7
7
  "email": "oserhiienko@datagrok.ai"
@@ -26,7 +26,7 @@
26
26
  "wu": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@datagrok-libraries/helm-web-editor": "^1.1.10",
29
+ "@datagrok-libraries/helm-web-editor": "^1.1.11",
30
30
  "@datagrok-libraries/js-draw-lite": "^0.0.8",
31
31
  "@datagrok/bio": "^2.14.1",
32
32
  "@datagrok/chem": "^1.9.2",
package/src/package.ts CHANGED
@@ -86,7 +86,7 @@ export function helmCellRenderer(): HelmCellRenderer {
86
86
  return new HelmGridCellRenderer(); // new
87
87
  }
88
88
 
89
- function checkMonomersAndOpenWebEditor(cell: DG.Cell, value?: string, units?: string) {
89
+ function checkMonomersAndOpenWebEditor(cell: DG.GridCell, value?: string, units?: string) {
90
90
  openWebEditor(cell, value, units);
91
91
  }
92
92
 
@@ -95,7 +95,7 @@ function checkMonomersAndOpenWebEditor(cell: DG.Cell, value?: string, units?: st
95
95
  //input: grid_cell cell
96
96
  //meta.columnTags: quality=Macromolecule, units=helm
97
97
  export function editMoleculeCell(cell: DG.GridCell): void {
98
- checkMonomersAndOpenWebEditor(cell.cell, undefined, undefined);
98
+ checkMonomersAndOpenWebEditor(cell, undefined, undefined);
99
99
  }
100
100
 
101
101
  //name: Open Helm Web Editor
@@ -107,11 +107,14 @@ export function openEditor(mol: string): void {
107
107
  const col = df.columns.bySemType('Macromolecule')! as DG.Column<string>;
108
108
  const colSh = SeqHandler.forColumn(col);
109
109
  const colUnits = col.meta.units;
110
+ if (df.currentRowIdx === -1)
111
+ return;
112
+ const gCell = DG.GridCell.fromColumnRow(grok.shell.tv.grid, col.name, df.currentRowIdx);
110
113
  if (colUnits === NOTATION.HELM)
111
- checkMonomersAndOpenWebEditor(df.currentCell, undefined, undefined);
114
+ checkMonomersAndOpenWebEditor(gCell, undefined, undefined);
112
115
  const convert = colSh.getConverter(NOTATION.HELM);
113
116
  const helmMol = convert(mol);
114
- checkMonomersAndOpenWebEditor(df.currentCell, helmMol, col.meta.units!);
117
+ checkMonomersAndOpenWebEditor(gCell, helmMol, col.meta.units!);
115
118
  }
116
119
 
117
120
  //name: Properties
@@ -122,14 +125,14 @@ export function propertiesWidget(sequence: DG.SemanticValue): DG.Widget {
122
125
  return getPropertiesWidget(sequence);
123
126
  }
124
127
 
125
- function openWebEditor(cell: DG.Cell, value?: string, units?: string) {
128
+ function openWebEditor(cell: DG.GridCell, value?: string, units?: string) {
126
129
  const view = ui.div();
127
130
  // const df = grok.shell.tv.grid.dataFrame;
128
- // const col = df.columns.bySemType('Macromolecule')!;
129
- const col = cell.column as DG.Column<string>;
131
+ // const col = df.columns.bySemType('Macromolecule')!
132
+ const col = cell.cell.column as DG.Column<string>;
130
133
  const sh = SeqHandler.forColumn(col);
131
- const rowIdx = cell.rowIndex;
132
- const app: App = _package.helmHelper.createWebEditorApp(view, !!cell && units === undefined ? cell.value : value!);
134
+ const app: App =
135
+ _package.helmHelper.createWebEditorApp(view, !!cell && units === undefined ? cell.cell.value : value!);
133
136
  const dlg = ui.dialog({showHeader: false, showFooter: true});
134
137
  dlg.add(view)
135
138
  .onOK(() => {
@@ -137,10 +140,10 @@ function openWebEditor(cell: DG.Cell, value?: string, units?: string) {
137
140
  .replace(/<span style='background:#bbf;'>/g, '');
138
141
  if (!!cell) {
139
142
  if (units === undefined)
140
- cell.value = helmValue;
143
+ cell.setValue(helmValue);
141
144
  else {
142
145
  const convertedRes = sh.convertHelmToFastaSeparator(helmValue, units!, sh.separator);
143
- cell.value = convertedRes;
146
+ cell.setValue(convertedRes);
144
147
  }
145
148
  }
146
149
  }).show({modal: true, fullScreen: true});
@@ -4,7 +4,7 @@ import * as DG from 'datagrok-api/dg';
4
4
 
5
5
 
6
6
  import {after, before, category, delay, expect, test, expectArray, timeout} from '@datagrok-libraries/utils/src/test';
7
- import {HelmType, Mol, OrgType} from '@datagrok-libraries/bio/src/helm/types';
7
+ import {HelmType, IHelmDrawOptions, Mol, OrgType} from '@datagrok-libraries/bio/src/helm/types';
8
8
  import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
9
9
  import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
10
10
  import {
@@ -13,22 +13,31 @@ import {
13
13
 
14
14
  import {JSDraw2Module} from '../types';
15
15
  import {initHelmMainPackage} from './utils';
16
- import {IHelmDrawOptions} from '@datagrok-libraries/helm-web-editor/src/types/org-helm';
17
16
 
18
17
  declare const org: OrgType;
19
18
  declare const JSDraw2: JSDraw2Module;
20
19
 
21
- type TestTgtType = { atomCount: number, bondCount: number };
20
+ type TestTgtType = { atomCount: number, bondCount: number, helm: string };
22
21
 
23
22
  category('parseHelm', () => {
24
23
  const testData: { [testName: string]: { src: string, tgt: TestTgtType } } = {
25
24
  'PT': {
26
25
  src: 'PEPTIDE1{[L-hArg(Et,Et)].E.F.G}|PEPTIDE2{C.E}$PEPTIDE1,PEPTIDE2,2:R3-1:R1$$$V2.0',
27
- tgt: {atomCount: 6, bondCount: 5}
26
+ tgt: {
27
+ atomCount: 6, bondCount: 5,
28
+ helm: 'PEPTIDE1{[L-hArg(Et,Et)].E.F.G}|PEPTIDE2{C.E}$PEPTIDE1,PEPTIDE2,2:R3-1:R1$$$V2.0'
29
+ }
30
+ },
31
+ 'PT-cycic': {
32
+ src: 'PEPTIDE1{[meI].C.[Aca].[Cys_SEt].T.C.[Thr_PO3H2].[Aca]}$PEPTIDE1,PEPTIDE1,8:R2-1:R1$$$V2.0',
33
+ tgt: {
34
+ atomCount: 8, bondCount: 8,
35
+ helm: 'PEPTIDE1{[meI].C.[Aca].[Cys_SEt].T.C.[Thr_PO3H2].[Aca]}$PEPTIDE1,PEPTIDE1,8:R2-1:R1$$$V2.0'
36
+ },
28
37
  },
29
38
  'RNA': {
30
39
  src: 'RNA1{[dhp]([m1A])p.r(T)p.r(T)p.r(G)p}$$$$V2.0',
31
- tgt: {atomCount: 12, bondCount: 11}
40
+ tgt: {atomCount: 12, bondCount: 11, helm: 'RNA1{[dhp]([m1A])p.r(T)p.r(T)p.r(G)p}$$$$V2.0',}
32
41
  }
33
42
  };
34
43
 
@@ -94,6 +103,9 @@ function _testParseHelmWithoutDOM(src: string, tgt: TestTgtType): void {
94
103
  io.parseHelm(plugin, src, origin, undefined);
95
104
 
96
105
  const m: Mol<HelmType> = plugin.jsd.m;
106
+ debugger;
107
+ const resHelm = io.getHelm(m);
97
108
  expect(m.atoms.length, tgt.atomCount);
98
109
  expect(m.bonds.length, tgt.bondCount);
110
+ expect(resHelm, tgt.helm);
99
111
  }
@@ -146,9 +146,8 @@ export class HelmGridCellRendererBack extends CellRendererBackAsyncBase<HelmProp
146
146
  gridCell: DG.GridCell, cellStyle: DG.GridCellStyle) {
147
147
  if (!this.monomerLib) {
148
148
  this.monomerLib = _package.monomerLib;
149
- if (this.monomerLib) {
149
+ if (this.monomerLib)
150
150
  this.subs.push(this.monomerLib.onChanged.subscribe(this.monomerLibOnChanged.bind(this)));
151
- }
152
151
  }
153
152
  super.render(g, x, y, w, h, gridCell, cellStyle);
154
153
  }