@datagrok/sequence-translator 0.0.5 → 0.0.9
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/jest.config.js +33 -0
- package/package.json +12 -4
- package/setup.cmd +1 -1
- package/src/ICDs.ts +3 -0
- package/src/IDPs.ts +3 -0
- package/src/__jest__/remote.test.ts +49 -0
- package/src/__jest__/test-node.ts +96 -0
- package/src/defineAxolabsPattern.ts +2 -8
- package/src/package-test.ts +2 -1
- package/src/package.ts +175 -684
- package/src/salts.ts +2 -0
- package/src/sources.ts +3 -0
- package/src/structures-works/converters.ts +288 -0
- package/src/structures-works/from-monomers.ts +104 -0
- package/src/{map.ts → structures-works/map.ts} +28 -6
- package/src/structures-works/mol-transformations.ts +428 -0
- package/src/structures-works/save-sense-antisense.ts +51 -0
- package/src/structures-works/sequence-codes-tools.ts +236 -0
- package/src/tests/smiles-tests.ts +1 -1
- package/src/users.ts +3 -0
- package/test-SequenceTranslator-2e08c8e54bde-1367d435.html +245 -0
- package/tsconfig.json +2 -1
- package/src/save-sense-antisense.ts +0 -36
package/src/salts.ts
ADDED
package/src/sources.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
//name: asoGapmersNucleotidesToBioSpring
|
|
2
|
+
//input: string nucleotides {semType: DNA nucleotides}
|
|
3
|
+
//output: string result {semType: BioSpring / Gapmers}
|
|
4
|
+
export function asoGapmersNucleotidesToBioSpring(nucleotides: string): string {
|
|
5
|
+
let count: number = -1;
|
|
6
|
+
const objForEdges: {[index: string]: string} = {
|
|
7
|
+
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': '5*', 'A': '6*', 'C': '7*', 'G': '8*'};
|
|
8
|
+
const objForCenter: {[index: string]: string} = {
|
|
9
|
+
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': 'T*', 'A': 'A*', 'C': '9*', 'G': 'G*'};
|
|
10
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|T|C|G)/g, function(x: string) {
|
|
11
|
+
count++;
|
|
12
|
+
return (count > 4 && count < 15) ? objForCenter[x] : objForEdges[x];
|
|
13
|
+
}).slice(0, (nucleotides.endsWith('(invabasic)') || nucleotides.endsWith('(GalNAc-2-JNJ)')) ?
|
|
14
|
+
nucleotides.length : 2 * count + 1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//name: asoGapmersNucleotidesToGcrs
|
|
18
|
+
//input: string nucleotides {semType: DNA nucleotides}
|
|
19
|
+
//output: string result {semType: GCRS / Gapmers}
|
|
20
|
+
export function asoGapmersNucleotidesToGcrs(nucleotides: string): string {
|
|
21
|
+
let count: number = -1;
|
|
22
|
+
const objForEdges: {[index: string]: string} = {
|
|
23
|
+
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': 'moeUnps',
|
|
24
|
+
'A': 'moeAnps', 'C': 'moe5mCnps', 'G': 'moeGnps'};
|
|
25
|
+
const objForCenter: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
26
|
+
'C': '5mCps', 'A': 'Aps', 'T': 'Tps', 'G': 'Gps'};
|
|
27
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|T|C|G)/g, function(x: string) {
|
|
28
|
+
count++;
|
|
29
|
+
if (count < 5) return (count == 4) ? objForEdges[x].slice(0, -3) + 'ps' : objForEdges[x];
|
|
30
|
+
if (count < 15) return (count == 14) ? objForCenter[x].slice(0, -2) + 'nps' : objForCenter[x];
|
|
31
|
+
return objForEdges[x];
|
|
32
|
+
}).slice(0, (nucleotides.endsWith('(invabasic)') || nucleotides.endsWith('(GalNAc-2-JNJ)')) ?
|
|
33
|
+
nucleotides.length : -3);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//name: asoGapmersBioSpringToNucleotides
|
|
37
|
+
//input: string nucleotides {semType: BioSpring / Gapmers}
|
|
38
|
+
//output: string result {semType: DNA nucleotides}
|
|
39
|
+
export function asoGapmersBioSpringToNucleotides(nucleotides: string): string {
|
|
40
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
41
|
+
'*': '', '5': 'T', '6': 'A', '7': 'C', '8': 'G', '9': 'C'};
|
|
42
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|\*|5|6|7|8|9)/g, function(x: string) {return obj[x];});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//name: asoGapmersBioSpringToGcrs
|
|
46
|
+
//input: string nucleotides {semType: BioSpring / Gapmers}
|
|
47
|
+
//output: string result {semType: GCRS / Gapmers}
|
|
48
|
+
export function asoGapmersBioSpringToGcrs(nucleotides: string): string {
|
|
49
|
+
let count: number = -1;
|
|
50
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
51
|
+
'5*': 'moeUnps', '6*': 'moeAnps', '7*': 'moe5mCnps', '8*': 'moeGnps', '9*': '5mCps', 'A*': 'Aps', 'T*': 'Tps',
|
|
52
|
+
'G*': 'Gps', 'C*': 'Cps', '5': 'moeU', '6': 'moeA', '7': 'moe5mC', '8': 'moeG',
|
|
53
|
+
};
|
|
54
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|5\*|6\*|7\*|8\*|9\*|A\*|T\*|G\*|C\*|5|6|7|8)/g,
|
|
55
|
+
function(x: string) {
|
|
56
|
+
count++;
|
|
57
|
+
return (count == 4) ? obj[x].slice(0, -3) + 'ps' : (count == 14) ? obj[x].slice(0, -2) + 'nps' : obj[x];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
//name: asoGapmersGcrsToBioSpring
|
|
63
|
+
//input: string nucleotides {semType: GCRS / Gapmers}
|
|
64
|
+
//output: string result {semType: BioSpring / Gapmers}
|
|
65
|
+
export function asoGapmersGcrsToBioSpring(nucleotides: string): string {
|
|
66
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
67
|
+
'moeT': '5', 'moeA': '6', 'moe5mC': '7', 'moeG': '8', 'moeU': '5', '5mC': '9', 'nps': '*', 'ps': '*', 'U': 'T',
|
|
68
|
+
};
|
|
69
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|moeT|moeA|moe5mC|moeG|moeU|5mC|nps|ps|U)/g,
|
|
70
|
+
function(x: string) {return obj[x];});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//name: asoGapmersGcrsToNucleotides
|
|
74
|
+
//input: string nucleotides {semType: GCRS / Gapmers}
|
|
75
|
+
//output: string result {semType: DNA nucleotides}
|
|
76
|
+
export function asoGapmersGcrsToNucleotides(nucleotides: string) {
|
|
77
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
78
|
+
'moe': '', '5m': '', 'n': '', 'ps': '', 'U': 'T'};
|
|
79
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|moe|5m|n|ps|U)/g, function(x: string) {return obj[x];});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//name: siRnaBioSpringToNucleotides
|
|
83
|
+
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
84
|
+
//output: string result {semType: RNA nucleotides}
|
|
85
|
+
export function siRnaBioSpringToNucleotides(nucleotides: string) {
|
|
86
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
87
|
+
'1': 'U', '2': 'A', '3': 'C', '4': 'G', '5': 'U', '6': 'A', '7': 'C', '8': 'G', '*': ''};
|
|
88
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
89
|
+
function(x: string) {return obj[x];});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//name: siRnaBioSpringToAxolabs
|
|
93
|
+
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
94
|
+
//output: string result {semType: Axolabs / siRNA}
|
|
95
|
+
export function siRnaBioSpringToAxolabs(nucleotides: string) {
|
|
96
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
97
|
+
'1': 'Uf', '2': 'Af', '3': 'Cf', '4': 'Gf', '5': 'u', '6': 'a', '7': 'c', '8': 'g', '*': 's'};
|
|
98
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
99
|
+
function(x: string) {return obj[x];});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
//name: siRnaBioSpringToGcrs
|
|
104
|
+
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
105
|
+
//output: string result {semType: GCRS}
|
|
106
|
+
export function siRnaBioSpringToGcrs(nucleotides: string) {
|
|
107
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
108
|
+
'1': 'fU', '2': 'fA', '3': 'fC', '4': 'fG', '5': 'mU', '6': 'mA', '7': 'mC', '8': 'mG', '*': 'ps'};
|
|
109
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
110
|
+
function(x: string) {return obj[x];});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//name: siRnaAxolabsToGcrs
|
|
114
|
+
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
115
|
+
//output: string result {semType: GCRS}
|
|
116
|
+
export function siRnaAxolabsToGcrs(nucleotides: string) {
|
|
117
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
118
|
+
'Uf': 'fU', 'Af': 'fA', 'Cf': 'fC', 'Gf': 'fG', 'u': 'mU', 'a': 'mA', 'c': 'mC', 'g': 'mG', 's': 'ps',
|
|
119
|
+
};
|
|
120
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
121
|
+
function(x: string) {return obj[x];});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//name: siRnaAxolabsToBioSpring
|
|
125
|
+
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
126
|
+
//output: string result {semType: BioSpring / siRNA}
|
|
127
|
+
export function siRnaAxolabsToBioSpring(nucleotides: string) {
|
|
128
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
129
|
+
'Uf': '1', 'Af': '2', 'Cf': '3', 'Gf': '4', 'u': '5', 'a': '6', 'c': '7', 'g': '8', 's': '*',
|
|
130
|
+
};
|
|
131
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
132
|
+
function(x: string) {return obj[x];});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//name: siRnaAxolabsToNucleotides
|
|
136
|
+
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
137
|
+
//output: string result {semType: RNA nucleotides}
|
|
138
|
+
export function siRnaAxolabsToNucleotides(nucleotides: string) {
|
|
139
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
140
|
+
'Uf': 'U', 'Af': 'A', 'Cf': 'C', 'Gf': 'G', 'u': 'U', 'a': 'A', 'c': 'C', 'g': 'G', 's': '',
|
|
141
|
+
};
|
|
142
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
143
|
+
function(x: string) {return obj[x];});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
//name: siRnaGcrsToNucleotides
|
|
148
|
+
//input: string nucleotides {semType: GCRS}
|
|
149
|
+
//output: string result {semType: RNA nucleotides}
|
|
150
|
+
export function siRnaGcrsToNucleotides(nucleotides: string) {
|
|
151
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
152
|
+
'fU': 'U', 'fA': 'A', 'fC': 'C', 'fG': 'G', 'mU': 'U', 'mA': 'A', 'mC': 'C', 'mG': 'G', 'ps': '',
|
|
153
|
+
};
|
|
154
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
155
|
+
function(x: string) {return obj[x];});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//name: siRnaGcrsToBioSpring
|
|
159
|
+
//input: string nucleotides {semType: GCRS}
|
|
160
|
+
//output: string result {semType: BioSpring / siRNA}
|
|
161
|
+
export function siRnaGcrsToBioSpring(nucleotides: string) {
|
|
162
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
163
|
+
'fU': '1', 'fA': '2', 'fC': '3', 'fG': '4', 'mU': '5', 'mA': '6', 'mC': '7', 'mG': '8', 'ps': '*',
|
|
164
|
+
};
|
|
165
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
166
|
+
function(x: string) {return obj[x];});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//name: siRnaGcrsToAxolabs
|
|
170
|
+
//input: string nucleotides {semType: GCRS}
|
|
171
|
+
//output: string result {semType: Axolabs / siRNA}
|
|
172
|
+
export function siRnaGcrsToAxolabs(nucleotides: string) {
|
|
173
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
174
|
+
'fU': 'Uf', 'fA': 'Af', 'fC': 'Cf', 'fG': 'Gf', 'mU': 'u', 'mA': 'a', 'mC': 'c', 'mG': 'g', 'ps': 's',
|
|
175
|
+
};
|
|
176
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
177
|
+
function(x: string) {return obj[x];});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//name: siRnaNucleotideToBioSpringSenseStrand
|
|
181
|
+
//input: string nucleotides {semType: RNA nucleotides}
|
|
182
|
+
//output: string result {semType: BioSpring / siRNA}
|
|
183
|
+
export function siRnaNucleotideToBioSpringSenseStrand(nucleotides: string) {
|
|
184
|
+
let count: number = -1;
|
|
185
|
+
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
186
|
+
'A': '6*', 'U': '5*', 'G': '8*', 'C': '7*'};
|
|
187
|
+
const objForRightEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
188
|
+
'A': '*6', 'U': '*5', 'G': '*8', 'C': '*7'};
|
|
189
|
+
const objForOddIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
190
|
+
'A': '6', 'U': '5', 'G': '8', 'C': '7'};
|
|
191
|
+
const objForEvenIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
192
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': '2', 'U': '1', 'G': '4', 'C': '3'};
|
|
193
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
194
|
+
count++;
|
|
195
|
+
if (count < 2) return objForLeftEdge[x];
|
|
196
|
+
if (count > nucleotides.length - 3) return objForRightEdge[x];
|
|
197
|
+
return (count % 2 == 0) ? objForEvenIndices[x] : objForOddIndices[x];
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
//name: siRnaNucleotidesToGcrs
|
|
202
|
+
//input: string nucleotides {semType: RNA nucleotides}
|
|
203
|
+
//output: string result {semType: GCRS}
|
|
204
|
+
export function siRnaNucleotidesToGcrs(nucleotides: string) {
|
|
205
|
+
let count: number = -1;
|
|
206
|
+
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
207
|
+
'A': 'mAps', 'U': 'mUps', 'G': 'mGps', 'C': 'mCps'};
|
|
208
|
+
const objForRightEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
209
|
+
'A': 'psmA', 'U': 'psmU', 'G': 'psmG', 'C': 'psmC'};
|
|
210
|
+
const objForEvenIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
211
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'fA', 'U': 'fU', 'G': 'fG', 'C': 'fC'};
|
|
212
|
+
const objForOddIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
213
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'mA', 'U': 'mU', 'G': 'mG', 'C': 'mC'};
|
|
214
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
215
|
+
count++;
|
|
216
|
+
if (count < 2) return objForLeftEdge[x];
|
|
217
|
+
if (count > nucleotides.length - 3) return objForRightEdge[x];
|
|
218
|
+
return (count % 2 == 0) ? objForEvenIndices[x] : objForOddIndices[x];
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
//name: siRnaNucleotideToAxolabsSenseStrand
|
|
223
|
+
//input: string nucleotides {semType: RNA nucleotides}
|
|
224
|
+
//output: string result {semType: Axolabs}
|
|
225
|
+
export function siRnaNucleotideToAxolabsSenseStrand(nucleotides: string) {
|
|
226
|
+
let count: number = -1;
|
|
227
|
+
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
228
|
+
'A': 'as', 'U': 'us', 'G': 'gs', 'C': 'cs'};
|
|
229
|
+
const objForSomeIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
230
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Af', 'U': 'Uf', 'G': 'Gf', 'C': 'Cf'};
|
|
231
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
232
|
+
'A': 'a', 'U': 'u', 'G': 'g', 'C': 'c'};
|
|
233
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
234
|
+
count++;
|
|
235
|
+
if (count < 2) return objForLeftEdge[x];
|
|
236
|
+
if (count == 6 || (count > 7 && count < 11)) return objForSomeIndices[x];
|
|
237
|
+
if (count == nucleotides.length - 1) return 'a';
|
|
238
|
+
return obj[x];
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//name: siRnaNucleotideToAxolabsAntisenseStrand
|
|
243
|
+
//input: string nucleotides {semType: RNA nucleotides}
|
|
244
|
+
//output: string result {semType: Axolabs}
|
|
245
|
+
export function siRnaNucleotideToAxolabsAntisenseStrand(nucleotides: string) {
|
|
246
|
+
let count: number = -1;
|
|
247
|
+
const objForSmallLinkages: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
248
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'as', 'U': 'us', 'G': 'gs', 'C': 'cs'};
|
|
249
|
+
const objForBigLinkages: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
250
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Afs', 'U': 'Ufs', 'G': 'Gfs', 'C': 'Cfs'};
|
|
251
|
+
const objForSomeIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
252
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Af', 'U': 'Uf', 'G': 'Gf', 'C': 'Cf'};
|
|
253
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
254
|
+
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'a', 'U': 'u', 'G': 'g', 'C': 'c'};
|
|
255
|
+
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
256
|
+
count++;
|
|
257
|
+
if (count > 19 && count < 22) return objForSmallLinkages[x];
|
|
258
|
+
if (count == 0) return 'us';
|
|
259
|
+
if (count == 1) return objForBigLinkages[x];
|
|
260
|
+
return (count == 5 || count == 7 || count == 8 || count == 13 || count == 15) ? objForSomeIndices[x] : obj[x];
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
//name: gcrsToNucleotides
|
|
265
|
+
//input: string nucleotides {semType: GCRS}
|
|
266
|
+
//output: string result {semType: RNA nucleotides}
|
|
267
|
+
export function gcrsToNucleotides(nucleotides: string) {
|
|
268
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
269
|
+
'mAps': 'A', 'mUps': 'U', 'mGps': 'G', 'mCps': 'C', 'fAps': 'A', 'fUps': 'U', 'fGps': 'G', 'fCps': 'C',
|
|
270
|
+
'fU': 'U', 'fA': 'A', 'fC': 'C', 'fG': 'G', 'mU': 'U', 'mA': 'A', 'mC': 'C', 'mG': 'G',
|
|
271
|
+
};
|
|
272
|
+
return nucleotides.replace(
|
|
273
|
+
/(\(invabasic\)|\(GalNAc-2-JNJ\)|mAps|mUps|mGps|mCps|fAps|fUps|fGps|fCps|fU|fA|fC|fG|mU|mA|mC|mG)/g,
|
|
274
|
+
function(x: string) {return obj[x];});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
//name: gcrsToMermade12
|
|
278
|
+
//input: string nucleotides {semType: GCRS}
|
|
279
|
+
//output: string result {semType: Mermade 12 / siRNA}
|
|
280
|
+
export function gcrsToMermade12(nucleotides: string) {
|
|
281
|
+
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
282
|
+
'mAps': 'e', 'mUps': 'h', 'mGps': 'g', 'mCps': 'f', 'fAps': 'i', 'fUps': 'l', 'fGps': 'k', 'fCps': 'j', 'fU': 'L',
|
|
283
|
+
'fA': 'I', 'fC': 'J', 'fG': 'K', 'mU': 'H', 'mA': 'E', 'mC': 'F', 'mG': 'G',
|
|
284
|
+
};
|
|
285
|
+
return nucleotides.replace(
|
|
286
|
+
/(\(invabasic\)|\(GalNAc-2-JNJ\)|mAps|mUps|mGps|mCps|fAps|fUps|fGps|fCps|fU|fA|fC|fG|mU|mA|mC|mG)/g,
|
|
287
|
+
function(x: string) {return obj[x];});
|
|
288
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {map, stadardPhosphateLinkSmiles, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS} from './map';
|
|
2
|
+
import {isValidSequence} from './sequence-codes-tools';
|
|
3
|
+
import {getNucleotidesMol} from './mol-transformations';
|
|
4
|
+
|
|
5
|
+
export function sequenceToMolV3000(sequence: string, inverted: boolean = false, oclRender: boolean = false): string {
|
|
6
|
+
const obj = getObjectWithCodesAndSmiles(sequence);
|
|
7
|
+
let codes = sortByStringLengthInDescendingOrder(Object.keys(obj));
|
|
8
|
+
let i = 0;
|
|
9
|
+
const smilesCodes:string[] = [];
|
|
10
|
+
const codesList = [];
|
|
11
|
+
const links = ['s', 'ps', '*'];
|
|
12
|
+
const includesStandardLinkAlready = ['e', 'h', /*'g',*/ 'f', 'i', 'l', 'k', 'j'];
|
|
13
|
+
const dropdowns = Object.keys(MODIFICATIONS);
|
|
14
|
+
codes = codes.concat(dropdowns);
|
|
15
|
+
while (i < sequence.length) {
|
|
16
|
+
const code = codes.find((s: string) => s == sequence.slice(i, i + s.length))!;
|
|
17
|
+
i += code.length;
|
|
18
|
+
inverted ? codesList.unshift(code) : codesList.push(code);
|
|
19
|
+
}
|
|
20
|
+
for (let i = 0; i < codesList.length; i++) {
|
|
21
|
+
if (dropdowns.includes(codesList[i])) {
|
|
22
|
+
smilesCodes.push((i >= codesList.length / 2) ?
|
|
23
|
+
MODIFICATIONS[codesList[i]].right : MODIFICATIONS[codesList[i]].left);
|
|
24
|
+
smilesCodes.push(stadardPhosphateLinkSmiles);
|
|
25
|
+
} else {
|
|
26
|
+
if (links.includes(codesList[i]) ||
|
|
27
|
+
includesStandardLinkAlready.includes(codesList[i]) ||
|
|
28
|
+
(i < codesList.length - 1 && links.includes(codesList[i + 1]))
|
|
29
|
+
)
|
|
30
|
+
smilesCodes.push(obj[codesList[i]]);
|
|
31
|
+
else {
|
|
32
|
+
smilesCodes.push(obj[codesList[i]]);
|
|
33
|
+
smilesCodes.push(stadardPhosphateLinkSmiles);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return getNucleotidesMol(smilesCodes, oclRender);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function sequenceToSmiles(sequence: string, inverted: boolean = false): string {
|
|
42
|
+
const obj = getObjectWithCodesAndSmiles(sequence);
|
|
43
|
+
let codes = sortByStringLengthInDescendingOrder(Object.keys(obj));
|
|
44
|
+
let i = 0;
|
|
45
|
+
let smiles = '';
|
|
46
|
+
const codesList = [];
|
|
47
|
+
const links = ['s', 'ps', '*'];
|
|
48
|
+
const includesStandardLinkAlready = ['e', 'h', /*'g',*/ 'f', 'i', 'l', 'k', 'j'];
|
|
49
|
+
const dropdowns = Object.keys(MODIFICATIONS);
|
|
50
|
+
codes = codes.concat(dropdowns);
|
|
51
|
+
while (i < sequence.length) {
|
|
52
|
+
const code = codes.find((s: string) => s == sequence.slice(i, i + s.length))!;
|
|
53
|
+
i += code.length;
|
|
54
|
+
inverted ? codesList.unshift(code) : codesList.push(code);
|
|
55
|
+
}
|
|
56
|
+
for (let i = 0; i < codesList.length; i++) {
|
|
57
|
+
if (dropdowns.includes(codesList[i])) {
|
|
58
|
+
smiles += (i >= codesList.length / 2) ?
|
|
59
|
+
MODIFICATIONS[codesList[i]].right + stadardPhosphateLinkSmiles:
|
|
60
|
+
MODIFICATIONS[codesList[i]].left + stadardPhosphateLinkSmiles;
|
|
61
|
+
} else {
|
|
62
|
+
if (links.includes(codesList[i]) ||
|
|
63
|
+
includesStandardLinkAlready.includes(codesList[i]) ||
|
|
64
|
+
(i < codesList.length - 1 && links.includes(codesList[i + 1]))
|
|
65
|
+
)
|
|
66
|
+
smiles += obj[codesList[i]];
|
|
67
|
+
else
|
|
68
|
+
smiles += obj[codesList[i]] + stadardPhosphateLinkSmiles;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
smiles = smiles.replace(/OO/g, 'O');
|
|
72
|
+
return (
|
|
73
|
+
(
|
|
74
|
+
links.includes(codesList[codesList.length - 1]) &&
|
|
75
|
+
codesList.length > 1 &&
|
|
76
|
+
!includesStandardLinkAlready.includes(codesList[codesList.length - 2])
|
|
77
|
+
) ||
|
|
78
|
+
dropdowns.includes(codesList[codesList.length - 1]) ||
|
|
79
|
+
includesStandardLinkAlready.includes(codesList[codesList.length - 1])
|
|
80
|
+
) ?
|
|
81
|
+
smiles :
|
|
82
|
+
smiles.slice(0, smiles.length - stadardPhosphateLinkSmiles.length + 1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function getObjectWithCodesAndSmiles(sequence: string) {
|
|
86
|
+
const obj: { [code: string]: string } = {};
|
|
87
|
+
for (const synthesizer of Object.keys(map)) {
|
|
88
|
+
for (const technology of Object.keys(map[synthesizer])) {
|
|
89
|
+
for (const code of Object.keys(map[synthesizer][technology]))
|
|
90
|
+
obj[code] = map[synthesizer][technology][code].SMILES;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// TODO: create object based from synthesizer type to avoid key(codes) duplicates
|
|
94
|
+
const output = isValidSequence(sequence);
|
|
95
|
+
if (output.expectedSynthesizer == SYNTHESIZERS.MERMADE_12)
|
|
96
|
+
obj['g'] = map[SYNTHESIZERS.MERMADE_12][TECHNOLOGIES.SI_RNA]['g'].SMILES;
|
|
97
|
+
else if (output.expectedSynthesizer == SYNTHESIZERS.AXOLABS)
|
|
98
|
+
obj['g'] = map[SYNTHESIZERS.AXOLABS][TECHNOLOGIES.SI_RNA]['g'].SMILES;
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function sortByStringLengthInDescendingOrder(array: string[]): string[] {
|
|
103
|
+
return array.sort(function(a: string, b: string) {return b.length - a.length;});
|
|
104
|
+
}
|
|
@@ -11,14 +11,36 @@ export const TECHNOLOGIES = {
|
|
|
11
11
|
ASO_GAPMERS: 'For ASO Gapmers',
|
|
12
12
|
SI_RNA: 'For 2\'-OMe and 2\'-F modified siRNA',
|
|
13
13
|
};
|
|
14
|
+
export const COL_NAMES = {
|
|
15
|
+
CHEMISTRY: 'Chemistry',
|
|
16
|
+
NUMBER: 'Number',
|
|
17
|
+
TYPE: 'Type',
|
|
18
|
+
CHEMISTRY_NAME: 'Chemistry Name',
|
|
19
|
+
INTERNAL_COMPOUND_ID: 'Internal compound ID',
|
|
20
|
+
IDP: 'IDP',
|
|
21
|
+
SEQUENCE: 'Sequence',
|
|
22
|
+
COMPOUND_NAME: 'Compound Name',
|
|
23
|
+
COMPOUND_COMMENTS: 'Compound Comments',
|
|
24
|
+
SALT: 'Salt',
|
|
25
|
+
EQUIVALENTS: 'Equivalents',
|
|
26
|
+
PURITY: 'Purity',
|
|
27
|
+
CPD_MW: 'Cpd MW',
|
|
28
|
+
SALT_MASS: 'Salt mass',
|
|
29
|
+
BATCH_MW: 'Batch MW',
|
|
30
|
+
SOURCE: 'Source',
|
|
31
|
+
ICD: 'ICD',
|
|
32
|
+
OWNER: 'Owner',
|
|
33
|
+
};
|
|
14
34
|
// interface CODES {
|
|
15
35
|
// }
|
|
16
|
-
export const MODIFICATIONS: {[index: string]: {left: string, right: string}} = {
|
|
36
|
+
export const MODIFICATIONS: {[index: string]: {molecularWeight: number, left: string, right: string}} = {
|
|
17
37
|
'(invabasic)': {
|
|
38
|
+
molecularWeight: 118.13,
|
|
18
39
|
left: 'O[C@@H]1C[C@@H]O[C@H]1CO',
|
|
19
40
|
right: 'O[C@@H]1C[C@@H]O[C@H]1CO',
|
|
20
41
|
},
|
|
21
42
|
'(GalNAc-2-JNJ)': {
|
|
43
|
+
molecularWeight: 1273.3,
|
|
22
44
|
left: 'C(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)' +
|
|
23
45
|
'(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)' +
|
|
24
46
|
'(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)NC(=O)CCCC(=O)NCC(O)CO',
|
|
@@ -49,7 +71,7 @@ export const map: {[synthesizer: string]:
|
|
|
49
71
|
'name': 'Guanine',
|
|
50
72
|
'weight': 329.21,
|
|
51
73
|
'normalized': 'dG',
|
|
52
|
-
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C
|
|
74
|
+
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C[C@@H]1O',
|
|
53
75
|
},
|
|
54
76
|
'C': {
|
|
55
77
|
'name': 'Cytosine',
|
|
@@ -75,7 +97,7 @@ export const map: {[synthesizer: string]:
|
|
|
75
97
|
'name': 'Guanine',
|
|
76
98
|
'weight': 329.21,
|
|
77
99
|
'normalized': 'dG',
|
|
78
|
-
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C
|
|
100
|
+
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C[C@@H]1O',
|
|
79
101
|
},
|
|
80
102
|
'C': {
|
|
81
103
|
'name': 'Cytosine',
|
|
@@ -139,7 +161,7 @@ export const map: {[synthesizer: string]:
|
|
|
139
161
|
'name': 'Guanine',
|
|
140
162
|
'weight': 329.21,
|
|
141
163
|
'normalized': 'dG',
|
|
142
|
-
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C
|
|
164
|
+
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C[C@@H]1O',
|
|
143
165
|
},
|
|
144
166
|
'T': {
|
|
145
167
|
'name': 'Tyrosine',
|
|
@@ -341,13 +363,13 @@ export const map: {[synthesizer: string]:
|
|
|
341
363
|
'name': 'Guanine',
|
|
342
364
|
'weight': 329.21,
|
|
343
365
|
'normalized': 'dG',
|
|
344
|
-
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C
|
|
366
|
+
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C[C@@H]1O',
|
|
345
367
|
},
|
|
346
368
|
'dG': {
|
|
347
369
|
'name': 'Guanine',
|
|
348
370
|
'weight': 329.21,
|
|
349
371
|
'normalized': 'dG',
|
|
350
|
-
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C
|
|
372
|
+
'SMILES': 'OC[C@H]1O[C@@H](N2C3N=C(N)NC(=O)C=3N=C2)C[C@@H]1O',
|
|
351
373
|
},
|
|
352
374
|
'T': {
|
|
353
375
|
'name': 'Tyrosine',
|