@datagrok/sequence-translator 1.0.17 → 1.1.4
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 +36 -0
- package/detectors.js +8 -0
- package/dist/package-test.js +2 -73079
- package/dist/package-test.js.map +1 -0
- package/dist/package.js +2 -72284
- package/dist/package.js.map +1 -0
- package/files/axolabs-style.json +97 -0
- package/files/codes-to-symbols.json +67 -0
- package/files/formats-to-helm.json +63 -0
- package/files/linkers.json +22 -0
- package/files/monomer-lib.json +1142 -0
- package/link-bio +7 -0
- package/package.json +30 -31
- 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-tab → model/axolabs}/draw-svg.ts +1 -1
- package/src/{axolabs-tab → model/axolabs}/helpers.ts +7 -5
- package/src/model/const.ts +18 -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 +49 -0
- package/src/model/format-translation/format-converter.ts +109 -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 +119 -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/{utils/structures-works → model/sequence-to-structure-utils}/mol-transformations.ts +33 -41
- package/src/model/sequence-to-structure-utils/monomer-code-parser.ts +92 -0
- package/src/model/sequence-to-structure-utils/sdf-tab.ts +97 -0
- package/src/model/sequence-to-structure-utils/sequence-to-molfile.ts +409 -0
- package/src/package-test.ts +3 -1
- package/src/package.ts +113 -91
- package/src/tests/const.ts +24 -0
- package/src/tests/formats-support.ts +40 -0
- package/src/tests/formats-to-helm.ts +53 -0
- package/src/tests/helm-to-nucleotides.ts +28 -0
- 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 +719 -0
- package/src/view/tabs/main.ts +174 -0
- package/src/view/tabs/sdf.ts +193 -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 +127 -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-unlink-clean.sh +0 -21
- 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/calculations.ts +0 -40
- package/src/autostart/constants.ts +0 -37
- package/src/autostart/registration.ts +0 -306
- package/src/axolabs-tab/axolabs-tab.ts +0 -873
- package/src/axolabs-tab/define-pattern.ts +0 -874
- package/src/hardcode-to-be-eliminated/ICDs.ts +0 -3
- package/src/hardcode-to-be-eliminated/IDPs.ts +0 -3
- package/src/hardcode-to-be-eliminated/const.ts +0 -5
- package/src/hardcode-to-be-eliminated/constants.ts +0 -101
- package/src/hardcode-to-be-eliminated/converters.ts +0 -323
- package/src/hardcode-to-be-eliminated/map.ts +0 -720
- package/src/hardcode-to-be-eliminated/salts.ts +0 -2
- package/src/hardcode-to-be-eliminated/sources.ts +0 -3
- package/src/hardcode-to-be-eliminated/users.ts +0 -3
- package/src/main-tab/main-tab.ts +0 -210
- package/src/sdf-tab/sdf-tab.ts +0 -163
- package/src/sdf-tab/sequence-codes-tools.ts +0 -347
- package/src/tests/smiles-tests.ts +0 -458
- package/src/utils/const.ts +0 -0
- package/src/utils/helpers.ts +0 -28
- 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/src/utils/structures-works/draw-molecule.ts +0 -84
- package/src/utils/structures-works/from-monomers.ts +0 -266
- package/test-SequenceTranslator-6288c2fbe346-695b7b55.html +0 -259
- package/vendors/openchemlib-full.js +0 -293
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
import {before, category, expect, test} from '@datagrok-libraries/utils/src/test';
|
|
7
|
+
import {DEFAULT_FORMATS} from '../model/const';
|
|
8
|
+
import {FormatConverter} from '../model/format-translation/format-converter';
|
|
9
|
+
import {getJsonData} from '../model/data-loading-utils/json-loader';
|
|
10
|
+
import {formatsToHelm} from './const';
|
|
11
|
+
import {SequenceValidator} from '../model/parsing-validation/sequence-validator';
|
|
12
|
+
import {getTranslatedSequences} from '../model/format-translation/conversion-utils';
|
|
13
|
+
import {_package} from '../package';
|
|
14
|
+
|
|
15
|
+
function getTranslationObject(sequence: string, format: string): {[format: string]: string} {
|
|
16
|
+
const indexOfInvalidChar = (new SequenceValidator(sequence)).getInvalidCodeIndex(format);
|
|
17
|
+
return getTranslatedSequences(sequence, indexOfInvalidChar, format);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const inputs = {
|
|
21
|
+
[DEFAULT_FORMATS.AXOLABS]: 'Afcgacsu',
|
|
22
|
+
[DEFAULT_FORMATS.HELM]: 'RNA1{[fR](A)p.[25r](C)p.[25r](G)p.[25r](A)p.[25r](C)[sp].[25r](U)}$$$$'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
category('Formats support', () => {
|
|
26
|
+
before(async () => {
|
|
27
|
+
await getJsonData();
|
|
28
|
+
await _package.initMonomerLib();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
Object.entries(inputs).forEach(([format, sequence]) => {
|
|
32
|
+
test(`All formats for ${format}`, async () => {
|
|
33
|
+
const output = getTranslationObject(sequence, format);
|
|
34
|
+
const result = Object.keys(output).length;
|
|
35
|
+
// +1 due to nucleotides
|
|
36
|
+
const expected = Object.keys(formatsToHelm).length + 1;
|
|
37
|
+
expect(result, expected);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
import {before, category, expect, test} from '@datagrok-libraries/utils/src/test';
|
|
7
|
+
import {DEFAULT_FORMATS} from '../model/const';
|
|
8
|
+
import {FormatConverter} from '../model/format-translation/format-converter';
|
|
9
|
+
import {getJsonData} from '../model/data-loading-utils/json-loader';
|
|
10
|
+
import {formatsToHelm} from './const';
|
|
11
|
+
import {_package} from '../package';
|
|
12
|
+
|
|
13
|
+
function getHelm(strand: string, format: string): string {
|
|
14
|
+
return (new FormatConverter(strand, format).convertTo(DEFAULT_FORMATS.HELM));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getFromat(helm: string, format: string): string {
|
|
18
|
+
return (new FormatConverter(helm, DEFAULT_FORMATS.HELM).convertTo(format));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
category('Formats to HELM', () => {
|
|
22
|
+
before(async () => {
|
|
23
|
+
await getJsonData();
|
|
24
|
+
await _package.initMonomerLib();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
for (const format of Object.keys(formatsToHelm)) {
|
|
28
|
+
for (const [strand, helm] of Object.entries(formatsToHelm[format])) {
|
|
29
|
+
test(`${format} to HELM`, async () => {
|
|
30
|
+
const expected = helm;
|
|
31
|
+
const result = getHelm(strand, format);
|
|
32
|
+
expect(result, expected);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
category('HELM to Formats', () => {
|
|
39
|
+
before(async () => {
|
|
40
|
+
await getJsonData();
|
|
41
|
+
await _package.initMonomerLib();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
for (const format of Object.keys(formatsToHelm)) {
|
|
45
|
+
for (const [strand, helm] of Object.entries(formatsToHelm[format])) {
|
|
46
|
+
test(`${format} to HELM`, async () => {
|
|
47
|
+
const expected = strand;
|
|
48
|
+
const result = getFromat(helm, format);
|
|
49
|
+
expect(result, expected);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
import {before, category, expect, test} from '@datagrok-libraries/utils/src/test';
|
|
7
|
+
import {DEFAULT_FORMATS} from '../model/const';
|
|
8
|
+
import {FormatConverter} from '../model/format-translation/format-converter';
|
|
9
|
+
import {getNucleotidesSequence} from '../model/format-translation/conversion-utils';
|
|
10
|
+
import {getJsonData} from '../model/data-loading-utils/json-loader';
|
|
11
|
+
import {helmToNucleotides} from './const';
|
|
12
|
+
import {_package} from '../package';
|
|
13
|
+
import {MonomerLibWrapper} from '../model/monomer-lib/lib-wrapper';
|
|
14
|
+
|
|
15
|
+
category('HELM to Nucleotides', () => {
|
|
16
|
+
before(async () => {
|
|
17
|
+
await getJsonData();
|
|
18
|
+
await _package.initMonomerLib();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
Object.entries(helmToNucleotides).forEach(([helm, nucleotide], idx) => {
|
|
22
|
+
test(`Sequence ${idx + 1} to nucleotides`, async () => {
|
|
23
|
+
const expected = nucleotide;
|
|
24
|
+
const result = getNucleotidesSequence(helm, MonomerLibWrapper.getInstance());
|
|
25
|
+
expect(result, expected);
|
|
26
|
+
});
|
|
27
|
+
})
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
export const MAIN_TAB = 'SEQUENCE';
|
|
7
|
+
export const AXOLABS_TAB = 'PATTERN';
|
|
8
|
+
export const SDF_TAB = 'SDF';
|
|
9
|
+
|
|
10
|
+
export const DEFAULT_AXOLABS_INPUT = 'Afcgacsu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.colored-text-input > textarea {
|
|
2
|
+
width: 100%;
|
|
3
|
+
-webkit-text-fill-color: transparent;
|
|
4
|
+
background-color: transparent;
|
|
5
|
+
position: relative;
|
|
6
|
+
z-index: 1;
|
|
7
|
+
resize: none;
|
|
8
|
+
height: 22px; /* Fine tuned value to avoid "jumping" of the textarea upon autoresize */
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.colored-text-input > div {
|
|
12
|
+
/* The values here are fine tuned to those of the ui.input textarea in order
|
|
13
|
+
* to achieve precise overlap */
|
|
14
|
+
overflow: auto;
|
|
15
|
+
position: absolute;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
cursor: text;
|
|
18
|
+
z-index: 0;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
padding: 2px;
|
|
21
|
+
line-height: normal;
|
|
22
|
+
font-family: 'Roboto Mono', 'Roboto Mono Local', monospace;
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
color: transparent;
|
|
25
|
+
white-space: pre-wrap;
|
|
26
|
+
word-wrap: break-word;
|
|
27
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */
|
|
2
|
+
.st-main-input-table {
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.st-main-input-table td:has(textarea) {
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding-right: 20px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.st-main-input-table td:has(select) {
|
|
12
|
+
min-width: 120px;
|
|
13
|
+
vertical-align: top;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.st-main-output-table {
|
|
17
|
+
margin-top: 20px;
|
|
18
|
+
margin-right: 20px;
|
|
19
|
+
margin-bottom: 10px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.st-main-output-table table {
|
|
23
|
+
width: 100%;
|
|
24
|
+
table-layout: fixed;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* .st-main-output-table table tbody tr td { */
|
|
28
|
+
/* max-width: 20%; */
|
|
29
|
+
/* } */
|
|
30
|
+
|
|
31
|
+
.st-main-output-table td {
|
|
32
|
+
padding-top: 6px;
|
|
33
|
+
padding-bottom: 6px;
|
|
34
|
+
}
|
|
35
|
+
.st-main-output-table tr:nth-child(even) {
|
|
36
|
+
background-color: var(--grey-1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.st-main-output-table td:nth-child(odd) {
|
|
40
|
+
width: 120px;
|
|
41
|
+
vertical-align: top;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.st-main-output-table td a {
|
|
45
|
+
overflow-wrap: break-word;
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Naming convention: class names should begin with st and tab name (main, axo, sdf) to avoid naming collitions */
|
|
2
|
+
|
|
3
|
+
.st-sdf-body {
|
|
4
|
+
padding-right: 20px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.st-sdf-input-form {
|
|
8
|
+
text-align: right;
|
|
9
|
+
vertical-align: top;
|
|
10
|
+
min-width: 95px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.st-sdf-direction-choice label {
|
|
14
|
+
min-width: 100px;
|
|
15
|
+
float: right;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.st-sdf-direction-choice div {
|
|
19
|
+
justify-content: right;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.st-sdf-text-input-td { /* Style for td containing textarea */
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.st-sdf-mol-img {
|
|
27
|
+
margin-right: 30px;
|
|
28
|
+
float: right;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.st-sdf-bool-button-block {
|
|
32
|
+
justify-content: right;
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.st-sdf-bottom {
|
|
37
|
+
flex-direction: row-reverse;
|
|
38
|
+
padding-top: 20px;
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* Do not change these import lines to match external modules in webpack configuration */
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import * as ui from 'datagrok-api/ui';
|
|
4
|
+
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
|
|
6
|
+
import {drawZoomedInMolecule} from '../utils/draw-molecule';
|
|
7
|
+
import {MonomerLibWrapper} from '../../model/monomer-lib/lib-wrapper';
|
|
8
|
+
|
|
9
|
+
export class MonomerLibViewer {
|
|
10
|
+
static async view(): Promise<void> {
|
|
11
|
+
const table = MonomerLibWrapper.getInstance().getTableForViewer();
|
|
12
|
+
table.name = 'Monomer Library';
|
|
13
|
+
const view = grok.shell.addTableView(table);
|
|
14
|
+
view.grid.props.allowEdit = false;
|
|
15
|
+
const onDoubleClick = view.grid.onCellDoubleClick;
|
|
16
|
+
onDoubleClick.subscribe(async (gridCell: DG.GridCell) => {
|
|
17
|
+
const molfile = gridCell.cell.value;
|
|
18
|
+
if (gridCell.tableColumn?.semType === 'Molecule')
|
|
19
|
+
await drawZoomedInMolecule(molfile);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|