@datagrok/sequence-translator 0.0.9 → 1.0.1
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/README.md +19 -11
- package/css/style.css +18 -0
- package/dist/package-test.js +2454 -0
- package/dist/package.js +5234 -0
- package/package.json +19 -10
- package/src/defineAxolabsPattern.ts +58 -55
- package/src/package-test.ts +1 -1
- package/src/package.ts +53 -50
- package/src/salts.ts +2 -2
- package/src/structures-works/from-monomers.ts +20 -12
- package/src/structures-works/mol-transformations.ts +34 -18
- package/src/structures-works/save-sense-antisense.ts +5 -2
- package/src/structures-works/sequence-codes-tools.ts +192 -93
- package/src/tests/smiles-tests.ts +31 -27
- package/{test-SequenceTranslator-2e08c8e54bde-1367d435.html → test-SequenceTranslator-089b6516ed77-2280593f.html} +2 -2
|
@@ -93,9 +93,9 @@ export function getNucleotidesMol(smilesCodes: string[], oclRender: boolean = fa
|
|
|
93
93
|
return linkV3000(molBlocks, false, oclRender);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export function linkV3000(molBlocks: string[],
|
|
96
|
+
export function linkV3000(molBlocks: string[], twoChains: boolean = false, oclRender: boolean = false) {
|
|
97
97
|
let macroMolBlock = '\nDatagrok macromolecule handler\n\n';
|
|
98
|
-
macroMolBlock += ' 0 0 0 0 0 0
|
|
98
|
+
macroMolBlock += ' 0 0 0 0 0 0 999 V3000\n';
|
|
99
99
|
macroMolBlock += 'M V30 BEGIN CTAB\n';
|
|
100
100
|
let atomBlock = '';
|
|
101
101
|
let bondBlock = '';
|
|
@@ -103,22 +103,33 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
103
103
|
const collection: number [] = [];
|
|
104
104
|
let natom = 0;
|
|
105
105
|
let nbond = 0;
|
|
106
|
-
let sequenceShift = 0;
|
|
107
106
|
let xShift = 0;
|
|
108
107
|
|
|
109
|
-
if (
|
|
108
|
+
if (twoChains && molBlocks.length > 1)
|
|
110
109
|
molBlocks[1] = invertNucleotidesV3000(molBlocks[1]);
|
|
111
110
|
|
|
112
111
|
for (let i = 0; i < molBlocks.length; i++) {
|
|
112
|
+
molBlocks[i] = molBlocks[i].replaceAll('(-\nM V30 ', '(')
|
|
113
|
+
.replaceAll('-\nM V30 ', '').replaceAll(' )', ')');
|
|
113
114
|
const numbers = extractAtomsBondsNumbersV3000(molBlocks[i]);
|
|
114
115
|
const coordinates = extractAtomDataV3000(molBlocks[i]);
|
|
116
|
+
|
|
117
|
+
if (twoChains) {
|
|
118
|
+
const xShiftRight = Math.min(...coordinates.x);
|
|
119
|
+
const yShift = i == 0 ? Math.min(...coordinates.y) - 1 : Math.max(...coordinates.y) + 1;
|
|
120
|
+
for (let j = 0; j < coordinates.x.length; j++)
|
|
121
|
+
coordinates.x[j] -= xShiftRight;
|
|
122
|
+
for (let j = 0; j < coordinates.y.length; j++)
|
|
123
|
+
coordinates.y[j] -= yShift;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
let indexAtoms = molBlocks[i].indexOf('M V30 BEGIN ATOM'); // V3000 index for atoms coordinates
|
|
116
127
|
indexAtoms = molBlocks[i].indexOf('\n', indexAtoms);
|
|
117
128
|
let index = indexAtoms;
|
|
118
129
|
let indexEnd = indexAtoms;
|
|
119
130
|
|
|
120
131
|
for (let j = 0; j < numbers.natom; j++) {
|
|
121
|
-
if (coordinates.atomIndex[j] != 1 || i == 0 ||
|
|
132
|
+
if (coordinates.atomIndex[j] != 1 || i == 0 || twoChains) {
|
|
122
133
|
//rewrite atom number
|
|
123
134
|
index = molBlocks[i].indexOf('V30', index) + 4;
|
|
124
135
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
@@ -130,13 +141,17 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
130
141
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
131
142
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
132
143
|
|
|
133
|
-
const totalShift = xShift - coordinates.x[0];
|
|
134
|
-
let coordinate =
|
|
144
|
+
const totalShift = twoChains ? 0 : xShift - coordinates.x[0];
|
|
145
|
+
let coordinate = twoChains ?
|
|
146
|
+
Math.round(10000*coordinates.x[j])/10000 :
|
|
147
|
+
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd)) + totalShift))/10000;
|
|
135
148
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
136
149
|
|
|
137
150
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
138
151
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
139
|
-
coordinate =
|
|
152
|
+
coordinate = twoChains ?
|
|
153
|
+
Math.round(10000*coordinates.y[j])/10000 :
|
|
154
|
+
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd))))/10000;
|
|
140
155
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
141
156
|
|
|
142
157
|
index = molBlocks[i].indexOf('\n', index) + 1;
|
|
@@ -184,7 +199,7 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
184
199
|
while (indexCollection != -1) {
|
|
185
200
|
indexCollection += 28;
|
|
186
201
|
const collectionEnd = molBlocks[i].indexOf(')', indexCollection);
|
|
187
|
-
const collectionEntries = molBlocks[i].substring(indexCollection, collectionEnd).split(' ');
|
|
202
|
+
const collectionEntries = molBlocks[i].substring(indexCollection, collectionEnd).split(' ').slice(1);
|
|
188
203
|
collectionEntries.forEach((e) => {
|
|
189
204
|
collection.push(parseInt(e) + natom);
|
|
190
205
|
});
|
|
@@ -192,10 +207,9 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
192
207
|
indexCollection = molBlocks[i].indexOf('M V30 MDLV30/STEABS ATOMS=(', indexCollection);
|
|
193
208
|
}
|
|
194
209
|
|
|
195
|
-
natom +=
|
|
210
|
+
natom += twoChains ? numbers.natom : numbers.natom - 1;
|
|
196
211
|
nbond += numbers.nbond;
|
|
197
|
-
xShift +=
|
|
198
|
-
sequenceShift += twoMolecules ? -7 : 0;
|
|
212
|
+
xShift += twoChains ? 0 : coordinates.x[numbers.natom - 1] - coordinates.x[0];
|
|
199
213
|
}
|
|
200
214
|
|
|
201
215
|
const entries = 4;
|
|
@@ -209,18 +223,20 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
209
223
|
|
|
210
224
|
collectionBlock += ')\n';
|
|
211
225
|
} else {
|
|
226
|
+
collectionBlock += 'M V30 MDLV30/STEABS ATOMS=(' + collection.length + ' -\n';
|
|
212
227
|
for (let i = 0; i < collNumber; i++) {
|
|
213
|
-
collectionBlock += 'M V30
|
|
228
|
+
collectionBlock += 'M V30 ';
|
|
214
229
|
const entriesCurrent = i + 1 == collNumber ? collection.length - (collNumber - 1)*entries : entries;
|
|
215
|
-
for (let j = 0; j < entriesCurrent; j++)
|
|
216
|
-
collectionBlock += (j + 1 == entriesCurrent) ?
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
for (let j = 0; j < entriesCurrent; j++) {
|
|
231
|
+
collectionBlock += (j + 1 == entriesCurrent) ?
|
|
232
|
+
(i == collNumber - 1 ? collection[entries*i + j] + ')\n' : collection[entries*i + j] + ' -\n') :
|
|
233
|
+
collection[entries*i + j] + ' ';
|
|
234
|
+
}
|
|
219
235
|
}
|
|
220
236
|
}
|
|
221
237
|
|
|
222
238
|
//generate file
|
|
223
|
-
|
|
239
|
+
twoChains? natom : natom++;
|
|
224
240
|
macroMolBlock += 'M V30 COUNTS ' + natom + ' ' + nbond + ' 0 0 0\n';
|
|
225
241
|
macroMolBlock += 'M V30 BEGIN ATOM\n';
|
|
226
242
|
macroMolBlock += atomBlock;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as ui from 'datagrok-api/ui';
|
|
2
2
|
import {sequenceToMolV3000} from '../structures-works/from-monomers';
|
|
3
3
|
import {linkV3000} from '../structures-works/mol-transformations';
|
|
4
|
+
import {getFormat} from '../structures-works/sequence-codes-tools';
|
|
4
5
|
|
|
5
6
|
export function saveSdf(as: string, ss: string, oneEntity: boolean, fit3dx: boolean) {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const formatAs = getFormat(as);
|
|
8
|
+
const formatSs = getFormat(ss);
|
|
9
|
+
const molSS = sequenceToMolV3000(ss, false, false, formatSs!);
|
|
10
|
+
const molAS = sequenceToMolV3000(as, true, false, formatAs!);
|
|
8
11
|
let result: string;
|
|
9
12
|
if (oneEntity)
|
|
10
13
|
result = linkV3000([molSS, molAS], true, !fit3dx) + '\n\n$$$$\n';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// import * as grok from 'datagrok-api/grok';
|
|
2
|
+
// import * as ui from 'datagrok-api/ui';
|
|
3
|
+
// import * as DG from 'datagrok-api/dg';
|
|
1
4
|
import {map, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS} from './map';
|
|
2
5
|
import {asoGapmersNucleotidesToBioSpring, asoGapmersNucleotidesToGcrs,
|
|
3
6
|
asoGapmersBioSpringToNucleotides, asoGapmersBioSpringToGcrs, asoGapmersGcrsToNucleotides,
|
|
@@ -10,98 +13,196 @@ import {asoGapmersNucleotidesToBioSpring, asoGapmersNucleotidesToGcrs,
|
|
|
10
13
|
const noTranslationTableAvailable = 'No translation table available';
|
|
11
14
|
export const undefinedInputSequence = 'Type of input sequence is undefined';
|
|
12
15
|
|
|
13
|
-
export function
|
|
14
|
-
indexOfFirstNotValidCharacter: number,
|
|
15
|
-
expectedSynthesizer: string | null,
|
|
16
|
-
expectedTechnology: string | null
|
|
17
|
-
} {
|
|
16
|
+
export function getFormat(sequence: string): string | null {
|
|
18
17
|
const possibleSynthesizers = getListOfPossibleSynthesizersByFirstMatchedCode(sequence);
|
|
18
|
+
|
|
19
|
+
if (possibleSynthesizers.length == 0)
|
|
20
|
+
return null;
|
|
21
|
+
|
|
22
|
+
let outputIndex = 0;
|
|
23
|
+
|
|
24
|
+
const firstUniqueCharacters = ['r', 'd'];
|
|
25
|
+
const nucleotides = ['A', 'U', 'T', 'C', 'G'];
|
|
26
|
+
|
|
27
|
+
possibleSynthesizers.forEach((synthesizer) => {
|
|
28
|
+
const codes = getAllCodesOfSynthesizer(synthesizer);
|
|
29
|
+
while (outputIndex < sequence.length) {
|
|
30
|
+
const matchedCode = codes.find((c) => c == sequence.slice(outputIndex, outputIndex + c.length));
|
|
31
|
+
|
|
32
|
+
if (matchedCode == null)
|
|
33
|
+
break;
|
|
34
|
+
|
|
35
|
+
if ( // for mistake pattern 'rAA'
|
|
36
|
+
outputIndex > 1 &&
|
|
37
|
+
nucleotides.includes(sequence[outputIndex]) &&
|
|
38
|
+
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
39
|
+
) break;
|
|
40
|
+
|
|
41
|
+
if ( // for mistake pattern 'ArA'
|
|
42
|
+
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
43
|
+
nucleotides.includes(sequence[outputIndex])
|
|
44
|
+
) {
|
|
45
|
+
outputIndex++;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
outputIndex += matchedCode.length;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const indexOfFirstNotValidChar = (outputIndex == sequence.length) ? -1 : outputIndex;
|
|
54
|
+
if (indexOfFirstNotValidChar != -1)
|
|
55
|
+
return possibleSynthesizers[0];
|
|
56
|
+
|
|
57
|
+
const possibleTechnologies = getListOfPossibleTechnologiesByFirstMatchedCode(sequence, possibleSynthesizers[0]);
|
|
58
|
+
|
|
59
|
+
if (possibleTechnologies.length == 0)
|
|
60
|
+
return null;
|
|
61
|
+
|
|
62
|
+
outputIndex = 0;
|
|
63
|
+
|
|
64
|
+
possibleTechnologies.forEach((technology: string) => {
|
|
65
|
+
const codes = Object.keys(map[possibleSynthesizers[0]][technology]);
|
|
66
|
+
while (outputIndex < sequence.length) {
|
|
67
|
+
const matchedCode = codes.find((c) => c == sequence.slice(outputIndex, outputIndex + c.length));
|
|
68
|
+
|
|
69
|
+
if (matchedCode == null)
|
|
70
|
+
break;
|
|
71
|
+
|
|
72
|
+
if ( // for mistake pattern 'rAA'
|
|
73
|
+
outputIndex > 1 &&
|
|
74
|
+
nucleotides.includes(sequence[outputIndex]) &&
|
|
75
|
+
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
76
|
+
) break;
|
|
77
|
+
|
|
78
|
+
if ( // for mistake pattern 'ArA'
|
|
79
|
+
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
80
|
+
nucleotides.includes(sequence[outputIndex])
|
|
81
|
+
) {
|
|
82
|
+
outputIndex++;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
outputIndex += matchedCode.length;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return possibleSynthesizers[0];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function isValidSequence(sequence: string, format: string | null): {
|
|
94
|
+
indexOfFirstNotValidChar: number,
|
|
95
|
+
synthesizer: string[] | null,
|
|
96
|
+
technology: string[] | null
|
|
97
|
+
} {
|
|
98
|
+
const possibleSynthesizers = format == null ?
|
|
99
|
+
getListOfPossibleSynthesizersByFirstMatchedCode(sequence) :
|
|
100
|
+
[format];
|
|
101
|
+
|
|
102
|
+
// if (possibleSynthesizers.length > 1) {
|
|
103
|
+
// const synthesizer = ui.choiceInput('Choose synthesizer from list: ', possibleSynthesizers[0],
|
|
104
|
+
// possibleSynthesizers);
|
|
105
|
+
// ui.dialog('Choose Synthesizer')
|
|
106
|
+
// .add(ui.panel([synthesizer.root], {style: {fontWeight: 'bold'}}))
|
|
107
|
+
// .onOK(() => possibleSynthesizers = [synthesizer.value])
|
|
108
|
+
// .onCancel(() => {
|
|
109
|
+
// possibleSynthesizers = [possibleSynthesizers[0]];
|
|
110
|
+
// grok.shell.warning('Input sequence is expected to be in format ' + possibleSynthesizers[0]);
|
|
111
|
+
// })
|
|
112
|
+
// .show();
|
|
113
|
+
// } else if (possibleSynthesizers.length == 0)
|
|
19
114
|
if (possibleSynthesizers.length == 0)
|
|
20
|
-
return {
|
|
115
|
+
return {indexOfFirstNotValidChar: 0, synthesizer: null, technology: null};
|
|
21
116
|
|
|
22
|
-
let
|
|
117
|
+
let outputIndex = 0;
|
|
23
118
|
|
|
24
119
|
const firstUniqueCharacters = ['r', 'd'];
|
|
25
120
|
const nucleotides = ['A', 'U', 'T', 'C', 'G'];
|
|
26
121
|
|
|
27
|
-
possibleSynthesizers.forEach((synthesizer
|
|
122
|
+
possibleSynthesizers.forEach((synthesizer) => {
|
|
28
123
|
const codes = getAllCodesOfSynthesizer(synthesizer);
|
|
29
|
-
while (
|
|
30
|
-
const matchedCode = codes
|
|
31
|
-
.find((c) => c == sequence.slice(outputIndices[synthesizerIndex], outputIndices[synthesizerIndex] + c.length));
|
|
124
|
+
while (outputIndex < sequence.length) {
|
|
125
|
+
const matchedCode = codes.find((c) => c == sequence.slice(outputIndex, outputIndex + c.length));
|
|
32
126
|
|
|
33
127
|
if (matchedCode == null)
|
|
34
128
|
break;
|
|
35
129
|
|
|
36
130
|
if ( // for mistake pattern 'rAA'
|
|
37
|
-
|
|
38
|
-
nucleotides.includes(sequence[
|
|
39
|
-
firstUniqueCharacters.includes(sequence[
|
|
131
|
+
outputIndex > 1 &&
|
|
132
|
+
nucleotides.includes(sequence[outputIndex]) &&
|
|
133
|
+
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
40
134
|
) break;
|
|
41
135
|
|
|
42
136
|
if ( // for mistake pattern 'ArA'
|
|
43
|
-
firstUniqueCharacters.includes(sequence[
|
|
44
|
-
nucleotides.includes(sequence[
|
|
137
|
+
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
138
|
+
nucleotides.includes(sequence[outputIndex])
|
|
45
139
|
) {
|
|
46
|
-
|
|
140
|
+
outputIndex++;
|
|
47
141
|
break;
|
|
48
142
|
}
|
|
49
143
|
|
|
50
|
-
|
|
144
|
+
outputIndex += matchedCode.length;
|
|
51
145
|
}
|
|
52
146
|
});
|
|
53
147
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const expectedSynthesizer = possibleSynthesizers[outputIndices.indexOf(indexOfExpectedSythesizer)];
|
|
57
|
-
if (indexOfFirstNotValidCharacter != -1) {
|
|
148
|
+
const indexOfFirstNotValidChar = (outputIndex == sequence.length) ? -1 : outputIndex;
|
|
149
|
+
if (indexOfFirstNotValidChar != -1) {
|
|
58
150
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
151
|
+
indexOfFirstNotValidChar: indexOfFirstNotValidChar,
|
|
152
|
+
synthesizer: possibleSynthesizers,
|
|
153
|
+
technology: null,
|
|
62
154
|
};
|
|
63
155
|
}
|
|
64
156
|
|
|
65
|
-
const possibleTechnologies = getListOfPossibleTechnologiesByFirstMatchedCode(sequence,
|
|
157
|
+
const possibleTechnologies = getListOfPossibleTechnologiesByFirstMatchedCode(sequence, possibleSynthesizers[0]);
|
|
158
|
+
|
|
159
|
+
// if (possibleTechnologies.length > 1) {
|
|
160
|
+
// const technology = ui.choiceInput('Choose technology from list: ', possibleTechnologies[0],
|
|
161
|
+
// possibleTechnologies);
|
|
162
|
+
// ui.dialog('Choose Technology')
|
|
163
|
+
// .add(ui.panel([technology.root], {style: {fontWeight: 'bold'}}))
|
|
164
|
+
// .onOK(() => possibleTechnologies = [technology.value])
|
|
165
|
+
// .onCancel(() => {
|
|
166
|
+
// possibleTechnologies = [possibleTechnologies[0]];
|
|
167
|
+
// grok.shell.warning('Input sequence is expected to be in format ' + possibleTechnologies[0]);
|
|
168
|
+
// })
|
|
169
|
+
// .show();
|
|
170
|
+
// } else if (possibleTechnologies.length == 0)
|
|
66
171
|
if (possibleTechnologies.length == 0)
|
|
67
|
-
return {
|
|
172
|
+
return {indexOfFirstNotValidChar: 0, synthesizer: null, technology: null};
|
|
68
173
|
|
|
69
|
-
|
|
174
|
+
outputIndex = 0;
|
|
70
175
|
|
|
71
|
-
possibleTechnologies.forEach((technology: string
|
|
72
|
-
const codes = Object.keys(map[
|
|
73
|
-
while (
|
|
74
|
-
const matchedCode = codes
|
|
75
|
-
.find((c) => c == sequence.slice(outputIndices[technologyIndex], outputIndices[technologyIndex] + c.length));
|
|
176
|
+
possibleTechnologies.forEach((technology: string) => {
|
|
177
|
+
const codes = Object.keys(map[possibleSynthesizers[0]][technology]);
|
|
178
|
+
while (outputIndex < sequence.length) {
|
|
179
|
+
const matchedCode = codes.find((c) => c == sequence.slice(outputIndex, outputIndex + c.length));
|
|
76
180
|
|
|
77
181
|
if (matchedCode == null)
|
|
78
182
|
break;
|
|
79
183
|
|
|
80
184
|
if ( // for mistake pattern 'rAA'
|
|
81
|
-
|
|
82
|
-
nucleotides.includes(sequence[
|
|
83
|
-
firstUniqueCharacters.includes(sequence[
|
|
185
|
+
outputIndex > 1 &&
|
|
186
|
+
nucleotides.includes(sequence[outputIndex]) &&
|
|
187
|
+
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
84
188
|
) break;
|
|
85
189
|
|
|
86
190
|
if ( // for mistake pattern 'ArA'
|
|
87
|
-
firstUniqueCharacters.includes(sequence[
|
|
88
|
-
nucleotides.includes(sequence[
|
|
191
|
+
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
192
|
+
nucleotides.includes(sequence[outputIndex])
|
|
89
193
|
) {
|
|
90
|
-
|
|
194
|
+
outputIndex++;
|
|
91
195
|
break;
|
|
92
196
|
}
|
|
93
197
|
|
|
94
|
-
|
|
198
|
+
outputIndex += matchedCode.length;
|
|
95
199
|
}
|
|
96
200
|
});
|
|
97
201
|
|
|
98
|
-
const indexOfExpectedTechnology = Math.max(...outputIndices);
|
|
99
|
-
const expectedTechnology = possibleTechnologies[outputIndices.indexOf(indexOfExpectedTechnology)];
|
|
100
|
-
|
|
101
202
|
return {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
203
|
+
indexOfFirstNotValidChar: indexOfFirstNotValidChar,
|
|
204
|
+
synthesizer: possibleSynthesizers,
|
|
205
|
+
technology: [possibleTechnologies[outputIndex]],
|
|
105
206
|
};
|
|
106
207
|
}
|
|
107
208
|
|
|
@@ -140,93 +241,91 @@ function getListOfPossibleTechnologiesByFirstMatchedCode(sequence: string, synth
|
|
|
140
241
|
return technologies;
|
|
141
242
|
}
|
|
142
243
|
|
|
143
|
-
export function convertSequence(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const output = isValidSequence(seq);
|
|
147
|
-
if (output.indexOfFirstNotValidCharacter != -1) {
|
|
244
|
+
export function convertSequence(sequence: string, output: {
|
|
245
|
+
indexOfFirstNotValidChar: number, synthesizer: string[] | null, technology: string[] | null}) {
|
|
246
|
+
if (output.indexOfFirstNotValidChar != -1) {
|
|
148
247
|
return {
|
|
149
248
|
// type: '',
|
|
150
|
-
|
|
249
|
+
indexOfFirstNotValidChar: JSON.stringify(output),
|
|
151
250
|
Error: undefinedInputSequence,
|
|
152
251
|
};
|
|
153
252
|
}
|
|
154
|
-
if (output.
|
|
253
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.RAW_NUCLEOTIDES)) {//&& output.technology!.includes(TECHNOLOGIES.DNA)) {
|
|
155
254
|
return {
|
|
156
|
-
type: SYNTHESIZERS.RAW_NUCLEOTIDES + ' ' + TECHNOLOGIES.DNA,
|
|
157
|
-
Nucleotides:
|
|
158
|
-
BioSpring: asoGapmersNucleotidesToBioSpring(
|
|
159
|
-
GCRS: asoGapmersNucleotidesToGcrs(
|
|
255
|
+
type: SYNTHESIZERS.RAW_NUCLEOTIDES, // + ' ' + TECHNOLOGIES.DNA,
|
|
256
|
+
Nucleotides: sequence,
|
|
257
|
+
BioSpring: asoGapmersNucleotidesToBioSpring(sequence),
|
|
258
|
+
GCRS: asoGapmersNucleotidesToGcrs(sequence),
|
|
160
259
|
};
|
|
161
260
|
}
|
|
162
|
-
if (output.
|
|
261
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.BIOSPRING) && output.technology!.includes(TECHNOLOGIES.ASO_GAPMERS)) {
|
|
163
262
|
return {
|
|
164
263
|
type: SYNTHESIZERS.BIOSPRING + ' ' + TECHNOLOGIES.ASO_GAPMERS,
|
|
165
|
-
Nucleotides: asoGapmersBioSpringToNucleotides(
|
|
166
|
-
BioSpring:
|
|
167
|
-
GCRS: asoGapmersBioSpringToGcrs(
|
|
264
|
+
Nucleotides: asoGapmersBioSpringToNucleotides(sequence),
|
|
265
|
+
BioSpring: sequence,
|
|
266
|
+
GCRS: asoGapmersBioSpringToGcrs(sequence),
|
|
168
267
|
};
|
|
169
268
|
}
|
|
170
|
-
if (output.
|
|
269
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.GCRS) && output.technology!.includes(TECHNOLOGIES.ASO_GAPMERS)) {
|
|
171
270
|
return {
|
|
172
271
|
type: SYNTHESIZERS.GCRS + ' ' + TECHNOLOGIES.ASO_GAPMERS,
|
|
173
|
-
Nucleotides: asoGapmersGcrsToNucleotides(
|
|
174
|
-
BioSpring: asoGapmersGcrsToBioSpring(
|
|
175
|
-
Mermade12: gcrsToMermade12(
|
|
176
|
-
GCRS:
|
|
272
|
+
Nucleotides: asoGapmersGcrsToNucleotides(sequence),
|
|
273
|
+
BioSpring: asoGapmersGcrsToBioSpring(sequence),
|
|
274
|
+
Mermade12: gcrsToMermade12(sequence),
|
|
275
|
+
GCRS: sequence,
|
|
177
276
|
};
|
|
178
277
|
}
|
|
179
|
-
if (output.
|
|
278
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.RAW_NUCLEOTIDES) && output.technology!.includes(TECHNOLOGIES.RNA)) {
|
|
180
279
|
return {
|
|
181
280
|
type: SYNTHESIZERS.RAW_NUCLEOTIDES + ' ' + TECHNOLOGIES.RNA,
|
|
182
|
-
Nucleotides:
|
|
183
|
-
BioSpring: siRnaNucleotideToBioSpringSenseStrand(
|
|
184
|
-
Axolabs: siRnaNucleotideToAxolabsSenseStrand(
|
|
185
|
-
GCRS: siRnaNucleotidesToGcrs(
|
|
281
|
+
Nucleotides: sequence,
|
|
282
|
+
BioSpring: siRnaNucleotideToBioSpringSenseStrand(sequence),
|
|
283
|
+
Axolabs: siRnaNucleotideToAxolabsSenseStrand(sequence),
|
|
284
|
+
GCRS: siRnaNucleotidesToGcrs(sequence),
|
|
186
285
|
};
|
|
187
286
|
}
|
|
188
|
-
if (output.
|
|
287
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.BIOSPRING) && output.technology!.includes(TECHNOLOGIES.SI_RNA)) {
|
|
189
288
|
return {
|
|
190
289
|
type: SYNTHESIZERS.BIOSPRING + ' ' + TECHNOLOGIES.SI_RNA,
|
|
191
|
-
Nucleotides: siRnaBioSpringToNucleotides(
|
|
192
|
-
BioSpring:
|
|
193
|
-
Axolabs: siRnaBioSpringToAxolabs(
|
|
194
|
-
GCRS: siRnaBioSpringToGcrs(
|
|
290
|
+
Nucleotides: siRnaBioSpringToNucleotides(sequence),
|
|
291
|
+
BioSpring: sequence,
|
|
292
|
+
Axolabs: siRnaBioSpringToAxolabs(sequence),
|
|
293
|
+
GCRS: siRnaBioSpringToGcrs(sequence),
|
|
195
294
|
};
|
|
196
295
|
}
|
|
197
|
-
if (output.
|
|
296
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.AXOLABS)) {
|
|
198
297
|
return {
|
|
199
298
|
type: SYNTHESIZERS.AXOLABS + ' ' + TECHNOLOGIES.SI_RNA,
|
|
200
|
-
Nucleotides: siRnaAxolabsToNucleotides(
|
|
201
|
-
BioSpring: siRnaAxolabsToBioSpring(
|
|
202
|
-
Axolabs:
|
|
203
|
-
GCRS: siRnaAxolabsToGcrs(
|
|
299
|
+
Nucleotides: siRnaAxolabsToNucleotides(sequence),
|
|
300
|
+
BioSpring: siRnaAxolabsToBioSpring(sequence),
|
|
301
|
+
Axolabs: sequence,
|
|
302
|
+
GCRS: siRnaAxolabsToGcrs(sequence),
|
|
204
303
|
};
|
|
205
304
|
}
|
|
206
|
-
if (output.
|
|
305
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.GCRS) && output.technology!.includes(TECHNOLOGIES.SI_RNA)) {
|
|
207
306
|
return {
|
|
208
307
|
type: SYNTHESIZERS.GCRS + ' ' + TECHNOLOGIES.SI_RNA,
|
|
209
|
-
Nucleotides: siRnaGcrsToNucleotides(
|
|
210
|
-
BioSpring: siRnaGcrsToBioSpring(
|
|
211
|
-
Axolabs: siRnaGcrsToAxolabs(
|
|
212
|
-
MM12: gcrsToMermade12(
|
|
213
|
-
GCRS:
|
|
308
|
+
Nucleotides: siRnaGcrsToNucleotides(sequence),
|
|
309
|
+
BioSpring: siRnaGcrsToBioSpring(sequence),
|
|
310
|
+
Axolabs: siRnaGcrsToAxolabs(sequence),
|
|
311
|
+
MM12: gcrsToMermade12(sequence),
|
|
312
|
+
GCRS: sequence,
|
|
214
313
|
};
|
|
215
314
|
}
|
|
216
|
-
if (output.
|
|
315
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.GCRS)) {
|
|
217
316
|
return {
|
|
218
317
|
type: SYNTHESIZERS.GCRS,
|
|
219
|
-
Nucleotides: gcrsToNucleotides(
|
|
220
|
-
GCRS:
|
|
221
|
-
Mermade12: gcrsToMermade12(
|
|
318
|
+
Nucleotides: gcrsToNucleotides(sequence),
|
|
319
|
+
GCRS: sequence,
|
|
320
|
+
Mermade12: gcrsToMermade12(sequence),
|
|
222
321
|
};
|
|
223
322
|
}
|
|
224
|
-
if (output.
|
|
323
|
+
if (output.synthesizer!.includes(SYNTHESIZERS.MERMADE_12)) {
|
|
225
324
|
return {
|
|
226
325
|
type: SYNTHESIZERS.MERMADE_12,
|
|
227
326
|
Nucleotides: noTranslationTableAvailable,
|
|
228
327
|
GCRS: noTranslationTableAvailable,
|
|
229
|
-
Mermade12:
|
|
328
|
+
Mermade12: sequence,
|
|
230
329
|
};
|
|
231
330
|
}
|
|
232
331
|
return {
|