@datagrok/sequence-translator 1.0.10 → 1.0.12
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.12",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vadym Kovadlo",
|
|
7
7
|
"email": "vkovadlo@datagrok.ai"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@datagrok-libraries/utils": "^1.11.1",
|
|
17
17
|
"@types/react": "^18.0.15",
|
|
18
|
-
"datagrok-api": "^1.
|
|
18
|
+
"datagrok-api": "^1.7.2",
|
|
19
19
|
"datagrok-tools": "^4.1.2",
|
|
20
20
|
"npm": "^8.11.0",
|
|
21
21
|
"openchemlib": "6.0.1",
|
|
@@ -131,17 +131,20 @@ export function defineAxolabsPattern() {
|
|
|
131
131
|
asBases[i] = ui.choiceInput('', asBases[i].value, baseChoices, (v: string) => {
|
|
132
132
|
if (!enumerateModifications.includes(v)) {
|
|
133
133
|
enumerateModifications.push(v);
|
|
134
|
-
isEnumerateModificationsDiv.append(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
enumerateModifications.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
isEnumerateModificationsDiv.append(
|
|
135
|
+
ui.divText('', {style: {width: '25px'}}),
|
|
136
|
+
ui.boolInput(v, true, (boolV: boolean) => {
|
|
137
|
+
if (boolV) {
|
|
138
|
+
if (!enumerateModifications.includes(v))
|
|
139
|
+
enumerateModifications.push(v);
|
|
140
|
+
} else {
|
|
141
|
+
const index = enumerateModifications.indexOf(v, 0);
|
|
142
|
+
if (index > -1)
|
|
143
|
+
enumerateModifications.splice(index, 1);
|
|
144
|
+
}
|
|
145
|
+
updateSvgScheme();
|
|
146
|
+
}).root,
|
|
147
|
+
);
|
|
145
148
|
}
|
|
146
149
|
updateAsModification();
|
|
147
150
|
updateSvgScheme();
|
|
@@ -174,17 +177,20 @@ export function defineAxolabsPattern() {
|
|
|
174
177
|
ssBases[i] = ui.choiceInput('', ssBases[i].value, baseChoices, (v: string) => {
|
|
175
178
|
if (!enumerateModifications.includes(v)) {
|
|
176
179
|
enumerateModifications.push(v);
|
|
177
|
-
isEnumerateModificationsDiv.append(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
enumerateModifications.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
isEnumerateModificationsDiv.append(
|
|
181
|
+
ui.divText('', {style: {width: '25px'}}),
|
|
182
|
+
ui.boolInput(v, true, (boolV: boolean) => {
|
|
183
|
+
if (boolV) {
|
|
184
|
+
if (!enumerateModifications.includes(v))
|
|
185
|
+
enumerateModifications.push(v);
|
|
186
|
+
} else {
|
|
187
|
+
const index = enumerateModifications.indexOf(v, 0);
|
|
188
|
+
if (index > -1)
|
|
189
|
+
enumerateModifications.splice(index, 1);
|
|
190
|
+
}
|
|
191
|
+
updateSvgScheme();
|
|
192
|
+
}).root,
|
|
193
|
+
);
|
|
188
194
|
}
|
|
189
195
|
updateSsModification();
|
|
190
196
|
updateSvgScheme();
|
|
@@ -499,18 +505,20 @@ export function defineAxolabsPattern() {
|
|
|
499
505
|
const loadPatternDiv = ui.div([]);
|
|
500
506
|
const asModificationDiv = ui.div([]);
|
|
501
507
|
const firstAsPtoDiv = ui.div([]);
|
|
502
|
-
const isEnumerateModificationsDiv = ui.divH([
|
|
503
|
-
|
|
504
|
-
if (
|
|
505
|
-
enumerateModifications.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
508
|
+
const isEnumerateModificationsDiv = ui.divH([
|
|
509
|
+
ui.boolInput(defaultBase, true, (v: boolean) => {
|
|
510
|
+
if (v) {
|
|
511
|
+
if (!enumerateModifications.includes(defaultBase))
|
|
512
|
+
enumerateModifications.push(defaultBase);
|
|
513
|
+
} else {
|
|
514
|
+
const index = enumerateModifications.indexOf(defaultBase, 0);
|
|
515
|
+
if (index > -1)
|
|
516
|
+
enumerateModifications.splice(index, 1);
|
|
517
|
+
}
|
|
518
|
+
updateSvgScheme();
|
|
519
|
+
updateOutputExamples();
|
|
520
|
+
}).root,
|
|
521
|
+
]);
|
|
514
522
|
|
|
515
523
|
let ssBases = Array(defaultSequenceLength).fill(ui.choiceInput('', defaultBase, baseChoices));
|
|
516
524
|
let asBases = Array(defaultSequenceLength).fill(ui.choiceInput('', defaultBase, baseChoices));
|
package/src/axolabs/draw-svg.ts
CHANGED
|
@@ -35,11 +35,8 @@ function getTextWidth(text: string, font: number): number {
|
|
|
35
35
|
return 2 * context.measureText(text).width;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function getTextInsideCircle(
|
|
39
|
-
bases
|
|
40
|
-
numberOfNucleotides: number, enumerateModifications: string[]): string {
|
|
41
|
-
return (bases[index].slice(-3) == '(o)') || !enumerateModifications.includes(bases[index]) ? '' :
|
|
42
|
-
['A', 'G', 'C', 'U', 'T'].includes(bases[index]) ? bases[index] : String(numberOfNucleotides - nucleotideCounter);
|
|
38
|
+
function getTextInsideCircle(bases: string[], index: number): string {
|
|
39
|
+
return (bases[index].slice(-3) == '(o)' || !['A', 'G', 'C', 'U', 'T'].includes(bases[index])) ? '' : bases[index];
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
function getFontColorVisibleOnBackground(rgbString: string): string {
|
|
@@ -157,13 +154,15 @@ export function drawAxolabsPattern(
|
|
|
157
154
|
Math.max(xOfSsRightModifications, xOfAsRightModifications) +
|
|
158
155
|
widthOfLeftModification + baseDiameter * (Math.max(ssRightOverhangs, asRightOverhangs));
|
|
159
156
|
const yOfTitle = baseRadius;
|
|
157
|
+
const yOfSsNumbers = 2 * baseRadius;
|
|
158
|
+
const yOfAsNumbers = 8.5 * baseRadius;
|
|
160
159
|
const yOfSsTexts = 4 * baseRadius;
|
|
161
160
|
const yOfAsTexts = 7 * baseRadius;
|
|
162
161
|
const yOfComment = asExists ? 11 * baseRadius : 8.5 * baseRadius;
|
|
163
162
|
const yOfSsCircles = 3.5 * baseRadius;
|
|
164
163
|
const yOfAsCircles = 6.5 * baseRadius;
|
|
165
|
-
const yOfCirclesInLegends = asExists ? 9 * baseRadius : 6 * baseRadius;
|
|
166
|
-
const yOfTextLegend = asExists ?
|
|
164
|
+
const yOfCirclesInLegends = asExists ? 9.5 * baseRadius : 6 * baseRadius;
|
|
165
|
+
const yOfTextLegend = asExists ? 10 * baseRadius - 3 : yOfAsCircles - 3;
|
|
167
166
|
|
|
168
167
|
const image = svg.render(width, height);
|
|
169
168
|
|
|
@@ -188,14 +187,17 @@ export function drawAxolabsPattern(
|
|
|
188
187
|
}
|
|
189
188
|
let nucleotideCounter = numberOfSsNucleotides;
|
|
190
189
|
for (let i = ssBases.length - 1; i > -1; i--) {
|
|
190
|
+
const xOfNumbers = getXOfBaseCircles(i, ssRightOverhangs) +
|
|
191
|
+
getShiftToAlignNumberInsideCircle(ssBases, ssBases.length - i, numberOfSsNucleotides - nucleotideCounter);
|
|
191
192
|
if (ssBases[i].slice(-3) != '(o)')
|
|
192
193
|
nucleotideCounter--;
|
|
194
|
+
const n = (ssBases[i].slice(-3) != '(o)' && enumerateModifications.includes(ssBases[i])) ?
|
|
195
|
+
String(numberOfSsNucleotides - nucleotideCounter) : '';
|
|
193
196
|
image.append(
|
|
197
|
+
svg.text(n, xOfNumbers, yOfSsNumbers, legendFontSize, fontColor),
|
|
194
198
|
svg.circle(getXOfBaseCircles(i, ssRightOverhangs), yOfSsCircles, baseRadius, getBaseColor(ssBases[i])),
|
|
195
|
-
svg.text(getTextInsideCircle(ssBases, i,
|
|
196
|
-
|
|
197
|
-
getShiftToAlignNumberInsideCircle(ssBases, ssBases.length - i, numberOfSsNucleotides - nucleotideCounter),
|
|
198
|
-
yOfSsTexts, baseFontSize, getFontColorVisibleOnBackground(axolabsMap[ssBases[i]]['color'])),
|
|
199
|
+
svg.text(getTextInsideCircle(ssBases, i), xOfNumbers, yOfSsTexts, baseFontSize,
|
|
200
|
+
getFontColorVisibleOnBackground(getBaseColor(ssBases[i]))),
|
|
199
201
|
ssPtoStatuses[i] ?
|
|
200
202
|
svg.star(getXOfBaseCircles(i, ssRightOverhangs) + baseRadius, yOfSsTexts + psLinkageRadius, psLinkageColor) :
|
|
201
203
|
'',
|
|
@@ -217,13 +219,16 @@ export function drawAxolabsPattern(
|
|
|
217
219
|
for (let i = asBases.length - 1; i > -1; i--) {
|
|
218
220
|
if (asBases[i].slice(-3) != '(o)')
|
|
219
221
|
nucleotideCounter--;
|
|
222
|
+
const xOfNumbers = getXOfBaseCircles(i, asRightOverhangs) +
|
|
223
|
+
getShiftToAlignNumberInsideCircle(asBases, i, nucleotideCounter + 1);
|
|
224
|
+
const n = (asBases[i].slice(-3) != '(o)' && enumerateModifications.includes(asBases[i])) ?
|
|
225
|
+
String(nucleotideCounter + 1) : '';
|
|
220
226
|
image.append(
|
|
227
|
+
svg.text(n, xOfNumbers, yOfAsNumbers, legendFontSize, fontColor),
|
|
221
228
|
svg.circle(getXOfBaseCircles(i, asRightOverhangs), yOfAsCircles, baseRadius, getBaseColor(asBases[i])),
|
|
222
|
-
svg.text(getTextInsideCircle(
|
|
223
|
-
asBases, i,
|
|
224
|
-
|
|
225
|
-
getShiftToAlignNumberInsideCircle(asBases, i, nucleotideCounter + 1),
|
|
226
|
-
yOfAsTexts, baseFontSize, getFontColorVisibleOnBackground(axolabsMap[asBases[i]]['color'])),
|
|
229
|
+
svg.text(getTextInsideCircle(asBases, i),
|
|
230
|
+
getXOfBaseCircles(i, asRightOverhangs) + getShiftToAlignNumberInsideCircle(asBases, i, nucleotideCounter + 1),
|
|
231
|
+
yOfAsTexts, baseFontSize, getFontColorVisibleOnBackground(getBaseColor(asBases[i]))),
|
|
227
232
|
asPtoStatuses[i] ? svg.star(getXOfBaseCircles(i, asRightOverhangs) +
|
|
228
233
|
baseRadius, yOfAsTexts + psLinkageRadius, psLinkageColor) : '',
|
|
229
234
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<html><head><meta charset="utf-8"/><title>SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=
|
|
1
|
+
<html><head><meta charset="utf-8"/><title>SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=49ff04f38f57. Commit 128d0678.</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=
|
|
232
|
+
</style></head><body><div id="jesthtml-content"><header><h1 id="title">SequenceTranslator Test Report. Datagrok version datagrok/datagrok:latest SHA=49ff04f38f57. Commit 128d0678.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-10-24 16:17:41</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed">1 passed</div><div class="summary-failed summary-empty">0 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">1 passed</div><div class="summary-failed summary-empty">0 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">15.882s</div></div><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename"> </div><div class="test-title">TEST</div><div class="test-status">passed</div><div class="test-duration">1.582s</div></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)
|
|
233
233
|
at Generator.next (<anonymous>)
|
|
234
234
|
at fulfilled (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/test-node.ts:28:58)
|
|
235
235
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre><pre class="suite-consolelog-item-message">Using web root: http://localhost:8080</pre></div><div class="suite-consolelog-item"><pre class="suite-consolelog-item-origin"> at /home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts:40:11
|
|
@@ -243,14 +243,14 @@ header {
|
|
|
243
243
|
at Generator.next (<anonymous>)
|
|
244
244
|
at fulfilled (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts:28:58)
|
|
245
245
|
at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre><pre class="suite-consolelog-item-message">Test result : Success : 1 : SequenceTranslator.sequence-translator.usCfCfUfGfAf : OK
|
|
246
|
-
Test result : Success :
|
|
246
|
+
Test result : Success : 0 : SequenceTranslator.sequence-translator.usAfsusgsgsg : OK
|
|
247
247
|
Test result : Success : 1 : SequenceTranslator.sequence-translator.UfUfUfsCfsuacg : OK
|
|
248
248
|
Test result : Success : 0 : SequenceTranslator.sequence-translator.susususauasu : OK
|
|
249
249
|
Test result : Success : 0 : SequenceTranslator.sequence-translator.CfGfCfsGfsCf : OK
|
|
250
|
-
Test result : Success :
|
|
250
|
+
Test result : Success : 1 : SequenceTranslator.sequence-translator.acacacsacsac : OK
|
|
251
251
|
Test result : Success : 0 : SequenceTranslator.sequence-translator.cccgggusug : OK
|
|
252
|
-
Test result : Success :
|
|
253
|
-
Test result : Success :
|
|
252
|
+
Test result : Success : 1 : SequenceTranslator.sequence-translator.UfAfCfGfGfCfAfUf : OK
|
|
253
|
+
Test result : Success : 0 : SequenceTranslator.sequence-translator.(invabasic)cuCfuUfsc : OK
|
|
254
254
|
Test result : Success : 1 : SequenceTranslator.sequence-translator.(invabasic)usAfsucuCfuUfAfgcugUfgCfacususu : OK
|
|
255
|
-
Test result : Success :
|
|
255
|
+
Test result : Success : 0 : SequenceTranslator.sequence-translator.(invabasic)asacgGfuGfCfAfacucuauuca : OK
|
|
256
256
|
</pre></div></div></div></div></body></html>
|