@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,48 +1,70 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
1
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
import {download} from '../helpers';
|
|
2
6
|
import {sequenceToMolV3000} from '../structures-works/from-monomers';
|
|
3
|
-
import {
|
|
7
|
+
import {linkStrandsV3000} from '../structures-works/mol-transformations';
|
|
4
8
|
import {getFormat} from '../structures-works/sequence-codes-tools';
|
|
5
9
|
|
|
6
|
-
export function saveSdf(as: string, ss: string,
|
|
10
|
+
export function saveSdf(as: string, ss: string,
|
|
11
|
+
oneEntity: boolean, useChirality: boolean,
|
|
12
|
+
invertSS: boolean, invertAS: boolean,
|
|
13
|
+
as2: string | null = null, invertAS2: boolean | null) {
|
|
7
14
|
const formatAs = getFormat(as);
|
|
8
15
|
const formatSs = getFormat(ss);
|
|
16
|
+
let formatAs2: string | null = null;
|
|
17
|
+
let molAS2: string | null = null;
|
|
18
|
+
|
|
9
19
|
const molSS = sequenceToMolV3000(ss, invertSS, false, formatSs!);
|
|
10
20
|
const molAS = sequenceToMolV3000(as, invertAS, false, formatAs!);
|
|
21
|
+
|
|
22
|
+
if (as2 != null && as2 != '') {
|
|
23
|
+
formatAs2 = getFormat(as2!);
|
|
24
|
+
molAS2 = sequenceToMolV3000(as2, invertAS2!, false, formatAs2!);
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
let result: string;
|
|
12
|
-
if (oneEntity)
|
|
13
|
-
|
|
14
|
-
|
|
28
|
+
if (oneEntity) {
|
|
29
|
+
const antiStrands = molAS2 == null ? [molAS] : [molAS, molAS2];
|
|
30
|
+
result = linkStrandsV3000({senseStrands: [molSS], antiStrands: antiStrands}, useChirality) + '\n$$$$\n';
|
|
31
|
+
|
|
32
|
+
} else {
|
|
15
33
|
result =
|
|
16
34
|
molSS + '\n' +
|
|
17
35
|
`> <Sequence>\nSense Strand\n$$$$\n` +
|
|
18
36
|
molAS + '\n' +
|
|
19
37
|
`> <Sequence>\nAnti Sense\n$$$$\n`;
|
|
20
|
-
}
|
|
21
38
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
if (molAS2)
|
|
40
|
+
result += molAS2+ '\n' +
|
|
41
|
+
`> <Sequence>\nAnti Sense 2\n$$$$\n`;
|
|
42
|
+
}
|
|
43
|
+
download(ss.replace(/\s/g, '') + '.sdf', encodeURIComponent(result));
|
|
26
44
|
}
|
|
27
45
|
|
|
28
46
|
export function saveSenseAntiSense() {
|
|
29
47
|
const moleculeSvgDiv = ui.block([]);
|
|
30
48
|
const ssInput = ui.textInput('Sense Strand', '');
|
|
31
49
|
const asInput = ui.textInput('Anti Sense', '');
|
|
50
|
+
const asInput2 = ui.textInput('Anti Sense 2', '');
|
|
32
51
|
const straight = "5 prime -> 3 prime";
|
|
33
52
|
const inverse = "3 prime -> 5 prime";
|
|
34
53
|
let ssInverse = false;
|
|
35
54
|
let asInverse = false;
|
|
55
|
+
let as2Inverse = false;
|
|
36
56
|
|
|
37
57
|
const changeSense = ui.choiceInput('SS direction', straight, [straight, inverse]);
|
|
38
58
|
changeSense.onChanged(() => {ssInverse = changeSense.value == inverse;});
|
|
39
59
|
const changeAntiSense = ui.choiceInput('AS direction', straight, [straight, inverse]);
|
|
40
60
|
changeAntiSense.onChanged(() => {asInverse = changeAntiSense.value == inverse;});
|
|
61
|
+
const changeAntiSense2 = ui.choiceInput('AS 2 direction', straight, [straight, inverse]);
|
|
62
|
+
changeAntiSense2.onChanged(() => {asInverse = changeAntiSense.value == inverse;});
|
|
41
63
|
|
|
42
64
|
const saveOption = ui.switchInput('Save as one entity', true);
|
|
43
65
|
const chirality = ui.switchInput('Use chiral', true);
|
|
44
66
|
const saveBtn = ui.button('Save SDF', () =>
|
|
45
|
-
saveSdf(asInput.value, ssInput.value, saveOption.value, chirality.value, ssInverse, asInverse));
|
|
67
|
+
saveSdf(asInput.value, ssInput.value, saveOption.value, chirality.value, ssInverse, asInverse, asInput2.value, as2Inverse));
|
|
46
68
|
|
|
47
69
|
const saveSection = ui.panel([
|
|
48
70
|
ui.div([
|
|
@@ -51,9 +73,11 @@ export function saveSenseAntiSense() {
|
|
|
51
73
|
ui.divV([
|
|
52
74
|
ssInput,
|
|
53
75
|
asInput,
|
|
76
|
+
asInput2,
|
|
54
77
|
ui.div([changeSense], {style: {width: '40'}}),
|
|
55
78
|
changeSense,
|
|
56
79
|
changeAntiSense,
|
|
80
|
+
changeAntiSense2,
|
|
57
81
|
saveOption,
|
|
58
82
|
chirality,
|
|
59
83
|
ui.buttonsInput([saveBtn]),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {map, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS,
|
|
2
|
+
import {map, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS, DELIMITER, gcrsCodesWithoutSmiles, NUCLEOTIDES} from './map';
|
|
3
|
+
import {sortByStringLengthInDescendingOrder} from '../helpers';
|
|
3
4
|
import {asoGapmersNucleotidesToBioSpring, asoGapmersNucleotidesToGcrs,
|
|
4
5
|
asoGapmersBioSpringToNucleotides, asoGapmersBioSpringToGcrs, gcrsToMermade12, siRnaNucleotideToBioSpringSenseStrand,
|
|
5
6
|
siRnaNucleotideToAxolabsSenseStrand, siRnaNucleotidesToGcrs, siRnaBioSpringToNucleotides,
|
|
@@ -19,7 +20,6 @@ export function getFormat(sequence: string): string | null {
|
|
|
19
20
|
let outputIndex = 0;
|
|
20
21
|
|
|
21
22
|
const firstUniqueCharacters = ['r', 'd'];
|
|
22
|
-
const nucleotides = ['A', 'U', 'T', 'C', 'G'];
|
|
23
23
|
|
|
24
24
|
possibleSynthesizers.forEach((synthesizer) => {
|
|
25
25
|
const codes = getAllCodesOfSynthesizer(synthesizer);
|
|
@@ -31,13 +31,13 @@ export function getFormat(sequence: string): string | null {
|
|
|
31
31
|
|
|
32
32
|
if ( // for mistake pattern 'rAA'
|
|
33
33
|
outputIndex > 1 &&
|
|
34
|
-
|
|
34
|
+
NUCLEOTIDES.includes(sequence[outputIndex]) &&
|
|
35
35
|
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
36
36
|
) break;
|
|
37
37
|
|
|
38
38
|
if ( // for mistake pattern 'ArA'
|
|
39
39
|
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
40
|
-
|
|
40
|
+
NUCLEOTIDES.includes(sequence[outputIndex])
|
|
41
41
|
) {
|
|
42
42
|
outputIndex++;
|
|
43
43
|
break;
|
|
@@ -68,13 +68,13 @@ export function getFormat(sequence: string): string | null {
|
|
|
68
68
|
|
|
69
69
|
if ( // for mistake pattern 'rAA'
|
|
70
70
|
outputIndex > 1 &&
|
|
71
|
-
|
|
71
|
+
NUCLEOTIDES.includes(sequence[outputIndex]) &&
|
|
72
72
|
firstUniqueCharacters.includes(sequence[outputIndex - 2])
|
|
73
73
|
) break;
|
|
74
74
|
|
|
75
75
|
if ( // for mistake pattern 'ArA'
|
|
76
76
|
firstUniqueCharacters.includes(sequence[outputIndex + 1]) &&
|
|
77
|
-
|
|
77
|
+
NUCLEOTIDES.includes(sequence[outputIndex])
|
|
78
78
|
) {
|
|
79
79
|
outputIndex++;
|
|
80
80
|
break;
|
|
@@ -87,9 +87,6 @@ export function getFormat(sequence: string): string | null {
|
|
|
87
87
|
return possibleSynthesizers[0];
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
function sortByStringLengthInDescendingOrder(array: string[]): string[] {
|
|
91
|
-
return array.sort(function(a: string, b: string) {return b.length - a.length;});
|
|
92
|
-
}
|
|
93
90
|
|
|
94
91
|
export function isValidSequence(sequence: string, format: string | null): {
|
|
95
92
|
indexOfFirstNotValidChar: number,
|
|
@@ -118,7 +115,6 @@ export function isValidSequence(sequence: string, format: string | null): {
|
|
|
118
115
|
const outputIndices = Array(possibleSynthesizers.length).fill(0);
|
|
119
116
|
|
|
120
117
|
const firstUniqueCharacters = ['r', 'd'];
|
|
121
|
-
const nucleotides = ['A', 'U', 'T', 'C', 'G'];
|
|
122
118
|
possibleSynthesizers.forEach(function(synthesizer, i) {
|
|
123
119
|
const codes = sortByStringLengthInDescendingOrder(getAllCodesOfSynthesizer(synthesizer));
|
|
124
120
|
while (outputIndices[i] < sequence.length) {
|
|
@@ -129,13 +125,13 @@ export function isValidSequence(sequence: string, format: string | null): {
|
|
|
129
125
|
|
|
130
126
|
if ( // for mistake pattern 'rAA'
|
|
131
127
|
outputIndices[i] > 1 &&
|
|
132
|
-
|
|
128
|
+
NUCLEOTIDES.includes(sequence[outputIndices[i]]) &&
|
|
133
129
|
firstUniqueCharacters.includes(sequence[outputIndices[i] - 2])
|
|
134
130
|
) break;
|
|
135
131
|
|
|
136
132
|
if ( // for mistake pattern 'ArA'
|
|
137
133
|
firstUniqueCharacters.includes(sequence[outputIndices[i] + 1]) &&
|
|
138
|
-
|
|
134
|
+
NUCLEOTIDES.includes(sequence[outputIndices[i]])
|
|
139
135
|
) {
|
|
140
136
|
outputIndices[i]++;
|
|
141
137
|
break;
|
|
@@ -213,7 +209,7 @@ export function getAllCodesOfSynthesizer(synthesizer: string): string[] {
|
|
|
213
209
|
let codes: string[] = [];
|
|
214
210
|
for (const technology of Object.keys(map[synthesizer]))
|
|
215
211
|
codes = codes.concat(Object.keys(map[synthesizer][technology]));
|
|
216
|
-
return codes.concat(Object.keys(MODIFICATIONS)).concat(
|
|
212
|
+
return codes.concat(Object.keys(MODIFICATIONS)).concat(DELIMITER);
|
|
217
213
|
}
|
|
218
214
|
|
|
219
215
|
function getListOfPossibleSynthesizersByFirstMatchedCode(sequence: string): string[] {
|
|
@@ -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=e8c06047b7e7. Commit eb4db608.</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=e8c06047b7e7. Commit eb4db608.</h1></header><div id="metadata-container"><div id="timestamp">Started: 2022-11-22 12:28:58</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.587s</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">3.952s</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
|
|
@@ -239,7 +239,7 @@ header {
|
|
|
239
239
|
at Object.<anonymous>.__awaiter (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts:27:12)
|
|
240
240
|
at Object.<anonymous> (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts:38:23)
|
|
241
241
|
at Promise.then.completed (/home/runner/work/public/public/packages/SequenceTranslator/node_modules/jest-circus/build/utils.js:391:28)
|
|
242
|
-
at new Promise (<anonymous>)</pre><pre class="suite-consolelog-item-message">Testing SequenceTranslator package</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:
|
|
242
|
+
at new Promise (<anonymous>)</pre><pre class="suite-consolelog-item-message">Testing SequenceTranslator package</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:72:11
|
|
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
|
|
@@ -249,8 +249,11 @@ Test result : Success : 0 : SequenceTranslator.sequence-translator.susususauasu
|
|
|
249
249
|
Test result : Success : 0 : SequenceTranslator.sequence-translator.CfGfCfsGfsCf : OK
|
|
250
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 :
|
|
254
|
-
Test result : Success :
|
|
252
|
+
Test result : Success : 0 : SequenceTranslator.sequence-translator.UfAfCfGfGfCfAfUf : OK
|
|
253
|
+
Test result : Success : 1 : SequenceTranslator.sequence-translator.(invabasic)cuCfuUfsc : OK
|
|
254
|
+
Test result : Success : 0 : SequenceTranslator.sequence-translator.(invabasic)usAfsucuCfuUfAfgcugUfgCfacususu : OK
|
|
255
255
|
Test result : Success : 0 : SequenceTranslator.sequence-translator.(invabasic)asacgGfuGfCfAfacucuauuca : OK
|
|
256
|
-
</pre></div
|
|
256
|
+
</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:74:11
|
|
257
|
+
at Generator.next (<anonymous>)
|
|
258
|
+
at fulfilled (/home/runner/work/public/public/packages/SequenceTranslator/src/__jest__/remote.test.ts:28:58)
|
|
259
|
+
at processTicksAndRejections (internal/process/task_queues.js:97:5)</pre><pre class="suite-consolelog-item-message"/></div></div></div></div></body></html>
|