@datagrok/sequence-translator 1.3.3 → 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/CHANGELOG.md +12 -0
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/polytool/pt-conversion.ts +11 -7
- package/src/polytool/pt-dialog.ts +10 -2
- package/src/polytool/pt-enumeration.ts +15 -1
package/package.json
CHANGED
|
@@ -268,8 +268,12 @@ export class Chain {
|
|
|
268
268
|
function getHelms(sequences: string[], rules: Rules): string[] {
|
|
269
269
|
const helms = new Array<string>(sequences.length);
|
|
270
270
|
for (let i = 0; i < sequences.length; i++) {
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
if (sequences[i] === undefined)
|
|
272
|
+
helms[i] = '';
|
|
273
|
+
else {
|
|
274
|
+
const chain = Chain.fromNotation(sequences[i], rules);
|
|
275
|
+
helms[i] = chain.getHelm();
|
|
276
|
+
}
|
|
273
277
|
}
|
|
274
278
|
|
|
275
279
|
return helms;
|
|
@@ -288,20 +292,20 @@ export async function addTransformedColumn(
|
|
|
288
292
|
addCommonTags(targetHelmCol);
|
|
289
293
|
targetHelmCol.setTag('units', NOTATION.HELM);
|
|
290
294
|
|
|
295
|
+
if (addHelm) {
|
|
296
|
+
targetHelmCol.setTag('cell.renderer', 'helm');
|
|
297
|
+
df.columns.add(targetHelmCol);
|
|
298
|
+
}
|
|
299
|
+
|
|
291
300
|
const molCol = await grok.functions.call('Bio:getMolFromHelm', {
|
|
292
301
|
'df': df,
|
|
293
302
|
'helmCol': targetHelmCol,
|
|
294
303
|
'chiralityEngine': chiralityEngine
|
|
295
304
|
});
|
|
296
305
|
|
|
297
|
-
|
|
298
306
|
molCol.name = df.columns.getUnusedName('molfile(' + sequencesCol.name + ')');
|
|
299
307
|
molCol.semType = DG.SEMTYPE.MOLECULE;
|
|
300
308
|
|
|
301
|
-
if (addHelm) {
|
|
302
|
-
targetHelmCol.setTag('cell.renderer', 'helm');
|
|
303
|
-
df.columns.add(targetHelmCol);
|
|
304
|
-
}
|
|
305
309
|
df.columns.add(molCol, true);
|
|
306
310
|
await grok.data.detectSemanticTypes(df);
|
|
307
311
|
}
|
|
@@ -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
|
-
|
|
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
|
|