@datagrok/sequence-translator 1.0.0 → 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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/sequence-translator",
|
|
3
3
|
"friendlyName": "Sequence Translator",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "SequenceTranslator is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform, used to translate [oligonucleotide](https://en.wikipedia.org/wiki/Oligonucleotide) sequences between [different representations](https://github.com/datagrok-ai/public/tree/master/packages/SequenceTranslator#sequence-representations).",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -93,7 +93,7 @@ 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
98
|
macroMolBlock += ' 0 0 0 0 0 0 999 V3000\n';
|
|
99
99
|
macroMolBlock += 'M V30 BEGIN CTAB\n';
|
|
@@ -103,10 +103,9 @@ 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++) {
|
|
@@ -114,13 +113,23 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
114
113
|
.replaceAll('-\nM V30 ', '').replaceAll(' )', ')');
|
|
115
114
|
const numbers = extractAtomsBondsNumbersV3000(molBlocks[i]);
|
|
116
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
|
+
|
|
117
126
|
let indexAtoms = molBlocks[i].indexOf('M V30 BEGIN ATOM'); // V3000 index for atoms coordinates
|
|
118
127
|
indexAtoms = molBlocks[i].indexOf('\n', indexAtoms);
|
|
119
128
|
let index = indexAtoms;
|
|
120
129
|
let indexEnd = indexAtoms;
|
|
121
130
|
|
|
122
131
|
for (let j = 0; j < numbers.natom; j++) {
|
|
123
|
-
if (coordinates.atomIndex[j] != 1 || i == 0 ||
|
|
132
|
+
if (coordinates.atomIndex[j] != 1 || i == 0 || twoChains) {
|
|
124
133
|
//rewrite atom number
|
|
125
134
|
index = molBlocks[i].indexOf('V30', index) + 4;
|
|
126
135
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
@@ -132,13 +141,17 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
132
141
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
133
142
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
134
143
|
|
|
135
|
-
const totalShift = xShift - coordinates.x[0];
|
|
136
|
-
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;
|
|
137
148
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
138
149
|
|
|
139
150
|
index = molBlocks[i].indexOf(' ', index) + 1;
|
|
140
151
|
indexEnd = molBlocks[i].indexOf(' ', index);
|
|
141
|
-
coordinate =
|
|
152
|
+
coordinate = twoChains ?
|
|
153
|
+
Math.round(10000*coordinates.y[j])/10000 :
|
|
154
|
+
Math.round(10000*(parseFloat(molBlocks[i].substring(index, indexEnd))))/10000;
|
|
142
155
|
molBlocks[i] = molBlocks[i].slice(0, index) + coordinate + molBlocks[i].slice(indexEnd);
|
|
143
156
|
|
|
144
157
|
index = molBlocks[i].indexOf('\n', index) + 1;
|
|
@@ -194,10 +207,9 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
194
207
|
indexCollection = molBlocks[i].indexOf('M V30 MDLV30/STEABS ATOMS=(', indexCollection);
|
|
195
208
|
}
|
|
196
209
|
|
|
197
|
-
natom +=
|
|
210
|
+
natom += twoChains ? numbers.natom : numbers.natom - 1;
|
|
198
211
|
nbond += numbers.nbond;
|
|
199
|
-
xShift +=
|
|
200
|
-
sequenceShift += twoMolecules ? -7 : 0;
|
|
212
|
+
xShift += twoChains ? 0 : coordinates.x[numbers.natom - 1] - coordinates.x[0];
|
|
201
213
|
}
|
|
202
214
|
|
|
203
215
|
const entries = 4;
|
|
@@ -224,7 +236,7 @@ export function linkV3000(molBlocks: string[], twoMolecules: boolean = false, oc
|
|
|
224
236
|
}
|
|
225
237
|
|
|
226
238
|
//generate file
|
|
227
|
-
|
|
239
|
+
twoChains? natom : natom++;
|
|
228
240
|
macroMolBlock += 'M V30 COUNTS ' + natom + ' ' + nbond + ' 0 0 0\n';
|
|
229
241
|
macroMolBlock += 'M V30 BEGIN ATOM\n';
|
|
230
242
|
macroMolBlock += atomBlock;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<html><head><meta charset="utf-8"/><title>SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=089b6516ed77. Commit
|
|
1
|
+
<html><head><meta charset="utf-8"/><title>SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=089b6516ed77. Commit 2280593f.</title><style type="text/css">html,
|
|
2
2
|
body {
|
|
3
3
|
font-family: Arial, Helvetica, sans-serif;
|
|
4
4
|
font-size: 1rem;
|
|
@@ -229,7 +229,7 @@ header {
|
|
|
229
229
|
font-size: 1rem;
|
|
230
230
|
padding: 0 0.5rem;
|
|
231
231
|
}
|
|
232
|
-
</style></head><body><div id="jesthtml-content"><header><h1 id="title">SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=089b6516ed77. Commit
|
|
232
|
+
</style></head><body><div id="jesthtml-content"><header><h1 id="title">SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=089b6516ed77. Commit 2280593f.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-06-09 16:25:38</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (1)</div><div class="summary-passed summary-empty">0 passed</div><div class="summary-failed">1 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></div><div id="suite-1" class="suite-container"><div class="suite-info"><div class="suite-path">/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts</div><div class="suite-time warn">13.491s</div></div><div class="suite-tests"><div class="test-result failed"><div class="test-info"><div class="test-suitename"> </div><div class="test-title">TEST</div><div class="test-status">failed</div><div class="test-duration">0.623s</div></div><div class="failureMessages"> <pre class="failureMsg">Error: Evaluation failed: Unable to find JS function "test"
|
|
233
233
|
at ExecutionContext._evaluateInternal (/home/runner/work/public/public/packages/SequenceTranslator/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
|
|
234
234
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)
|
|
235
235
|
at ExecutionContext.evaluate (/home/runner/work/public/public/packages/SequenceTranslator/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)</pre></div></div></div><div class="suite-consolelog"><div class="suite-consolelog-header">Console Log</div><div class="suite-consolelog-item"><pre class="suite-consolelog-item-origin"> at Object.<anonymous> (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/test-node.ts:62:11)
|