@datagrok/sequence-translator 1.0.16 → 1.1.0
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/.eslintrc.json +4 -3
- package/CHANGELOG.md +3 -0
- package/detectors.js +8 -28
- package/dist/package-test.js +2 -72987
- package/dist/package-test.js.map +1 -0
- package/dist/package.js +2 -72192
- package/dist/package.js.map +1 -0
- package/files/axolabs-style.json +97 -0
- package/files/codes-to-symbols.json +66 -0
- package/files/formats-to-helm.json +59 -0
- package/files/linkers.json +22 -0
- package/files/monomer-lib.json +1094 -0
- package/link-bio +7 -0
- package/package.json +30 -26
- package/scripts/build-monomer-lib.py +391 -122
- package/src/demo/demo-st-ui.ts +71 -0
- package/src/demo/handle-error.ts +12 -0
- package/src/model/axolabs/axolabs-tab.ts +111 -0
- package/src/model/axolabs/const.ts +33 -0
- package/src/{axolabs → model/axolabs}/draw-svg.ts +1 -1
- package/src/{axolabs → model/axolabs}/helpers.ts +7 -5
- package/src/model/const.ts +19 -0
- package/src/model/data-loading-utils/const.ts +8 -0
- package/src/model/data-loading-utils/json-loader.ts +38 -0
- package/src/model/data-loading-utils/types.ts +30 -0
- package/src/model/format-translation/const.ts +8 -0
- package/src/model/format-translation/conversion-utils.ts +48 -0
- package/src/model/format-translation/format-converter.ts +107 -0
- package/src/model/helpers.ts +12 -0
- package/src/model/monomer-lib/const.ts +3 -0
- package/src/model/monomer-lib/lib-wrapper.ts +106 -0
- package/src/model/parsing-validation/format-detector.ts +57 -0
- package/src/model/parsing-validation/sequence-validator.ts +52 -0
- package/src/model/sequence-to-structure-utils/const.ts +1 -0
- package/src/{structures-works → model/sequence-to-structure-utils}/mol-transformations.ts +61 -87
- package/src/model/sequence-to-structure-utils/monomer-code-parser.ts +92 -0
- package/src/model/sequence-to-structure-utils/sdf-tab.ts +94 -0
- package/src/model/sequence-to-structure-utils/sequence-to-molfile.ts +409 -0
- package/src/package.ts +106 -77
- package/src/tests/const.ts +17 -0
- package/src/tests/smiles-tests.ts +32 -457
- package/src/view/const/main-tab.ts +3 -0
- package/src/view/const/view.ts +10 -0
- package/src/view/css/axolabs-tab.css +1 -0
- package/src/view/css/colored-text-input.css +27 -0
- package/src/view/css/main-tab.css +46 -0
- package/src/view/css/sdf-tab.css +39 -0
- package/src/view/monomer-lib-viewer/viewer.ts +22 -0
- package/src/view/tabs/axolabs.ts +720 -0
- package/src/view/tabs/main.ts +174 -0
- package/src/view/tabs/sdf.ts +173 -0
- package/src/view/utils/app-info-dialog.ts +18 -0
- package/src/view/utils/colored-input/colored-text-input.ts +56 -0
- package/src/view/utils/colored-input/input-painters.ts +44 -0
- package/src/view/utils/draw-molecule.ts +86 -0
- package/src/view/utils/molecule-img.ts +106 -0
- package/src/view/view.ts +129 -0
- package/tsconfig.json +12 -18
- package/webpack.config.js +17 -4
- package/README.md +0 -84
- package/css/style.css +0 -18
- package/img/Sequence Translator Axolabs.png +0 -0
- package/jest.config.js +0 -33
- package/setup-unlink-clean.cmd +0 -14
- package/setup.cmd +0 -14
- package/setup.sh +0 -37
- package/src/__jest__/remote.test.ts +0 -77
- package/src/__jest__/test-node.ts +0 -97
- package/src/apps/oligo-sd-file-app.ts +0 -58
- package/src/autostart/ICDs.ts +0 -3
- package/src/autostart/IDPs.ts +0 -3
- package/src/autostart/calculations.ts +0 -40
- package/src/autostart/constants.ts +0 -37
- package/src/autostart/registration.ts +0 -241
- package/src/autostart/salts.ts +0 -2
- package/src/autostart/sources.ts +0 -3
- package/src/autostart/users.ts +0 -3
- package/src/axolabs/constants.ts +0 -101
- package/src/axolabs/define-pattern.ts +0 -873
- package/src/helpers.ts +0 -28
- package/src/main/main-view.ts +0 -262
- package/src/structures-works/const.ts +0 -5
- package/src/structures-works/converters.ts +0 -323
- package/src/structures-works/from-monomers.ts +0 -267
- package/src/structures-works/map.ts +0 -720
- package/src/structures-works/save-sense-antisense.ts +0 -91
- package/src/structures-works/sequence-codes-tools.ts +0 -344
- package/src/utils/parse.ts +0 -27
- package/src/utils/sdf-add-columns.ts +0 -118
- package/src/utils/sdf-save-table.ts +0 -56
- package/test-SequenceTranslator-6288c2fbe346-cce4ac1d.html +0 -259
- package/vendors/openchemlib-full.js +0 -293
package/src/helpers.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as DG from 'datagrok-api/dg';
|
|
2
|
-
|
|
3
|
-
export function sortByStringLengthInDescendingOrder(array: string[]): string[] {
|
|
4
|
-
return array.sort(function(a, b) {return b.length - a.length;});
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function stringify(items: string[]): string {
|
|
8
|
-
return '["' + items.join('", "') + '"]';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function download(name: string, href: string): void {
|
|
12
|
-
const element = document.createElement('a');
|
|
13
|
-
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + href);
|
|
14
|
-
element.setAttribute('download', name);
|
|
15
|
-
element.click();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function removeEmptyRows(t: DG.DataFrame, colToCheck: DG.Column): DG.DataFrame {
|
|
19
|
-
for (let i = t.rowCount - 1; i > -1; i--) {
|
|
20
|
-
if (colToCheck.getString(i) == '')
|
|
21
|
-
t.rows.removeAt(i, 1, false);
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function differenceOfTwoArrays(a: string[], b: string[]): string[] {
|
|
27
|
-
return a.filter((x) => !b.includes(x));
|
|
28
|
-
}
|
package/src/main/main-view.ts
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
|
-
import * as ui from 'datagrok-api/ui';
|
|
3
|
-
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
|
|
5
|
-
import * as rxjs from 'rxjs';
|
|
6
|
-
import {convertSequence, undefinedInputSequence, isValidSequence} from '../structures-works/sequence-codes-tools';
|
|
7
|
-
import {map} from '../structures-works/map';
|
|
8
|
-
import {MODIFICATIONS} from '../structures-works/const';
|
|
9
|
-
import {sequenceToSmiles, sequenceToMolV3000} from '../structures-works/from-monomers';
|
|
10
|
-
import $ from 'cash-dom';
|
|
11
|
-
import {download} from '../helpers';
|
|
12
|
-
import {extractAtomDataV3000} from '../structures-works/mol-transformations';
|
|
13
|
-
import {errorToConsole} from '@datagrok-libraries/utils/src/to-console';
|
|
14
|
-
|
|
15
|
-
const defaultInput = 'fAmCmGmAmCpsmU'; // todo: capitalize constants
|
|
16
|
-
const sequenceWasCopied = 'Copied'; // todo: wrap hardcoded literals into constants
|
|
17
|
-
const tooltipSequence = 'Copy sequence';
|
|
18
|
-
|
|
19
|
-
export async function mainView(onSequenceChanged: (seq: string) => void): Promise<HTMLDivElement> {
|
|
20
|
-
const onInput: rxjs.Subject<string> = new rxjs.Subject<string>();
|
|
21
|
-
|
|
22
|
-
async function updateTableAndMolecule(sequence: string, inputFormat: string): Promise<void> {
|
|
23
|
-
moleculeSvgDiv.innerHTML = '';
|
|
24
|
-
outputTableDiv.innerHTML = '';
|
|
25
|
-
const pi = DG.TaskBarProgressIndicator.create('Rendering table and molecule...');
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
sequence = sequence.replace(/\s/g, '');
|
|
29
|
-
const output = isValidSequence(sequence, null);
|
|
30
|
-
inputFormatChoiceInput.value = output.synthesizer![0];
|
|
31
|
-
const outputSequenceObj = convertSequence(sequence, output);
|
|
32
|
-
const tableRows = [];
|
|
33
|
-
|
|
34
|
-
for (const key of Object.keys(outputSequenceObj).slice(1)) {
|
|
35
|
-
const indexOfFirstNotValidChar = ('indexOfFirstNotValidChar' in outputSequenceObj) ?
|
|
36
|
-
JSON.parse(outputSequenceObj.indexOfFirstNotValidChar!).indexOfFirstNotValidChar :
|
|
37
|
-
-1;
|
|
38
|
-
|
|
39
|
-
tableRows.push({
|
|
40
|
-
'key': key,
|
|
41
|
-
'value': ('indexOfFirstNotValidChar' in outputSequenceObj) ?
|
|
42
|
-
ui.divH([
|
|
43
|
-
ui.divText(sequence.slice(0, indexOfFirstNotValidChar), {style: {color: 'grey'}}),
|
|
44
|
-
ui.tooltip.bind(
|
|
45
|
-
ui.divText(sequence.slice(indexOfFirstNotValidChar), {style: {color: 'red'}}),
|
|
46
|
-
'Expected format: ' + JSON.parse(outputSequenceObj.indexOfFirstNotValidChar!).synthesizer +
|
|
47
|
-
'. See tables with valid codes on the right',
|
|
48
|
-
),
|
|
49
|
-
]) : //@ts-ignore
|
|
50
|
-
ui.link(outputSequenceObj[key], () => navigator.clipboard.writeText(outputSequenceObj[key])
|
|
51
|
-
.then(() => grok.shell.info(sequenceWasCopied)), tooltipSequence, ''),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
outputTableDiv.append(
|
|
56
|
-
ui.div([
|
|
57
|
-
DG.HtmlTable.create(tableRows, (item: { key: string; value: string; }) =>
|
|
58
|
-
[item.key, item.value], ['Code', 'Sequence']).root,
|
|
59
|
-
]),
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
if (outputSequenceObj.type != undefinedInputSequence && outputSequenceObj.Error != undefinedInputSequence) {
|
|
63
|
-
const formCanvasWidth = 500;
|
|
64
|
-
const formCanvasHeight = 170;
|
|
65
|
-
const formCanvas = ui.canvas(
|
|
66
|
-
formCanvasWidth * window.devicePixelRatio, formCanvasHeight * window.devicePixelRatio);
|
|
67
|
-
formCanvas.style.width = `${formCanvasWidth}px`;
|
|
68
|
-
formCanvas.style.height = `${formCanvasHeight}px`;
|
|
69
|
-
|
|
70
|
-
formCanvas.addEventListener('click', async () => {
|
|
71
|
-
try {
|
|
72
|
-
const mol = sequenceToMolV3000(
|
|
73
|
-
inputSequenceField.value.replace(/\s/g, ''), false, true,
|
|
74
|
-
output.synthesizer![0],
|
|
75
|
-
);
|
|
76
|
-
console.log(mol);
|
|
77
|
-
|
|
78
|
-
const addDiv = ui.div([], {style: {overflowX: 'scroll'}});
|
|
79
|
-
|
|
80
|
-
// addDiv size required, but now available before dialog show()
|
|
81
|
-
const coordinates = extractAtomDataV3000(mol);
|
|
82
|
-
const cw: number = $(window).width() * 0.80; // addDiv.clientWidth
|
|
83
|
-
const ch: number = $(window).height() * 0.70; // addDiv.clientHeight
|
|
84
|
-
const molWidth: number = Math.max(...coordinates.x) - Math.min(...coordinates.x);
|
|
85
|
-
const molHeight: number = Math.max(...coordinates.y) - Math.min(...coordinates.y);
|
|
86
|
-
|
|
87
|
-
const wR: number = cw / molWidth;
|
|
88
|
-
const hR: number = ch / molHeight;
|
|
89
|
-
const r: number = hR; // Math.max(wR, hR);
|
|
90
|
-
const dlgCanvasWidth = r * molWidth;
|
|
91
|
-
const dlgCanvasHeight = r * molHeight;
|
|
92
|
-
|
|
93
|
-
const dlgCanvas = ui.canvas(dlgCanvasWidth * window.devicePixelRatio, dlgCanvasHeight * window.devicePixelRatio);
|
|
94
|
-
dlgCanvas.style.width = `${dlgCanvasWidth}px`;
|
|
95
|
-
dlgCanvas.style.height = `${dlgCanvasHeight}px`;
|
|
96
|
-
|
|
97
|
-
// // @ts-ignore
|
|
98
|
-
// OCL.StructureView.drawMolecule(dlgCanvas, OCL.Molecule.fromMolfile(mol), {suppressChiralText: true});
|
|
99
|
-
// await grok.chem.canvasMol(0, 0, dlgCanvas.width, dlgCanvas.height, dlgCanvas, mol, null,
|
|
100
|
-
// {setNewCoords: false, normalizeDepiction: false, straightenDepiction: false});
|
|
101
|
-
await grok.functions.call('Chem:canvasMol', {
|
|
102
|
-
x: 0, y: 0, w: dlgCanvas.width, h: dlgCanvas.height, canvas: dlgCanvas,
|
|
103
|
-
molString: mol, scaffoldMolString: '',
|
|
104
|
-
options: {normalizeDepiction: false, straightenDepiction: false}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
addDiv.appendChild(dlgCanvas);
|
|
108
|
-
ui.dialog('Molecule: ' + inputSequenceField.value)
|
|
109
|
-
.add(addDiv)
|
|
110
|
-
.showModal(true);
|
|
111
|
-
} catch (err) {
|
|
112
|
-
const errStr = errorToConsole(err);
|
|
113
|
-
console.error(errStr);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
$(formCanvas).on('mouseover', () => $(formCanvas).css('cursor', 'zoom-in'));
|
|
117
|
-
$(formCanvas).on('mouseout', () => $(formCanvas).css('cursor', 'default'));
|
|
118
|
-
const mol = sequenceToMolV3000(inputSequenceField.value.replace(/\s/g, ''), false, true,
|
|
119
|
-
output.synthesizer![0]);
|
|
120
|
-
// // @ts-ignore
|
|
121
|
-
// OCL.StructureView.drawMolecule(formCanvas, OCL.Molecule.fromMolfile(mol), {suppressChiralText: true});
|
|
122
|
-
await grok.functions.call('Chem:canvasMol', {
|
|
123
|
-
x: 0, y: 0, w: formCanvas.width, h: formCanvas.height, canvas: formCanvas,
|
|
124
|
-
molString: mol, scaffoldMolString: '',
|
|
125
|
-
options: {normalizeDepiction: false, straightenDepiction: false}
|
|
126
|
-
});
|
|
127
|
-
moleculeSvgDiv.append(formCanvas);
|
|
128
|
-
} else
|
|
129
|
-
moleculeSvgDiv.innerHTML = '';
|
|
130
|
-
} finally {
|
|
131
|
-
pi.close();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const inputFormatChoiceInput = ui.choiceInput('Input format: ', 'Janssen GCRS Codes', Object.keys(map));
|
|
136
|
-
inputFormatChoiceInput.onInput((format: string) => {
|
|
137
|
-
updateTableAndMolecule(inputSequenceField.value.replace(/\s/g, ''), format);
|
|
138
|
-
});
|
|
139
|
-
const moleculeSvgDiv = ui.block([]);
|
|
140
|
-
const outputTableDiv = ui.div([]);
|
|
141
|
-
const inputSequenceField = ui.textInput('', defaultInput, (sequence: string) => {
|
|
142
|
-
// Send event to DG.debounce()
|
|
143
|
-
onInput.next(sequence);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
DG.debounce<string>(onInput, 300).subscribe((sequence) => {
|
|
147
|
-
updateTableAndMolecule(sequence, inputFormatChoiceInput.value!);
|
|
148
|
-
onSequenceChanged(sequence);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
const asoGapmersGrid = DG.Viewer.grid(
|
|
152
|
-
DG.DataFrame.fromObjects([
|
|
153
|
-
{'Name': '2\'MOE-5Me-rU', 'BioSpring': '5', 'Janssen GCRS': 'moeT'},
|
|
154
|
-
{'Name': '2\'MOE-rA', 'BioSpring': '6', 'Janssen GCRS': 'moeA'},
|
|
155
|
-
{'Name': '2\'MOE-5Me-rC', 'BioSpring': '7', 'Janssen GCRS': 'moe5mC'},
|
|
156
|
-
{'Name': '2\'MOE-rG', 'BioSpring': '8', 'Janssen GCRS': 'moeG'},
|
|
157
|
-
{'Name': '5-Methyl-dC', 'BioSpring': '9', 'Janssen GCRS': '5mC'},
|
|
158
|
-
{'Name': 'ps linkage', 'BioSpring': '*', 'Janssen GCRS': 'ps'},
|
|
159
|
-
{'Name': 'dA', 'BioSpring': 'A', 'Janssen GCRS': 'A, dA'},
|
|
160
|
-
{'Name': 'dC', 'BioSpring': 'C', 'Janssen GCRS': 'C, dC'},
|
|
161
|
-
{'Name': 'dG', 'BioSpring': 'G', 'Janssen GCRS': 'G, dG'},
|
|
162
|
-
{'Name': 'dT', 'BioSpring': 'T', 'Janssen GCRS': 'T, dT'},
|
|
163
|
-
{'Name': 'rA', 'BioSpring': '', 'Janssen GCRS': 'rA'},
|
|
164
|
-
{'Name': 'rC', 'BioSpring': '', 'Janssen GCRS': 'rC'},
|
|
165
|
-
{'Name': 'rG', 'BioSpring': '', 'Janssen GCRS': 'rG'},
|
|
166
|
-
{'Name': 'rU', 'BioSpring': '', 'Janssen GCRS': 'rU'},
|
|
167
|
-
])!, {showRowHeader: false, showCellTooltip: false, allowEdit: false},
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const omeAndFluoroGrid = DG.Viewer.grid(
|
|
171
|
-
DG.DataFrame.fromObjects([
|
|
172
|
-
{'Name': '2\'-fluoro-U', 'BioSpring': '1', 'Axolabs': 'Uf', 'Janssen GCRS': 'fU'},
|
|
173
|
-
{'Name': '2\'-fluoro-A', 'BioSpring': '2', 'Axolabs': 'Af', 'Janssen GCRS': 'fA'},
|
|
174
|
-
{'Name': '2\'-fluoro-C', 'BioSpring': '3', 'Axolabs': 'Cf', 'Janssen GCRS': 'fC'},
|
|
175
|
-
{'Name': '2\'-fluoro-G', 'BioSpring': '4', 'Axolabs': 'Gf', 'Janssen GCRS': 'fG'},
|
|
176
|
-
{'Name': '2\'OMe-rU', 'BioSpring': '5', 'Axolabs': 'u', 'Janssen GCRS': 'mU'},
|
|
177
|
-
{'Name': '2\'OMe-rA', 'BioSpring': '6', 'Axolabs': 'a', 'Janssen GCRS': 'mA'},
|
|
178
|
-
{'Name': '2\'OMe-rC', 'BioSpring': '7', 'Axolabs': 'c', 'Janssen GCRS': 'mC'},
|
|
179
|
-
{'Name': '2\'OMe-rG', 'BioSpring': '8', 'Axolabs': 'g', 'Janssen GCRS': 'mG'},
|
|
180
|
-
{'Name': 'ps linkage', 'BioSpring': '*', 'Axolabs': 's', 'Janssen GCRS': 'ps'},
|
|
181
|
-
])!, {showRowHeader: false, showCellTooltip: false, allowEdit: false},
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
const overhangModificationsGrid = DG.Viewer.grid(
|
|
185
|
-
DG.DataFrame.fromColumns([
|
|
186
|
-
DG.Column.fromStrings('Name', Object.keys(MODIFICATIONS)),
|
|
187
|
-
])!, {showRowHeader: false, showCellTooltip: false, allowEdit: false},
|
|
188
|
-
);
|
|
189
|
-
updateTableAndMolecule(defaultInput, inputFormatChoiceInput.value!);
|
|
190
|
-
|
|
191
|
-
const codesTablesDiv = ui.splitV([
|
|
192
|
-
ui.box(ui.h2('ASO Gapmers'), {style: {maxHeight: '40px'}}),
|
|
193
|
-
asoGapmersGrid.root,
|
|
194
|
-
ui.box(ui.h2('2\'-OMe and 2\'-F siRNA'), {style: {maxHeight: '40px'}}),
|
|
195
|
-
omeAndFluoroGrid.root,
|
|
196
|
-
ui.box(ui.h2('Overhang modifications'), {style: {maxHeight: '40px'}}),
|
|
197
|
-
overhangModificationsGrid.root,
|
|
198
|
-
], {style: {maxWidth: '350px'}});
|
|
199
|
-
|
|
200
|
-
const appMainDescription = ui.info([
|
|
201
|
-
ui.divText('How to convert one sequence:', {style: {'font-weight': 'bolder'}}),
|
|
202
|
-
ui.divText('Paste sequence into the text field below'),
|
|
203
|
-
ui.divText('\n How to convert many sequences:', {style: {'font-weight': 'bolder'}}),
|
|
204
|
-
ui.divText('1. Drag & drop an Excel or CSV file with sequences into Datagrok'),
|
|
205
|
-
ui.divText('2. Right-click on the column header, then see the \'Convert\' menu'),
|
|
206
|
-
ui.divText('This will add the result column to the right of the table'),
|
|
207
|
-
], 'Convert oligonucleotide sequences between Nucleotides, BioSpring, Axolabs, Mermade 12 and GCRS representations.');
|
|
208
|
-
|
|
209
|
-
$(codesTablesDiv).hide();
|
|
210
|
-
const switchInput = ui.switchInput('Codes', false, (v: boolean) => (v) ?
|
|
211
|
-
$(codesTablesDiv).show() :
|
|
212
|
-
$(codesTablesDiv).hide(),
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
const downloadMolFileIcon = ui.iconFA('download', async () => {
|
|
216
|
-
const clearSequence = inputSequenceField.value.replace(/\s/g, '');
|
|
217
|
-
const result = sequenceToMolV3000(inputSequenceField.value.replace(/\s/g, ''), false, false,
|
|
218
|
-
inputFormatChoiceInput.value!);
|
|
219
|
-
download(clearSequence + '.mol', encodeURIComponent(result));
|
|
220
|
-
}, 'Save .mol file');
|
|
221
|
-
|
|
222
|
-
const copySmilesIcon = ui.iconFA('copy', () => {
|
|
223
|
-
navigator.clipboard.writeText(
|
|
224
|
-
sequenceToSmiles(inputSequenceField.value.replace(/\s/g, ''), false, inputFormatChoiceInput.value!),
|
|
225
|
-
).then(() => grok.shell.info(sequenceWasCopied));
|
|
226
|
-
}, 'Copy SMILES');
|
|
227
|
-
|
|
228
|
-
const topPanel = [
|
|
229
|
-
downloadMolFileIcon,
|
|
230
|
-
copySmilesIcon,
|
|
231
|
-
switchInput.root,
|
|
232
|
-
];
|
|
233
|
-
|
|
234
|
-
const v = grok.shell.v;
|
|
235
|
-
const tabControl = grok.shell.sidebar;
|
|
236
|
-
tabControl.onTabChanged.subscribe((_) => {
|
|
237
|
-
v.setRibbonPanels([(tabControl.currentPane.name == 'MAIN') ? topPanel : []]);
|
|
238
|
-
});
|
|
239
|
-
v.setRibbonPanels([topPanel]);
|
|
240
|
-
|
|
241
|
-
return ui.box(
|
|
242
|
-
ui.splitH([
|
|
243
|
-
ui.splitV([
|
|
244
|
-
ui.panel([
|
|
245
|
-
appMainDescription,
|
|
246
|
-
ui.div([
|
|
247
|
-
ui.h1('Input sequence'),
|
|
248
|
-
ui.div([], 'input-base'),
|
|
249
|
-
inputSequenceField.root,
|
|
250
|
-
], 'inputSequence'),
|
|
251
|
-
ui.div([inputFormatChoiceInput], {style: {padding: '5px 0'}}),
|
|
252
|
-
ui.block([
|
|
253
|
-
ui.h1('Output'),
|
|
254
|
-
outputTableDiv,
|
|
255
|
-
]),
|
|
256
|
-
moleculeSvgDiv,
|
|
257
|
-
], 'sequence'),
|
|
258
|
-
]),
|
|
259
|
-
codesTablesDiv,
|
|
260
|
-
], {style: {height: '100%', width: '100%'}}),
|
|
261
|
-
);
|
|
262
|
-
}
|
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import {lcmsToGcrs, MODIFICATIONS} from './map';
|
|
2
|
-
import * as DG from 'datagrok-api/dg';
|
|
3
|
-
import {DELIMITER} from './map';
|
|
4
|
-
import {sortByStringLengthInDescendingOrder} from '../helpers';
|
|
5
|
-
//name: gcrsToLcms
|
|
6
|
-
//input: string nucleotides {semType: GCRS}
|
|
7
|
-
//output: string result {semType: LCMS}
|
|
8
|
-
export function gcrsToLcms(sequence: string): string {
|
|
9
|
-
try {
|
|
10
|
-
const df = DG.DataFrame.fromCsv(lcmsToGcrs);
|
|
11
|
-
const arr1: string[] = df.getCol('GCRS').toList();
|
|
12
|
-
const arr2: string[] = df.getCol('LCMS').toList();
|
|
13
|
-
const obj: { [i: string]: string } = {};
|
|
14
|
-
arr1.forEach((element, index) => obj[element] = arr2[index]);
|
|
15
|
-
obj[DELIMITER] = DELIMITER;
|
|
16
|
-
const codes = arr1
|
|
17
|
-
.concat(DELIMITER)
|
|
18
|
-
.concat(Object.keys(MODIFICATIONS));
|
|
19
|
-
const sortedCodes = sortByStringLengthInDescendingOrder(codes);
|
|
20
|
-
let i = 0;
|
|
21
|
-
let r1 = '';
|
|
22
|
-
while (i < sequence.length) {
|
|
23
|
-
const matchedCode = sortedCodes.find((c) => c == sequence.slice(i, i + c.length))!;
|
|
24
|
-
r1 += obj[sequence.slice(i, i + matchedCode.length)];
|
|
25
|
-
i += matchedCode.length;
|
|
26
|
-
}
|
|
27
|
-
while (r1.indexOf('//') != -1)
|
|
28
|
-
r1 = r1.replace('//', '/');
|
|
29
|
-
return r1;
|
|
30
|
-
} catch {
|
|
31
|
-
return '<error>';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//name: asoGapmersNucleotidesToBioSpring
|
|
36
|
-
//input: string nucleotides {semType: DNA nucleotides}
|
|
37
|
-
//output: string result {semType: BioSpring / Gapmers}
|
|
38
|
-
export function asoGapmersNucleotidesToBioSpring(nucleotides: string): string {
|
|
39
|
-
let count: number = -1;
|
|
40
|
-
const objForEdges: { [index: string]: string } = {
|
|
41
|
-
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': '5*', 'A': '6*', 'C': '7*', 'G': '8*'};
|
|
42
|
-
const objForCenter: { [index: string]: string } = {
|
|
43
|
-
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': 'T*', 'A': 'A*', 'C': '9*', 'G': 'G*'};
|
|
44
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|T|C|G)/g, function(x: string) {
|
|
45
|
-
count++;
|
|
46
|
-
return (count > 4 && count < 15) ? objForCenter[x] : objForEdges[x];
|
|
47
|
-
}).slice(0, (nucleotides.endsWith('(invabasic)') || nucleotides.endsWith('(GalNAc-2-JNJ)')) ?
|
|
48
|
-
nucleotides.length : 2 * count + 1);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
//name: asoGapmersNucleotidesToGcrs
|
|
52
|
-
//input: string nucleotides {semType: DNA nucleotides}
|
|
53
|
-
//output: string result {semType: GCRS / Gapmers}
|
|
54
|
-
export function asoGapmersNucleotidesToGcrs(nucleotides: string): string {
|
|
55
|
-
let count: number = -1;
|
|
56
|
-
const objForEdges: { [index: string]: string } = {
|
|
57
|
-
'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'T': 'moeUnps',
|
|
58
|
-
'A': 'moeAnps', 'C': 'moe5mCnps', 'G': 'moeGnps'};
|
|
59
|
-
const objForCenter: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
60
|
-
'C': '5mCps', 'A': 'Aps', 'T': 'Tps', 'G': 'Gps'};
|
|
61
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|T|C|G)/g, function(x: string) {
|
|
62
|
-
count++;
|
|
63
|
-
if (count < 5) return (count == 4) ? objForEdges[x].slice(0, -3) + 'ps' : objForEdges[x];
|
|
64
|
-
if (count < 15) return (count == 14) ? objForCenter[x].slice(0, -2) + 'nps' : objForCenter[x];
|
|
65
|
-
return objForEdges[x];
|
|
66
|
-
}).slice(0, (nucleotides.endsWith('(invabasic)') || nucleotides.endsWith('(GalNAc-2-JNJ)')) ?
|
|
67
|
-
nucleotides.length : -3);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//name: asoGapmersBioSpringToNucleotides
|
|
71
|
-
//input: string nucleotides {semType: BioSpring / Gapmers}
|
|
72
|
-
//output: string result {semType: DNA nucleotides}
|
|
73
|
-
export function asoGapmersBioSpringToNucleotides(nucleotides: string): string {
|
|
74
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
75
|
-
'*': '', '5': 'T', '6': 'A', '7': 'C', '8': 'G', '9': 'C'};
|
|
76
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|\*|5|6|7|8|9)/g, function(x: string) {return obj[x];});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
//name: asoGapmersBioSpringToGcrs
|
|
80
|
-
//input: string nucleotides {semType: BioSpring / Gapmers}
|
|
81
|
-
//output: string result {semType: GCRS / Gapmers}
|
|
82
|
-
export function asoGapmersBioSpringToGcrs(nucleotides: string): string {
|
|
83
|
-
let count: number = -1;
|
|
84
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
85
|
-
'5*': 'moeUnps', '6*': 'moeAnps', '7*': 'moe5mCnps', '8*': 'moeGnps', '9*': '5mCps', 'A*': 'Aps', 'T*': 'Tps',
|
|
86
|
-
'G*': 'Gps', 'C*': 'Cps', '5': 'moeU', '6': 'moeA', '7': 'moe5mC', '8': 'moeG',
|
|
87
|
-
};
|
|
88
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|5\*|6\*|7\*|8\*|9\*|A\*|T\*|G\*|C\*|5|6|7|8)/g,
|
|
89
|
-
function(x: string) {
|
|
90
|
-
count++;
|
|
91
|
-
return (count == 4) ? obj[x].slice(0, -3) + 'ps' : (count == 14) ? obj[x].slice(0, -2) + 'nps' : obj[x];
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//name: asoGapmersGcrsToBioSpring
|
|
97
|
-
//input: string nucleotides {semType: GCRS / Gapmers}
|
|
98
|
-
//output: string result {semType: BioSpring / Gapmers}
|
|
99
|
-
export function asoGapmersGcrsToBioSpring(nucleotides: string): string {
|
|
100
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
101
|
-
'fU': '1', 'fA': '2', 'fC': '3', 'fG': '4', 'mU': '5', 'mA': '6', 'mC': '7', 'mG': '8',
|
|
102
|
-
'moeT': '5', 'moeA': '6', 'moe5mC': '7', 'moeG': '8', 'moeU': '5', '5mC': '9', 'nps': '*', 'ps': '*', 'U': 'T',
|
|
103
|
-
};
|
|
104
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|moeT|moeA|moe5mC|moeG|moeU|5mC|nps|ps|U)/g,
|
|
105
|
-
function(x: string) {return obj[x];});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
//name: asoGapmersGcrsToNucleotides
|
|
109
|
-
//input: string nucleotides {semType: GCRS / Gapmers}
|
|
110
|
-
//output: string result {semType: DNA nucleotides}
|
|
111
|
-
export function asoGapmersGcrsToNucleotides(nucleotides: string) {
|
|
112
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
113
|
-
'moe': '', '5m': '', 'n': '', 'ps': '', 'U': 'T'};
|
|
114
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|moe|5m|n|ps|U)/g, function(x: string) {return obj[x];});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
//name: siRnaBioSpringToNucleotides
|
|
118
|
-
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
119
|
-
//output: string result {semType: RNA nucleotides}
|
|
120
|
-
export function siRnaBioSpringToNucleotides(nucleotides: string) {
|
|
121
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
122
|
-
'1': 'U', '2': 'A', '3': 'C', '4': 'G', '5': 'U', '6': 'A', '7': 'C', '8': 'G', '*': ''};
|
|
123
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
124
|
-
function(x: string) {return obj[x];});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//name: siRnaBioSpringToAxolabs
|
|
128
|
-
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
129
|
-
//output: string result {semType: Axolabs / siRNA}
|
|
130
|
-
export function siRnaBioSpringToAxolabs(nucleotides: string) {
|
|
131
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
132
|
-
'1': 'Uf', '2': 'Af', '3': 'Cf', '4': 'Gf', '5': 'u', '6': 'a', '7': 'c', '8': 'g', '*': 's'};
|
|
133
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
134
|
-
function(x: string) {return obj[x];});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
//name: siRnaBioSpringToGcrs
|
|
139
|
-
//input: string nucleotides {semType: BioSpring / siRNA}
|
|
140
|
-
//output: string result {semType: GCRS}
|
|
141
|
-
export function siRnaBioSpringToGcrs(nucleotides: string) {
|
|
142
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
143
|
-
'1': 'fU', '2': 'fA', '3': 'fC', '4': 'fG', '5': 'mU', '6': 'mA', '7': 'mC', '8': 'mG', '*': 'ps'};
|
|
144
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|1|2|3|4|5|6|7|8|\*)/g,
|
|
145
|
-
function(x: string) {return obj[x];});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
//name: siRnaAxolabsToGcrs
|
|
149
|
-
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
150
|
-
//output: string result {semType: GCRS}
|
|
151
|
-
export function siRnaAxolabsToGcrs(nucleotides: string) {
|
|
152
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
153
|
-
'Uf': 'fU', 'Af': 'fA', 'Cf': 'fC', 'Gf': 'fG', 'u': 'mU', 'a': 'mA', 'c': 'mC', 'g': 'mG', 's': 'ps',
|
|
154
|
-
};
|
|
155
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
156
|
-
function(x: string) {return obj[x];});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
//name: siRnaAxolabsToBioSpring
|
|
160
|
-
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
161
|
-
//output: string result {semType: BioSpring / siRNA}
|
|
162
|
-
export function siRnaAxolabsToBioSpring(nucleotides: string) {
|
|
163
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
164
|
-
'Uf': '1', 'Af': '2', 'Cf': '3', 'Gf': '4', 'u': '5', 'a': '6', 'c': '7', 'g': '8', 's': '*',
|
|
165
|
-
};
|
|
166
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
167
|
-
function(x: string) {return obj[x];});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
//name: siRnaAxolabsToNucleotides
|
|
171
|
-
//input: string nucleotides {semType: Axolabs / siRNA}
|
|
172
|
-
//output: string result {semType: RNA nucleotides}
|
|
173
|
-
export function siRnaAxolabsToNucleotides(nucleotides: string) {
|
|
174
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
175
|
-
'Uf': 'U', 'Af': 'A', 'Cf': 'C', 'Gf': 'G', 'u': 'U', 'a': 'A', 'c': 'C', 'g': 'G', 's': '',
|
|
176
|
-
};
|
|
177
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|Uf|Af|Cf|Gf|u|a|c|g|s)/g,
|
|
178
|
-
function(x: string) {return obj[x];});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
//name: siRnaGcrsToNucleotides
|
|
183
|
-
//input: string nucleotides {semType: GCRS}
|
|
184
|
-
//output: string result {semType: RNA nucleotides}
|
|
185
|
-
export function siRnaGcrsToNucleotides(nucleotides: string) {
|
|
186
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
187
|
-
'fU': 'U', 'fA': 'A', 'fC': 'C', 'fG': 'G', 'mU': 'U', 'mA': 'A', 'mC': 'C', 'mG': 'G', 'ps': '',
|
|
188
|
-
};
|
|
189
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
190
|
-
function(x: string) {return obj[x];});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
//name: siRnaGcrsToBioSpring
|
|
194
|
-
//input: string nucleotides {semType: GCRS}
|
|
195
|
-
//output: string result {semType: BioSpring / siRNA}
|
|
196
|
-
export function siRnaGcrsToBioSpring(nucleotides: string) {
|
|
197
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
198
|
-
'fU': '1', 'fA': '2', 'fC': '3', 'fG': '4', 'mU': '5', 'mA': '6', 'mC': '7', 'mG': '8', 'ps': '*',
|
|
199
|
-
};
|
|
200
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
201
|
-
function(x: string) {return obj[x];});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
//name: siRnaGcrsToAxolabs
|
|
205
|
-
//input: string nucleotides {semType: GCRS}
|
|
206
|
-
//output: string result {semType: Axolabs / siRNA}
|
|
207
|
-
export function siRnaGcrsToAxolabs(nucleotides: string) {
|
|
208
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
209
|
-
'fU': 'Uf', 'fA': 'Af', 'fC': 'Cf', 'fG': 'Gf', 'mU': 'u', 'mA': 'a', 'mC': 'c', 'mG': 'g', 'ps': 's',
|
|
210
|
-
};
|
|
211
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|fU|fA|fC|fG|mU|mA|mC|mG|ps)/g,
|
|
212
|
-
function(x: string) {return obj[x];});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
//name: siRnaNucleotideToBioSpringSenseStrand
|
|
216
|
-
//input: string nucleotides {semType: RNA nucleotides}
|
|
217
|
-
//output: string result {semType: BioSpring / siRNA}
|
|
218
|
-
export function siRnaNucleotideToBioSpringSenseStrand(nucleotides: string) {
|
|
219
|
-
let count: number = -1;
|
|
220
|
-
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
221
|
-
'A': '6*', 'U': '5*', 'G': '8*', 'C': '7*'};
|
|
222
|
-
const objForRightEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
223
|
-
'A': '*6', 'U': '*5', 'G': '*8', 'C': '*7'};
|
|
224
|
-
const objForOddIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
225
|
-
'A': '6', 'U': '5', 'G': '8', 'C': '7'};
|
|
226
|
-
const objForEvenIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
227
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': '2', 'U': '1', 'G': '4', 'C': '3'};
|
|
228
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
229
|
-
count++;
|
|
230
|
-
if (count < 2) return objForLeftEdge[x];
|
|
231
|
-
if (count > nucleotides.length - 3) return objForRightEdge[x];
|
|
232
|
-
return (count % 2 == 0) ? objForEvenIndices[x] : objForOddIndices[x];
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
//name: siRnaNucleotidesToGcrs
|
|
237
|
-
//input: string nucleotides {semType: RNA nucleotides}
|
|
238
|
-
//output: string result {semType: GCRS}
|
|
239
|
-
export function siRnaNucleotidesToGcrs(nucleotides: string) {
|
|
240
|
-
let count: number = -1;
|
|
241
|
-
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
242
|
-
'A': 'mAps', 'U': 'mUps', 'G': 'mGps', 'C': 'mCps'};
|
|
243
|
-
const objForRightEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
244
|
-
'A': 'psmA', 'U': 'psmU', 'G': 'psmG', 'C': 'psmC'};
|
|
245
|
-
const objForEvenIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
246
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'fA', 'U': 'fU', 'G': 'fG', 'C': 'fC'};
|
|
247
|
-
const objForOddIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
248
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'mA', 'U': 'mU', 'G': 'mG', 'C': 'mC'};
|
|
249
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
250
|
-
count++;
|
|
251
|
-
if (count < 2) return objForLeftEdge[x];
|
|
252
|
-
if (count > nucleotides.length - 3) return objForRightEdge[x];
|
|
253
|
-
return (count % 2 == 0) ? objForEvenIndices[x] : objForOddIndices[x];
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
//name: siRnaNucleotideToAxolabsSenseStrand
|
|
258
|
-
//input: string nucleotides {semType: RNA nucleotides}
|
|
259
|
-
//output: string result {semType: Axolabs}
|
|
260
|
-
export function siRnaNucleotideToAxolabsSenseStrand(nucleotides: string) {
|
|
261
|
-
let count: number = -1;
|
|
262
|
-
const objForLeftEdge: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
263
|
-
'A': 'as', 'U': 'us', 'G': 'gs', 'C': 'cs'};
|
|
264
|
-
const objForSomeIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
265
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Af', 'U': 'Uf', 'G': 'Gf', 'C': 'Cf'};
|
|
266
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
267
|
-
'A': 'a', 'U': 'u', 'G': 'g', 'C': 'c'};
|
|
268
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
269
|
-
count++;
|
|
270
|
-
if (count < 2) return objForLeftEdge[x];
|
|
271
|
-
if (count == 6 || (count > 7 && count < 11)) return objForSomeIndices[x];
|
|
272
|
-
if (count == nucleotides.length - 1) return 'a';
|
|
273
|
-
return obj[x];
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
//name: siRnaNucleotideToAxolabsAntisenseStrand
|
|
278
|
-
//input: string nucleotides {semType: RNA nucleotides}
|
|
279
|
-
//output: string result {semType: Axolabs}
|
|
280
|
-
export function siRnaNucleotideToAxolabsAntisenseStrand(nucleotides: string) {
|
|
281
|
-
let count: number = -1;
|
|
282
|
-
const objForSmallLinkages: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
283
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'as', 'U': 'us', 'G': 'gs', 'C': 'cs'};
|
|
284
|
-
const objForBigLinkages: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
285
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Afs', 'U': 'Ufs', 'G': 'Gfs', 'C': 'Cfs'};
|
|
286
|
-
const objForSomeIndices: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
287
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'Af', 'U': 'Uf', 'G': 'Gf', 'C': 'Cf'};
|
|
288
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)',
|
|
289
|
-
'(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)', 'A': 'a', 'U': 'u', 'G': 'g', 'C': 'c'};
|
|
290
|
-
return nucleotides.replace(/(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C)/g, function(x: string) {
|
|
291
|
-
count++;
|
|
292
|
-
if (count > 19 && count < 22) return objForSmallLinkages[x];
|
|
293
|
-
if (count == 0) return 'us';
|
|
294
|
-
if (count == 1) return objForBigLinkages[x];
|
|
295
|
-
return (count == 5 || count == 7 || count == 8 || count == 13 || count == 15) ? objForSomeIndices[x] : obj[x];
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
//name: gcrsToNucleotides
|
|
300
|
-
//input: string nucleotides {semType: GCRS}
|
|
301
|
-
//output: string result {semType: RNA nucleotides}
|
|
302
|
-
export function gcrsToNucleotides(nucleotides: string) {
|
|
303
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
304
|
-
'mAps': 'A', 'mUps': 'U', 'mGps': 'G', 'mCps': 'C', 'fAps': 'A', 'fUps': 'U', 'fGps': 'G', 'fCps': 'C',
|
|
305
|
-
'fU': 'U', 'fA': 'A', 'fC': 'C', 'fG': 'G', 'mU': 'U', 'mA': 'A', 'mC': 'C', 'mG': 'G',
|
|
306
|
-
};
|
|
307
|
-
return nucleotides.replace(
|
|
308
|
-
/(\(invabasic\)|\(GalNAc-2-JNJ\)|mAps|mUps|mGps|mCps|fAps|fUps|fGps|fCps|fU|fA|fC|fG|mU|mA|mC|mG)/g,
|
|
309
|
-
function(x: string) {return obj[x];});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
//name: gcrsToMermade12
|
|
313
|
-
//input: string nucleotides {semType: GCRS}
|
|
314
|
-
//output: string result {semType: Mermade 12 / siRNA}
|
|
315
|
-
export function gcrsToMermade12(nucleotides: string) {
|
|
316
|
-
const obj: {[index: string]: string} = {'(invabasic)': '(invabasic)', '(GalNAc-2-JNJ)': '(GalNAc-2-JNJ)',
|
|
317
|
-
'mAps': 'e', 'mUps': 'h', 'mGps': 'g', 'mCps': 'f', 'fAps': 'i', 'fUps': 'l', 'fGps': 'k', 'fCps': 'j', 'fU': 'L',
|
|
318
|
-
'fA': 'I', 'fC': 'J', 'fG': 'K', 'mU': 'H', 'mA': 'E', 'mC': 'F', 'mG': 'G',
|
|
319
|
-
};
|
|
320
|
-
return nucleotides.replace(
|
|
321
|
-
/(\(invabasic\)|\(GalNAc-2-JNJ\)|mAps|mUps|mGps|mCps|fAps|fUps|fGps|fCps|fU|fA|fC|fG|mU|mA|mC|mG)/g,
|
|
322
|
-
function(x: string) {return obj[x];});
|
|
323
|
-
}
|