@datagrok/sequence-translator 1.0.12 → 1.0.14
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/dist/package-test.js +70739 -1417
- package/dist/package.js +70546 -4914
- package/package.json +6 -4
- package/scripts/build-monomer-lib.py +140 -0
- package/setup-unlink-clean.cmd +14 -0
- package/setup.cmd +14 -11
- package/setup.sh +37 -0
- package/src/__jest__/remote.test.ts +11 -3
- package/src/{ICDs.ts → autostart/ICDs.ts} +0 -0
- package/src/{IDPs.ts → autostart/IDPs.ts} +0 -0
- package/src/autostart/calculations.ts +37 -0
- package/src/autostart/constants.ts +49 -0
- package/src/autostart/registration.ts +101 -122
- package/src/{salts.ts → autostart/salts.ts} +0 -0
- package/src/{sources.ts → autostart/sources.ts} +0 -0
- package/src/{users.ts → autostart/users.ts} +0 -0
- package/src/axolabs/constants.ts +10 -10
- package/src/axolabs/define-pattern.ts +13 -12
- package/src/axolabs/draw-svg.ts +140 -201
- package/src/axolabs/helpers.ts +94 -0
- package/src/helpers.ts +28 -0
- package/src/main/main-view.ts +85 -87
- package/src/package.ts +25 -8
- package/src/structures-works/const.ts +18 -0
- package/src/structures-works/converters.ts +3 -3
- package/src/structures-works/from-monomers.ts +185 -32
- package/src/structures-works/map.ts +20 -35
- package/src/structures-works/mol-transformations.ts +295 -582
- package/src/structures-works/save-sense-antisense.ts +35 -11
- package/src/structures-works/sequence-codes-tools.ts +9 -13
- package/{test-SequenceTranslator-49ff04f38f57-128d0678.html → test-SequenceTranslator-e8c06047b7e7-eb4db608.html} +10 -7
|
@@ -1,573 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
Datagrok monomer library Nucleotides
|
|
3
|
-
|
|
4
|
-
0 0 0 0 0 0 0 V3000
|
|
5
|
-
M V30 BEGIN CTAB
|
|
6
|
-
M V30 COUNTS 5 4 0 0 0
|
|
7
|
-
M V30 BEGIN ATOM
|
|
8
|
-
M V30 1 O -1.5 0 0 0
|
|
9
|
-
M V30 2 P 0 0 0 0
|
|
10
|
-
M V30 3 O 0 1 0 0
|
|
11
|
-
M V30 4 O 0 -1 0 0
|
|
12
|
-
M V30 5 O 1.5 0 0 0
|
|
13
|
-
M V30 END ATOM
|
|
14
|
-
M V30 BEGIN BOND
|
|
15
|
-
M V30 1 1 1 2
|
|
16
|
-
M V30 2 2 2 3
|
|
17
|
-
M V30 3 1 2 4
|
|
18
|
-
M V30 4 1 2 5
|
|
19
|
-
M V30 END BOND
|
|
20
|
-
M V30 END CTAB
|
|
21
|
-
M V30 BEGIN COLLECTION
|
|
22
|
-
M V30 END COLLECTION
|
|
23
|
-
M END`;
|
|
24
|
-
|
|
25
|
-
const THIOPHOSHATE = `
|
|
26
|
-
Datagrok monomer library Nucleotides
|
|
27
|
-
|
|
28
|
-
0 0 0 0 0 0 0 V3000
|
|
29
|
-
M V30 BEGIN CTAB
|
|
30
|
-
M V30 COUNTS 5 4 0 0 0
|
|
31
|
-
M V30 BEGIN ATOM
|
|
32
|
-
M V30 1 O -1.5 0 0 0
|
|
33
|
-
M V30 2 P 0 0 0 0
|
|
34
|
-
M V30 3 O 0 1 0 0
|
|
35
|
-
M V30 4 S 0 -1 0 0
|
|
36
|
-
M V30 5 O 1.5 0 0 0
|
|
37
|
-
M V30 END ATOM
|
|
38
|
-
M V30 BEGIN BOND
|
|
39
|
-
M V30 1 1 1 2
|
|
40
|
-
M V30 2 2 2 3
|
|
41
|
-
M V30 3 1 2 4
|
|
42
|
-
M V30 4 1 2 5
|
|
43
|
-
M V30 END BOND
|
|
44
|
-
M V30 END CTAB
|
|
45
|
-
M V30 BEGIN COLLECTION
|
|
46
|
-
M V30 END COLLECTION
|
|
47
|
-
M END`;
|
|
48
|
-
|
|
49
|
-
const INVABASIC = `
|
|
50
|
-
Datagrok monomer library Nucleotides
|
|
51
|
-
|
|
52
|
-
0 0 0 0 0 0 0 V3000
|
|
53
|
-
M V30 BEGIN CTAB
|
|
54
|
-
M V30 COUNTS 8 8 0 0 0
|
|
55
|
-
M V30 BEGIN ATOM
|
|
56
|
-
M V30 1 O 1.0934 -2.1636 0 0
|
|
57
|
-
M V30 2 C 1.8365 -1.4945 0 0 CFG=2
|
|
58
|
-
M V30 3 C 2.8147 -1.7024 0 0
|
|
59
|
-
M V30 4 C 3.3147 -0.8364 0 0
|
|
60
|
-
M V30 5 O 2.6455 -0.0932 0 0
|
|
61
|
-
M V30 6 C 1.732 -0.5 0 0 CFG=1
|
|
62
|
-
M V30 7 C 0.866 0 0 0
|
|
63
|
-
M V30 8 O 0.866 1 0 0
|
|
64
|
-
M V30 END ATOM
|
|
65
|
-
M V30 BEGIN BOND
|
|
66
|
-
M V30 1 1 2 1 CFG=1
|
|
67
|
-
M V30 2 1 2 3
|
|
68
|
-
M V30 3 1 3 4
|
|
69
|
-
M V30 4 1 4 5
|
|
70
|
-
M V30 5 1 6 5
|
|
71
|
-
M V30 6 1 2 6
|
|
72
|
-
M V30 7 1 6 7 CFG=3
|
|
73
|
-
M V30 8 1 7 8
|
|
74
|
-
M V30 END BOND
|
|
75
|
-
M V30 BEGIN COLLECTION
|
|
76
|
-
M V30 MDLV30/STEABS ATOMS=(2 2 6)
|
|
77
|
-
M V30 END COLLECTION
|
|
78
|
-
M V30 END CTAB
|
|
79
|
-
M END`;
|
|
80
|
-
|
|
81
|
-
const GALNAC = `
|
|
82
|
-
Datagrok monomer library Nucleotides
|
|
83
|
-
|
|
84
|
-
0 0 0 0 0 999 V3000
|
|
85
|
-
M V30 BEGIN CTAB
|
|
86
|
-
M V30 COUNTS 111 113 0 0 0
|
|
87
|
-
M V30 BEGIN ATOM
|
|
88
|
-
M V30 1 O -20.7313 -0.7027 0 0
|
|
89
|
-
M V30 2 C -19.3976 0.0673 0 0
|
|
90
|
-
M V30 3 C -18.0638 -0.7027 0 0
|
|
91
|
-
M V30 4 C -16.7303 0.0673 0 0
|
|
92
|
-
M V30 5 N -15.3965 -0.7027 0 0
|
|
93
|
-
M V30 6 C -14.0628 0.0673 0 0
|
|
94
|
-
M V30 7 C -12.7293 -0.7027 0 0
|
|
95
|
-
M V30 8 C -11.3955 0.0673 0 0
|
|
96
|
-
M V30 9 C -10.062 -0.7027 0 0
|
|
97
|
-
M V30 10 C -8.7283 0.0673 0 0
|
|
98
|
-
M V30 11 N -7.3947 -0.7027 0 0
|
|
99
|
-
M V30 12 O -18.0638 -2.2427 0 0
|
|
100
|
-
M V30 13 O -14.0628 1.6073 0 0
|
|
101
|
-
M V30 14 O -8.7283 1.6073 0 0
|
|
102
|
-
M V30 15 C -5.8547 -0.7027 0 0
|
|
103
|
-
M V30 16 C -5.8547 0.8373 0 0
|
|
104
|
-
M V30 17 C -5.8547 -2.2427 0 0
|
|
105
|
-
M V30 18 C -3.4848 -3.0127 0 0
|
|
106
|
-
M V30 19 C -2.4544 -4.157 0 0
|
|
107
|
-
M V30 20 C -0.948 -3.8368 0 0
|
|
108
|
-
M V30 21 N 0.0824 -4.9813 0 0
|
|
109
|
-
M V30 22 C 1.5888 -4.6612 0 0
|
|
110
|
-
M V30 23 C 2.6192 -5.8056 0 0
|
|
111
|
-
M V30 24 C 4.1256 -5.4855 0 0
|
|
112
|
-
M V30 25 N 5.156 -6.6297 0 0
|
|
113
|
-
M V30 26 C 6.6624 -6.3096 0 0
|
|
114
|
-
M V30 27 C 7.6928 -7.4541 0 0
|
|
115
|
-
M V30 28 C 9.1992 -7.1339 0 0
|
|
116
|
-
M V30 29 C 10.2296 -8.2784 0 0
|
|
117
|
-
M V30 30 C 11.736 -7.9583 0 0
|
|
118
|
-
M V30 31 O 12.7664 -9.1027 0 0
|
|
119
|
-
M V30 32 O -0.4722 -2.3723 0 0
|
|
120
|
-
M V30 33 O 7.1382 -4.845 0 0
|
|
121
|
-
M V30 34 C 14.2728 -8.7824 0 0
|
|
122
|
-
M V30 35 C 15.3032 -9.9267 0 0
|
|
123
|
-
M V30 36 C 16.8098 -9.6065 0 0
|
|
124
|
-
M V30 37 C 17.2856 -8.1421 0 0
|
|
125
|
-
M V30 38 C 16.2552 -6.9975 0 0
|
|
126
|
-
M V30 39 O 14.7486 -7.3178 0 0
|
|
127
|
-
M V30 40 C 16.7312 -5.5329 0 0
|
|
128
|
-
M V30 41 O 18.7918 -7.8218 0 0
|
|
129
|
-
M V30 42 O 17.8404 -10.751 0 0
|
|
130
|
-
M V30 43 N 14.8274 -11.3914 0 0
|
|
131
|
-
M V30 44 C 15.7325 -12.6372 0 0
|
|
132
|
-
M V30 45 C 15.2567 -14.1018 0 0
|
|
133
|
-
M V30 46 O 17.2537 -12.3963 0 0
|
|
134
|
-
M V30 47 O 18.2628 -5.372 0 0
|
|
135
|
-
M V30 48 O -4.9494 -3.4885 0 0
|
|
136
|
-
M V30 49 C -4.521 0.0673 0 0
|
|
137
|
-
M V30 50 C -1.9414 0.2026 0 0
|
|
138
|
-
M V30 51 C -0.6077 -0.5674 0 0
|
|
139
|
-
M V30 52 C 0.726 0.2026 0 0
|
|
140
|
-
M V30 53 N 2.0596 -0.5674 0 0
|
|
141
|
-
M V30 54 C 3.3933 0.2026 0 0
|
|
142
|
-
M V30 55 C 4.7271 -0.5674 0 0
|
|
143
|
-
M V30 56 C 6.0606 0.2026 0 0
|
|
144
|
-
M V30 57 N 7.3943 -0.5674 0 0
|
|
145
|
-
M V30 58 C 8.7281 0.2026 0 0
|
|
146
|
-
M V30 59 C 10.0618 -0.5674 0 0
|
|
147
|
-
M V30 60 C 11.3953 0.2026 0 0
|
|
148
|
-
M V30 61 C 14.0628 0.2026 0 0
|
|
149
|
-
M V30 62 O 15.3964 -0.5674 0 0
|
|
150
|
-
M V30 63 O 0.726 1.7426 0 0
|
|
151
|
-
M V30 64 O 8.7281 1.7426 0 0
|
|
152
|
-
M V30 65 C 16.7301 0.2026 0 0
|
|
153
|
-
M V30 66 C 18.0638 -0.5676 0 0
|
|
154
|
-
M V30 67 C 19.3976 0.2026 0 0
|
|
155
|
-
M V30 68 C 19.3974 1.7426 0 0
|
|
156
|
-
M V30 69 C 18.0638 2.5126 0 0
|
|
157
|
-
M V30 70 O 16.7301 1.7426 0 0
|
|
158
|
-
M V30 71 C 18.064 4.0526 0 0
|
|
159
|
-
M V30 72 O 20.7311 2.5126 0 0
|
|
160
|
-
M V30 73 O 20.7313 -0.5674 0 0
|
|
161
|
-
M V30 74 N 18.0638 -2.1076 0 0
|
|
162
|
-
M V30 75 C 19.3096 -3.0127 0 0
|
|
163
|
-
M V30 76 C 19.3096 -4.5527 0 0
|
|
164
|
-
M V30 77 O 20.6818 -2.3135 0 0
|
|
165
|
-
M V30 78 O 19.4709 4.6791 0 0
|
|
166
|
-
M V30 79 O -3.1872 -0.7027 0 0
|
|
167
|
-
M V30 80 C 12.7291 -0.5674 0 0
|
|
168
|
-
M V30 81 C -3.919 3.2277 0 0
|
|
169
|
-
M V30 82 C -2.4126 2.9076 0 0
|
|
170
|
-
M V30 83 C -1.3822 4.0519 0 0
|
|
171
|
-
M V30 84 N 0.1242 3.7317 0 0
|
|
172
|
-
M V30 85 C 1.1546 4.8762 0 0
|
|
173
|
-
M V30 86 C 2.661 4.5561 0 0
|
|
174
|
-
M V30 87 C 3.6914 5.7005 0 0
|
|
175
|
-
M V30 88 N 5.1978 5.3804 0 0
|
|
176
|
-
M V30 89 C 6.2282 6.5248 0 0
|
|
177
|
-
M V30 90 C 7.7346 6.2045 0 0
|
|
178
|
-
M V30 91 C 8.765 7.349 0 0
|
|
179
|
-
M V30 92 C 10.2714 7.0288 0 0
|
|
180
|
-
M V30 93 C 11.3018 8.1733 0 0
|
|
181
|
-
M V30 94 O 12.8082 7.8532 0 0
|
|
182
|
-
M V30 95 O -1.858 5.5167 0 0
|
|
183
|
-
M V30 96 O 5.7524 7.9894 0 0
|
|
184
|
-
M V30 97 C 13.8386 8.9976 0 0
|
|
185
|
-
M V30 98 C 15.345 8.6773 0 0
|
|
186
|
-
M V30 99 C 16.3756 9.8219 0 0
|
|
187
|
-
M V30 100 C 15.8996 11.2863 0 0
|
|
188
|
-
M V30 101 C 14.3934 11.6068 0 0
|
|
189
|
-
M V30 102 O 13.3628 10.4622 0 0
|
|
190
|
-
M V30 103 C 13.9176 13.0714 0 0
|
|
191
|
-
M V30 104 O 16.93 12.4308 0 0
|
|
192
|
-
M V30 105 O 17.882 9.5018 0 0
|
|
193
|
-
M V30 106 N 15.8208 7.2127 0 0
|
|
194
|
-
M V30 107 C 17.2856 6.7367 0 0
|
|
195
|
-
M V30 108 C 17.7614 5.2721 0 0
|
|
196
|
-
M V30 109 O 18.3744 7.8257 0 0
|
|
197
|
-
M V30 110 O 15.062 14.1018 0 0
|
|
198
|
-
M V30 111 O -4.8241 1.9817 0 0
|
|
199
|
-
M V30 END ATOM
|
|
200
|
-
M V30 BEGIN BOND
|
|
201
|
-
M V30 1 1 2 3
|
|
202
|
-
M V30 2 1 3 4
|
|
203
|
-
M V30 3 1 6 7
|
|
204
|
-
M V30 4 1 7 8
|
|
205
|
-
M V30 5 1 8 9
|
|
206
|
-
M V30 6 1 9 10
|
|
207
|
-
M V30 7 1 1 2
|
|
208
|
-
M V30 8 1 3 12
|
|
209
|
-
M V30 9 1 4 5
|
|
210
|
-
M V30 10 1 5 6
|
|
211
|
-
M V30 11 2 6 13
|
|
212
|
-
M V30 12 1 10 11
|
|
213
|
-
M V30 13 1 11 15
|
|
214
|
-
M V30 14 1 15 16
|
|
215
|
-
M V30 15 1 15 17
|
|
216
|
-
M V30 16 2 10 14
|
|
217
|
-
M V30 17 1 18 19
|
|
218
|
-
M V30 18 1 19 20
|
|
219
|
-
M V30 19 1 22 23
|
|
220
|
-
M V30 20 1 23 24
|
|
221
|
-
M V30 21 1 26 27
|
|
222
|
-
M V30 22 1 27 28
|
|
223
|
-
M V30 23 1 28 29
|
|
224
|
-
M V30 24 1 29 30
|
|
225
|
-
M V30 25 2 26 33
|
|
226
|
-
M V30 26 2 20 32
|
|
227
|
-
M V30 27 1 20 21
|
|
228
|
-
M V30 28 1 21 22
|
|
229
|
-
M V30 29 1 24 25
|
|
230
|
-
M V30 30 1 25 26
|
|
231
|
-
M V30 31 1 30 31
|
|
232
|
-
M V30 32 1 31 34
|
|
233
|
-
M V30 33 1 35 36
|
|
234
|
-
M V30 34 1 36 37
|
|
235
|
-
M V30 35 1 37 38
|
|
236
|
-
M V30 36 1 34 35
|
|
237
|
-
M V30 37 1 38 39
|
|
238
|
-
M V30 38 1 34 39
|
|
239
|
-
M V30 39 1 38 40
|
|
240
|
-
M V30 40 1 35 43
|
|
241
|
-
M V30 41 1 43 44
|
|
242
|
-
M V30 42 1 44 45
|
|
243
|
-
M V30 43 2 44 46
|
|
244
|
-
M V30 44 1 36 42
|
|
245
|
-
M V30 45 1 37 41
|
|
246
|
-
M V30 46 1 40 47
|
|
247
|
-
M V30 47 1 18 48
|
|
248
|
-
M V30 48 1 15 49
|
|
249
|
-
M V30 49 1 50 51
|
|
250
|
-
M V30 50 1 51 52
|
|
251
|
-
M V30 51 1 54 55
|
|
252
|
-
M V30 52 1 55 56
|
|
253
|
-
M V30 53 1 58 59
|
|
254
|
-
M V30 54 1 59 60
|
|
255
|
-
M V30 55 2 58 64
|
|
256
|
-
M V30 56 2 52 63
|
|
257
|
-
M V30 57 1 52 53
|
|
258
|
-
M V30 58 1 53 54
|
|
259
|
-
M V30 59 1 56 57
|
|
260
|
-
M V30 60 1 57 58
|
|
261
|
-
M V30 61 1 61 62
|
|
262
|
-
M V30 62 1 62 65
|
|
263
|
-
M V30 63 1 66 67
|
|
264
|
-
M V30 64 1 67 68
|
|
265
|
-
M V30 65 1 68 69
|
|
266
|
-
M V30 66 1 65 66
|
|
267
|
-
M V30 67 1 69 70
|
|
268
|
-
M V30 68 1 65 70
|
|
269
|
-
M V30 69 1 69 71
|
|
270
|
-
M V30 70 1 66 74
|
|
271
|
-
M V30 71 1 74 75
|
|
272
|
-
M V30 72 1 75 76
|
|
273
|
-
M V30 73 2 75 77
|
|
274
|
-
M V30 74 1 67 73
|
|
275
|
-
M V30 75 1 68 72
|
|
276
|
-
M V30 76 1 71 78
|
|
277
|
-
M V30 77 1 50 79
|
|
278
|
-
M V30 78 1 49 79
|
|
279
|
-
M V30 79 1 60 80
|
|
280
|
-
M V30 80 1 80 61
|
|
281
|
-
M V30 81 1 81 82
|
|
282
|
-
M V30 82 1 82 83
|
|
283
|
-
M V30 83 1 85 86
|
|
284
|
-
M V30 84 1 86 87
|
|
285
|
-
M V30 85 1 89 90
|
|
286
|
-
M V30 86 1 90 91
|
|
287
|
-
M V30 87 1 91 92
|
|
288
|
-
M V30 88 1 92 93
|
|
289
|
-
M V30 89 2 89 96
|
|
290
|
-
M V30 90 2 83 95
|
|
291
|
-
M V30 91 1 83 84
|
|
292
|
-
M V30 92 1 84 85
|
|
293
|
-
M V30 93 1 87 88
|
|
294
|
-
M V30 94 1 88 89
|
|
295
|
-
M V30 95 1 93 94
|
|
296
|
-
M V30 96 1 94 97
|
|
297
|
-
M V30 97 1 98 99
|
|
298
|
-
M V30 98 1 99 100
|
|
299
|
-
M V30 99 1 100 101
|
|
300
|
-
M V30 100 1 97 98
|
|
301
|
-
M V30 101 1 101 102
|
|
302
|
-
M V30 102 1 97 102
|
|
303
|
-
M V30 103 1 101 103
|
|
304
|
-
M V30 104 1 98 106
|
|
305
|
-
M V30 105 1 106 107
|
|
306
|
-
M V30 106 1 107 108
|
|
307
|
-
M V30 107 2 107 109
|
|
308
|
-
M V30 108 1 99 105
|
|
309
|
-
M V30 109 1 100 104
|
|
310
|
-
M V30 110 1 103 110
|
|
311
|
-
M V30 111 1 81 111
|
|
312
|
-
M V30 112 1 16 111
|
|
313
|
-
M V30 113 1 17 48
|
|
314
|
-
M V30 END BOND
|
|
315
|
-
M V30 END CTAB
|
|
316
|
-
M END`;
|
|
317
|
-
|
|
318
|
-
const GALNACPRIME = `
|
|
319
|
-
Datagrok monomer library Nucleotides
|
|
320
|
-
|
|
321
|
-
0 0 0 0 0 999 V3000
|
|
322
|
-
M V30 BEGIN CTAB
|
|
323
|
-
M V30 COUNTS 111 113 0 0 0
|
|
324
|
-
M V30 BEGIN ATOM
|
|
325
|
-
M V30 1 O 20.7313 0.7027 0 0
|
|
326
|
-
M V30 2 C 19.3976 -0.0673 0 0
|
|
327
|
-
M V30 3 C 18.0638 0.7027 0 0
|
|
328
|
-
M V30 4 C 16.7303 -0.0673 0 0
|
|
329
|
-
M V30 5 N 15.3965 0.7027 0 0
|
|
330
|
-
M V30 6 C 14.0628 -0.0673 0 0
|
|
331
|
-
M V30 7 C 12.7293 0.7027 0 0
|
|
332
|
-
M V30 8 C 11.3955 -0.0673 0 0
|
|
333
|
-
M V30 9 C 10.062 0.7027 0 0
|
|
334
|
-
M V30 10 C 8.7283 -0.0673 0 0
|
|
335
|
-
M V30 11 N 7.3947 0.7027 0 0
|
|
336
|
-
M V30 12 O 18.0638 2.2427 0 0
|
|
337
|
-
M V30 13 O 14.0628 -1.6073 0 0
|
|
338
|
-
M V30 14 O 8.7283 -1.6073 0 0
|
|
339
|
-
M V30 15 C 5.8547 0.7027 0 0
|
|
340
|
-
M V30 16 C 5.8547 -0.8373 0 0
|
|
341
|
-
M V30 17 C 5.8547 2.2427 0 0
|
|
342
|
-
M V30 18 C 3.4848 3.0127 0 0
|
|
343
|
-
M V30 19 C 2.4544 4.157 0 0
|
|
344
|
-
M V30 20 C 0.948 3.8368 0 0
|
|
345
|
-
M V30 21 N -0.0824 4.9813 0 0
|
|
346
|
-
M V30 22 C -1.5888 4.6612 0 0
|
|
347
|
-
M V30 23 C -2.6192 5.8056 0 0
|
|
348
|
-
M V30 24 C -4.1256 5.4855 0 0
|
|
349
|
-
M V30 25 N -5.156 6.6297 0 0
|
|
350
|
-
M V30 26 C -6.6624 6.3096 0 0
|
|
351
|
-
M V30 27 C -7.6928 7.4541 0 0
|
|
352
|
-
M V30 28 C -9.1992 7.1339 0 0
|
|
353
|
-
M V30 29 C -10.2296 8.2784 0 0
|
|
354
|
-
M V30 30 C -11.736 7.9583 0 0
|
|
355
|
-
M V30 31 O -12.7664 9.1027 0 0
|
|
356
|
-
M V30 32 O 0.4722 2.3723 0 0
|
|
357
|
-
M V30 33 O -7.1382 4.845 0 0
|
|
358
|
-
M V30 34 C -14.2728 8.7824 0 0
|
|
359
|
-
M V30 35 C -15.3032 9.9267 0 0
|
|
360
|
-
M V30 36 C -16.8098 9.6065 0 0
|
|
361
|
-
M V30 37 C -17.2856 8.1421 0 0
|
|
362
|
-
M V30 38 C -16.2552 6.9975 0 0
|
|
363
|
-
M V30 39 O -14.7486 7.3178 0 0
|
|
364
|
-
M V30 40 C -16.7312 5.5329 0 0
|
|
365
|
-
M V30 41 O -18.7918 7.8218 0 0
|
|
366
|
-
M V30 42 O -17.8404 10.751 0 0
|
|
367
|
-
M V30 43 N -14.8274 11.3914 0 0
|
|
368
|
-
M V30 44 C -15.7325 12.6372 0 0
|
|
369
|
-
M V30 45 C -15.2567 14.1018 0 0
|
|
370
|
-
M V30 46 O -17.2537 12.3963 0 0
|
|
371
|
-
M V30 47 O -18.2628 5.372 0 0
|
|
372
|
-
M V30 48 O 4.9494 3.4885 0 0
|
|
373
|
-
M V30 49 C 4.521 -0.0673 0 0
|
|
374
|
-
M V30 50 C 1.9414 -0.2026 0 0
|
|
375
|
-
M V30 51 C 0.6077 0.5674 0 0
|
|
376
|
-
M V30 52 C -0.726 -0.2026 0 0
|
|
377
|
-
M V30 53 N -2.0596 0.5674 0 0
|
|
378
|
-
M V30 54 C -3.3933 -0.2026 0 0
|
|
379
|
-
M V30 55 C -4.7271 0.5674 0 0
|
|
380
|
-
M V30 56 C -6.0606 -0.2026 0 0
|
|
381
|
-
M V30 57 N -7.3943 0.5674 0 0
|
|
382
|
-
M V30 58 C -8.7281 -0.2026 0 0
|
|
383
|
-
M V30 59 C -10.0618 0.5674 0 0
|
|
384
|
-
M V30 60 C -11.3953 -0.2026 0 0
|
|
385
|
-
M V30 61 C -14.0628 -0.2026 0 0
|
|
386
|
-
M V30 62 O -15.3964 0.5674 0 0
|
|
387
|
-
M V30 63 O -0.726 -1.7426 0 0
|
|
388
|
-
M V30 64 O -8.7281 -1.7426 0 0
|
|
389
|
-
M V30 65 C -16.7301 -0.2026 0 0
|
|
390
|
-
M V30 66 C -18.0638 0.5676 0 0
|
|
391
|
-
M V30 67 C -19.3976 -0.2026 0 0
|
|
392
|
-
M V30 68 C -19.3974 -1.7426 0 0
|
|
393
|
-
M V30 69 C -18.0638 -2.5126 0 0
|
|
394
|
-
M V30 70 O -16.7301 -1.7426 0 0
|
|
395
|
-
M V30 71 C -18.064 -4.0526 0 0
|
|
396
|
-
M V30 72 O -20.7311 -2.5126 0 0
|
|
397
|
-
M V30 73 O -20.7313 0.5674 0 0
|
|
398
|
-
M V30 74 N -18.0638 2.1076 0 0
|
|
399
|
-
M V30 75 C -19.3096 3.0127 0 0
|
|
400
|
-
M V30 76 C -19.3096 4.5527 0 0
|
|
401
|
-
M V30 77 O -20.6818 2.3135 0 0
|
|
402
|
-
M V30 78 O -19.4709 -4.6791 0 0
|
|
403
|
-
M V30 79 O 3.1872 0.7027 0 0
|
|
404
|
-
M V30 80 C -12.7291 0.5674 0 0
|
|
405
|
-
M V30 81 C 3.919 -3.2277 0 0
|
|
406
|
-
M V30 82 C 2.4126 -2.9076 0 0
|
|
407
|
-
M V30 83 C 1.3822 -4.0519 0 0
|
|
408
|
-
M V30 84 N -0.1242 -3.7317 0 0
|
|
409
|
-
M V30 85 C -1.1546 -4.8762 0 0
|
|
410
|
-
M V30 86 C -2.661 -4.5561 0 0
|
|
411
|
-
M V30 87 C -3.6914 -5.7005 0 0
|
|
412
|
-
M V30 88 N -5.1978 -5.3804 0 0
|
|
413
|
-
M V30 89 C -6.2282 -6.5248 0 0
|
|
414
|
-
M V30 90 C -7.7346 -6.2045 0 0
|
|
415
|
-
M V30 91 C -8.765 -7.349 0 0
|
|
416
|
-
M V30 92 C -10.2714 -7.0288 0 0
|
|
417
|
-
M V30 93 C -11.3018 -8.1733 0 0
|
|
418
|
-
M V30 94 O -12.8082 -7.8532 0 0
|
|
419
|
-
M V30 95 O 1.858 -5.5167 0 0
|
|
420
|
-
M V30 96 O -5.7524 -7.9894 0 0
|
|
421
|
-
M V30 97 C -13.8386 -8.9976 0 0
|
|
422
|
-
M V30 98 C -15.345 -8.6773 0 0
|
|
423
|
-
M V30 99 C -16.3756 -9.8219 0 0
|
|
424
|
-
M V30 100 C -15.8996 -11.2863 0 0
|
|
425
|
-
M V30 101 C -14.3934 -11.6068 0 0
|
|
426
|
-
M V30 102 O -13.3628 -10.4622 0 0
|
|
427
|
-
M V30 103 C -13.9176 -13.0714 0 0
|
|
428
|
-
M V30 104 O -16.93 -12.4308 0 0
|
|
429
|
-
M V30 105 O -17.882 -9.5018 0 0
|
|
430
|
-
M V30 106 N -15.8208 -7.2127 0 0
|
|
431
|
-
M V30 107 C -17.2856 -6.7367 0 0
|
|
432
|
-
M V30 108 C -17.7614 -5.2721 0 0
|
|
433
|
-
M V30 109 O -18.3744 -7.8257 0 0
|
|
434
|
-
M V30 110 O -15.062 -14.1018 0 0
|
|
435
|
-
M V30 111 O 4.8241 -1.9817 0 0
|
|
436
|
-
M V30 END ATOM
|
|
437
|
-
M V30 BEGIN BOND
|
|
438
|
-
M V30 1 1 2 3
|
|
439
|
-
M V30 2 1 3 4
|
|
440
|
-
M V30 3 1 6 7
|
|
441
|
-
M V30 4 1 7 8
|
|
442
|
-
M V30 5 1 8 9
|
|
443
|
-
M V30 6 1 9 10
|
|
444
|
-
M V30 7 1 1 2
|
|
445
|
-
M V30 8 1 3 12
|
|
446
|
-
M V30 9 1 4 5
|
|
447
|
-
M V30 10 1 5 6
|
|
448
|
-
M V30 11 2 6 13
|
|
449
|
-
M V30 12 1 10 11
|
|
450
|
-
M V30 13 1 11 15
|
|
451
|
-
M V30 14 1 15 16
|
|
452
|
-
M V30 15 1 15 17
|
|
453
|
-
M V30 16 2 10 14
|
|
454
|
-
M V30 17 1 18 19
|
|
455
|
-
M V30 18 1 19 20
|
|
456
|
-
M V30 19 1 22 23
|
|
457
|
-
M V30 20 1 23 24
|
|
458
|
-
M V30 21 1 26 27
|
|
459
|
-
M V30 22 1 27 28
|
|
460
|
-
M V30 23 1 28 29
|
|
461
|
-
M V30 24 1 29 30
|
|
462
|
-
M V30 25 2 26 33
|
|
463
|
-
M V30 26 2 20 32
|
|
464
|
-
M V30 27 1 20 21
|
|
465
|
-
M V30 28 1 21 22
|
|
466
|
-
M V30 29 1 24 25
|
|
467
|
-
M V30 30 1 25 26
|
|
468
|
-
M V30 31 1 30 31
|
|
469
|
-
M V30 32 1 31 34
|
|
470
|
-
M V30 33 1 35 36
|
|
471
|
-
M V30 34 1 36 37
|
|
472
|
-
M V30 35 1 37 38
|
|
473
|
-
M V30 36 1 34 35
|
|
474
|
-
M V30 37 1 38 39
|
|
475
|
-
M V30 38 1 34 39
|
|
476
|
-
M V30 39 1 38 40
|
|
477
|
-
M V30 40 1 35 43
|
|
478
|
-
M V30 41 1 43 44
|
|
479
|
-
M V30 42 1 44 45
|
|
480
|
-
M V30 43 2 44 46
|
|
481
|
-
M V30 44 1 36 42
|
|
482
|
-
M V30 45 1 37 41
|
|
483
|
-
M V30 46 1 40 47
|
|
484
|
-
M V30 47 1 18 48
|
|
485
|
-
M V30 48 1 15 49
|
|
486
|
-
M V30 49 1 50 51
|
|
487
|
-
M V30 50 1 51 52
|
|
488
|
-
M V30 51 1 54 55
|
|
489
|
-
M V30 52 1 55 56
|
|
490
|
-
M V30 53 1 58 59
|
|
491
|
-
M V30 54 1 59 60
|
|
492
|
-
M V30 55 2 58 64
|
|
493
|
-
M V30 56 2 52 63
|
|
494
|
-
M V30 57 1 52 53
|
|
495
|
-
M V30 58 1 53 54
|
|
496
|
-
M V30 59 1 56 57
|
|
497
|
-
M V30 60 1 57 58
|
|
498
|
-
M V30 61 1 61 62
|
|
499
|
-
M V30 62 1 62 65
|
|
500
|
-
M V30 63 1 66 67
|
|
501
|
-
M V30 64 1 67 68
|
|
502
|
-
M V30 65 1 68 69
|
|
503
|
-
M V30 66 1 65 66
|
|
504
|
-
M V30 67 1 69 70
|
|
505
|
-
M V30 68 1 65 70
|
|
506
|
-
M V30 69 1 69 71
|
|
507
|
-
M V30 70 1 66 74
|
|
508
|
-
M V30 71 1 74 75
|
|
509
|
-
M V30 72 1 75 76
|
|
510
|
-
M V30 73 2 75 77
|
|
511
|
-
M V30 74 1 67 73
|
|
512
|
-
M V30 75 1 68 72
|
|
513
|
-
M V30 76 1 71 78
|
|
514
|
-
M V30 77 1 50 79
|
|
515
|
-
M V30 78 1 49 79
|
|
516
|
-
M V30 79 1 60 80
|
|
517
|
-
M V30 80 1 80 61
|
|
518
|
-
M V30 81 1 81 82
|
|
519
|
-
M V30 82 1 82 83
|
|
520
|
-
M V30 83 1 85 86
|
|
521
|
-
M V30 84 1 86 87
|
|
522
|
-
M V30 85 1 89 90
|
|
523
|
-
M V30 86 1 90 91
|
|
524
|
-
M V30 87 1 91 92
|
|
525
|
-
M V30 88 1 92 93
|
|
526
|
-
M V30 89 2 89 96
|
|
527
|
-
M V30 90 2 83 95
|
|
528
|
-
M V30 91 1 83 84
|
|
529
|
-
M V30 92 1 84 85
|
|
530
|
-
M V30 93 1 87 88
|
|
531
|
-
M V30 94 1 88 89
|
|
532
|
-
M V30 95 1 93 94
|
|
533
|
-
M V30 96 1 94 97
|
|
534
|
-
M V30 97 1 98 99
|
|
535
|
-
M V30 98 1 99 100
|
|
536
|
-
M V30 99 1 100 101
|
|
537
|
-
M V30 100 1 97 98
|
|
538
|
-
M V30 101 1 101 102
|
|
539
|
-
M V30 102 1 97 102
|
|
540
|
-
M V30 103 1 101 103
|
|
541
|
-
M V30 104 1 98 106
|
|
542
|
-
M V30 105 1 106 107
|
|
543
|
-
M V30 106 1 107 108
|
|
544
|
-
M V30 107 2 107 109
|
|
545
|
-
M V30 108 1 99 105
|
|
546
|
-
M V30 109 1 100 104
|
|
547
|
-
M V30 110 1 103 110
|
|
548
|
-
M V30 111 1 81 111
|
|
549
|
-
M V30 112 1 16 111
|
|
550
|
-
M V30 113 1 17 48
|
|
551
|
-
M V30 END BOND
|
|
552
|
-
M V30 END CTAB
|
|
553
|
-
M END`;
|
|
554
|
-
|
|
555
|
-
export function getNucleotidesMol(smilesCodes: string[]) {
|
|
1
|
+
export function getNucleotidesMol(codes: string[]) {
|
|
556
2
|
const molBlocks: string[] = [];
|
|
557
3
|
|
|
558
|
-
for (let i = 0; i < smilesCodes.length - 1; i++) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
4
|
+
// for (let i = 0; i < smilesCodes.length - 1; i++) {
|
|
5
|
+
// smilesCodes[i] == 'OP(=O)(O)O' ? molBlocks.push(PHOSHATE) :
|
|
6
|
+
// smilesCodes[i] == 'OP(=O)(S)O' ? molBlocks.push(THIOPHOSHATE) :
|
|
7
|
+
// smilesCodes[i] == 'O[C@@H]1C[C@@H]O[C@H]1CO' ? molBlocks.push(rotateNucleotidesV3000(INVABASIC)) :
|
|
8
|
+
// smilesCodes[i] == 'OCC(O)CNC(=O)CCCC(=O)NC(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)' ? molBlocks.push(GALNAC) :
|
|
9
|
+
// smilesCodes[i] == 'C(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)(COCCC(=O)NCCCNC(=O)CCCCOC2OC(CO)C(O)C(O)C2NC(=O)C)NC(=O)CCCC(=O)NCC(O)CO' ? molBlocks.push(GALNACPRIME) :
|
|
10
|
+
// molBlocks.push(rotateNucleotidesV3000(smilesCodes[i]));
|
|
11
|
+
// }
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < codes.length - 1; i++) {
|
|
14
|
+
if(codes[i].includes('MODIFICATION')) {
|
|
15
|
+
if(i == 0)
|
|
16
|
+
molBlocks.push(reflect(codes[i]));
|
|
17
|
+
else
|
|
18
|
+
molBlocks.push(codes[i]);
|
|
19
|
+
}
|
|
20
|
+
else
|
|
21
|
+
molBlocks.push(rotateNucleotidesV3000(codes[i]));
|
|
565
22
|
}
|
|
566
23
|
|
|
567
|
-
return linkV3000(molBlocks
|
|
24
|
+
return linkV3000(molBlocks);
|
|
568
25
|
}
|
|
569
26
|
|
|
570
|
-
export function
|
|
27
|
+
export function linkStrandsV3000(strands:{senseStrands: string[], antiStrands: string[]}, useChirality: boolean = true) {
|
|
571
28
|
let macroMolBlock = '\nDatagrok macromolecule handler\n\n';
|
|
572
29
|
macroMolBlock += ' 0 0 0 0 0 0 999 V3000\n';
|
|
573
30
|
macroMolBlock += 'M V30 BEGIN CTAB\n';
|
|
@@ -579,18 +36,34 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
579
36
|
let nbond = 0;
|
|
580
37
|
let xShift = 0;
|
|
581
38
|
|
|
582
|
-
if (twoChains && molBlocks.length > 1)
|
|
583
|
-
|
|
39
|
+
// if (twoChains && molBlocks.length > 1)
|
|
40
|
+
// molBlocks[1] = invertNucleotidesV3000(molBlocks[1]);
|
|
41
|
+
|
|
42
|
+
if (strands.antiStrands.length > 0) {
|
|
43
|
+
for(let i = 0; i < strands.antiStrands.length; i++) {
|
|
44
|
+
strands.antiStrands[i] = invertNucleotidesV3000(strands.antiStrands[i]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let inverted = false;
|
|
49
|
+
let molBlocks = strands.senseStrands.concat(strands.antiStrands);
|
|
584
50
|
|
|
585
51
|
for (let i = 0; i < molBlocks.length; i++) {
|
|
52
|
+
|
|
53
|
+
if (i >= strands.senseStrands.length && inverted == false) {
|
|
54
|
+
inverted = true;
|
|
55
|
+
xShift = 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
586
59
|
molBlocks[i] = molBlocks[i].replaceAll('(-\nM V30 ', '(')
|
|
587
60
|
.replaceAll('-\nM V30 ', '').replaceAll(' )', ')');
|
|
588
61
|
const numbers = extractAtomsBondsNumbersV3000(molBlocks[i]);
|
|
589
62
|
const coordinates = extractAtomDataV3000(molBlocks[i]);
|
|
590
63
|
|
|
591
|
-
if (
|
|
592
|
-
const xShiftRight = Math.min(...coordinates.x);
|
|
593
|
-
const yShift =
|
|
64
|
+
if (inverted) {
|
|
65
|
+
const xShiftRight = Math.min(...coordinates.x) - xShift;
|
|
66
|
+
const yShift = !inverted ? Math.min(...coordinates.y) - 1 : Math.max(...coordinates.y) + 10;
|
|
594
67
|
for (let j = 0; j < coordinates.x.length; j++)
|
|
595
68
|
coordinates.x[j] -= xShiftRight;
|
|
596
69
|
for (let j = 0; j < coordinates.y.length; j++)
|
|
@@ -603,11 +76,176 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
603
76
|
let indexEnd = indexAtoms;
|
|
604
77
|
|
|
605
78
|
for (let j = 0; j < numbers.natom; j++) {
|
|
606
|
-
if (coordinates.atomIndex[j] != 1 || i == 0 || twoChains) {
|
|
79
|
+
// if (coordinates.atomIndex[j] != 1 || i == 0 || twoChains) {
|
|
80
|
+
//rewrite atom number
|
|
81
|
+
index = molBlocks[i].indexOf('V30', index) + 4;
|
|
82
|
+
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
83
|
+
const atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
84
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
85
|
+
|
|
86
|
+
//rewrite coordinates
|
|
87
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
88
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
89
|
+
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
90
|
+
|
|
91
|
+
const totalShift = true ? 0 : xShift - coordinates.x[0];
|
|
92
|
+
let coordinate = true ?
|
|
93
|
+
Math.round(10000*coordinates.x[j])/10000 :
|
|
94
|
+
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd)) + totalShift))/10000;
|
|
95
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
96
|
+
|
|
97
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
98
|
+
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
99
|
+
coordinate = true ?
|
|
100
|
+
Math.round(10000*coordinates.y[j])/10000 :
|
|
101
|
+
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd))))/10000;
|
|
102
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
103
|
+
|
|
104
|
+
index = molBlocks[i].indexOf('\n', index) + 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const indexAtomsEnd = molBlocks[i].indexOf('M V30 END ATOM');
|
|
108
|
+
atomBlock += molBlocks[i].substring(indexAtoms + 1, indexAtomsEnd);
|
|
109
|
+
|
|
110
|
+
let indexBonds = molBlocks[i].indexOf('M V30 BEGIN BOND'); // V3000 index for bonds
|
|
111
|
+
indexBonds = molBlocks[i].indexOf('\n', indexBonds);
|
|
112
|
+
index = indexBonds;
|
|
113
|
+
indexEnd = indexBonds;
|
|
114
|
+
|
|
115
|
+
for (let j = 0; j < numbers.nbond; j++) {
|
|
116
|
+
//rewrite bond number
|
|
117
|
+
index = molBlocks[i].indexOf('V30', index) + 4;
|
|
118
|
+
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
119
|
+
const bondNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + nbond;
|
|
120
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + bondNumber + molBlocks[i].slice(indexEnd);
|
|
121
|
+
|
|
122
|
+
//rewrite atom pair in bond
|
|
123
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
124
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
125
|
+
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
126
|
+
let atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
127
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
128
|
+
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
129
|
+
indexEnd = Math.min(molBlocks[i].indexOf('\n', index), molBlocks[i].indexOf(' ', index));
|
|
130
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
131
|
+
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
132
|
+
|
|
133
|
+
index = molBlocks[i].indexOf('\n', index) + 1;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const indexBondEnd = molBlocks[i].indexOf('M V30 END BOND');
|
|
137
|
+
bondBlock += molBlocks[i].substring(indexBonds + 1, indexBondEnd);
|
|
138
|
+
|
|
139
|
+
let indexCollection = molBlocks[i].indexOf('M V30 MDLV30/STEABS ATOMS=('); // V3000 index for collections
|
|
140
|
+
|
|
141
|
+
while (indexCollection != -1) {
|
|
142
|
+
indexCollection += 28;
|
|
143
|
+
const collectionEnd = molBlocks[i].indexOf(')', indexCollection);
|
|
144
|
+
const collectionEntries = molBlocks[i].substring(indexCollection, collectionEnd).split(' ').slice(1);
|
|
145
|
+
collectionEntries.forEach((e) => {
|
|
146
|
+
collection.push(parseInt(e) + natom);
|
|
147
|
+
});
|
|
148
|
+
indexCollection = collectionEnd;
|
|
149
|
+
indexCollection = molBlocks[i].indexOf('M V30 MDLV30/STEABS ATOMS=(', indexCollection);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
natom += true ? numbers.natom : numbers.natom - 1;
|
|
153
|
+
nbond += numbers.nbond;
|
|
154
|
+
xShift += Math.max(...coordinates.x) + 1;//twoChains ? 0 : coordinates.x[numbers.natom - 1] - coordinates.x[0];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const entries = 4;
|
|
158
|
+
const collNumber = Math.ceil(collection.length / entries);
|
|
159
|
+
|
|
160
|
+
//if (oclRender) {
|
|
161
|
+
// collectionBlock += 'M V30 MDLV30/STEABS ATOMS=(' + collection.length;
|
|
162
|
+
|
|
163
|
+
// for (let j = 0; j < collection.length; j++)
|
|
164
|
+
// collectionBlock += ' ' + collection[j];
|
|
165
|
+
|
|
166
|
+
// collectionBlock += ')\n';
|
|
167
|
+
//} else {
|
|
168
|
+
collectionBlock += 'M V30 MDLV30/STEABS ATOMS=(' + collection.length + ' -\n';
|
|
169
|
+
for (let i = 0; i < collNumber; i++) {
|
|
170
|
+
collectionBlock += 'M V30 ';
|
|
171
|
+
const entriesCurrent = i + 1 == collNumber ? collection.length - (collNumber - 1)*entries : entries;
|
|
172
|
+
for (let j = 0; j < entriesCurrent; j++) {
|
|
173
|
+
collectionBlock += (j + 1 == entriesCurrent) ?
|
|
174
|
+
(i == collNumber - 1 ? collection[entries*i + j] + ')\n' : collection[entries*i + j] + ' -\n') :
|
|
175
|
+
collection[entries*i + j] + ' ';
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//}
|
|
179
|
+
|
|
180
|
+
//generate file
|
|
181
|
+
true? natom : natom++;
|
|
182
|
+
macroMolBlock += 'M V30 COUNTS ' + natom + ' ' + nbond + ' 0 0 0\n';
|
|
183
|
+
macroMolBlock += 'M V30 BEGIN ATOM\n';
|
|
184
|
+
macroMolBlock += atomBlock;
|
|
185
|
+
macroMolBlock += 'M V30 END ATOM\n';
|
|
186
|
+
macroMolBlock += 'M V30 BEGIN BOND\n';
|
|
187
|
+
macroMolBlock += bondBlock;
|
|
188
|
+
macroMolBlock += 'M V30 END BOND\n';
|
|
189
|
+
if(useChirality){
|
|
190
|
+
macroMolBlock += 'M V30 BEGIN COLLECTION\n';
|
|
191
|
+
macroMolBlock += collectionBlock;
|
|
192
|
+
macroMolBlock += 'M V30 END COLLECTION\n';
|
|
193
|
+
} else
|
|
194
|
+
macroMolBlock = macroMolBlock.replace(/ CFG=\d/g, ' ');
|
|
195
|
+
|
|
196
|
+
macroMolBlock += 'M V30 END CTAB\n';
|
|
197
|
+
macroMolBlock += 'M END';
|
|
198
|
+
|
|
199
|
+
return macroMolBlock;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function linkV3000(molBlocks: string[], useChirality: boolean = true) {
|
|
203
|
+
let macroMolBlock = '\nDatagrok macromolecule handler\n\n';
|
|
204
|
+
macroMolBlock += ' 0 0 0 0 0 0 999 V3000\n';
|
|
205
|
+
macroMolBlock += 'M V30 BEGIN CTAB\n';
|
|
206
|
+
let atomBlock = '';
|
|
207
|
+
let bondBlock = '';
|
|
208
|
+
let collectionBlock = '';
|
|
209
|
+
const collection: number [] = [];
|
|
210
|
+
let natom = 0;
|
|
211
|
+
let nbond = 0;
|
|
212
|
+
let xShift = 0;
|
|
213
|
+
|
|
214
|
+
for (let i = 0; i < molBlocks.length; i++) {
|
|
215
|
+
const isBoundary = molBlocks[i].includes('MODIFICATION') && i == 0;
|
|
216
|
+
let specLength = 0;
|
|
217
|
+
if (isBoundary) {
|
|
218
|
+
const coordinates = extractAtomDataV3000(molBlocks[i]);
|
|
219
|
+
specLength = coordinates.atomIndex.length;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
molBlocks[i] = molBlocks[i].replaceAll('(-\nM V30 ', '(')
|
|
224
|
+
.replaceAll('-\nM V30 ', '').replaceAll(' )', ')');
|
|
225
|
+
const numbers = extractAtomsBondsNumbersV3000(molBlocks[i]);
|
|
226
|
+
const coordinates = extractAtomDataV3000(molBlocks[i]);
|
|
227
|
+
|
|
228
|
+
let indexAtoms = molBlocks[i].indexOf('M V30 BEGIN ATOM'); // V3000 index for atoms coordinates
|
|
229
|
+
indexAtoms = molBlocks[i].indexOf('\n', indexAtoms);
|
|
230
|
+
let index = indexAtoms;
|
|
231
|
+
let indexEnd = indexAtoms;
|
|
232
|
+
|
|
233
|
+
for (let j = 0; j < numbers.natom; j++) {
|
|
234
|
+
if (coordinates.atomIndex[j] != 1 || i == 0) {
|
|
607
235
|
//rewrite atom number
|
|
608
236
|
index = molBlocks[i].indexOf('V30', index) + 4;
|
|
609
237
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
610
|
-
|
|
238
|
+
let atomNumber = 0;
|
|
239
|
+
if(isBoundary) {
|
|
240
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd))
|
|
241
|
+
if(atomNumber == 1)
|
|
242
|
+
atomNumber = specLength;
|
|
243
|
+
else if(atomNumber == specLength)
|
|
244
|
+
atomNumber = 1;
|
|
245
|
+
atomNumber += natom;
|
|
246
|
+
} else {
|
|
247
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
248
|
+
}
|
|
611
249
|
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
612
250
|
|
|
613
251
|
//rewrite coordinates
|
|
@@ -615,16 +253,14 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
615
253
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
616
254
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
617
255
|
|
|
618
|
-
const totalShift =
|
|
619
|
-
let coordinate =
|
|
620
|
-
Math.round(10000*coordinates.x[j])/10000 :
|
|
256
|
+
const totalShift = xShift - coordinates.x[0];
|
|
257
|
+
let coordinate =
|
|
621
258
|
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd)) + totalShift))/10000;
|
|
622
259
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
623
260
|
|
|
624
261
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
625
262
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
626
|
-
coordinate =
|
|
627
|
-
Math.round(10000*coordinates.y[j])/10000 :
|
|
263
|
+
coordinate =
|
|
628
264
|
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd))))/10000;
|
|
629
265
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
630
266
|
|
|
@@ -655,11 +291,32 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
655
291
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
656
292
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
657
293
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
658
|
-
let atomNumber =
|
|
294
|
+
let atomNumber = 0;
|
|
295
|
+
if(isBoundary) {
|
|
296
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd))
|
|
297
|
+
if(atomNumber == 1)
|
|
298
|
+
atomNumber = specLength;
|
|
299
|
+
else if(atomNumber == specLength)
|
|
300
|
+
atomNumber = 1;
|
|
301
|
+
atomNumber += natom;
|
|
302
|
+
} else {
|
|
303
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
304
|
+
}
|
|
305
|
+
|
|
659
306
|
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
660
307
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
661
308
|
indexEnd = Math.min(molBlocks[i].indexOf('\n', index), molBlocks[i].indexOf(' ', index));
|
|
662
|
-
atomNumber =
|
|
309
|
+
atomNumber = 0;
|
|
310
|
+
if(isBoundary) {
|
|
311
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd))
|
|
312
|
+
if(atomNumber == 1)
|
|
313
|
+
atomNumber = specLength;
|
|
314
|
+
else if(atomNumber == specLength)
|
|
315
|
+
atomNumber = 1;
|
|
316
|
+
atomNumber += natom;
|
|
317
|
+
} else {
|
|
318
|
+
atomNumber = parseInt(molBlocks[i].substring(index, indexEnd)) + natom;
|
|
319
|
+
}
|
|
663
320
|
molBlocks[i] = molBlocks[i].slice(0, index) + atomNumber + molBlocks[i].slice(indexEnd);
|
|
664
321
|
|
|
665
322
|
index = molBlocks[i].indexOf('\n', index) + 1;
|
|
@@ -681,9 +338,12 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
681
338
|
indexCollection = molBlocks[i].indexOf('M V30 MDLV30/STEABS ATOMS=(', indexCollection);
|
|
682
339
|
}
|
|
683
340
|
|
|
684
|
-
natom +=
|
|
341
|
+
natom += numbers.natom - 1;
|
|
685
342
|
nbond += numbers.nbond;
|
|
686
|
-
|
|
343
|
+
if(isBoundary)
|
|
344
|
+
xShift += Math.max(...coordinates.x);
|
|
345
|
+
else
|
|
346
|
+
xShift += coordinates.x[numbers.natom - 1] - coordinates.x[0];
|
|
687
347
|
}
|
|
688
348
|
|
|
689
349
|
const entries = 4;
|
|
@@ -710,7 +370,7 @@ export function linkV3000(molBlocks: string[], twoChains: boolean = false, useCh
|
|
|
710
370
|
//}
|
|
711
371
|
|
|
712
372
|
//generate file
|
|
713
|
-
|
|
373
|
+
natom++;
|
|
714
374
|
macroMolBlock += 'M V30 COUNTS ' + natom + ' ' + nbond + ' 0 0 0\n';
|
|
715
375
|
macroMolBlock += 'M V30 BEGIN ATOM\n';
|
|
716
376
|
macroMolBlock += atomBlock;
|
|
@@ -760,7 +420,11 @@ function rotateNucleotidesV3000(molecule: string) {
|
|
|
760
420
|
angle = coordinates.x[indexFivePrime] > coordinates.x[indexThreePrime] ? Math.PI : 0;
|
|
761
421
|
else {
|
|
762
422
|
const derivative = coordinates.y[indexFivePrime]/coordinates.x[indexFivePrime];
|
|
763
|
-
angle = derivative > 0 ? Math.PI - Math.atan(derivative) :
|
|
423
|
+
angle = derivative > 0 ? Math.PI - Math.atan(derivative) :
|
|
424
|
+
(coordinates.x[indexFivePrime] < 0 ?
|
|
425
|
+
Math.atan(derivative) :
|
|
426
|
+
- Math.PI - Math.atan(derivative)
|
|
427
|
+
);
|
|
764
428
|
}
|
|
765
429
|
|
|
766
430
|
const cos = Math.cos(angle);
|
|
@@ -798,6 +462,55 @@ function rotateNucleotidesV3000(molecule: string) {
|
|
|
798
462
|
return molBlock;
|
|
799
463
|
}
|
|
800
464
|
|
|
465
|
+
function reflect(molecule: string) {
|
|
466
|
+
// @ts-ignore
|
|
467
|
+
let molBlock = molecule.includes('M END') ? molecule : OCL.Molecule.fromSmiles(molecule).toMolfileV3();
|
|
468
|
+
const coordinates = extractAtomDataV3000(molBlock);
|
|
469
|
+
const natom = coordinates.atomIndex.length;
|
|
470
|
+
|
|
471
|
+
const indexFivePrime = coordinates.atomIndex.indexOf(1);
|
|
472
|
+
const indexThreePrime = coordinates.atomIndex.indexOf(natom);
|
|
473
|
+
|
|
474
|
+
const xCenter = (coordinates.x[indexThreePrime] + coordinates.x[indexFivePrime])/2;
|
|
475
|
+
const yCenter = (coordinates.y[indexThreePrime] + coordinates.y[indexFivePrime])/2;
|
|
476
|
+
|
|
477
|
+
//place to center
|
|
478
|
+
for (let i = 0; i < natom; i++) {
|
|
479
|
+
coordinates.x[i] -= xCenter;
|
|
480
|
+
coordinates.y[i] -= yCenter;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
//place to center
|
|
484
|
+
for (let i = 0; i < natom; i++)
|
|
485
|
+
coordinates.x[i] = -coordinates.x[i];
|
|
486
|
+
|
|
487
|
+
//place to right
|
|
488
|
+
const xShift = coordinates.x[indexFivePrime];
|
|
489
|
+
for (let i = 0; i < natom; i++)
|
|
490
|
+
coordinates.x[i] -= xShift;
|
|
491
|
+
|
|
492
|
+
//rewrite molBlock
|
|
493
|
+
let index = molBlock.indexOf('M V30 BEGIN ATOM'); // V3000 index for atoms coordinates
|
|
494
|
+
index = molBlock.indexOf('\n', index);
|
|
495
|
+
let indexEnd = index;
|
|
496
|
+
for (let i = 0; i < natom; i++) {
|
|
497
|
+
index = molBlock.indexOf('V30', index) + 4;
|
|
498
|
+
index = molBlock.indexOf(' ', index) + 1;
|
|
499
|
+
index = molBlock.indexOf(' ', index) + 1;
|
|
500
|
+
indexEnd = molBlock.indexOf(' ', index) + 1;
|
|
501
|
+
indexEnd = molBlock.indexOf(' ', indexEnd);
|
|
502
|
+
|
|
503
|
+
molBlock = molBlock.slice(0, index) +
|
|
504
|
+
coordinates.x[i] + ' ' + coordinates.y[i] +
|
|
505
|
+
molBlock.slice(indexEnd);
|
|
506
|
+
|
|
507
|
+
index = molBlock.indexOf('\n', index) + 1;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return molBlock;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
|
|
801
514
|
function invertNucleotidesV3000(molecule: string) {
|
|
802
515
|
// @ts-ignore
|
|
803
516
|
let molBlock = molecule.includes('M END') ? molecule : OCL.Molecule.fromSmiles(molecule).toMolfileV3();
|