@datagrok/sequence-translator 1.9.13 → 1.9.15
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/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js.map +1 -1
- package/files/polytool-rules/rules_example.json +7 -0
- package/package.json +3 -3
- package/src/package.g.ts +2 -2
- package/src/package.ts +21 -49
- package/test-console-output-1.log +60 -71
- 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.9.
|
|
4
|
+
"version": "1.9.15",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@datagrok-libraries/bio": "^5.54.8",
|
|
26
26
|
"@datagrok-libraries/chem-meta": "^1.2.8",
|
|
27
27
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
28
|
-
"@datagrok-libraries/utils": "^4.6.
|
|
28
|
+
"@datagrok-libraries/utils": "^4.6.5",
|
|
29
29
|
"@types/react": "^18.0.15",
|
|
30
30
|
"cash-dom": "^8.1.0",
|
|
31
31
|
"datagrok-api": "^1.25.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
55
55
|
"@typescript-eslint/parser": "^7.2.0",
|
|
56
56
|
"css-loader": "^6.7.3",
|
|
57
|
-
"datagrok-tools": "^4.14.
|
|
57
|
+
"datagrok-tools": "^4.14.55",
|
|
58
58
|
"eslint": "^8.57.0",
|
|
59
59
|
"eslint-config-google": "^0.14.0",
|
|
60
60
|
"style-loader": "^3.3.1",
|
package/src/package.g.ts
CHANGED
|
@@ -119,8 +119,8 @@ export async function getPolyToolConvertEditor(call: DG.FuncCall) : Promise<any>
|
|
|
119
119
|
|
|
120
120
|
//input: dataframe table
|
|
121
121
|
//input: column seqCol { caption: Sequence }
|
|
122
|
-
//input: bool generateHelm
|
|
123
|
-
//input: bool chiralityEngine
|
|
122
|
+
//input: bool generateHelm = true
|
|
123
|
+
//input: bool chiralityEngine = true
|
|
124
124
|
//input: object rules
|
|
125
125
|
//output: column result
|
|
126
126
|
//editor: SequenceTranslator:getPolyToolConvertEditor
|
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
|
+
}
|