@datagrok/sequence-translator 1.9.14 → 1.10.0
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/detectors.js +1 -0
- package/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +4 -4
- package/src/apps/common/model/monomer-lib/lib-wrapper.ts +1 -1
- package/src/apps/common/model/oligo-toolkit-package.ts +3 -4
- package/src/apps/translator/view/ui.ts +2 -1
- package/src/package.ts +21 -49
- package/src/polytool/conversion/pt-atomic.ts +2 -2
- package/src/polytool/conversion/pt-rule-cards.ts +2 -1
- package/src/polytool/conversion/pt-rules.ts +1 -1
- package/src/polytool/conversion/pt-synthetic.ts +2 -2
- package/src/polytool/monomer-lib-handler.ts +1 -1
- package/src/polytool/pt-dialog.ts +3 -3
- package/src/polytool/pt-enumerate-seq-dialog.ts +8 -4
- package/src/polytool/pt-enumeration-helm.ts +1 -1
- package/src/polytool/pt-unrule-dialog.ts +2 -2
- package/src/polytool/utils.ts +16 -9
- package/src/tests/polytool-chain-from-notation-tests.ts +1 -0
- package/src/tests/polytool-chain-parse-notation-tests.ts +2 -1
- package/src/tests/polytool-convert-tests.ts +2 -1
- package/src/tests/polytool-enumerate-breadth-tests.ts +10 -10
- package/src/tests/polytool-enumerate-tests.ts +1 -1
- package/src/tests/toAtomicLevel-tests.ts +3 -2
- package/src/tests/utils/detect-macromolecule-utils.ts +1 -0
- package/test-console-output-1.log +162 -194
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/sequence-translator",
|
|
3
3
|
"friendlyName": "Sequence Translator",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@datagrok-libraries/bio": "^5.
|
|
25
|
+
"@datagrok-libraries/bio": "^5.60.0",
|
|
26
26
|
"@datagrok-libraries/chem-meta": "^1.2.8",
|
|
27
27
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
28
28
|
"@datagrok-libraries/utils": "^4.6.5",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"wu": "^2.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@datagrok-libraries/helm-web-editor": "^1.1.
|
|
42
|
+
"@datagrok-libraries/helm-web-editor": "^1.1.16",
|
|
43
43
|
"@datagrok-libraries/js-draw-lite": "^0.0.10",
|
|
44
|
-
"@datagrok/bio": "^2.
|
|
44
|
+
"@datagrok/bio": "^2.24.0",
|
|
45
45
|
"@datagrok/chem": "^1.13.0",
|
|
46
46
|
"@datagrok/helm": "^2.7.0",
|
|
47
47
|
"@types/jquery": "^3.5.32",
|
|
@@ -3,7 +3,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
3
3
|
import {_package} from '../../../../package';
|
|
4
4
|
import {DEFAULT_FORMATS} from '../const';
|
|
5
5
|
|
|
6
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
6
|
+
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
7
7
|
import {HELM_REQUIRED_FIELD as REQ, HELM_OPTIONAL_FIELDS as OPT} from '@datagrok-libraries/bio/src/utils/const';
|
|
8
8
|
|
|
9
9
|
import {META_FIELDS as MET} from './const';
|
|
@@ -3,8 +3,7 @@ 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
5
|
|
|
6
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
7
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
6
|
+
import {IMonomerLib, Monomer, getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
7
|
import {LoggerWrapper} from '@datagrok-libraries/bio/src/utils/logger';
|
|
9
8
|
import {ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
10
9
|
import {IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
@@ -21,7 +20,6 @@ import {FormatDetector} from './parsing-validation/format-detector';
|
|
|
21
20
|
import {highlightInvalidSubsequence} from '../view/components/colored-input/input-painters';
|
|
22
21
|
|
|
23
22
|
export class OligoToolkitPackage extends DG.Package implements ITranslationHelper {
|
|
24
|
-
|
|
25
23
|
private _helmHelper: IHelmHelper;
|
|
26
24
|
public get helmHelper(): IHelmHelper {
|
|
27
25
|
if (!this._helmHelper)
|
|
@@ -119,7 +117,8 @@ async function loadMonomerLib(monomersPath: string): Promise<IMonomerLib> {
|
|
|
119
117
|
`Initializing ${APP_NAME.COMBINED} monomer library ...`);
|
|
120
118
|
try {
|
|
121
119
|
const libHelper = await getMonomerLibHelper();
|
|
122
|
-
const
|
|
120
|
+
const path = (monomersPath.endsWith('/') ? monomersPath : monomersPath + '/') + DEFAULT_LIB_FILENAME;
|
|
121
|
+
const res = await libHelper.readLibraryFromFilePath(path);
|
|
123
122
|
return res;
|
|
124
123
|
} finally { pi.close(); }
|
|
125
124
|
}
|
|
@@ -22,8 +22,9 @@ import {convert, getSupportedTargetFormats, getTranslatedSequences} from '../mod
|
|
|
22
22
|
import {ITranslationHelper} from '../../../types';
|
|
23
23
|
|
|
24
24
|
import {NUCLEOTIDES_FORMAT, SEQUENCE_COPIED_MSG, SEQ_TOOLTIP_MSG} from './const';
|
|
25
|
-
import './style.css';
|
|
26
25
|
import {_package} from '../../../package';
|
|
26
|
+
//@ts-ignore
|
|
27
|
+
import './style.css';
|
|
27
28
|
|
|
28
29
|
const enum REQUIRED_COLUMN_LABEL {
|
|
29
30
|
SEQUENCE = 'Sequence',
|
package/src/package.ts
CHANGED
|
@@ -26,7 +26,7 @@ import {CyclizedNotationProvider} from './utils/cyclized';
|
|
|
26
26
|
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
27
27
|
import {PolyToolTags} from './consts';
|
|
28
28
|
import {getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
29
|
-
import {
|
|
29
|
+
import {getPTCombineDialog} from './polytool/pt-combine-dialog';
|
|
30
30
|
|
|
31
31
|
export * from './package.g';
|
|
32
32
|
|
|
@@ -72,14 +72,13 @@ async function initSequenceTranslatorInt(): Promise<void> {
|
|
|
72
72
|
_package.completeInit(helmHelper);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export class PackageFunctions{
|
|
75
|
+
export class PackageFunctions {
|
|
76
76
|
@grok.decorators.app({
|
|
77
77
|
icon: 'img/icons/toolkit.png',
|
|
78
78
|
browsePath: 'Peptides | Oligo Toolkit',
|
|
79
79
|
name: 'Oligo Toolkit'
|
|
80
80
|
})
|
|
81
81
|
static async oligoToolkitApp(): Promise<DG.ViewBase> {
|
|
82
|
-
|
|
83
82
|
await _package.initLibData();
|
|
84
83
|
const externalViewFactories = await getExternalAppViewFactories(_package);
|
|
85
84
|
if (!externalViewFactories)
|
|
@@ -89,10 +88,9 @@ export class PackageFunctions{
|
|
|
89
88
|
return view;
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
|
|
93
92
|
@grok.decorators.init()
|
|
94
93
|
static async init(): Promise<void> {
|
|
95
|
-
|
|
96
94
|
if (initSequenceTranslatorPromise === null)
|
|
97
95
|
_package.startInit(initSequenceTranslatorPromise = initSequenceTranslatorInt());
|
|
98
96
|
|
|
@@ -105,7 +103,6 @@ export class PackageFunctions{
|
|
|
105
103
|
name: 'Oligo Translator'
|
|
106
104
|
})
|
|
107
105
|
static async oligoTranslatorApp(): Promise<DG.ViewBase> {
|
|
108
|
-
|
|
109
106
|
const view = await getSpecifiedAppView(APP_NAME.TRANSLATOR);
|
|
110
107
|
return view;
|
|
111
108
|
}
|
|
@@ -117,7 +114,6 @@ export class PackageFunctions{
|
|
|
117
114
|
name: 'Oligo Pattern'
|
|
118
115
|
})
|
|
119
116
|
static async oligoPatternApp(): Promise<DG.ViewBase> {
|
|
120
|
-
|
|
121
117
|
const view = await getSpecifiedAppView(APP_NAME.PATTERN);
|
|
122
118
|
return view;
|
|
123
119
|
}
|
|
@@ -129,7 +125,6 @@ export class PackageFunctions{
|
|
|
129
125
|
name: 'Oligo Structure'
|
|
130
126
|
})
|
|
131
127
|
static async oligoStructureApp(): Promise<DG.ViewBase> {
|
|
132
|
-
|
|
133
128
|
const view = await getSpecifiedAppView(APP_NAME.STRUCTURE);
|
|
134
129
|
return view;
|
|
135
130
|
}
|
|
@@ -137,7 +132,6 @@ export class PackageFunctions{
|
|
|
137
132
|
|
|
138
133
|
@grok.decorators.func({outputs: [{type: 'object', name: 'result'}]})
|
|
139
134
|
static async getTranslationHelper(): Promise<ITranslationHelper> {
|
|
140
|
-
|
|
141
135
|
await _package.initLibData();
|
|
142
136
|
return _package;
|
|
143
137
|
}
|
|
@@ -145,7 +139,6 @@ export class PackageFunctions{
|
|
|
145
139
|
|
|
146
140
|
@grok.decorators.func({outputs: [{type: 'object', name: 'result'}]})
|
|
147
141
|
static getCodeToWeightsMap(): Record<string, number> {
|
|
148
|
-
|
|
149
142
|
const monomerLibWrapper = _package.monomerLibWrapper;
|
|
150
143
|
const map = monomerLibWrapper.getCodesToWeightsMap();
|
|
151
144
|
return Object.fromEntries(map);
|
|
@@ -155,7 +148,6 @@ export class PackageFunctions{
|
|
|
155
148
|
@grok.decorators.func()
|
|
156
149
|
static validateSequence(
|
|
157
150
|
sequence: string): boolean {
|
|
158
|
-
|
|
159
151
|
const validator = _package.createSequenceValidator(sequence);
|
|
160
152
|
const format = _package.createFormatDetector(sequence).getFormat();
|
|
161
153
|
return (format === null) ? false : validator.isValidSequence(format!);
|
|
@@ -168,14 +160,13 @@ export class PackageFunctions{
|
|
|
168
160
|
static getMolfileFromGcrsSequence(
|
|
169
161
|
sequence: string,
|
|
170
162
|
invert: boolean): string {
|
|
171
|
-
|
|
172
163
|
return (new SequenceToMolfileConverter(sequence, invert, 'GCRS')).convert();
|
|
173
164
|
}
|
|
174
165
|
|
|
175
166
|
|
|
176
167
|
@grok.decorators.func()
|
|
177
168
|
static linkStrands(
|
|
178
|
-
@grok.decorators.param({type:'object'})
|
|
169
|
+
@grok.decorators.param({type: 'object'}) strands: { senseStrands: string[], antiStrands: string[] }): string {
|
|
179
170
|
return linkStrandsV3000(strands, true);
|
|
180
171
|
}
|
|
181
172
|
|
|
@@ -202,7 +193,6 @@ export class PackageFunctions{
|
|
|
202
193
|
description: 'Design a modification pattern for an oligonucleotide sequence'
|
|
203
194
|
})
|
|
204
195
|
static async demoOligoPattern(): Promise<void> {
|
|
205
|
-
|
|
206
196
|
await demoOligoPatternUI();
|
|
207
197
|
}
|
|
208
198
|
|
|
@@ -215,7 +205,6 @@ export class PackageFunctions{
|
|
|
215
205
|
description: 'Visualize duplex and save SDF'
|
|
216
206
|
})
|
|
217
207
|
static async demoOligoStructure(): Promise<void> {
|
|
218
|
-
|
|
219
208
|
await demoOligoStructureUI();
|
|
220
209
|
}
|
|
221
210
|
|
|
@@ -224,65 +213,58 @@ export class PackageFunctions{
|
|
|
224
213
|
static async translateOligonucleotideSequence(
|
|
225
214
|
sequence: string, sourceFormat: string, targetFormat: string
|
|
226
215
|
): Promise<string> {
|
|
227
|
-
|
|
228
216
|
await _package.initLibData();
|
|
229
217
|
return _package.createFormatConverter(sequence, sourceFormat).convertTo(targetFormat);
|
|
230
218
|
}
|
|
231
219
|
|
|
232
220
|
@grok.decorators.func({
|
|
233
221
|
'top-menu': 'Bio | PolyTool | Convert...',
|
|
234
|
-
name: 'polyToolConvert',
|
|
235
|
-
description: 'Perform cyclization of polymers'
|
|
222
|
+
'name': 'polyToolConvert',
|
|
223
|
+
'description': 'Perform cyclization of polymers'
|
|
236
224
|
})
|
|
237
225
|
static async polyToolConvertTopMenu(): Promise<void> {
|
|
238
|
-
|
|
239
226
|
await polyToolConvertUI();
|
|
240
227
|
}
|
|
241
228
|
|
|
242
229
|
@grok.decorators.editor()
|
|
243
230
|
static async getPolyToolConvertEditor(
|
|
244
231
|
call: DG.FuncCall): Promise<DG.Column<string> | null> {
|
|
245
|
-
|
|
246
232
|
const funcEditor = await PolyToolConvertFuncEditor.create(call);
|
|
247
233
|
return await funcEditor.showDialog();
|
|
248
234
|
}
|
|
249
235
|
|
|
250
236
|
|
|
251
237
|
@grok.decorators.func({
|
|
252
|
-
editor: 'SequenceTranslator:getPolyToolConvertEditor',
|
|
238
|
+
editor: 'SequenceTranslator:getPolyToolConvertEditor',
|
|
253
239
|
})
|
|
254
240
|
static async polyToolConvert2(
|
|
255
241
|
table: DG.DataFrame,
|
|
256
|
-
@grok.decorators.param({options: {
|
|
257
|
-
@grok.decorators.param({options: {
|
|
258
|
-
@grok.decorators.param({options: {
|
|
242
|
+
@grok.decorators.param({options: {caption: 'Sequence'}}) seqCol: DG.Column,
|
|
243
|
+
@grok.decorators.param({options: {initialValue: 'true'}}) generateHelm: boolean,
|
|
244
|
+
@grok.decorators.param({options: {initialValue: 'true'}}) chiralityEngine: boolean,
|
|
259
245
|
@grok.decorators.param({type: 'object'}) rules: string[]
|
|
260
246
|
): Promise<DG.Column<string>> {
|
|
261
|
-
|
|
262
247
|
const ptConvertRes = await polyToolConvert(seqCol, generateHelm, false, chiralityEngine, false, rules);
|
|
263
248
|
return ptConvertRes[0];
|
|
264
249
|
}
|
|
265
250
|
|
|
266
251
|
|
|
267
|
-
|
|
268
252
|
@grok.decorators.func({
|
|
269
253
|
'top-menu': 'Bio | PolyTool | Enumerate HELM...',
|
|
270
|
-
name: 'polyToolEnumerateHelm',
|
|
271
|
-
description: 'Perform cyclization of polymers'
|
|
254
|
+
'name': 'polyToolEnumerateHelm',
|
|
255
|
+
'description': 'Perform cyclization of polymers'
|
|
272
256
|
})
|
|
273
257
|
static async polyToolEnumerateHelmTopMenu(): Promise<void> {
|
|
274
|
-
|
|
275
258
|
await polyToolEnumerateHelmUI(grok.shell.tv?.dataFrame.currentCell);
|
|
276
259
|
}
|
|
277
260
|
|
|
278
261
|
|
|
279
262
|
@grok.decorators.func({
|
|
280
263
|
'top-menu': 'Bio | PolyTool | Enumerate Chem...',
|
|
281
|
-
name: 'polyToolEnumerateChem',
|
|
282
|
-
description: 'Perform cyclization of polymers'
|
|
264
|
+
'name': 'polyToolEnumerateChem',
|
|
265
|
+
'description': 'Perform cyclization of polymers'
|
|
283
266
|
})
|
|
284
267
|
static async polyToolEnumerateChemTopMenu(): Promise<void> {
|
|
285
|
-
|
|
286
268
|
polyToolEnumerateChemUI();
|
|
287
269
|
}
|
|
288
270
|
|
|
@@ -290,8 +272,7 @@ export class PackageFunctions{
|
|
|
290
272
|
@grok.decorators.func()
|
|
291
273
|
static async polyToolColumnChoice(
|
|
292
274
|
@grok.decorators.param({options: {description: 'Input data table'}}) df: DG.DataFrame,
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
macroMolecule: DG.Column): Promise<void> {
|
|
295
276
|
_setPeptideColumn(macroMolecule);
|
|
296
277
|
await grok.data.detectSemanticTypes(df);
|
|
297
278
|
}
|
|
@@ -300,7 +281,6 @@ export class PackageFunctions{
|
|
|
300
281
|
@grok.decorators.func()
|
|
301
282
|
static async createMonomerLibraryForPolyTool(
|
|
302
283
|
file: DG.FileInfo) {
|
|
303
|
-
|
|
304
284
|
const fileContent = await file.readAsString();
|
|
305
285
|
const libHandler = new PolyToolCsvLibHandler(file.fileName, fileContent);
|
|
306
286
|
const libObject = await libHandler.getJson();
|
|
@@ -319,7 +299,6 @@ export class PackageFunctions{
|
|
|
319
299
|
name: 'HELM Enumerator'
|
|
320
300
|
})
|
|
321
301
|
static async ptEnumeratorHelmApp(): Promise<void> {
|
|
322
|
-
|
|
323
302
|
await polyToolEnumerateHelmUI();
|
|
324
303
|
}
|
|
325
304
|
|
|
@@ -333,18 +312,15 @@ export class PackageFunctions{
|
|
|
333
312
|
name: 'Chem Enumerator'
|
|
334
313
|
})
|
|
335
314
|
static async ptEnumeratorChemApp(): Promise<void> {
|
|
336
|
-
|
|
337
315
|
polyToolEnumerateChemUI();
|
|
338
316
|
}
|
|
339
317
|
|
|
340
318
|
|
|
341
|
-
|
|
342
319
|
@grok.decorators.func({
|
|
343
320
|
name: 'Polytool Helm Enumerator dialog'
|
|
344
321
|
})
|
|
345
322
|
static async getPtHelmEnumeratorDialog(
|
|
346
|
-
@grok.decorators.param({type:'object',options:{nullable:true}})
|
|
347
|
-
|
|
323
|
+
@grok.decorators.param({type: 'object', options: {nullable: true}}) cell?: DG.Cell) {
|
|
348
324
|
return polyToolEnumerateHelmUI(cell);
|
|
349
325
|
}
|
|
350
326
|
|
|
@@ -353,30 +329,26 @@ export class PackageFunctions{
|
|
|
353
329
|
name: 'Polytool Chem Enumerator dialog'
|
|
354
330
|
})
|
|
355
331
|
static async getPtChemEnumeratorDialog(
|
|
356
|
-
@grok.decorators.param({type:'object',options:{nullable:true}})
|
|
357
|
-
|
|
332
|
+
@grok.decorators.param({type: 'object', options: {nullable: true}}) cell?: DG.Cell) {
|
|
358
333
|
return polyToolEnumerateChemUI(cell);
|
|
359
334
|
}
|
|
360
335
|
|
|
361
336
|
|
|
362
337
|
@grok.decorators.func({
|
|
363
|
-
name: 'Combine Sequences',
|
|
338
|
+
'name': 'Combine Sequences',
|
|
364
339
|
'top-menu': 'Bio | PolyTool | Combine Sequences...'
|
|
365
340
|
})
|
|
366
341
|
static async getPolyToolCombineDialog() {
|
|
367
|
-
|
|
368
342
|
getPTCombineDialog();
|
|
369
343
|
}
|
|
370
344
|
|
|
371
345
|
|
|
372
|
-
|
|
373
346
|
@grok.decorators.func({
|
|
374
347
|
name: 'applyNotationProviderForHarmonizedSequence'
|
|
375
348
|
})
|
|
376
349
|
static applyNotationProviderForCyclized(
|
|
377
|
-
@grok.decorators.param({type:'column'}) col: DG.Column<string>,
|
|
378
|
-
|
|
379
|
-
|
|
350
|
+
@grok.decorators.param({type: 'column'}) col: DG.Column<string>,
|
|
351
|
+
separator: string) {
|
|
380
352
|
col.setTag('aligned', 'SEQ');
|
|
381
353
|
col.setTag('alphabet', 'UN');
|
|
382
354
|
col.setTag('.alphabetIsMultichar', 'true');
|
|
@@ -392,4 +364,4 @@ async function getSpecifiedAppView(appName: string): Promise<DG.ViewBase> {
|
|
|
392
364
|
const appUI = getSpecifiedAppUI(appName, _package);
|
|
393
365
|
const view = await appUI.getAppView();
|
|
394
366
|
return view;
|
|
395
|
-
}
|
|
367
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
3
|
|
|
4
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
4
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
5
5
|
import {getSeqHelper, ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
6
6
|
import {_toAtomicLevel} from '@datagrok-libraries/bio/src/monomer-works/to-atomic-level';
|
|
7
7
|
import {ALPHABET, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
8
|
-
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types';
|
|
8
|
+
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
9
9
|
import {RDModule} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
10
10
|
|
|
11
11
|
export function dealGroups(col: DG.Column<string>): void {
|
|
@@ -2,9 +2,10 @@
|
|
|
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
|
+
// @ts-ignore
|
|
5
6
|
import './style.css';
|
|
6
7
|
|
|
7
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
8
|
+
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
9
|
import {Rules} from './pt-rules';
|
|
9
10
|
import {getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
10
11
|
import {doPolyToolConvert} from './pt-conversion';
|
|
@@ -5,7 +5,7 @@ import * as ui from 'datagrok-api/ui';
|
|
|
5
5
|
import {ActiveFiles} from '@datagrok-libraries/utils/src/settings/active-files-base';
|
|
6
6
|
import {RulesManager} from './rule-manager';
|
|
7
7
|
import {RuleCards} from './pt-rule-cards';
|
|
8
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
8
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
9
9
|
import {
|
|
10
10
|
_package,
|
|
11
11
|
PackageFunctions} from '../../package';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import {getRdKitModule} from '@datagrok-libraries/bio/src/chem/rdkit-module';
|
|
2
3
|
import {Rules, RuleReaction, getMonomerPairs} from './pt-rules';
|
|
3
4
|
import {InvalidReactionError, MonomerNotFoundError} from '../types';
|
|
@@ -7,8 +8,7 @@ import * as grok from 'datagrok-api/grok';
|
|
|
7
8
|
|
|
8
9
|
import wu from 'wu';
|
|
9
10
|
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
10
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
11
|
-
import {IMonomerLib, IMonomerLibBase, Monomer, MonomerLibData, RGroup} from '@datagrok-libraries/bio/src/types';
|
|
11
|
+
import {IMonomerLib, IMonomerLibBase, Monomer, MonomerLibData, RGroup, getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
12
12
|
import {RDModule, RDMol, RDReaction, MolList, RDReactionResult} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
13
13
|
import {HELM_REQUIRED_FIELD as REQ,
|
|
14
14
|
HELM_OPTIONAL_FIELDS as OPT, HELM_RGROUP_FIELDS} from '@datagrok-libraries/bio/src/utils/const';
|
|
@@ -7,7 +7,7 @@ import {HELM_FIELDS, DUMMY_MONOMER} from '@datagrok-libraries/bio/src/utils/cons
|
|
|
7
7
|
import {
|
|
8
8
|
helmFieldsToPolyToolInputFields, R_GROUP_BLOCK_DUMMY
|
|
9
9
|
} from './const';
|
|
10
|
-
import {Monomer, RGroup} from '@datagrok-libraries/bio/src/types/
|
|
10
|
+
import {Monomer, RGroup} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
11
11
|
|
|
12
12
|
export class PolyToolMonomerLibHandler {
|
|
13
13
|
constructor(private rawLib: any[]) { }
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from './const';
|
|
29
29
|
|
|
30
30
|
import {_package} from '../package';
|
|
31
|
-
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/
|
|
31
|
+
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
32
32
|
import {MonomerHoverLink} from '@datagrok-libraries/bio/src/monomer-works/utils';
|
|
33
33
|
import {MonomerMap} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
34
34
|
import {ISeqMonomer} from '@datagrok-libraries/bio/src/helm/types';
|
|
@@ -42,7 +42,6 @@ import {addSubstructProvider, getMonomerHover, ISubstruct, setMonomerHover}
|
|
|
42
42
|
import {getMolHighlight} from '@datagrok-libraries/bio/src/monomer-works/seq-to-molfile';
|
|
43
43
|
import {ChemTags} from '@datagrok-libraries/chem-meta/src/consts';
|
|
44
44
|
import {mergeSubstructs} from '@datagrok-libraries/chem-meta/src/types';
|
|
45
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
46
45
|
import {dealGroups, helmToMol} from './conversion/pt-atomic';
|
|
47
46
|
|
|
48
47
|
type PolyToolConvertSerialized = {
|
|
@@ -94,13 +93,14 @@ export async function getPolyToolConvertDialog(srcCol?: DG.Column): Promise<DG.D
|
|
|
94
93
|
if (!srcColVal) {
|
|
95
94
|
if (srcColList.length < 1)
|
|
96
95
|
throw new Error(PT_ERROR_DATAFRAME);
|
|
97
|
-
|
|
96
|
+
|
|
98
97
|
if (customSrcCols.length < 1) {
|
|
99
98
|
const toAtomicLevelFunc = DG.Func.find({package: 'Bio', name: 'toAtomicLevel'})[0];
|
|
100
99
|
if (toAtomicLevelFunc) {
|
|
101
100
|
toAtomicLevelFunc.prepare().edit();
|
|
102
101
|
return null;
|
|
103
102
|
}
|
|
103
|
+
// eslint-disable-next-line max-len
|
|
104
104
|
grok.shell.warning('Polytool requires a macromolecule column with custom notation. \n\nUse Top menu | Bio | Transform | To Atomic Level.');
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
@@ -10,7 +10,7 @@ import {Unsubscribable} from 'rxjs';
|
|
|
10
10
|
|
|
11
11
|
import {GetMonomerResType, HelmAtom, MonomerNumberingTypes} from '@datagrok-libraries/helm-web-editor/src/types/org-helm';
|
|
12
12
|
import {getHelmHelper, HelmInputBase, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
13
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
13
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
14
14
|
import {HelmType, PolymerType} from '@datagrok-libraries/bio/src/helm/types';
|
|
15
15
|
import {helmTypeToPolymerType} from '@datagrok-libraries/bio/src/monomer-works/monomer-works';
|
|
16
16
|
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
@@ -169,7 +169,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
169
169
|
const seqCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, 'seq', [PT_HELM_EXAMPLE]);
|
|
170
170
|
seqCol.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
171
171
|
const _tempDf = DG.DataFrame.fromColumns([seqCol]);
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
seqCol.meta.units = NOTATION.HELM;
|
|
174
174
|
const sh = seqHelper.getSeqHandler(seqCol);
|
|
175
175
|
resSeqValue = sh.getValue(0);
|
|
@@ -187,7 +187,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
187
187
|
const warningsTextDiv = ui.divText('', {style: {color: 'red'}});
|
|
188
188
|
// #### Inputs
|
|
189
189
|
inputs = {
|
|
190
|
-
macromolecule: helmHelper.createHelmInput(
|
|
190
|
+
macromolecule: helmHelper.createHelmInput(
|
|
191
191
|
'Macromolecule', {
|
|
192
192
|
editable: false,
|
|
193
193
|
editorOptions: {
|
|
@@ -590,7 +590,11 @@ async function getPolyToolEnumerateDialog(
|
|
|
590
590
|
return;
|
|
591
591
|
}
|
|
592
592
|
const monLibName = placeHoldersValue[0].monomers[0];
|
|
593
|
-
const monLib = await libHelper.
|
|
593
|
+
const monLib = await libHelper.readSingleLibraryByName(monLibName);
|
|
594
|
+
if (!monLib) {
|
|
595
|
+
grok.shell.warning(`Monomer Library '${monLibName}' was not found`);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
594
598
|
const peptideMonomers = monLib.getMonomerSymbolsByType(PolymerTypes.PEPTIDE);
|
|
595
599
|
placeHoldersValue[0].monomers = peptideMonomers;
|
|
596
600
|
enumerationType = PolyToolEnumeratorTypes.Single;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as ui from 'datagrok-api/ui';
|
|
2
3
|
import * as grok from 'datagrok-api/grok';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
import {PtBio} from './conversion/pt-tools-helmmol';
|
|
13
|
-
import {getAvailableMonomers} from './utils';
|
|
14
14
|
import {PolyToolEnumeratorParams, PolyToolEnumeratorTypes,
|
|
15
15
|
PolyToolPlaceholder, PolyToolBreadthPlaceholder} from './types';
|
|
16
16
|
|
|
@@ -42,7 +42,7 @@ export async function getPolyToolUnruleDialog(srcCol?: DG.Column<string>): Promi
|
|
|
42
42
|
});
|
|
43
43
|
let ruleFileList: string[];
|
|
44
44
|
const ruleInputs = new RuleInputs(RULES_PATH, RULES_STORAGE_NAME, '.json', {
|
|
45
|
-
onValueChanged: (value: string[]) => { ruleFileList = value;}
|
|
45
|
+
onValueChanged: (value: string[]) => { ruleFileList = value; }
|
|
46
46
|
});
|
|
47
47
|
const rulesHeader = ui.inlineText([PT_UI_RULES_USED]);
|
|
48
48
|
const rulesForm = await ruleInputs.getForm();
|
|
@@ -95,7 +95,7 @@ export async function polyToolUnrule(
|
|
|
95
95
|
const rules = await getRules(ruleFiles);
|
|
96
96
|
const resHelmList = doPolyToolUnrule(srcCol.toList(), rules, helmHelper);
|
|
97
97
|
const resHelmColName = `harmonized(srcCol.name)`;
|
|
98
|
-
const resHelmCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, resHelmColName, resHelmList
|
|
98
|
+
const resHelmCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, resHelmColName, resHelmList);
|
|
99
99
|
resHelmCol.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
100
100
|
resHelmCol.meta.units = NOTATION.CUSTOM;
|
|
101
101
|
if (table) {
|
package/src/polytool/utils.ts
CHANGED
|
@@ -8,8 +8,8 @@ import {ALPHABET, ALIGNMENT, NOTATION} from '@datagrok-libraries/bio/src/utils/m
|
|
|
8
8
|
import {OrgType} from '@datagrok-libraries/bio/src/helm/types';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from '@datagrok-libraries/bio/src/
|
|
11
|
+
getMonomerLibHelper, IMonomerLibHelper
|
|
12
|
+
} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
13
13
|
|
|
14
14
|
declare const org: OrgType;
|
|
15
15
|
export const LIB_PATH = 'System:AppData/Bio/monomer-libraries/';
|
|
@@ -28,15 +28,23 @@ function addCommonTags(col: DG.Column<any>) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export async function getAvailableMonomers(screenLibrary: string): Promise<string[]> {
|
|
31
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
32
|
-
const monomerLib = await monomerLibHelper.
|
|
31
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
32
|
+
const monomerLib = await monomerLibHelper.readSingleLibraryByName(screenLibrary);
|
|
33
|
+
if (!monomerLib) {
|
|
34
|
+
_package.logger.error(`Monomer library '${screenLibrary}' not found.`);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
33
37
|
//NOTICE: works with Peptides only
|
|
34
38
|
return monomerLib.getMonomerSymbolsByType('PEPTIDE');
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export async function getAvailableMonomerMols(screenLibrary: string): Promise<{[monomerSymbol: string]: string}> {
|
|
38
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
39
|
-
const monomerLib = await monomerLibHelper.
|
|
42
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
43
|
+
const monomerLib = await monomerLibHelper.readSingleLibraryByName(screenLibrary);
|
|
44
|
+
if (!monomerLib) {
|
|
45
|
+
_package.logger.error(`Monomer library '${screenLibrary}' not found.`);
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
40
48
|
const monomers = monomerLib.getMonomerSymbolsByType('PEPTIDE');
|
|
41
49
|
const mols = new Array<string>(monomers.length);
|
|
42
50
|
|
|
@@ -45,7 +53,6 @@ export async function getAvailableMonomerMols(screenLibrary: string): Promise<{[
|
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export async function getLibrariesList(): Promise<string[]> {
|
|
48
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
49
|
-
|
|
50
|
-
return monomerFileManager.getValidLibraryPaths();
|
|
56
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
57
|
+
return monomerLibHelper.getAvaliableLibraryNames();
|
|
51
58
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -81,7 +82,7 @@ category('PolyTool: Chain: parseNotation', () => {
|
|
|
81
82
|
'3-in-1-1-6-3': {inIdx: 1, spIdx: 2, outIdx: 3, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
82
83
|
'7-in-1-1-6-3': {inIdx: 5, spIdx: 2, outIdx: 7, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
83
84
|
'8-in-1-1-6-3': {inIdx: 0, spIdx: 3, outIdx: 8, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
84
|
-
// '11-in-1-1-6-3': {inIdx: 0, spIdx: 4}, src: {outIdx: 11, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]}},
|
|
85
|
+
// '11-in-1-1-6-3': {inIdx: 0, spIdx: 4}, src: {outIdx: 11, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]}},
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
for (const [testName, {inIdx, spIdx, outIdx, monomers}] of Object.entries(innerIdxTests)) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
4
5
|
|
|
5
6
|
import {before, after, category, expect, test, expectArray, testEvent, expectObject}
|
|
6
7
|
from '@datagrok-libraries/utils/src/test';
|
|
7
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
8
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
9
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
10
|
import {
|
|
10
11
|
getUserLibSettings, setUserLibSettings
|
|
@@ -4,7 +4,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
4
4
|
|
|
5
5
|
import {before, after, category, expect, test, expectArray} from '@datagrok-libraries/utils/src/test';
|
|
6
6
|
import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
7
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
7
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
8
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
9
|
import {
|
|
10
10
|
getUserLibSettings, setUserLibSettings
|
|
@@ -94,15 +94,15 @@ category('PolyTool: Enumerate', () => {
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
tgt: [
|
|
97
|
-
{seq:
|
|
98
|
-
{seq:
|
|
99
|
-
{seq:
|
|
100
|
-
{seq:
|
|
101
|
-
{seq:
|
|
102
|
-
{seq:
|
|
103
|
-
{seq:
|
|
104
|
-
{seq:
|
|
105
|
-
{seq:
|
|
97
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.Y.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K-K3Y'},
|
|
98
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.K.Y.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K-G4Y'},
|
|
99
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.K.G.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K-P5Y'},
|
|
100
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.Y.K.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K-W3Y'},
|
|
101
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.Y.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K-K4Y'},
|
|
102
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.K.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K-P5Y'},
|
|
103
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.Y.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K-W3Y'},
|
|
104
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.Y.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K-G4Y'},
|
|
105
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K-K5Y'}
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
};
|