@datagrok/sequence-translator 1.4.1 → 1.4.3
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 +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/files/polytool-rules/rules_example.json +10 -0
- package/files/samples/cyclized.csv +2 -1
- package/files/tests/polytool-reaction-lib.json +40 -0
- package/package.json +7 -7
- package/src/package-test.ts +9 -1
- package/src/package.ts +8 -0
- package/src/polytool/const.ts +1 -0
- package/src/polytool/pt-conversion.ts +147 -43
- package/src/polytool/pt-dialog.ts +86 -24
- package/src/polytool/pt-enumeration-helm-dialog.ts +35 -20
- package/src/polytool/pt-enumeration-helm.ts +46 -26
- package/src/polytool/pt-placeholders-breadth-input.ts +111 -0
- package/src/polytool/pt-placeholders-input.ts +13 -20
- package/src/polytool/pt-rules.ts +24 -4
- package/src/polytool/pt-unrule-dialog.ts +106 -0
- package/src/polytool/pt-unrule.ts +37 -0
- package/src/polytool/types.ts +5 -2
- package/src/tests/polytool-convert-tests.ts +8 -9
- package/src/tests/polytool-enumerate-breadth-tests.ts +116 -0
- package/src/tests/polytool-enumerate-tests.ts +40 -41
- package/src/tests/polytool-unrule-tests.ts +10 -0
- package/src/tests/toAtomicLevel-tests.ts +72 -0
package/src/polytool/types.ts
CHANGED
|
@@ -9,12 +9,15 @@ export enum PolyToolEnumeratorTypes {
|
|
|
9
9
|
|
|
10
10
|
export type PolyToolEnumeratorType = typeof PolyToolEnumeratorTypes[keyof typeof PolyToolEnumeratorTypes];
|
|
11
11
|
|
|
12
|
-
export type PolyToolPlaceholders = {
|
|
12
|
+
export type PolyToolPlaceholders = { position: number, monomers: string[] } [];
|
|
13
|
+
|
|
14
|
+
export type PolyToolPlaceholdersBreadth = { start: number, end: number, monomers: string[] }[];
|
|
13
15
|
|
|
14
16
|
export type PolyToolEnumeratorParams = {
|
|
15
17
|
type: PolyToolEnumeratorType;
|
|
16
18
|
/** position key is zero-based */
|
|
17
|
-
placeholders
|
|
19
|
+
placeholders?: PolyToolPlaceholders;
|
|
20
|
+
placeholdersBreadth?: PolyToolPlaceholdersBreadth;
|
|
18
21
|
keepOriginal?: boolean;
|
|
19
22
|
trivialName?: boolean;
|
|
20
23
|
}
|
|
@@ -6,7 +6,7 @@ import {before, after, category, expect, test, expectArray, testEvent, delay} fr
|
|
|
6
6
|
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
7
7
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
8
8
|
import {
|
|
9
|
-
getUserLibSettings, setUserLibSettings
|
|
9
|
+
getUserLibSettings, setUserLibSettings
|
|
10
10
|
} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
11
11
|
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
12
12
|
|
|
@@ -23,9 +23,8 @@ category('PolyTool: Convert', () => {
|
|
|
23
23
|
before(async () => {
|
|
24
24
|
monomerLibHelper = await getMonomerLibHelper();
|
|
25
25
|
userLibSettings = await getUserLibSettings();
|
|
26
|
-
|
|
27
|
-
await
|
|
28
|
-
await monomerLibHelper.loadMonomerLib(true);
|
|
26
|
+
|
|
27
|
+
await monomerLibHelper.loadMonomerLibForTests();
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
after(async () => {
|
|
@@ -43,11 +42,11 @@ category('PolyTool: Convert', () => {
|
|
|
43
42
|
'R-F-D(2)-T-G-H-F-Y-P-NH2(2)',
|
|
44
43
|
],
|
|
45
44
|
tgt: [
|
|
46
|
-
'PEPTIDE1{
|
|
47
|
-
'PEPTIDE1{
|
|
48
|
-
'PEPTIDE1{
|
|
49
|
-
'PEPTIDE1{
|
|
50
|
-
'PEPTIDE1{
|
|
45
|
+
'PEPTIDE1{R.F.C.T.G.H.F.Y.P.C.[meI]}$PEPTIDE1,PEPTIDE1,3:R3-10:R3$$$',
|
|
46
|
+
'PEPTIDE1{C.T.G.H.F.Y.P.C.[meI]}$PEPTIDE1,PEPTIDE1,1:R3-8:R3$$$',
|
|
47
|
+
'PEPTIDE1{R.F.C.T.G.H.F.Y.P.C}$PEPTIDE1,PEPTIDE1,3:R3-10:R3$$$',
|
|
48
|
+
'PEPTIDE1{C.T.G.H.F.H.P.C}$PEPTIDE1,PEPTIDE1,1:R3-8:R3$$$',
|
|
49
|
+
'PEPTIDE1{R.F.D.T.G.H.F.Y.P.[NH2]}$PEPTIDE1,PEPTIDE1,10:R2-3:R3$$$',
|
|
51
50
|
]
|
|
52
51
|
}
|
|
53
52
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
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 {before, after, category, expect, test, expectArray} from '@datagrok-libraries/utils/src/test';
|
|
6
|
+
import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
7
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
8
|
+
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
|
+
import {
|
|
10
|
+
getUserLibSettings, setUserLibSettings
|
|
11
|
+
} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
12
|
+
|
|
13
|
+
import {PolyToolEnumeratorParams, PolyToolEnumeratorTypes} from '../polytool/types';
|
|
14
|
+
import {doPolyToolEnumerateHelm} from '../polytool/pt-enumeration-helm';
|
|
15
|
+
|
|
16
|
+
import {_package} from '../package-test';
|
|
17
|
+
|
|
18
|
+
category('PolyTool: Enumerate', () => {
|
|
19
|
+
let helmHelper: IHelmHelper;
|
|
20
|
+
let monomerLibHelper: IMonomerLibHelper;
|
|
21
|
+
let userLibSettings: UserLibSettings; //backup
|
|
22
|
+
|
|
23
|
+
before(async () => {
|
|
24
|
+
helmHelper = await getHelmHelper(); // initialize JSDraw2 and org
|
|
25
|
+
|
|
26
|
+
monomerLibHelper = await getMonomerLibHelper();
|
|
27
|
+
userLibSettings = await getUserLibSettings();
|
|
28
|
+
|
|
29
|
+
await monomerLibHelper.loadMonomerLibForTests();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
after(async () => {
|
|
33
|
+
await setUserLibSettings(userLibSettings);
|
|
34
|
+
await monomerLibHelper.loadMonomerLib(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const tests: {
|
|
38
|
+
[testName: string]: { src: string, params: PolyToolEnumeratorParams, tgt: { seq: string, name: string }[] }
|
|
39
|
+
} = {
|
|
40
|
+
'breadth1': {
|
|
41
|
+
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
42
|
+
params: {
|
|
43
|
+
type: PolyToolEnumeratorTypes.Single,
|
|
44
|
+
placeholdersBreadth: [
|
|
45
|
+
{start: 2, end: 4, monomers: ['K']},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
tgt: [
|
|
49
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.K.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K'},
|
|
50
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.K.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K'},
|
|
51
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K'},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
'breadth1-with-original': {
|
|
55
|
+
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
56
|
+
params: {
|
|
57
|
+
type: PolyToolEnumeratorTypes.Single,
|
|
58
|
+
placeholdersBreadth: [
|
|
59
|
+
{start: 2, end: 4, monomers: ['K']},
|
|
60
|
+
],
|
|
61
|
+
keepOriginal: true,
|
|
62
|
+
},
|
|
63
|
+
tgt: [
|
|
64
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: ''},
|
|
65
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.K.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K'},
|
|
66
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.K.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K'},
|
|
67
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K'},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
'breadth2': {
|
|
71
|
+
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
72
|
+
params: {
|
|
73
|
+
type: PolyToolEnumeratorTypes.Single,
|
|
74
|
+
placeholdersBreadth: [
|
|
75
|
+
{start: 2, end: 4, monomers: ['K', 'Y']},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
tgt: [
|
|
79
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.K.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3K'},
|
|
80
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.K.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4K'},
|
|
81
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K'},
|
|
82
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.Y.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-W3Y'},
|
|
83
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.Y.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-G4Y'},
|
|
84
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5Y'},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
'breadth-double': {
|
|
88
|
+
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
89
|
+
params: {
|
|
90
|
+
type: PolyToolEnumeratorTypes.Single,
|
|
91
|
+
placeholdersBreadth: [
|
|
92
|
+
{start: 2, end: 4, monomers: ['K']},
|
|
93
|
+
{start: 2, end: 4, monomers: ['Y']},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
tgt: [
|
|
97
|
+
{seq: "PEPTIDE1{[Ac(1)].F.Y.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-W3K-K3Y"},
|
|
98
|
+
{seq: "PEPTIDE1{[Ac(1)].F.K.Y.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-W3K-G4Y"},
|
|
99
|
+
{seq: "PEPTIDE1{[Ac(1)].F.K.G.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-W3K-P5Y"},
|
|
100
|
+
{seq: "PEPTIDE1{[Ac(1)].F.Y.K.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-G4K-W3Y"},
|
|
101
|
+
{seq: "PEPTIDE1{[Ac(1)].F.W.Y.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-G4K-K4Y"},
|
|
102
|
+
{seq: "PEPTIDE1{[Ac(1)].F.W.K.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-G4K-P5Y"},
|
|
103
|
+
{seq: "PEPTIDE1{[Ac(1)].F.Y.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-P5K-W3Y"},
|
|
104
|
+
{seq: "PEPTIDE1{[Ac(1)].F.W.Y.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-P5K-G4Y"},
|
|
105
|
+
{seq: "PEPTIDE1{[Ac(1)].F.W.G.Y.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0", name: "-P5K-K5Y"}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
for (const [testName, testData] of Object.entries(tests)) {
|
|
111
|
+
test(`${testName}`, async () => {
|
|
112
|
+
const res = doPolyToolEnumerateHelm(testData.src, '', testData.params);
|
|
113
|
+
expectArray(res, testData.tgt.map((r) => [r.seq, r.name]));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
@@ -7,7 +7,7 @@ import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-
|
|
|
7
7
|
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
8
8
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
9
|
import {
|
|
10
|
-
getUserLibSettings, setUserLibSettings
|
|
10
|
+
getUserLibSettings, setUserLibSettings
|
|
11
11
|
} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
12
12
|
|
|
13
13
|
import {PolyToolEnumeratorParams, PolyToolEnumeratorTypes} from '../polytool/types';
|
|
@@ -26,8 +26,7 @@ category('PolyTool: Enumerate', () => {
|
|
|
26
26
|
monomerLibHelper = await getMonomerLibHelper();
|
|
27
27
|
userLibSettings = await getUserLibSettings();
|
|
28
28
|
// Clear settings to test default
|
|
29
|
-
await
|
|
30
|
-
await monomerLibHelper.loadMonomerLib(true);
|
|
29
|
+
await monomerLibHelper.loadMonomerLibForTests();
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
after(async () => {
|
|
@@ -36,42 +35,42 @@ category('PolyTool: Enumerate', () => {
|
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
const tests: {
|
|
39
|
-
[testName: string]: { src: string, params: PolyToolEnumeratorParams, tgt:
|
|
38
|
+
[testName: string]: { src: string, params: PolyToolEnumeratorParams, tgt: { seq: string, name: string }[] }
|
|
40
39
|
} = {
|
|
41
40
|
'single1': {
|
|
42
41
|
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
43
42
|
params: {
|
|
44
43
|
type: PolyToolEnumeratorTypes.Single,
|
|
45
|
-
placeholders:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
placeholders: [
|
|
45
|
+
{position: 4, monomers: ['K', 'P', 'F4COO']},
|
|
46
|
+
{position: 6, monomers: ['Y', 'T']},
|
|
47
|
+
],
|
|
49
48
|
},
|
|
50
49
|
tgt: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K'},
|
|
51
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5P'},
|
|
52
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.[F4COO].L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5[F4COO]'},
|
|
53
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-[Tic]7Y'},
|
|
54
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-[Tic]7T'},
|
|
56
55
|
]
|
|
57
56
|
},
|
|
58
57
|
'single-with-original': {
|
|
59
58
|
src: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0',
|
|
60
59
|
params: {
|
|
61
60
|
type: PolyToolEnumeratorTypes.Single,
|
|
62
|
-
placeholders:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
placeholders: [
|
|
62
|
+
{position: 4, monomers: ['K', 'P', 'F4COO']},
|
|
63
|
+
{position: 6, monomers: ['Y', 'T']},
|
|
64
|
+
],
|
|
66
65
|
keepOriginal: true,
|
|
67
66
|
},
|
|
68
67
|
tgt: [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: ''},
|
|
69
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.K.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5K'},
|
|
70
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5P'},
|
|
71
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.[F4COO].L.[Tic].[C(1)].G.[NH2]}$$$$V2.0', name: '-P5[F4COO]'},
|
|
72
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-[Tic]7Y'},
|
|
73
|
+
{seq: 'PEPTIDE1{[Ac(1)].F.W.G.P.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-[Tic]7T'},
|
|
75
74
|
]
|
|
76
75
|
},
|
|
77
76
|
'matrix1': {
|
|
@@ -79,25 +78,25 @@ category('PolyTool: Enumerate', () => {
|
|
|
79
78
|
params:
|
|
80
79
|
{
|
|
81
80
|
type: PolyToolEnumeratorTypes.Matrix,
|
|
82
|
-
placeholders:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
placeholders: [
|
|
82
|
+
{position: 1, monomers: ['D', 'L']},
|
|
83
|
+
{position: 4, monomers: ['K', 'P', 'F4COO']},
|
|
84
|
+
{position: 6, monomers: ['Y', 'T']},
|
|
85
|
+
]
|
|
87
86
|
},
|
|
88
87
|
tgt: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.K.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5K-[Tic]7Y'},
|
|
89
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.K.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5K-[Tic]7T'},
|
|
90
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.P.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5P-[Tic]7Y'},
|
|
91
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.P.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5P-[Tic]7T'},
|
|
92
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.[F4COO].L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5[F4COO]-[Tic]7Y'},
|
|
93
|
+
{seq: 'PEPTIDE1{[Ac(1)].D.W.G.[F4COO].L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2D-P5[F4COO]-[Tic]7T'},
|
|
94
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.K.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5K-[Tic]7Y'},
|
|
95
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.K.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5K-[Tic]7T'},
|
|
96
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.P.L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5P-[Tic]7Y'},
|
|
97
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.P.L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5P-[Tic]7T'},
|
|
98
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.[F4COO].L.Y.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5[F4COO]-[Tic]7Y'},
|
|
99
|
+
{seq: 'PEPTIDE1{[Ac(1)].L.W.G.[F4COO].L.T.[C(1)].G.[NH2]}$$$$V2.0', name: '-F2L-P5[F4COO]-[Tic]7T'},
|
|
101
100
|
],
|
|
102
101
|
}
|
|
103
102
|
};
|
|
@@ -105,7 +104,7 @@ category('PolyTool: Enumerate', () => {
|
|
|
105
104
|
for (const [testName, testData] of Object.entries(tests)) {
|
|
106
105
|
test(`${testName}`, async () => {
|
|
107
106
|
const res = doPolyToolEnumerateHelm(testData.src, '', testData.params);
|
|
108
|
-
expectArray(res, testData.tgt);
|
|
107
|
+
expectArray(res, testData.tgt.map((r) => [r.seq, r.name]));
|
|
109
108
|
});
|
|
110
109
|
}
|
|
111
110
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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 {before, after, category, expect, test, expectArray, testEvent, delay} from '@datagrok-libraries/utils/src/test';
|
|
6
|
+
|
|
7
|
+
import {doPolyToolUnrule} from '../polytool/pt-unrule';
|
|
8
|
+
import {getRules} from '../polytool/pt-rules';
|
|
9
|
+
|
|
10
|
+
import {_package} from '../package-test';
|
|
@@ -0,0 +1,72 @@
|
|
|
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 {before, after, category, expect, test, expectArray, testEvent, delay} from '@datagrok-libraries/utils/src/test';
|
|
6
|
+
import {Monomer, MonomerLibData} from '@datagrok-libraries/bio/src/types/index';
|
|
7
|
+
|
|
8
|
+
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
9
|
+
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
10
|
+
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
11
|
+
import {getUserLibSettings, setUserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
12
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
13
|
+
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
14
|
+
import {getRdKitModule} from '@datagrok-libraries/bio/src/chem/rdkit-module';
|
|
15
|
+
import {RDModule} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
16
|
+
|
|
17
|
+
import {_package} from '../package-test';
|
|
18
|
+
|
|
19
|
+
category('toAtomicLevel', () => {
|
|
20
|
+
let userLibSettings: UserLibSettings;
|
|
21
|
+
let monomerLibHelper: IMonomerLibHelper;
|
|
22
|
+
let rdKitModule: RDModule;
|
|
23
|
+
|
|
24
|
+
before(async () => {
|
|
25
|
+
|
|
26
|
+
monomerLibHelper = await getMonomerLibHelper();
|
|
27
|
+
userLibSettings = await getUserLibSettings();
|
|
28
|
+
rdKitModule = await getRdKitModule();
|
|
29
|
+
|
|
30
|
+
await monomerLibHelper.loadMonomerLibForTests();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
after(async () => {
|
|
34
|
+
await setUserLibSettings(userLibSettings);
|
|
35
|
+
await monomerLibHelper.loadMonomerLib(true); // load user settings libraries
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('override', async () => {
|
|
39
|
+
const systemMonomerLib = monomerLibHelper.getMonomerLib();
|
|
40
|
+
const rLibStr = await _package.files.readAsText('tests/polytool-reaction-lib.json');
|
|
41
|
+
const rLib: Monomer[] = JSON.parse(rLibStr);
|
|
42
|
+
const ggazM = rLib.find((m) => m.symbol === 'GGaz')!;
|
|
43
|
+
expect(ggazM != null, true, `Monomer 'GGaz' not found.`);
|
|
44
|
+
|
|
45
|
+
const overrideMonomerLibData: MonomerLibData = {[PolymerTypes.PEPTIDE]: {'GGaz': ggazM}};
|
|
46
|
+
const overriddenMonomerLib = systemMonomerLib.override(overrideMonomerLibData);
|
|
47
|
+
|
|
48
|
+
const seqHelper = await getSeqHelper();
|
|
49
|
+
|
|
50
|
+
const helmCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, 'helm',
|
|
51
|
+
['PEPTIDE1{F.P.Y.[GGaz].H.A.A.G.G.A.C}|PEPTIDE2{A.A.A}$PEPTIDE1,PEPTIDE2,4:R4-1:R1|PEPTIDE1,PEPTIDE1,11:R2-4:R3$$$V2.0']);
|
|
52
|
+
helmCol.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
53
|
+
helmCol.meta.units = NOTATION.HELM;
|
|
54
|
+
const talRes = await seqHelper.helmToAtomicLevel(helmCol, false, false, overriddenMonomerLib);
|
|
55
|
+
|
|
56
|
+
expect(talRes.molCol != null, true, 'Result molCol is null');
|
|
57
|
+
const molfile = talRes.molCol!.get(0)!;
|
|
58
|
+
expect(!!molfile, true, 'Molfile is empty');
|
|
59
|
+
|
|
60
|
+
const mol = rdKitModule.get_mol(molfile);
|
|
61
|
+
try {
|
|
62
|
+
const molInchi = mol.get_inchi();
|
|
63
|
+
const molInchiKey = rdKitModule.get_inchikey_for_inchi(molInchi);
|
|
64
|
+
|
|
65
|
+
expect(mol.get_num_bonds(), 103);
|
|
66
|
+
expect(mol.get_num_atoms(), 98);
|
|
67
|
+
expect(molInchiKey, 'XPQUTLNSNIMERR-WKBTUBAPSA-N');
|
|
68
|
+
} finally {
|
|
69
|
+
mol.delete();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|