@datagrok/sequence-translator 1.3.4 → 1.3.5

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.3.4",
4
+ "version": "1.3.5",
5
5
  "author": {
6
6
  "name": "Alexey Choposky",
7
7
  "email": "achopovsky@datagrok.ai"
@@ -8,6 +8,7 @@ import {addTransformedColumn} from './pt-conversion';
8
8
 
9
9
  import {handleError} from './utils';
10
10
  import {getLibrariesList, HelmInput, getEnumeration} from './pt-enumeration';
11
+ import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
11
12
 
12
13
  const PT_ERROR_DATAFRAME = 'No dataframe with macromolecule columns open';
13
14
  const PT_WARNING_COLUMN = 'No marcomolecule column chosen!';
@@ -86,6 +87,13 @@ export async function getPolyToolEnumerationDialog(): Promise<DG.Dialog> {
86
87
  screenLibrary.root
87
88
  ]);
88
89
 
90
+ const cccSubs = grok.events.onCurrentCellChanged.subscribe(() => {
91
+ const cell = grok.shell.tv.dataFrame.currentCell;
92
+
93
+ if (cell.column.semType === DG.SEMTYPE.MACROMOLECULE && cell.column.tags[DG.TAGS.UNITS] === NOTATION.HELM)
94
+ helmInput.setHelmString(cell.value);
95
+ });
96
+
89
97
  const dialog = ui.dialog(PT_UI_DIALOG_ENUMERATION)
90
98
  .add(div)
91
99
  .onOK(async () => {
@@ -105,10 +113,10 @@ export async function getPolyToolEnumerationDialog(): Promise<DG.Dialog> {
105
113
  } catch (err: any) {
106
114
 
107
115
  } finally {
108
-
116
+ cccSubs.unsubscribe();
109
117
  }
110
118
  }).onCancel(() => {
111
-
119
+ cccSubs.unsubscribe();
112
120
  });
113
121
 
114
122
  return dialog;
@@ -1,5 +1,6 @@
1
1
  import * as ui from 'datagrok-api/ui';
2
2
  import * as grok from 'datagrok-api/grok';
3
+ import * as DG from 'datagrok-api/dg';
3
4
 
4
5
  import {IHelmHelper, getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
5
6
  import {IHelmWebEditor} from '@datagrok-libraries/bio/src/helm/types';
@@ -9,6 +10,7 @@ import * as org from 'org';
9
10
  import $ from 'cash-dom';
10
11
  import {Unsubscribable, fromEvent} from 'rxjs';
11
12
  import {IMonomerLibFileManager, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
13
+ import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
12
14
 
13
15
  import {Chain} from './pt-conversion';
14
16
 
@@ -99,7 +101,13 @@ export class HelmInput {
99
101
  editor.host.style.width = '200px';
100
102
  editor.host.style.height = '100px';
101
103
  editor.host.style.paddingLeft = '40px';
102
- editor.editor.setHelm(PT_HELM_EXAMPLE);
104
+
105
+ const cell = grok.shell.tv.dataFrame.currentCell;
106
+
107
+ if (cell.column.semType === DG.SEMTYPE.MACROMOLECULE && cell.column.tags[DG.TAGS.UNITS] === NOTATION.HELM)
108
+ editor.editor.setHelm(cell.value);
109
+ else
110
+ editor.editor.setHelm(PT_HELM_EXAMPLE);
103
111
 
104
112
  return new HelmInput(helmHelper, editor);
105
113
  }
@@ -112,6 +120,12 @@ export class HelmInput {
112
120
  return this.helmSelection;
113
121
  }
114
122
 
123
+ setHelmString(helm: string): void {
124
+ this.helmString = helm;
125
+ this.editor.editor.setHelm(helm);
126
+ this.helmSelection = [];
127
+ }
128
+
115
129
  getDiv(): HTMLDivElement {
116
130
  const title = ui.divText('Macromolecule', {style: {paddingTop: '43px', color: 'var(--grey-4)'}});
117
131