@datagrok/sequence-translator 1.9.9 → 1.9.11
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/.eslintrc.json +0 -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/files/polytool-rules/rules_example.json +4 -4
- package/package.json +4 -4
- package/src/demo/demo-st-ui.ts +4 -4
- package/src/package-api.ts +4 -4
- package/src/package.g.ts +195 -0
- package/src/package.ts +345 -273
- package/src/polytool/conversion/pt-rule-cards.ts +76 -47
- package/src/polytool/conversion/pt-rules.ts +39 -12
- package/src/polytool/conversion/rule-manager.ts +65 -12
- package/src/polytool/conversion/style.css +2 -2
- package/src/polytool/pt-enumerate-seq-dialog.ts +3 -3
- package/src/tests/polytool-convert-tests.ts +2 -2
- package/test-console-output-1.log +139 -138
- package/test-record-1.mp4 +0 -0
- package/tsconfig.json +2 -2
- package/webpack.config.js +5 -1
package/src/package.ts
CHANGED
|
@@ -15,7 +15,6 @@ import {demoOligoPatternUI, demoOligoStructureUI, demoOligoTranslatorUI} from '.
|
|
|
15
15
|
import {getExternalAppViewFactories} from './plugins/mermade';
|
|
16
16
|
import {defaultErrorHandler} from './utils/err-info';
|
|
17
17
|
|
|
18
|
-
//polytool specific
|
|
19
18
|
import {polyToolConvert, polyToolConvertUI} from './polytool/pt-dialog';
|
|
20
19
|
import {polyToolEnumerateChemUI} from './polytool/pt-dialog';
|
|
21
20
|
import {polyToolEnumerateHelmUI} from './polytool/pt-enumerate-seq-dialog';
|
|
@@ -29,295 +28,368 @@ import {PolyToolTags} from './consts';
|
|
|
29
28
|
import {getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
30
29
|
import { getPTCombineDialog } from './polytool/pt-combine-dialog';
|
|
31
30
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
let initSequenceTranslatorPromise: Promise<void> | null = null;
|
|
31
|
+
export * from './package.g';
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
export async function init(): Promise<void> {
|
|
38
|
-
if (initSequenceTranslatorPromise === null)
|
|
39
|
-
_package.startInit(initSequenceTranslatorPromise = initSequenceTranslatorInt());
|
|
33
|
+
/** Temporary polyfill */
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
function getDecoratorFunc() {
|
|
36
|
+
return function(args: any) {
|
|
37
|
+
return function(
|
|
38
|
+
target: any,
|
|
39
|
+
propertyKey: string,
|
|
40
|
+
descriptor: PropertyDescriptor
|
|
41
|
+
) { };
|
|
42
|
+
};
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
]);
|
|
48
|
-
_package.completeInit(helmHelper);
|
|
49
|
-
}
|
|
45
|
+
// Ensure decorators object exists and polyfill missing decorators
|
|
46
|
+
if (!grok.decorators)
|
|
47
|
+
(grok as any).decorators = {};
|
|
50
48
|
|
|
51
|
-
//name: Oligo Toolkit
|
|
52
|
-
//meta.icon: img/icons/toolkit.png
|
|
53
|
-
//meta.browsePath: Peptides | Oligo Toolkit
|
|
54
|
-
//tags: app
|
|
55
|
-
//output: view v
|
|
56
|
-
export async function oligoToolkitApp(): Promise<DG.ViewBase> {
|
|
57
|
-
await _package.initLibData();
|
|
58
|
-
const externalViewFactories = await getExternalAppViewFactories(_package);
|
|
59
|
-
if (!externalViewFactories)
|
|
60
|
-
throw new Error('External app view factories not loaded');
|
|
61
|
-
const appUI = new CombinedAppUI(externalViewFactories!, _package);
|
|
62
|
-
const view = await appUI.getAppView();
|
|
63
|
-
return view;
|
|
64
|
-
}
|
|
65
49
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const view = await getSpecifiedAppView(APP_NAME.TRANSLATOR);
|
|
73
|
-
return view;
|
|
74
|
-
}
|
|
50
|
+
const decorators = [
|
|
51
|
+
'func', 'init', 'param', 'panel', 'editor', 'demo', 'app',
|
|
52
|
+
'appTreeBrowser', 'fileHandler', 'fileExporter', 'model', 'viewer', 'filter', 'cellRenderer', 'autostart',
|
|
53
|
+
'dashboard', 'folderViewer', 'semTypeDetector', 'packageSettingsEditor', 'functionAnalysis', 'converter',
|
|
54
|
+
'fileViewer', 'model', 'treeBrowser', 'polyfill'
|
|
55
|
+
];
|
|
75
56
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//output: view v
|
|
81
|
-
export async function oligoPatternApp(): Promise<DG.ViewBase> {
|
|
82
|
-
const view = await getSpecifiedAppView(APP_NAME.PATTERN);
|
|
83
|
-
return view;
|
|
84
|
-
}
|
|
57
|
+
decorators.forEach((decorator) => {
|
|
58
|
+
if (!(grok.decorators as any)[decorator])
|
|
59
|
+
(grok.decorators as any)[decorator] = getDecoratorFunc();
|
|
60
|
+
});
|
|
85
61
|
|
|
86
|
-
|
|
87
|
-
//meta.icon: img/icons/structure.png
|
|
88
|
-
//meta.browsePath: Peptides | Oligo Toolkit
|
|
89
|
-
//tags: app
|
|
90
|
-
//output: view v
|
|
91
|
-
export async function oligoStructureApp(): Promise<DG.ViewBase> {
|
|
92
|
-
const view = await getSpecifiedAppView(APP_NAME.STRUCTURE);
|
|
93
|
-
return view;
|
|
94
|
-
}
|
|
62
|
+
/** End temporary polyfill */
|
|
95
63
|
|
|
96
|
-
|
|
97
|
-
//output: object result
|
|
98
|
-
export async function getTranslationHelper(): Promise<ITranslationHelper> {
|
|
99
|
-
await _package.initLibData();
|
|
100
|
-
return _package;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//name: getCodeToWeightsMap
|
|
104
|
-
//output: object result
|
|
105
|
-
export function getCodeToWeightsMap(): { [key: string]: number } {
|
|
106
|
-
const monomerLibWrapper = _package.monomerLibWrapper;
|
|
107
|
-
const map = monomerLibWrapper.getCodesToWeightsMap();
|
|
108
|
-
return Object.fromEntries(map);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
//name: validateSequence
|
|
112
|
-
//input: string sequence
|
|
113
|
-
//output: bool result
|
|
114
|
-
export function validateSequence(sequence: string): boolean {
|
|
115
|
-
const validator = _package.createSequenceValidator(sequence);
|
|
116
|
-
const format = _package.createFormatDetector(sequence).getFormat();
|
|
117
|
-
return (format === null) ? false : validator.isValidSequence(format!);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
//name: validateSequence
|
|
121
|
-
//input: string sequence
|
|
122
|
-
//input: bool invert
|
|
123
|
-
//output: string result
|
|
124
|
-
export function getMolfileFromGcrsSequence(sequence: string, invert: boolean): string {
|
|
125
|
-
return (new SequenceToMolfileConverter(sequence, invert, 'GCRS')).convert();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
//name: linkStrands
|
|
129
|
-
//input: object strands
|
|
130
|
-
//output: string result
|
|
131
|
-
export function linkStrands(strands: { senseStrands: string[], antiStrands: string[] }): string {
|
|
132
|
-
return linkStrandsV3000(strands, true);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//name: demoOligoTranslator
|
|
136
|
-
//meta.demoPath: Bioinformatics | Oligo Toolkit | Translator
|
|
137
|
-
//description: Translate oligonucleotide sequences across various formats accepted by different synthesizers
|
|
138
|
-
//meta.path: /apps/Tutorials/Demo/Bioinformatics/Oligonucleotide%20Sequence:%20Translate
|
|
139
|
-
//meta.demoSkip: GROK-14320
|
|
140
|
-
export async function demoTranslateSequence(): Promise<void> {
|
|
141
|
-
await demoOligoTranslatorUI();
|
|
142
|
-
}
|
|
64
|
+
export const _package: OligoToolkitPackage = new OligoToolkitPackage({debug: true}/**/);
|
|
143
65
|
|
|
144
|
-
|
|
145
|
-
//meta.demoPath: Bioinformatics | Oligo Toolkit | Pattern
|
|
146
|
-
//description: Design a modification pattern for an oligonucleotide sequence
|
|
147
|
-
//meta.path:%20/apps/Tutorials/Demo/Bioinformatics/Oligonucleotide%20Sequence:%20Visualize%20duplex
|
|
148
|
-
export async function demoOligoPattern(): Promise<void> {
|
|
149
|
-
await demoOligoPatternUI();
|
|
150
|
-
}
|
|
66
|
+
let initSequenceTranslatorPromise: Promise<void> | null = null;
|
|
151
67
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
await demoOligoStructureUI();
|
|
68
|
+
async function initSequenceTranslatorInt(): Promise<void> {
|
|
69
|
+
const [helmHelper] = await Promise.all([
|
|
70
|
+
getHelmHelper(),
|
|
71
|
+
]);
|
|
72
|
+
_package.completeInit(helmHelper);
|
|
158
73
|
}
|
|
159
74
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
75
|
+
export class PackageFunctions{
|
|
76
|
+
@grok.decorators.app({
|
|
77
|
+
icon: 'img/icons/toolkit.png',
|
|
78
|
+
browsePath: 'Peptides | Oligo Toolkit',
|
|
79
|
+
name: 'Oligo Toolkit'
|
|
80
|
+
})
|
|
81
|
+
static async oligoToolkitApp(): Promise<DG.ViewBase> {
|
|
82
|
+
|
|
83
|
+
await _package.initLibData();
|
|
84
|
+
const externalViewFactories = await getExternalAppViewFactories(_package);
|
|
85
|
+
if (!externalViewFactories)
|
|
86
|
+
throw new Error('External app view factories not loaded');
|
|
87
|
+
const appUI = new CombinedAppUI(externalViewFactories!, _package);
|
|
88
|
+
const view = await appUI.getAppView();
|
|
89
|
+
return view;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@grok.decorators.init()
|
|
94
|
+
static async init(): Promise<void> {
|
|
95
|
+
|
|
96
|
+
if (initSequenceTranslatorPromise === null)
|
|
97
|
+
_package.startInit(initSequenceTranslatorPromise = initSequenceTranslatorInt());
|
|
98
|
+
|
|
99
|
+
return initSequenceTranslatorPromise;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@grok.decorators.app({
|
|
103
|
+
icon: 'img/icons/translator.png',
|
|
104
|
+
browsePath: 'Peptides | Oligo Toolkit',
|
|
105
|
+
name: 'Oligo Translator'
|
|
106
|
+
})
|
|
107
|
+
static async oligoTranslatorApp(): Promise<DG.ViewBase> {
|
|
108
|
+
|
|
109
|
+
const view = await getSpecifiedAppView(APP_NAME.TRANSLATOR);
|
|
110
|
+
return view;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@grok.decorators.app({
|
|
115
|
+
icon: 'img/icons/pattern.png',
|
|
116
|
+
browsePath: 'Peptides | Oligo Toolkit',
|
|
117
|
+
name: 'Oligo Pattern'
|
|
118
|
+
})
|
|
119
|
+
static async oligoPatternApp(): Promise<DG.ViewBase> {
|
|
120
|
+
|
|
121
|
+
const view = await getSpecifiedAppView(APP_NAME.PATTERN);
|
|
122
|
+
return view;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@grok.decorators.app({
|
|
127
|
+
icon: 'img/icons/structure.png',
|
|
128
|
+
browsePath: 'Peptides | Oligo Toolkit',
|
|
129
|
+
name: 'Oligo Structure'
|
|
130
|
+
})
|
|
131
|
+
static async oligoStructureApp(): Promise<DG.ViewBase> {
|
|
132
|
+
|
|
133
|
+
const view = await getSpecifiedAppView(APP_NAME.STRUCTURE);
|
|
134
|
+
return view;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@grok.decorators.func({outputs: [{type: 'object', name: 'result'}]})
|
|
139
|
+
static async getTranslationHelper(): Promise<ITranslationHelper> {
|
|
140
|
+
|
|
141
|
+
await _package.initLibData();
|
|
142
|
+
return _package;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@grok.decorators.func({outputs: [{type: 'object', name: 'result'}]})
|
|
147
|
+
static getCodeToWeightsMap(): Record<string, number> {
|
|
148
|
+
|
|
149
|
+
const monomerLibWrapper = _package.monomerLibWrapper;
|
|
150
|
+
const map = monomerLibWrapper.getCodesToWeightsMap();
|
|
151
|
+
return Object.fromEntries(map);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@grok.decorators.func()
|
|
156
|
+
static validateSequence(
|
|
157
|
+
sequence: string): boolean {
|
|
158
|
+
|
|
159
|
+
const validator = _package.createSequenceValidator(sequence);
|
|
160
|
+
const format = _package.createFormatDetector(sequence).getFormat();
|
|
161
|
+
return (format === null) ? false : validator.isValidSequence(format!);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@grok.decorators.func({
|
|
166
|
+
name: 'validateSequence'
|
|
167
|
+
})
|
|
168
|
+
static getMolfileFromGcrsSequence(
|
|
169
|
+
sequence: string,
|
|
170
|
+
invert: boolean): string {
|
|
171
|
+
|
|
172
|
+
return (new SequenceToMolfileConverter(sequence, invert, 'GCRS')).convert();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@grok.decorators.func()
|
|
177
|
+
static linkStrands(
|
|
178
|
+
@grok.decorators.param({type:'object'}) strands: { senseStrands: string[], antiStrands: string[] }): string {
|
|
179
|
+
return linkStrandsV3000(strands, true);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@grok.decorators.func({
|
|
184
|
+
meta: {
|
|
185
|
+
demoPath: 'Bioinformatics | Oligo Toolkit | Translator',
|
|
186
|
+
path: '/apps/Tutorials/Demo/Bioinformatics/Oligonucleotide%20Sequence:%20Translate',
|
|
187
|
+
demoSkip: 'GROK-14320'
|
|
188
|
+
},
|
|
189
|
+
name: 'demoOligoTranslator',
|
|
190
|
+
description: 'Translate oligonucleotide sequences across various formats accepted by different synthesizers'
|
|
191
|
+
})
|
|
192
|
+
static async demoTranslateSequence(): Promise<void> {
|
|
193
|
+
await demoOligoTranslatorUI();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@grok.decorators.func({
|
|
198
|
+
meta: {
|
|
199
|
+
demoPath: 'Bioinformatics | Oligo Toolkit | Pattern',
|
|
200
|
+
path: '%20/apps/Tutorials/Demo/Bioinformatics/Oligonucleotide%20Sequence:%20Visualize%20duplex'
|
|
201
|
+
},
|
|
202
|
+
description: 'Design a modification pattern for an oligonucleotide sequence'
|
|
203
|
+
})
|
|
204
|
+
static async demoOligoPattern(): Promise<void> {
|
|
205
|
+
|
|
206
|
+
await demoOligoPatternUI();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@grok.decorators.func({
|
|
211
|
+
meta: {
|
|
212
|
+
demoPath: 'Bioinformatics | Oligo Toolkit | Structure',
|
|
213
|
+
path: '%20/apps/Tutorials/Demo/Bioinformatics/Oligonucleotide%20Sequence:%20Visualize%20duplex'
|
|
214
|
+
},
|
|
215
|
+
description: 'Visualize duplex and save SDF'
|
|
216
|
+
})
|
|
217
|
+
static async demoOligoStructure(): Promise<void> {
|
|
218
|
+
|
|
219
|
+
await demoOligoStructureUI();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
@grok.decorators.func()
|
|
224
|
+
static async translateOligonucleotideSequence(
|
|
225
|
+
sequence: string, sourceFormat: string, targetFormat: string
|
|
226
|
+
): Promise<string> {
|
|
227
|
+
|
|
228
|
+
await _package.initLibData();
|
|
229
|
+
return _package.createFormatConverter(sequence, sourceFormat).convertTo(targetFormat);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@grok.decorators.func({
|
|
233
|
+
'top-menu': 'Bio | PolyTool | Convert...',
|
|
234
|
+
name: 'polyToolConvert',
|
|
235
|
+
description: 'Perform cyclization of polymers'
|
|
236
|
+
})
|
|
237
|
+
static async polyToolConvertTopMenu(): Promise<void> {
|
|
238
|
+
|
|
239
|
+
await polyToolConvertUI();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@grok.decorators.editor()
|
|
243
|
+
static async getPolyToolConvertEditor(
|
|
244
|
+
call: DG.FuncCall): Promise<DG.Column<string> | null> {
|
|
245
|
+
|
|
246
|
+
const funcEditor = await PolyToolConvertFuncEditor.create(call);
|
|
247
|
+
return await funcEditor.showDialog();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
@grok.decorators.func({
|
|
252
|
+
editor: 'SequenceTranslator:getPolyToolConvertEditor',
|
|
253
|
+
})
|
|
254
|
+
static async polyToolConvert2(
|
|
255
|
+
table: DG.DataFrame,
|
|
256
|
+
@grok.decorators.param({options: { caption: 'Sequence'}}) seqCol: DG.Column,
|
|
257
|
+
@grok.decorators.param({options: { initialValue: 'true'}}) generateHelm: boolean,
|
|
258
|
+
@grok.decorators.param({options: { initialValue: 'true'}}) chiralityEngine: boolean,
|
|
259
|
+
@grok.decorators.param({type: 'object'}) rules: string[]
|
|
260
|
+
): Promise<DG.Column<string>> {
|
|
261
|
+
|
|
262
|
+
const ptConvertRes = await polyToolConvert(seqCol, generateHelm, false, chiralityEngine, false, rules);
|
|
263
|
+
return ptConvertRes[0];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@grok.decorators.func({
|
|
269
|
+
'top-menu': 'Bio | PolyTool | Enumerate HELM...',
|
|
270
|
+
name: 'polyToolEnumerateHelm',
|
|
271
|
+
description: 'Perform cyclization of polymers'
|
|
272
|
+
})
|
|
273
|
+
static async polyToolEnumerateHelmTopMenu(): Promise<void> {
|
|
274
|
+
|
|
275
|
+
await polyToolEnumerateHelmUI(grok.shell.tv?.dataFrame.currentCell);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
@grok.decorators.func({
|
|
280
|
+
'top-menu': 'Bio | PolyTool | Enumerate Chem...',
|
|
281
|
+
name: 'polyToolEnumerateChem',
|
|
282
|
+
description: 'Perform cyclization of polymers'
|
|
283
|
+
})
|
|
284
|
+
static async polyToolEnumerateChemTopMenu(): Promise<void> {
|
|
285
|
+
|
|
286
|
+
polyToolEnumerateChemUI();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@grok.decorators.func()
|
|
291
|
+
static async polyToolColumnChoice(
|
|
292
|
+
@grok.decorators.param({options: {description: 'Input data table'}}) df: DG.DataFrame,
|
|
293
|
+
macroMolecule: DG.Column): Promise<void> {
|
|
294
|
+
|
|
295
|
+
_setPeptideColumn(macroMolecule);
|
|
296
|
+
await grok.data.detectSemanticTypes(df);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
@grok.decorators.func()
|
|
301
|
+
static async createMonomerLibraryForPolyTool(
|
|
302
|
+
file: DG.FileInfo) {
|
|
303
|
+
|
|
304
|
+
const fileContent = await file.readAsString();
|
|
305
|
+
const libHandler = new PolyToolCsvLibHandler(file.fileName, fileContent);
|
|
306
|
+
const libObject = await libHandler.getJson();
|
|
307
|
+
const jsonFileName = file.fileName.replace(/\.csv$/, '.json');
|
|
308
|
+
const jsonFileContent = JSON.stringify(libObject, null, 2);
|
|
309
|
+
DG.Utils.download(jsonFileName, jsonFileContent);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
@grok.decorators.func({
|
|
314
|
+
meta: {
|
|
315
|
+
icon: 'img/icons/structure.png',
|
|
316
|
+
browsePath: 'Peptides | PolyTool'
|
|
317
|
+
},
|
|
318
|
+
tags: ['app'],
|
|
319
|
+
name: 'HELM Enumerator'
|
|
320
|
+
})
|
|
321
|
+
static async ptEnumeratorHelmApp(): Promise<void> {
|
|
322
|
+
|
|
323
|
+
await polyToolEnumerateHelmUI();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
@grok.decorators.func({
|
|
328
|
+
meta: {
|
|
329
|
+
icon: 'img/icons/structure.png',
|
|
330
|
+
browsePath: 'Peptides | PolyTool'
|
|
331
|
+
},
|
|
332
|
+
tags: ['app'],
|
|
333
|
+
name: 'Chem Enumerator'
|
|
334
|
+
})
|
|
335
|
+
static async ptEnumeratorChemApp(): Promise<void> {
|
|
336
|
+
|
|
337
|
+
polyToolEnumerateChemUI();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
@grok.decorators.func({
|
|
343
|
+
name: 'Polytool Helm Enumerator dialog'
|
|
344
|
+
})
|
|
345
|
+
static async getPtHelmEnumeratorDialog(
|
|
346
|
+
@grok.decorators.param({type:'object',options:{nullable:true}}) cell?: DG.Cell) {
|
|
347
|
+
|
|
348
|
+
return polyToolEnumerateHelmUI(cell);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
@grok.decorators.func({
|
|
353
|
+
name: 'Polytool Chem Enumerator dialog'
|
|
354
|
+
})
|
|
355
|
+
static async getPtChemEnumeratorDialog(
|
|
356
|
+
@grok.decorators.param({type:'object',options:{nullable:true}}) cell?: DG.Cell) {
|
|
357
|
+
|
|
358
|
+
return polyToolEnumerateChemUI(cell);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
@grok.decorators.func({
|
|
363
|
+
name: 'Combine Sequences',
|
|
364
|
+
'top-menu': 'Bio | PolyTool | Combine Sequences...'
|
|
365
|
+
})
|
|
366
|
+
static async getPolyToolCombineDialog() {
|
|
367
|
+
|
|
368
|
+
getPTCombineDialog();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
@grok.decorators.func({
|
|
374
|
+
name: 'applyNotationProviderForHarmonizedSequence'
|
|
375
|
+
})
|
|
376
|
+
static applyNotationProviderForCyclized(
|
|
377
|
+
@grok.decorators.param({type:'column'}) col: DG.Column<string>,
|
|
378
|
+
separator: string) {
|
|
379
|
+
|
|
380
|
+
col.setTag('aligned', 'SEQ');
|
|
381
|
+
col.setTag('alphabet', 'UN');
|
|
382
|
+
col.setTag('.alphabetIsMultichar', 'true');
|
|
383
|
+
col.meta.units = NOTATION.CUSTOM;
|
|
384
|
+
col.tags[PolyToolTags.dataRole] = 'template';
|
|
385
|
+
col.temp[SeqTemps.notationProvider] = new CyclizedNotationProvider(separator, _package.helmHelper);
|
|
386
|
+
}
|
|
170
387
|
}
|
|
171
388
|
|
|
389
|
+
//name: getSpecifiedAppView
|
|
172
390
|
async function getSpecifiedAppView(appName: string): Promise<DG.ViewBase> {
|
|
173
391
|
await _package.initLibData();
|
|
174
392
|
const appUI = getSpecifiedAppUI(appName, _package);
|
|
175
393
|
const view = await appUI.getAppView();
|
|
176
394
|
return view;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
//top-menu: Bio | PolyTool | Convert...
|
|
180
|
-
//name: polyToolConvert
|
|
181
|
-
//description: Perform cyclization of polymers
|
|
182
|
-
export async function polyToolConvertTopMenu(): Promise<void> {
|
|
183
|
-
await polyToolConvertUI();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// //top-menu: Bio | PolyTool | Unrule...
|
|
187
|
-
// //name: polyToolUnrule
|
|
188
|
-
// //description: Perform uncyclization of polymers by rules
|
|
189
|
-
// export async function polyToolUnruleTopMenu(): Promise<void> {
|
|
190
|
-
// await polyToolUnruleUI();
|
|
191
|
-
// }
|
|
192
|
-
|
|
193
|
-
//name: getPolyToolConvertEditor
|
|
194
|
-
//tags: editor
|
|
195
|
-
//input: funccall call
|
|
196
|
-
//output: column resCol
|
|
197
|
-
export async function getPolyToolConvertEditor(call: DG.FuncCall): Promise<DG.Column<string> | null> {
|
|
198
|
-
const funcEditor = await PolyToolConvertFuncEditor.create(call);
|
|
199
|
-
return await funcEditor.showDialog();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
//name: polyToolConvert2
|
|
203
|
-
//input: dataframe table
|
|
204
|
-
//input: column seqCol { caption: Sequence }
|
|
205
|
-
//input: bool generateHelm = true
|
|
206
|
-
//input: bool chiralityEngine = true
|
|
207
|
-
//input: object rules
|
|
208
|
-
//output: column resCol
|
|
209
|
-
//editor: SequenceTranslator:getPolyToolConvertEditor
|
|
210
|
-
export async function polyToolConvert2(table: DG.DataFrame,
|
|
211
|
-
seqCol: DG.Column, generateHelm: boolean, chiralityEngine: boolean, rules: string[]
|
|
212
|
-
): Promise<DG.Column<string>> {
|
|
213
|
-
const ptConvertRes = await polyToolConvert(seqCol, generateHelm, false, chiralityEngine, false, rules);
|
|
214
|
-
return ptConvertRes[0];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
//top-menu: Bio | PolyTool | Enumerate HELM...
|
|
219
|
-
//name: polyToolEnumerateHelm
|
|
220
|
-
//description: Perform cyclization of polymers
|
|
221
|
-
export async function polyToolEnumerateHelmTopMenu(): Promise<void> {
|
|
222
|
-
await polyToolEnumerateHelmUI(grok.shell.tv?.dataFrame.currentCell);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
//top-menu: Bio | PolyTool | Enumerate Chem...
|
|
226
|
-
//name: polyToolEnumerateChem
|
|
227
|
-
//description: Perform cyclization of polymers
|
|
228
|
-
export async function polyToolEnumerateChemTopMenu(): Promise<void> {
|
|
229
|
-
polyToolEnumerateChemUI();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
//name: polyToolColumnChoice
|
|
233
|
-
//input: dataframe df [Input data table]
|
|
234
|
-
//input: column macroMolecule
|
|
235
|
-
export async function polyToolColumnChoice(df: DG.DataFrame, macroMolecule: DG.Column): Promise<void> {
|
|
236
|
-
_setPeptideColumn(macroMolecule);
|
|
237
|
-
await grok.data.detectSemanticTypes(df);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
//name: createMonomerLibraryForPolyTool
|
|
241
|
-
//input: file file
|
|
242
|
-
export async function createMonomerLibraryForPolyTool(file: DG.FileInfo) {
|
|
243
|
-
const fileContent = await file.readAsString();
|
|
244
|
-
const libHandler = new PolyToolCsvLibHandler(file.fileName, fileContent);
|
|
245
|
-
const libObject = await libHandler.getJson();
|
|
246
|
-
const jsonFileName = file.fileName.replace(/\.csv$/, '.json');
|
|
247
|
-
const jsonFileContent = JSON.stringify(libObject, null, 2);
|
|
248
|
-
DG.Utils.download(jsonFileName, jsonFileContent);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// //name: PolyTool Converter
|
|
252
|
-
// //meta.icon: img/icons/structure.png
|
|
253
|
-
// //meta.browsePath: PolyTool
|
|
254
|
-
// //tags: app
|
|
255
|
-
// export async function ptConverterApp(): Promise<void> {
|
|
256
|
-
// const view = grok.shell.v as DG.TableView;
|
|
257
|
-
// const table = view.dataFrame;
|
|
258
|
-
// const colNames = table.columns.names();
|
|
259
|
-
// let covertableName = '';
|
|
260
|
-
|
|
261
|
-
// for (let i = 0; i < colNames.length; i++) {
|
|
262
|
-
// const col = table.columns.byName(colNames[i]);
|
|
263
|
-
// if (col.semType === DG.SEMTYPE.MACROMOLECULE && col.meta.units === NOTATION.SEPARATOR) {
|
|
264
|
-
// covertableName = colNames[i];
|
|
265
|
-
// break;
|
|
266
|
-
// }
|
|
267
|
-
// }
|
|
268
|
-
|
|
269
|
-
// if (covertableName === '')
|
|
270
|
-
// grok.shell.error('To run the app open a view with convertable separator notation for macromolecules');
|
|
271
|
-
// else {
|
|
272
|
-
// const dialog = await getPolyToolConversionDialog();
|
|
273
|
-
// dialog.show();
|
|
274
|
-
// }
|
|
275
|
-
// }
|
|
276
|
-
|
|
277
|
-
//name: HELM Enumerator
|
|
278
|
-
//meta.icon: img/icons/structure.png
|
|
279
|
-
//meta.browsePath: Peptides | PolyTool
|
|
280
|
-
//tags: app
|
|
281
|
-
export async function ptEnumeratorHelmApp(): Promise<void> {
|
|
282
|
-
await polyToolEnumerateHelmUI();
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
//name: Chem Enumerator
|
|
286
|
-
//meta.icon: img/icons/structure.png
|
|
287
|
-
//meta.browsePath: Peptides | PolyTool
|
|
288
|
-
//tags: app
|
|
289
|
-
export async function ptEnumeratorChemApp(): Promise<void> {
|
|
290
|
-
polyToolEnumerateChemUI();
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
//name: Polytool Helm Enumerator dialog
|
|
295
|
-
//input: object cell {nullable: true}
|
|
296
|
-
export async function getPtHelmEnumeratorDialog(cell?: DG.Cell) {
|
|
297
|
-
return polyToolEnumerateHelmUI(cell);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
//name: Polytool Chem Enumerator dialog
|
|
301
|
-
//input: object cell {nullable: true}
|
|
302
|
-
export async function getPtChemEnumeratorDialog(cell?: DG.Cell) {
|
|
303
|
-
return polyToolEnumerateChemUI(cell);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
//name: Combine Sequences
|
|
307
|
-
//top-menu: Bio | PolyTool | Combine Sequences...
|
|
308
|
-
export async function getPolyToolCombineDialog() {
|
|
309
|
-
getPTCombineDialog();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
//name: applyNotationProviderForHarmonizedSequence
|
|
314
|
-
//input: column col
|
|
315
|
-
//input: string separator
|
|
316
|
-
export function applyNotationProviderForCyclized(col: DG.Column<string>, separator: string) {
|
|
317
|
-
col.setTag('aligned', 'SEQ');
|
|
318
|
-
col.setTag('alphabet', 'UN');
|
|
319
|
-
col.setTag('.alphabetIsMultichar', 'true');
|
|
320
|
-
col.meta.units = NOTATION.CUSTOM;
|
|
321
|
-
col.tags[PolyToolTags.dataRole] = 'template';
|
|
322
|
-
col.temp[SeqTemps.notationProvider] = new CyclizedNotationProvider(separator, _package.helmHelper);
|
|
323
|
-
}
|
|
395
|
+
}
|