@datagrok/sequence-translator 0.0.1 → 0.0.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- class SequencetranslatorPackageDetectors extends DG.Package {
1
+ class SequenceTranslatorPackageDetectors extends DG.Package {
2
2
  //tags: semTypeDetector
3
3
  //input: column col
4
4
  //output: string semType
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@datagrok/sequence-translator",
3
3
  "friendlyName": "SequenceTranslator",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "description": "",
6
6
  "dependencies": {
7
7
  "@types/react": "latest",
8
- "datagrok-api": "../../js-api",
8
+ "datagrok-api": ">0.94.10",
9
9
  "datagrok-tools": "^4.1.2",
10
10
  "npm": "^7.11.2",
11
11
  "save-svg-as-png": "^1.4.17",
@@ -13,6 +13,7 @@
13
13
  "typescript": "latest"
14
14
  },
15
15
  "scripts": {
16
+ "link-api": "npm link datagrok-api",
16
17
  "debug-sequencetranslator": "grok publish --rebuild",
17
18
  "release-sequencetranslator": "grok publish --rebuild --release",
18
19
  "build-sequencetranslator": "webpack",
package/src/axolabsMap.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  const rnaColor = "rgb(255,230,153)";
2
- const invAbasicColor = "rgb(203,119,211)";
2
+ const invAbasicColor = "rgb(255,230,153)";
3
3
  export const axolabsMap: {[index: string]: {fullName: string, symbols: [string, string, string, string], color: string}} = {
4
4
  "RNA": {
5
5
  fullName: "RNA nucleotides",
package/src/map.ts ADDED
@@ -0,0 +1,355 @@
1
+ export const stadardPhosphateLinkSMILES = 'OP(=O)(O)O';
2
+ export const map: {[synthesizer: string]: {[technology: string]: {[code: string]: {"name": string, "weight": number, "normalized": string, "SMILES": string}}}} = {
3
+ "BioSpring Codes": {
4
+ "For ASO Gapmers": {
5
+ "5": {
6
+ "name": "2'MOE-5Me-rU",
7
+ "weight": 378.27,
8
+ "normalized": "rU",
9
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(=O)NC2(=O))[C@H](OCCOC)[C@@H]1O"
10
+ },
11
+ "6": {
12
+ "name": "2'MOE-rA",
13
+ "weight": 387.29,
14
+ "normalized": "rA",
15
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](OCCOC)[C@@H]1O"
16
+ },
17
+ "7": {
18
+ "name": "2'MOE-5Me-rC",
19
+ "weight": 377.29,
20
+ "normalized": "rC",
21
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))[C@H](OCCOC)[C@@H]1O"
22
+ },
23
+ "8": {
24
+ "name": "2'MOE-rG",
25
+ "weight": 403.28,
26
+ "normalized": "rG",
27
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](OCCOC)[C@@H]1O"
28
+ },
29
+ "9": {
30
+ "name": "5-Methyl-dC",
31
+ "weight": 303.21,
32
+ "normalized": "dC",
33
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))C[C@@H]1O"
34
+ },
35
+ "*": {
36
+ "name": "ps linkage",
37
+ "weight": 16.07,
38
+ "normalized": "",
39
+ "SMILES": "OP(=O)(O)S"
40
+ },
41
+ "A": {
42
+ "name": "Adenine",
43
+ "weight": 313.21,
44
+ "normalized": "dA",
45
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)C[C@@H]1O"
46
+ },
47
+ "C": {
48
+ "name": "Cytosine",
49
+ "weight": 289.18,
50
+ "normalized": "dC",
51
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))C[C@@H]1O"
52
+ },
53
+ "G": {
54
+ "name": "Guanine",
55
+ "weight": 329.21,
56
+ "normalized": "dG",
57
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C)[C@@H]1O"
58
+ },
59
+ "T": {
60
+ "name": "Tyrosine",
61
+ "weight": 304.2,
62
+ "normalized": "dT",
63
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(=O)NC2(=O))C[C@@H]1O"
64
+ }
65
+ },
66
+ "For 2'-OMe and 2'-F modified siRNA": {
67
+ "1": {
68
+ "name": "2'-fluoro-U",
69
+ "weight": 308.16,
70
+ "normalized": "rU",
71
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](F)[C@@H]1O"
72
+ },
73
+ "2": {
74
+ "name": "2'-fluoro-A",
75
+ "weight": 331.2,
76
+ "normalized": "rA",
77
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](F)[C@@H]1O"
78
+ },
79
+ "3": {
80
+ "name": "2'-fluoro-C",
81
+ "weight": 307.18,
82
+ "normalized": "rC",
83
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](F)[C@@H]1O"
84
+ },
85
+ "4": {
86
+ "name": "2'-fluoro-G",
87
+ "weight": 347.19,
88
+ "normalized": "rG",
89
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](F)[C@@H]1O"
90
+ },
91
+ "5": {
92
+ "name": "2'OMe-rU",
93
+ "weight": 320.2,
94
+ "normalized": "rU",
95
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](OC)[C@@H]1O"
96
+ },
97
+ "6": {
98
+ "name": "2'OMe-rA",
99
+ "weight": 343.24,
100
+ "normalized": "rA",
101
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](OC)[C@@H]1O"
102
+ },
103
+ "7": {
104
+ "name": "2'OMe-rC",
105
+ "weight": 319.21,
106
+ "normalized": "rC",
107
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](OC)[C@@H]1O"
108
+ },
109
+ "8": {
110
+ "name": "2'OMe-rG",
111
+ "weight": 359.24,
112
+ "normalized": "rG",
113
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](OC)[C@@H]1O"
114
+ },
115
+ "*": {
116
+ "name": "ps linkage",
117
+ "weight": 16.07,
118
+ "normalized": "",
119
+ "SMILES": "OP(=O)(O)S"
120
+ }
121
+ }
122
+ },
123
+ "Axolabs Codes": {
124
+ "For 2'-OMe and 2'-F modified siRNA": {
125
+ "Uf": {
126
+ "name": "2'-fluoro-U",
127
+ "weight": 308.16,
128
+ "normalized": "rU",
129
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](F)[C@@H]1O"
130
+ },
131
+ "Af": {
132
+ "name": "2'-fluoro-A",
133
+ "weight": 331.2,
134
+ "normalized": "rA",
135
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](F)[C@@H]1O"
136
+ },
137
+ "Cf": {
138
+ "name": "2'-fluoro-C",
139
+ "weight": 307.18,
140
+ "normalized": "rC",
141
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](F)[C@@H]1O"
142
+ },
143
+ "Gf": {
144
+ "name": "2'-fluoro-G",
145
+ "weight": 347.19,
146
+ "normalized": "rG",
147
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](F)[C@@H]1O"
148
+ },
149
+ "u": {
150
+ "name": "2'OMe-rU",
151
+ "weight": 320.2,
152
+ "normalized": "rU",
153
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](OC)[C@@H]1O"
154
+ },
155
+ "a": {
156
+ "name": "2'OMe-rA",
157
+ "weight": 343.24,
158
+ "normalized": "rA",
159
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](OC)[C@@H]1O"
160
+ },
161
+ "c": {
162
+ "name": "2'OMe-rC",
163
+ "weight": 319.21,
164
+ "normalized": "rC",
165
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](OC)[C@@H]1O"
166
+ },
167
+ "g": {
168
+ "name": "2'OMe-rG",
169
+ "weight": 359.,
170
+ "normalized": "rG",
171
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](OC)[C@@H]1O"
172
+ },
173
+ "s": {
174
+ "name": "ps linkage",
175
+ "weight": 16.07,
176
+ "normalized": "",
177
+ "SMILES": "OP(=O)(O)S"
178
+ }
179
+ }
180
+ },
181
+ "Janssen GCRS Codes": {
182
+ "For ASO Gapmers": {
183
+ "moeT": {
184
+ "name": "2'MOE-5Me-rU",
185
+ "weight": 378.27,
186
+ "normalized": "rU",
187
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(=O)NC2(=O))[C@H](OCCOC)[C@@H]1O"
188
+ },
189
+ "moeA": {
190
+ "name": "2'MOE-rA",
191
+ "weight": 387.29,
192
+ "normalized": "rA",
193
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](OCCOC)[C@@H]1O"
194
+ },
195
+ "moe5mC": {
196
+ "name": "2'MOE-5Me-rC",
197
+ "weight": 377.29,
198
+ "normalized": "rC",
199
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))[C@H](OCCOC)[C@@H]1O"
200
+ },
201
+ "(5m)moeC": {
202
+ "name": "2'MOE-5Me-rC",
203
+ "weight": 377.29,
204
+ "normalized": "rC",
205
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))[C@H](OCCOC)[C@@H]1O"
206
+ },
207
+ "moeG": {
208
+ "name": "2'MOE-rG",
209
+ "weight": 403.28,
210
+ "normalized": "rG",
211
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](OCCOC)[C@@H]1O"
212
+ },
213
+ "5mC": {
214
+ "name": "5-Methyl-dC",
215
+ "weight": 303.28,
216
+ "normalized": "dC",
217
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))C[C@@H]1O"
218
+ },
219
+ "(5m)C": {
220
+ "name": "5-Methyl-dC",
221
+ "weight": 303.28,
222
+ "normalized": "dC",
223
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(N)=NC2(=O))C[C@@H]1O"
224
+ },
225
+ "ps": {
226
+ "name": "ps linkage",
227
+ "weight": 16.07,
228
+ "normalized": "",
229
+ "SMILES": "OP(=O)(O)S"
230
+ },
231
+ "A": {
232
+ "name": "Adenine",
233
+ "weight": 313.21,
234
+ "normalized": "dA",
235
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)C[C@@H]1O"
236
+ },
237
+ "dA": {
238
+ "name": "Adenine",
239
+ "weight": 313.21,
240
+ "normalized": "dA",
241
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)C[C@@H]1O"
242
+ },
243
+ "C": {
244
+ "name": "Cytosine",
245
+ "weight": 289.18,
246
+ "normalized": "dC",
247
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))C[C@@H]1O"
248
+ },
249
+ "dC": {
250
+ "name": "Cytosine",
251
+ "weight": 289.18,
252
+ "normalized": "dC",
253
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))C[C@@H]1O"
254
+ },
255
+ "G": {
256
+ "name": "Guanine",
257
+ "weight": 329.21,
258
+ "normalized": "dG",
259
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C)[C@@H]1O"
260
+ },
261
+ "dG": {
262
+ "name": "Guanine",
263
+ "weight": 329.21,
264
+ "normalized": "dG",
265
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C)[C@@H]1O"
266
+ },
267
+ "T": {
268
+ "name": "Tyrosine",
269
+ "weight": 304.2,
270
+ "normalized": "dT",
271
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(=O)NC2(=O))C[C@@H]1O"
272
+ },
273
+ "dT": {
274
+ "name": "Tyrosine",
275
+ "weight": 304.2,
276
+ "normalized": "dT",
277
+ "SMILES": "OC[C@H]1O[C@@H](N2C=C(C)C(=O)NC2(=O))C[C@@H]1O"
278
+ },
279
+ "rA": {
280
+ "name": "Adenine",
281
+ "weight": 329.21,
282
+ "normalized": "rA",
283
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](O)[C@@H]1O"
284
+ },
285
+ "rC": {
286
+ "name": "Cytosine",
287
+ "weight": 305.18,
288
+ "normalized": "rC",
289
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](O)[C@@H]1O"
290
+ },
291
+ "rG": {
292
+ "name": "Guanine",
293
+ "weight": 345.21,
294
+ "normalized": "rG",
295
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](O)[C@@H]1O"
296
+ },
297
+ "rU": {
298
+ "name": "Uracil",
299
+ "weight": 306.17,
300
+ "normalized": "rU",
301
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](O)[C@@H]1O"
302
+ }
303
+ },
304
+ "For 2'-OMe and 2'-F modified siRNA": {
305
+ "fU": {
306
+ "name": "2'-fluoro-U",
307
+ "weight": 308.16,
308
+ "normalized": "rU",
309
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](F)[C@@H]1O"
310
+ },
311
+ "fA": {
312
+ "name": "2'-fluoro-A",
313
+ "weight": 331.2,
314
+ "normalized": "rA",
315
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](F)[C@@H]1O"
316
+ },
317
+ "fC": {
318
+ "name": "2'-fluoro-C",
319
+ "weight": 307.18,
320
+ "normalized": "rC",
321
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](F)[C@@H]1O"
322
+ },
323
+ "fG": {
324
+ "name": "2'-fluoro-G",
325
+ "weight": 347.19,
326
+ "normalized": "rG",
327
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](F)[C@@H]1O"
328
+ },
329
+ "mU": {
330
+ "name": "2'OMe-rU",
331
+ "weight": 320.2,
332
+ "normalized": "rU",
333
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(=O)NC2(=O))[C@H](OC)[C@@H]1O"
334
+ },
335
+ "mA": {
336
+ "name": "2'OMe-rA",
337
+ "weight": 343.24,
338
+ "normalized": "rA",
339
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=CN=C(N)C=3N=C2)[C@H](OC)[C@@H]1O"
340
+ },
341
+ "mC": {
342
+ "name": "2'OMe-rC",
343
+ "weight": 319.21,
344
+ "normalized": "rC",
345
+ "SMILES": "OC[C@H]1O[C@@H](N2C=CC(N)=NC2(=O))[C@H](OC)[C@@H]1O"
346
+ },
347
+ "mG": {
348
+ "name": "2'OMe-rG",
349
+ "weight": 359.24,
350
+ "normalized": "rG",
351
+ "SMILES": "OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)[C@H](OC)[C@@H]1O"
352
+ }
353
+ }
354
+ }
355
+ };
package/src/package.ts CHANGED
@@ -2,187 +2,192 @@
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
+ import * as OCL from 'openchemlib/full.js';
5
6
  import $ from "cash-dom";
6
-
7
7
  import {defineAxolabsPattern} from "./defineAxolabsPattern";
8
+ import {map, stadardPhosphateLinkSMILES} from "./map";
8
9
 
9
10
  export let _package = new DG.Package();
10
11
 
11
- const undefinedInputSequence: string = "Type of input sequence is undefined";
12
- const smallNumberOfCharacters: string = "Length of input sequence should be at least 10 characters";
13
- const defaultNucleotidesInput: string = "AGGTCCTCTTGACTTAGGCC";
14
- const noTranslationTableAvailable: string = "No translation table available";
15
- const sequenceWasCopied: string = 'Copied!';
16
- const tooltipSequence: string = 'Copy sequence';
12
+ const defaultInput = "AGGTCCTCTTGACTTAGGCC";
13
+ const minimalValidNumberOfCharacters = 6;
14
+ const smallNumberOfCharacters = "Length of input sequence should be at least " + minimalValidNumberOfCharacters + " characters";
15
+ const undefinedInputSequence = "Type of input sequence is undefined";
16
+ const noTranslationTableAvailable = "No translation table available";
17
+ const sequenceWasCopied = 'Copied';
18
+ const tooltipSequence = 'Copy sequence';
19
+
20
+ function sortByStringLengthInDescendingOrderToCheckForMatchWithLongerCodesFirst(array: string[]): string[] {
21
+ return array.sort(function(a, b) { return b.length - a.length; });
22
+ }
23
+
24
+ function getObjectWithCodesAndSmiles() {
25
+ let obj: {[code: string]: string} = {};
26
+ for (let synthesizer of Object.keys(map))
27
+ for (let technology of Object.keys(map[synthesizer]))
28
+ for (let code of Object.keys(map[synthesizer][technology]))
29
+ obj[code] = map[synthesizer][technology][code].SMILES;
30
+ return obj;
31
+ }
32
+
33
+ function modifiedToSmiles(sequence: string) {
34
+ const obj = getObjectWithCodesAndSmiles();
35
+ const codes = sortByStringLengthInDescendingOrderToCheckForMatchWithLongerCodesFirst(Object.keys(obj));
36
+ let i = 0, smiles = '', codesList = [];
37
+ const links = ['s', 'ps', '*'];
38
+ while (i < sequence.length) {
39
+ let code = codes.find((s) => s == sequence.slice(i, i + s.length))!;
40
+ i += code.length;
41
+ codesList.push(code);
42
+ }
43
+ for (let i = 0; i < codesList.length; i++)
44
+ smiles += (links.includes(codesList[i]) || (i < codesList.length - 1 && links.includes(codesList[i+1]))) ?
45
+ obj[codesList[i]] :
46
+ obj[codesList[i]] + stadardPhosphateLinkSMILES;
47
+ smiles = smiles.replace(/OO/g, 'O').replace(/SO/g, 'S');
48
+ return codesList[codesList.length - 1] == 'ps' ? smiles : smiles.slice(0, smiles.length - stadardPhosphateLinkSMILES.length + 1);
49
+ }
17
50
 
18
51
  //name: Sequence Translator
19
52
  //tags: app
20
- export function sequenceTranslator(): void {
53
+ export function sequenceTranslator() {
21
54
 
22
55
  let windows = grok.shell.windows;
23
56
  windows.showProperties = false;
24
57
  windows.showToolbox = false;
25
58
  windows.showHelp = false;
26
59
 
27
- let appMainDescription = ui.info(
28
- [
29
- ui.divText('\n How to convert one sequence:',{style:{'font-weight':'bolder'}}),
30
- ui.divText("Paste sequence into the text field below"),
31
- ui.divText('\n How to convert many sequences:',{style:{'font-weight':'bolder'}}),
32
- ui.divText("1. Drag & drop an Excel or CSV file with sequences into Datagrok. The platform will automatically detect columns with sequences"),
33
- ui.divText('2. Right-click on the column header, then see the \'Convert\' menu'),
34
- ui.divText("This will add the result column to the right of the table"),
35
- ], 'Convert oligonucleotide sequences between Nucleotides, BioSpring, Axolabs, and GCRS representations.'
36
- );
37
-
38
- let inputSequenceField = ui.textInput("", defaultNucleotidesInput, async (seq: string) => {
39
- moleculeSvg.innerHTML = "";
40
- let outputSequencesObj = convertSequence(seq);
41
-
60
+ function updateTableAndSVG(sequence: string) {
61
+ moleculeSvgDiv.innerHTML = "";
62
+ outputTableDiv.innerHTML = "";
63
+ let outputSequenceObj = convertSequence(sequence);
42
64
  let tableRows = [];
43
- for (let key of Object.keys(outputSequencesObj).slice(1)) {
44
- // @ts-ignore
45
- tableRows.push({'key': key, 'value': ui.link(outputSequencesObj[key], () => navigator.clipboard.writeText(outputSequencesObj[key]).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')})
65
+ for (let key of Object.keys(outputSequenceObj).slice(1)) {
66
+ //@ts-ignore
67
+ tableRows.push({'key': key, 'value': ui.link(outputSequenceObj[key], () => navigator.clipboard.writeText(outputSequenceObj[key]).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')})
46
68
  }
47
-
48
- outputTableDiv.innerHTML = "";
49
-
50
69
  outputTableDiv.append(
51
70
  ui.div([
52
71
  DG.HtmlTable.create(
53
- tableRows,
54
- (item: {key: string; value: string;}) => [item.key, item.value],
55
- ['Code', 'Sequence']
72
+ tableRows, (item: { key: string; value: string; }) => [item.key, item.value], ['Code', 'Sequence']
56
73
  ).root
57
74
  ], 'table')
58
75
  );
59
- grok.shell.v
60
- semTypeOfInputSequence.textContent = 'Detected input type: ' + outputSequencesObj.type;
61
-
62
- if (!(outputSequencesObj.type == undefinedInputSequence || outputSequencesObj.type == smallNumberOfCharacters)) {
76
+ semTypeOfInputSequence.textContent = 'Detected input type: ' + outputSequenceObj.type;
77
+ if (!(outputSequenceObj.type == undefinedInputSequence || outputSequenceObj.type == smallNumberOfCharacters)) {
63
78
  let pi = DG.TaskBarProgressIndicator.create('Rendering molecule...');
64
79
  try {
65
- let flavor: string = (outputSequencesObj.Nucleotides.includes('U')) ? "RNA_both_caps" : "DNA_both_caps";
66
- let mol = grok.chem.svgMol(<string> await nucleotidesToSmiles(outputSequencesObj.Nucleotides, flavor), 900, 300);
67
- moleculeSvg.append(mol);
80
+ let flavor: string = (outputSequenceObj.Nucleotides.includes('U')) ? "RNA_both_caps" : "DNA_both_caps";
81
+ (async () => {
82
+ let smiles = (/^[ATGCU]{6,}$/.test(inputSequenceField.value.replace(/\s/g, ''))) ?
83
+ await nucleotidesToSmiles(outputSequenceObj.Nucleotides, flavor) :
84
+ modifiedToSmiles(inputSequenceField.value.replace(/\s/g, ''));
85
+ smiles = smiles.replace(/@/g, ''); // Remove StereoChemistry on the Nucleic acid chain and remove the Chiral label
86
+ moleculeSvgDiv.append(grok.chem.svgMol(smiles, 900, 300));
87
+ })();
68
88
  } finally {
69
89
  pi.close();
70
90
  }
71
91
  }
72
- });
73
- let semTypeOfInputSequence = ui.divText('Detected input type: DNA Nucleotides Code');
74
-
75
- let outputTableDiv = ui.div([
76
- DG.HtmlTable.create([
77
- {key: 'Nucleotides', value: ui.link(defaultNucleotidesInput, () => navigator.clipboard.writeText(defaultNucleotidesInput).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')},
78
- {key: 'BioSpring', value: ui.link(asoGapmersNucleotidesToBioSpring(defaultNucleotidesInput), () => navigator.clipboard.writeText(asoGapmersNucleotidesToBioSpring(defaultNucleotidesInput)).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')},
79
- {key: 'Axolabs', value: ui.link(noTranslationTableAvailable, () => navigator.clipboard.writeText(defaultNucleotidesInput).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')},
80
- {key: 'GCRS', value: ui.link(asoGapmersNucleotidesToGcrs(defaultNucleotidesInput), () => navigator.clipboard.writeText(asoGapmersNucleotidesToGcrs(defaultNucleotidesInput)).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')}
81
- ], (item: {key: string; value: string;}) => [item.key, item.value], ['Code', 'Sequence']).root
82
- ], 'table');
83
-
84
- let accordionWithCmoCodes = ui.accordion();
85
- accordionWithCmoCodes.addPane('CMO Codes', () =>
86
- ui.divH([
87
- DG.HtmlTable.create(
88
- [
89
- {name: "2'MOE-5Me-rU", bioSpring: '5', gcrs: 'moeT'},
90
- {name: "2'MOE-rA", bioSpring: '6', gcrs: 'moeA'},
91
- {name: "2'MOE-5Me-rC", bioSpring: '7', gcrs: 'moe5mC'},
92
- {name: "2'MOE-rG", bioSpring: '8', gcrs: 'moeG'},
93
- {name: "5-Methyl-dC", bioSpring: '9', gcrs: '5mC'},
94
- {name: "ps linkage", bioSpring: '*', gcrs: 'ps'},
95
- {name: "dA", bioSpring: 'A', gcrs: 'A'},
96
- {name: "dC", bioSpring: 'C', gcrs: 'C'},
97
- {name: "dT", bioSpring: 'T', gcrs: 'T'},
98
- {name: "dG", bioSpring: 'G', gcrs: 'G'}
99
- ],
100
- (item: {name: string; bioSpring: string; gcrs: string}) => [item.name, item.bioSpring, item.gcrs],
101
- ['For ASO Gapmers', 'BioSpring', 'GCRS']
102
- ).root,
103
- ui.div([], {style: {width: '50px'}}),
104
- DG.HtmlTable.create(
105
- [
106
- {name: "2'-fluoro-U", axolabs: '1', bioSpring: 'Uf', gcrs: 'fU'},
107
- {name: "2'-fluoro-A", axolabs: '2', bioSpring: 'Af', gcrs: 'fA'},
108
- {name: "2'-fluoro-C", axolabs: '3', bioSpring: 'Cf', gcrs: 'fC'},
109
- {name: "2'-fluoro-G", axolabs: '4', bioSpring: 'Gf', gcrs: 'fG'},
110
- {name: "OMe-rU", axolabs: '5', bioSpring: 'u', gcrs: 'mU'},
111
- {name: "OMe-rA", axolabs: '6', bioSpring: 'a', gcrs: 'mA'},
112
- {name: "OMe-rC", axolabs: '7', bioSpring: 'c', gcrs: 'mC'},
113
- {name: "OMe-rG", axolabs: '8', bioSpring: 'g', gcrs: 'mG'},
114
- {name: "ps linkage", axolabs: '*', bioSpring: 's', gcrs: 'ps'}
115
- ],
116
- (item: {name: string; axolabs: string, bioSpring: string; gcrs: string}) => [item.name, item.bioSpring, item.axolabs, item.gcrs],
117
- ["For 2\'-OMe and 2\'-F modified siRNA", 'BioSpring', 'Axolabs', 'GCRS']
118
- ).root
119
- ]), false
92
+ }
93
+
94
+ const appMainDescription = ui.info([
95
+ ui.divText('\n How to convert one sequence:',{style:{'font-weight':'bolder'}}),
96
+ ui.divText("Paste sequence into the text field below"),
97
+ ui.divText('\n How to convert many sequences:',{style:{'font-weight':'bolder'}}),
98
+ ui.divText("1. Drag & drop an Excel or CSV file with sequences into Datagrok. The platform will automatically detect columns with sequences"),
99
+ ui.divText('2. Right-click on the column header, then see the \'Convert\' menu'),
100
+ ui.divText("This will add the result column to the right of the table"),
101
+ ], 'Convert oligonucleotide sequences between Nucleotides, BioSpring, Axolabs, and GCRS representations.'
120
102
  );
121
103
 
122
- let moleculeSvg = ui.block([
123
- grok.chem.svgMol('Cc1cn([C@H]2C[C@H](OP(=O)(O)OC[C@H]3O[C@@H](n4ccc(N)nc4=O)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n' +
124
- '4cc(C)c(=O)[nH]c4=O)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cc(C)c(=O)[nH]c4=O)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cnc5' +
125
- 'c(=O)[nH]c(N)nc54)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cnc5c(N)ncnc54)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4ccc(N)nc4=O)' +
126
- 'C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cc(C)c(=O)[nH]c4=O)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cc(C)c(=O)[nH]c4=O)C[C@@H]3OP(=O)(O)' +
127
- 'OC[C@H]3O[C@@H](n4cnc5c(N)ncnc54)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4cnc5c(=O)[nH]c(N)nc54)C[C@@H]3OP(=O)(O)OC[C@H]' +
128
- '3O[C@@H](n4cnc5c(=O)[nH]c(N)nc54)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H](n4ccc(N)nc4=O)C[C@@H]3OP(=O)(O)OC[C@H]3O[C@@H]' +
129
- '(n4ccc(N)nc4=O)C[C@@H]3OP(=O)(O)O)[C@@H](COP(=O)(O)O[C@H]3C[C@H](n4ccc(N)nc4=O)O[C@@H]3COP(=O)(O)O[C@H]3C[C@H]' +
130
- '(n4ccc(N)nc4=O)O[C@@H]3COP(=O)(O)O[C@H]3C[C@H](n4cc(C)c(=O)[nH]c4=O)O[C@@H]3COP(=O)(O)O[C@H]3C[C@H](n4cnc5c(=O)' +
131
- '[nH]c(N)nc54)O[C@@H]3COP(=O)(O)O[C@H]3C[C@H](n4cnc5c(=O)[nH]c(N)nc54)O[C@@H]3COP(=O)(O)O[C@H]3C[C@H](n4cnc5c(N)' +
132
- 'ncnc54)O[C@@H]3COP(=O)(O)O)O2)c(=O)[nH]c1=O', 900, 300
133
- )
134
- ]);
104
+ let inputSequenceField = ui.textInput("", defaultInput, (sequence: string) => updateTableAndSVG(sequence));
105
+ let outputSequenceObj = convertSequence(defaultInput);
106
+ let semTypeOfInputSequence = ui.divText('Detected input type: ' + outputSequenceObj.type);
107
+
108
+ let tableRows = [];
109
+ for (let key of Object.keys(outputSequenceObj).slice(1)) {
110
+ //@ts-ignore
111
+ tableRows.push({'key': key, 'value': ui.link(outputSequenceObj[key], () => navigator.clipboard.writeText(outputSequenceObj[key]).then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, '')})
112
+ }
113
+ let outputTableDiv = ui.div([], 'table');
114
+ outputTableDiv.append(
115
+ DG.HtmlTable.create(tableRows, (item: {key: string; value: string;}) => [item.key, item.value], ['Code', 'Sequence']).root
116
+ );
135
117
 
136
- let tab = ui.tabControl({
137
- 'MAIN': ui.div([
138
- appMainDescription,
139
- ui.panel([
140
- ui.div([
141
- ui.h1('Input sequence'),
142
- ui.div([
143
- inputSequenceField.root
144
- ],'input-base')
145
- ], 'sequenceInput'),
146
- semTypeOfInputSequence,
147
- ui.block([
148
- ui.h1('Output'),
149
- ui.h1('Output'),
150
- outputTableDiv
151
- ]),
152
- accordionWithCmoCodes.root,
153
- moleculeSvg,
154
- ui.button('SAVE SD FILE', async() => {
155
- let outputSequenceObj = convertSequence(inputSequenceField.value);
156
- let flavor: string = outputSequenceObj.Nucleotides.includes('U') ? "RNA_both_caps" : "DNA_both_caps";
157
- let smiles = await nucleotidesToSmiles(outputSequenceObj.Nucleotides, flavor);
158
- smiles = smiles.replace(/@/g, ''); // Remove StereoChemistry on the Nucleic acid chain and remove the Chiral label
159
- //@ts-ignore
160
- let mol = new OCL.Molecule.fromSmiles(smiles);
161
- let result = `${mol.toMolfile()}\n` + '$$$$';
162
- var element = document.createElement('a');
163
- element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result));
164
- element.setAttribute('download', outputSequenceObj.Nucleotides + '.sdf');
165
- element.click();
166
- })
167
- ], 'sequence')!
168
- ]),
169
- 'AXOLABS': _defineAxolabsPattern()
170
- }).root;
171
- tab.style.height = '100%';
172
- tab.style.width = '100%';
118
+ let tables = ui.divV([]);
119
+ for (let synthesizer of Object.keys(map)) {
120
+ for (let technology of Object.keys(map[synthesizer])) {
121
+ let tableRows = [];
122
+ for (let [key, value] of Object.entries(map[synthesizer][technology]))
123
+ tableRows.push({'name': value.name, 'code': key});
124
+ tables.append(
125
+ DG.HtmlTable.create(
126
+ tableRows,
127
+ (item: {name: string; code: string;}) => [item['name'], item['code']],
128
+ [synthesizer + ' ' + technology, 'Code']
129
+ ).root,
130
+ ui.div([], {style: {height: '30px'}})
131
+ );
132
+ }
133
+ }
134
+
135
+ let showCodesButton = ui.button('SHOW CODES', () => ui.dialog('Codes').add(tables).show());
136
+
137
+ let moleculeSvgDiv = ui.block([]);
138
+
139
+ let flavor: string = (defaultInput.includes('U')) ? "RNA_both_caps" : "DNA_both_caps";
140
+ (async () => moleculeSvgDiv.append(grok.chem.svgMol(<string> await nucleotidesToSmiles(defaultInput, flavor), 900, 300)))();
141
+
142
+ let saveMolFileButton = ui.bigButton('SAVE MOL FILE', async() => {
143
+ let outputSequenceObj = convertSequence(inputSequenceField.value);
144
+ flavor = outputSequenceObj.Nucleotides.includes('U') ? "RNA_both_caps" : "DNA_both_caps";
145
+ let smiles = (/^[ATGCU]{6,}$/.test(inputSequenceField.value.replace(/\s/g, ''))) ?
146
+ await nucleotidesToSmiles(outputSequenceObj.Nucleotides, flavor) :
147
+ modifiedToSmiles(inputSequenceField.value.replace(/\s/g, ''));
148
+ smiles = smiles.replace(/@/g, ''); // Remove StereoChemistry on the Nucleic acid chain and remove the Chiral label
149
+ let mol = OCL.Molecule.fromSmiles(smiles);
150
+ let result = `${mol.toMolfile()}\n`;// + '$$$$';
151
+ var element = document.createElement('a');
152
+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result));
153
+ element.setAttribute('download', inputSequenceField.value.replace(/\s/g, '') + '.mol');
154
+ element.click();
155
+ });
173
156
 
174
157
  let v = grok.shell.newView('Sequence Translator', [
175
- tab
158
+ ui.tabControl({
159
+ 'MAIN': ui.div([
160
+ appMainDescription,
161
+ ui.panel([
162
+ ui.div([
163
+ ui.h1('Input sequence'),
164
+ ui.div([
165
+ inputSequenceField.root
166
+ ],'input-base')
167
+ ], 'sequenceInput'),
168
+ semTypeOfInputSequence,
169
+ ui.block([
170
+ ui.h1('Output'),
171
+ outputTableDiv
172
+ ]),
173
+ moleculeSvgDiv,
174
+ ui.divH([saveMolFileButton, showCodesButton])
175
+ ], 'sequence')
176
+ ]),
177
+ 'AXOLABS': defineAxolabsPattern()
178
+ })
176
179
  ]);
177
180
  v.box = true;
178
181
 
179
182
  $('.sequence')
180
183
  .children().css('padding','5px 0');
181
- $('.sequenceInput .input-base').css('margin','0');
184
+ $('.sequenceInput .input-base')
185
+ .css('margin','0');
182
186
  $('.sequenceInput textarea')
183
187
  .css('resize','none')
184
188
  .css('min-height','50px')
185
- .css('width','100%');
189
+ .css('width','100%')
190
+ .attr("spellcheck", "false");
186
191
  $('.sequenceInput select')
187
192
  .css('width','100%');
188
193
  }
@@ -194,31 +199,19 @@ export async function nucleotidesToSmiles(nucleotides: string, flavor: string) {
194
199
  });
195
200
  }
196
201
 
197
- export function isDnaNucleotidesCode(sequence: string): boolean {return /^[ATGC]{10,}$/.test(sequence);}
198
-
199
- export function isRnaNucleotidesCode(sequence: string): boolean {return /^[AUGC]{10,}$/.test(sequence);}
200
-
201
- export function isAbiCode(sequence: string): boolean {return /^[5678ATGC]{10,}$/.test(sequence);}
202
-
203
- export function isAsoGapmerBioSpringCode(sequence: string): boolean {return /^[*56789ATGC]{30,}$/.test(sequence);}
204
-
205
- export function isAsoGapmerGcrsCode(sequence: string): boolean {return /^(?=.*moe)(?=.*5mC)(?=.*ps){30,}/.test(sequence);}
206
-
207
- export function isSiRnaBioSpringCode(sequence: string): boolean {return /^[*1-8]{30,}$/.test(sequence);}
208
-
209
- export function isSiRnaAxolabsCode(sequence: string): boolean {return /^[fsACGUacgu]{20,}$/.test(sequence);}
210
-
211
- export function isSiRnaGcrsCode(sequence: string): boolean {return (sequence.slice(0, 3) == 'moe' && /^[fmpsACGU]{30,}$/.test(sequence));}
212
-
213
- export function isGcrsCode(sequence: string): boolean {return /^[fmpsACGU]{30,}$/.test(sequence);}
214
-
215
- export function isOP100Code(sequence: string): boolean {return /^[acgu*]{10,}$/.test(sequence);}
216
-
217
- export function isMM12Code(sequence: string): boolean {return /^[IiJjKkLlEeFfGgHhQq]{10,}$/.test(sequence);}
202
+ export function isDnaNucleotidesCode(sequence: string) {return /^[ATGC]{6,}$/.test(sequence);}
203
+ export function isRnaNucleotidesCode(sequence: string) {return /^[AUGC]{6,}$/.test(sequence);}
204
+ export function isAsoGapmerBioSpringCode(sequence: string) {return /^[*56789ATGC]{6,}$/.test(sequence);}
205
+ export function isAsoGapmerGcrsCode(sequence: string) {return /^(?=.*moe)(?=.*5mC)(?=.*ps){6,}/.test(sequence);}
206
+ export function isSiRnaBioSpringCode(sequence: string) {return /^[*1-8]{6,}$/.test(sequence);}
207
+ export function isSiRnaAxolabsCode(sequence: string) {return /^[fsACGUacgu]{6,}$/.test(sequence);}
208
+ export function isSiRnaGcrsCode(sequence: string) {return /^[fmpsACGU]{6,}$/.test(sequence);}
209
+ export function isGcrsCode(sequence: string) {return /^[fmpsACGU]{6,}$/.test(sequence);}
210
+ export function isMM12Code(sequence: string) {return /^[IiJjKkLlEeFfGgHhQq]{6,}$/.test(sequence);}
218
211
 
219
212
  function convertSequence(seq: string) {
220
213
  seq = seq.replace(/\s/g, '');
221
- if (seq.length < 10)
214
+ if (seq.length < minimalValidNumberOfCharacters)
222
215
  return {
223
216
  type: smallNumberOfCharacters,
224
217
  Nucleotides: smallNumberOfCharacters,
@@ -234,15 +227,6 @@ function convertSequence(seq: string) {
234
227
  Axolabs: noTranslationTableAvailable,
235
228
  GCRS: asoGapmersNucleotidesToGcrs(seq)
236
229
  };
237
- if (isAbiCode(seq))
238
- return {
239
- type: "ABI Code",
240
- Nucleotides: noTranslationTableAvailable,
241
- GCRS: noTranslationTableAvailable,
242
- MM12: noTranslationTableAvailable,
243
- OP100: noTranslationTableAvailable,
244
- ABI: seq
245
- };
246
230
  if (isAsoGapmerBioSpringCode(seq))
247
231
  return {
248
232
  type: "ASO Gapmers / BioSpring Code",
@@ -257,6 +241,7 @@ function convertSequence(seq: string) {
257
241
  Nucleotides: asoGapmersGcrsToNucleotides(seq),
258
242
  BioSpring: asoGapmersGcrsToBioSpring(seq),
259
243
  Axolabs: noTranslationTableAvailable,
244
+ MM12: gcrsToMM12(seq),
260
245
  GCRS: seq
261
246
  };
262
247
  if (isRnaNucleotidesCode(seq))
@@ -289,6 +274,7 @@ function convertSequence(seq: string) {
289
274
  Nucleotides: siRnaGcrsToNucleotides(seq),
290
275
  BioSpring: siRnaGcrsToBioSpring(seq),
291
276
  Axolabs: siRnaGcrsToAxolabs(seq),
277
+ MM12: gcrsToMM12(seq),
292
278
  GCRS: seq
293
279
  };
294
280
  if (isGcrsCode(seq))
@@ -296,27 +282,14 @@ function convertSequence(seq: string) {
296
282
  type: "GCRS Code",
297
283
  Nucleotides: gcrsToNucleotides(seq),
298
284
  GCRS: seq,
299
- MM12: gcrsToMM12(seq),
300
- OP100: gcrsToOP100(seq),
301
- ABI: gcrsToABI(seq)
285
+ MM12: gcrsToMM12(seq)
302
286
  }
303
287
  if (isMM12Code(seq))
304
288
  return {
305
289
  type: "MM12 Code",
306
290
  Nucleotides: noTranslationTableAvailable,
307
291
  GCRS: noTranslationTableAvailable,
308
- MM12: seq,
309
- OP100: noTranslationTableAvailable,
310
- ABI: noTranslationTableAvailable
311
- };
312
- if (isOP100Code(seq))
313
- return {
314
- type: "OP100 Code",
315
- Nucleotides: noTranslationTableAvailable,
316
- GCRS: noTranslationTableAvailable,
317
- MM12: noTranslationTableAvailable,
318
- OP100: seq,
319
- ABI: noTranslationTableAvailable
292
+ MM12: seq
320
293
  };
321
294
  return {
322
295
  type: undefinedInputSequence,
@@ -452,9 +425,9 @@ export function siRnaAxolabsToNucleotides(nucleotides: string) {
452
425
  //output: string result {semType: RNA nucleotides}
453
426
  export function siRnaGcrsToNucleotides(nucleotides: string) {
454
427
  const obj: {[index: string]: string} = {
455
- "fU": "U", "fA": "A", "fC": "C", "fG": "G", "mU": "U", "mA": "A", "mC": "C", "mG": "G", "ps": "", "s": ""
428
+ "fU": "U", "fA": "A", "fC": "C", "fG": "G", "mU": "U", "mA": "A", "mC": "C", "mG": "G", "ps": ""
456
429
  };
457
- return nucleotides.replace(/(fU|fA|fC|fG|mU|mA|mC|mG|ps|s)/g, function (x: string) {return obj[x];});
430
+ return nucleotides.replace(/(fU|fA|fC|fG|mU|mA|mC|mG|ps)/g, function (x: string) {return obj[x];});
458
431
  }
459
432
 
460
433
  //name: siRnaGcrsToBioSpring
@@ -568,9 +541,6 @@ export function gcrsToOP100(nucleotides: string) {
568
541
  const objForOddIndicesAtLeftEdge: {[index: string]: string} = {
569
542
  "mAps": "a*", "mUps": "u*", "mGps": "g*", "mCps": "c*", "fAps": "a*", "fUps": "u*", "fGps": "g*", "fCps": "c*"
570
543
  };
571
- // const objForEvenIndicesAtRightEdge: {[index: string]: string} = {
572
- // "fU": "u*", "fA": "a*", "fC": "c*", "fG": "g*", "mU": "u*", "mA": "a*", "mC": "c*", "mG": "g*"
573
- // };
574
544
  const objForOddIndicesAtRightEdge: {[index: string]: string} = {
575
545
  "mAps": "a", "mUps": "u", "mGps": "g", "mCps": "c", "fAps": "a", "fUps": "u", "fGps": "g", "fCps": "c"
576
546
  };
@@ -597,22 +567,4 @@ export function gcrsToMM12(nucleotides: string) {
597
567
  "fA": "I", "fC": "J", "fG": "K", "mU": "H", "mA": "E", "mC": "F", "mG": "G"
598
568
  };
599
569
  return nucleotides.replace(/(mAps|mUps|mGps|mCps|fAps|fUps|fGps|fCps|fU|fA|fC|fG|mU|mA|mC|mG)/g, function (x: string) {return obj[x]});
600
- }
601
-
602
- //name: gcrsToABI
603
- //input: string nucleotides {semType: GCRS}
604
- //output: string result {semType: ABI}
605
- export function gcrsToABI(nucleotides: string) {
606
- let count: number = -1;
607
- const objForEdges: {[index: string]: string} = {"moeA": "5", "(5m)moeC": "6", "moeG": "7", "moeT": "8"};
608
- const objForCenter: {[index: string]: string} = {"A": "A", "T": "T", "(5m)C": "C", "G": "G"};
609
- return nucleotides.replace(/(moeA|\(5m\)moeC|moeG|moeT|A|T|\(5m\)C|G)/g, function (x: string) {
610
- count++;
611
- return (5 < count || count < 15) ? objForCenter[x] : objForEdges[x];
612
- });
613
- }
614
-
615
- //name: defineAxolabsPattern
616
- export function _defineAxolabsPattern() {
617
- return defineAxolabsPattern();
618
570
  }