@datagrok/sequence-translator 1.0.5 → 1.0.7
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/detectors.js +10 -8
- package/dist/package-test.js +346 -310
- package/dist/package.js +169 -108
- package/package.json +8 -4
- package/src/__jest__/remote.test.ts +9 -8
- package/src/__jest__/test-node.ts +3 -2
- package/src/autostart/registration.ts +61 -41
- package/src/axolabs/define-pattern.ts +10 -0
- package/src/main/main-view.ts +11 -12
- package/src/structures-works/converters.ts +18 -9
- package/src/structures-works/from-monomers.ts +3 -2
- package/src/structures-works/map.ts +7 -0
- package/src/structures-works/mol-transformations.ts +18 -16
- package/src/structures-works/save-sense-antisense.ts +26 -13
- package/src/structures-works/sequence-codes-tools.ts +14 -6
- package/src/tests/smiles-tests.ts +279 -279
- package/test-SequenceTranslator-4ba776b36f56-5798c6fc.html +246 -0
- package/test-SequenceTranslator-4f0c8bae6479-6545fe31.html +0 -276
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {map, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS, delimiter} from './map';
|
|
2
|
+
import {map, SYNTHESIZERS, TECHNOLOGIES, MODIFICATIONS, delimiter, gcrsCodesWithoutSmiles} from './map';
|
|
3
3
|
import {asoGapmersNucleotidesToBioSpring, asoGapmersNucleotidesToGcrs,
|
|
4
4
|
asoGapmersBioSpringToNucleotides, asoGapmersBioSpringToGcrs, asoGapmersGcrsToNucleotides,
|
|
5
5
|
asoGapmersGcrsToBioSpring, gcrsToMermade12, siRnaNucleotideToBioSpringSenseStrand,
|
|
@@ -88,6 +88,10 @@ export function getFormat(sequence: string): string | null {
|
|
|
88
88
|
return possibleSynthesizers[0];
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
function sortByStringLengthInDescendingOrder(array: string[]): string[] {
|
|
92
|
+
return array.sort(function(a: string, b: string) {return b.length - a.length;});
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
export function isValidSequence(sequence: string, format: string | null): {
|
|
92
96
|
indexOfFirstNotValidChar: number,
|
|
93
97
|
synthesizer: string[] | null,
|
|
@@ -118,7 +122,7 @@ export function isValidSequence(sequence: string, format: string | null): {
|
|
|
118
122
|
const nucleotides = ['A', 'U', 'T', 'C', 'G'];
|
|
119
123
|
|
|
120
124
|
possibleSynthesizers.forEach((synthesizer) => {
|
|
121
|
-
const codes = getAllCodesOfSynthesizer(synthesizer);
|
|
125
|
+
const codes = sortByStringLengthInDescendingOrder(getAllCodesOfSynthesizer(synthesizer));
|
|
122
126
|
while (outputIndex < sequence.length) {
|
|
123
127
|
const matchedCode = codes.find((c) => c == sequence.slice(outputIndex, outputIndex + c.length));
|
|
124
128
|
|
|
@@ -166,8 +170,8 @@ export function isValidSequence(sequence: string, format: string | null): {
|
|
|
166
170
|
// })
|
|
167
171
|
// .show();
|
|
168
172
|
// } else if (possibleTechnologies.length == 0)
|
|
169
|
-
if (possibleTechnologies.length == 0)
|
|
170
|
-
|
|
173
|
+
// if (possibleTechnologies.length == 0)
|
|
174
|
+
// return {indexOfFirstNotValidChar: 0, synthesizer: [possibleSynthesizers[3]], technology: null};
|
|
171
175
|
|
|
172
176
|
outputIndex = 0;
|
|
173
177
|
|
|
@@ -212,9 +216,11 @@ export function getAllCodesOfSynthesizer(synthesizer: string): string[] {
|
|
|
212
216
|
}
|
|
213
217
|
|
|
214
218
|
function getListOfPossibleSynthesizersByFirstMatchedCode(sequence: string): string[] {
|
|
215
|
-
|
|
219
|
+
let synthesizers: string[] = [];
|
|
216
220
|
Object.keys(map).forEach((synthesizer: string) => {
|
|
217
|
-
|
|
221
|
+
let codes = sortByStringLengthInDescendingOrder(getAllCodesOfSynthesizer(synthesizer));
|
|
222
|
+
if (synthesizer == 'Janssen GCRS Codes')
|
|
223
|
+
codes = codes.concat(gcrsCodesWithoutSmiles);
|
|
218
224
|
//TODO: get first non-dropdown code when there are two modifications
|
|
219
225
|
let start = 0;
|
|
220
226
|
for (let i = 0; i < sequence.length; i++) {
|
|
@@ -223,6 +229,8 @@ function getListOfPossibleSynthesizersByFirstMatchedCode(sequence: string): stri
|
|
|
223
229
|
break;
|
|
224
230
|
}
|
|
225
231
|
}
|
|
232
|
+
if (gcrsCodesWithoutSmiles.some((s: string) => s == sequence.slice(start, start + s.length)))
|
|
233
|
+
synthesizers = ['Janssen GCRS Codes'];
|
|
226
234
|
if (codes.some((s: string) => s == sequence.slice(start, start + s.length)))
|
|
227
235
|
synthesizers.push(synthesizer);
|
|
228
236
|
});
|