@datagrok/sequence-translator 1.9.15 → 1.10.1
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/455.js +1 -1
- package/dist/455.js.map +1 -1
- 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/package.json +4 -4
- package/src/apps/common/model/monomer-lib/lib-wrapper.ts +1 -1
- package/src/apps/common/model/oligo-toolkit-package.ts +3 -4
- package/src/apps/translator/view/ui.ts +2 -1
- package/src/polytool/conversion/pt-atomic.ts +2 -2
- package/src/polytool/conversion/pt-rule-cards.ts +2 -1
- package/src/polytool/conversion/pt-rules.ts +1 -1
- package/src/polytool/conversion/pt-synthetic.ts +33 -25
- package/src/polytool/monomer-lib-handler.ts +1 -1
- package/src/polytool/pt-dialog.ts +3 -3
- package/src/polytool/pt-enumerate-seq-dialog.ts +8 -4
- package/src/polytool/pt-enumeration-helm.ts +1 -1
- package/src/polytool/pt-unrule-dialog.ts +2 -2
- package/src/polytool/utils.ts +16 -9
- package/src/tests/polytool-chain-from-notation-tests.ts +1 -0
- package/src/tests/polytool-chain-parse-notation-tests.ts +2 -1
- package/src/tests/polytool-convert-tests.ts +2 -1
- package/src/tests/polytool-enumerate-breadth-tests.ts +10 -10
- package/src/tests/polytool-enumerate-tests.ts +1 -1
- package/src/tests/toAtomicLevel-tests.ts +5 -5
- package/src/tests/utils/detect-macromolecule-utils.ts +1 -0
- package/test-console-output-1.log +161 -193
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/sequence-translator",
|
|
3
3
|
"friendlyName": "Sequence Translator",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@datagrok-libraries/bio": "^5.
|
|
25
|
+
"@datagrok-libraries/bio": "^5.60.1",
|
|
26
26
|
"@datagrok-libraries/chem-meta": "^1.2.8",
|
|
27
27
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
28
28
|
"@datagrok-libraries/utils": "^4.6.5",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"wu": "^2.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@datagrok-libraries/helm-web-editor": "^1.1.
|
|
42
|
+
"@datagrok-libraries/helm-web-editor": "^1.1.16",
|
|
43
43
|
"@datagrok-libraries/js-draw-lite": "^0.0.10",
|
|
44
|
-
"@datagrok/bio": "^2.
|
|
44
|
+
"@datagrok/bio": "^2.24.0",
|
|
45
45
|
"@datagrok/chem": "^1.13.0",
|
|
46
46
|
"@datagrok/helm": "^2.7.0",
|
|
47
47
|
"@types/jquery": "^3.5.32",
|
|
@@ -3,7 +3,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
3
3
|
import {_package} from '../../../../package';
|
|
4
4
|
import {DEFAULT_FORMATS} from '../const';
|
|
5
5
|
|
|
6
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
6
|
+
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
7
7
|
import {HELM_REQUIRED_FIELD as REQ, HELM_OPTIONAL_FIELDS as OPT} from '@datagrok-libraries/bio/src/utils/const';
|
|
8
8
|
|
|
9
9
|
import {META_FIELDS as MET} from './const';
|
|
@@ -3,8 +3,7 @@ import * as grok from 'datagrok-api/grok';
|
|
|
3
3
|
import * as ui from 'datagrok-api/ui';
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
5
|
|
|
6
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
7
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
6
|
+
import {IMonomerLib, Monomer, getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
7
|
import {LoggerWrapper} from '@datagrok-libraries/bio/src/utils/logger';
|
|
9
8
|
import {ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
10
9
|
import {IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
@@ -21,7 +20,6 @@ import {FormatDetector} from './parsing-validation/format-detector';
|
|
|
21
20
|
import {highlightInvalidSubsequence} from '../view/components/colored-input/input-painters';
|
|
22
21
|
|
|
23
22
|
export class OligoToolkitPackage extends DG.Package implements ITranslationHelper {
|
|
24
|
-
|
|
25
23
|
private _helmHelper: IHelmHelper;
|
|
26
24
|
public get helmHelper(): IHelmHelper {
|
|
27
25
|
if (!this._helmHelper)
|
|
@@ -119,7 +117,8 @@ async function loadMonomerLib(monomersPath: string): Promise<IMonomerLib> {
|
|
|
119
117
|
`Initializing ${APP_NAME.COMBINED} monomer library ...`);
|
|
120
118
|
try {
|
|
121
119
|
const libHelper = await getMonomerLibHelper();
|
|
122
|
-
const
|
|
120
|
+
const path = (monomersPath.endsWith('/') ? monomersPath : monomersPath + '/') + DEFAULT_LIB_FILENAME;
|
|
121
|
+
const res = await libHelper.readLibraryFromFilePath(path);
|
|
123
122
|
return res;
|
|
124
123
|
} finally { pi.close(); }
|
|
125
124
|
}
|
|
@@ -22,8 +22,9 @@ import {convert, getSupportedTargetFormats, getTranslatedSequences} from '../mod
|
|
|
22
22
|
import {ITranslationHelper} from '../../../types';
|
|
23
23
|
|
|
24
24
|
import {NUCLEOTIDES_FORMAT, SEQUENCE_COPIED_MSG, SEQ_TOOLTIP_MSG} from './const';
|
|
25
|
-
import './style.css';
|
|
26
25
|
import {_package} from '../../../package';
|
|
26
|
+
//@ts-ignore
|
|
27
|
+
import './style.css';
|
|
27
28
|
|
|
28
29
|
const enum REQUIRED_COLUMN_LABEL {
|
|
29
30
|
SEQUENCE = 'Sequence',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
3
|
|
|
4
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
4
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
5
5
|
import {getSeqHelper, ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
6
6
|
import {_toAtomicLevel} from '@datagrok-libraries/bio/src/monomer-works/to-atomic-level';
|
|
7
7
|
import {ALPHABET, NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
8
|
-
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types';
|
|
8
|
+
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
9
9
|
import {RDModule} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
10
10
|
|
|
11
11
|
export function dealGroups(col: DG.Column<string>): void {
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
3
|
import * as ui from 'datagrok-api/ui';
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
|
+
// @ts-ignore
|
|
5
6
|
import './style.css';
|
|
6
7
|
|
|
7
|
-
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types';
|
|
8
|
+
import {IMonomerLib, Monomer} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
9
|
import {Rules} from './pt-rules';
|
|
9
10
|
import {getHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
10
11
|
import {doPolyToolConvert} from './pt-conversion';
|
|
@@ -5,7 +5,7 @@ import * as ui from 'datagrok-api/ui';
|
|
|
5
5
|
import {ActiveFiles} from '@datagrok-libraries/utils/src/settings/active-files-base';
|
|
6
6
|
import {RulesManager} from './rule-manager';
|
|
7
7
|
import {RuleCards} from './pt-rule-cards';
|
|
8
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
8
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
9
9
|
import {
|
|
10
10
|
_package,
|
|
11
11
|
PackageFunctions} from '../../package';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import {getRdKitModule} from '@datagrok-libraries/bio/src/chem/rdkit-module';
|
|
2
3
|
import {Rules, RuleReaction, getMonomerPairs} from './pt-rules';
|
|
3
4
|
import {InvalidReactionError, MonomerNotFoundError} from '../types';
|
|
@@ -7,8 +8,7 @@ import * as grok from 'datagrok-api/grok';
|
|
|
7
8
|
|
|
8
9
|
import wu from 'wu';
|
|
9
10
|
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
10
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
11
|
-
import {IMonomerLib, IMonomerLibBase, Monomer, MonomerLibData, RGroup} from '@datagrok-libraries/bio/src/types';
|
|
11
|
+
import {IMonomerLib, IMonomerLibBase, Monomer, MonomerLibData, RGroup, getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
12
12
|
import {RDModule, RDMol, RDReaction, MolList, RDReactionResult} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
13
13
|
import {HELM_REQUIRED_FIELD as REQ,
|
|
14
14
|
HELM_OPTIONAL_FIELDS as OPT, HELM_RGROUP_FIELDS} from '@datagrok-libraries/bio/src/utils/const';
|
|
@@ -20,8 +20,8 @@ export async function getOverriddenLibrary(rules: Rules): Promise<IMonomerLibBas
|
|
|
20
20
|
const rdkit = await getRdKitModule();
|
|
21
21
|
const argLib: { [symbol: string]: Monomer } = {};
|
|
22
22
|
|
|
23
|
-
let names: string [] = [];
|
|
24
|
-
let monomers: Monomer [] = [];
|
|
23
|
+
let names: (string | null) [] = [];
|
|
24
|
+
let monomers: (Monomer | null) [] = [];
|
|
25
25
|
|
|
26
26
|
for (let i = 0; i < rules.reactionRules.length; i++) {
|
|
27
27
|
try {
|
|
@@ -32,8 +32,11 @@ export async function getOverriddenLibrary(rules: Rules): Promise<IMonomerLibBas
|
|
|
32
32
|
console.error(e);
|
|
33
33
|
grok.shell.warning(e);
|
|
34
34
|
} finally {
|
|
35
|
-
for (let j = 0; j < names.length; j ++)
|
|
36
|
-
|
|
35
|
+
for (let j = 0; j < names.length; j ++) {
|
|
36
|
+
if (names[j] == null || monomers[j] == null)
|
|
37
|
+
continue;
|
|
38
|
+
argLib[names[j]!] = monomers[j]!;
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
|
|
@@ -44,16 +47,16 @@ export async function getOverriddenLibrary(rules: Rules): Promise<IMonomerLibBas
|
|
|
44
47
|
return overriddenMonomerLib;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleReaction): [string[], Monomer[]] {
|
|
50
|
+
export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleReaction): [(string | null)[], (Monomer | null)[]] {
|
|
48
51
|
const reacSmarts = rule.reaction;
|
|
49
52
|
const monomerName = rule.name;
|
|
50
53
|
const totalLength = rule.firstMonomers.length + rule.secondMonomers.length + 1;
|
|
51
54
|
const reactionMembers = rule.reaction.split('>>');
|
|
52
55
|
const reactants = reactionMembers[0].split('.');
|
|
53
56
|
|
|
54
|
-
const monomerNames = new Array<string>(totalLength);
|
|
55
|
-
const resMonomers = new Array<Monomer>(totalLength);
|
|
56
|
-
const monomers = new Array<string>(totalLength);
|
|
57
|
+
const monomerNames = new Array<string | null>(totalLength);
|
|
58
|
+
const resMonomers = new Array<Monomer | null>(totalLength);
|
|
59
|
+
const monomers = new Array<string | null>(totalLength);
|
|
57
60
|
|
|
58
61
|
const mainRxn = getReactionSmirks(rdkit, reacSmarts);
|
|
59
62
|
|
|
@@ -66,20 +69,21 @@ export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleRea
|
|
|
66
69
|
let counter = 0;
|
|
67
70
|
for (let i = 0; i < rule.firstMonomers.length; i++) {
|
|
68
71
|
const monomer = mLib.getMonomer('PEPTIDE', rule.firstMonomers[i]);
|
|
69
|
-
if (!monomer) throw new MonomerNotFoundError('PEPTIDE', rule.firstMonomers[i]);
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
if (monomer) {
|
|
74
|
+
const sMolBlock = cutReactant(rdkit, monomer.molfile, rxnCutFirst, monomer.name);
|
|
75
|
+
monomers[counter] = sMolBlock;
|
|
76
|
+
monomerNames[counter] = `${monomer.symbol}_${monomerName}`;
|
|
77
|
+
}
|
|
74
78
|
counter++;
|
|
75
79
|
}
|
|
76
80
|
for (let i = 0; i < rule.secondMonomers.length; i++) {
|
|
77
81
|
const monomer = mLib.getMonomer('PEPTIDE', rule.secondMonomers[i]);
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
if (monomer) {
|
|
83
|
+
const sMolBlock = cutReactant(rdkit, monomer.molfile, rxnCutSecond, monomer.name);
|
|
84
|
+
monomers[counter] = sMolBlock;
|
|
85
|
+
monomerNames[counter] = `${monomer.symbol}_${monomerName}`;
|
|
86
|
+
}
|
|
83
87
|
counter++;
|
|
84
88
|
}
|
|
85
89
|
|
|
@@ -103,17 +107,21 @@ export function getNewMonomers(rdkit: RDModule, mLib: IMonomerLib, rule: RuleRea
|
|
|
103
107
|
|
|
104
108
|
//after RDKit works - [X:N] is first atom which is exploited
|
|
105
109
|
for (let i = 0; i < totalLength - 1; i ++) {
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
if (monomers[i]) {
|
|
111
|
+
monomers[i] = monomers[i]!.replace(' 0.0000 0.0000 0.0000 C ', ' 0.0000 0.0000 0.0000 R# ')
|
|
112
|
+
.replace('M RGP 2', 'M RGP 3 2 3');
|
|
113
|
+
}
|
|
108
114
|
}
|
|
109
|
-
monomers[totalLength - 1] = modProduct(monomers[totalLength - 1]);
|
|
115
|
+
monomers[totalLength - 1] = modProduct(monomers[totalLength - 1]!);
|
|
110
116
|
|
|
111
117
|
for (let i = 0; i < totalLength; i ++) {
|
|
112
118
|
const isProduct = i == totalLength - 1 ? true : false;
|
|
119
|
+
if (!monomers[i] || !monomerNames[i])
|
|
120
|
+
continue;
|
|
113
121
|
const resMonomer: Monomer = {
|
|
114
|
-
[REQ.SYMBOL]: monomerNames[i]
|
|
115
|
-
[REQ.NAME]: monomerNames[i]
|
|
116
|
-
[REQ.MOLFILE]: monomers[i]
|
|
122
|
+
[REQ.SYMBOL]: monomerNames[i]!,
|
|
123
|
+
[REQ.NAME]: monomerNames[i]!,
|
|
124
|
+
[REQ.MOLFILE]: monomers[i]!,
|
|
117
125
|
[REQ.AUTHOR]: '',
|
|
118
126
|
[REQ.ID]: 0,
|
|
119
127
|
[REQ.RGROUPS]: getNewGroups(isProduct),
|
|
@@ -7,7 +7,7 @@ import {HELM_FIELDS, DUMMY_MONOMER} from '@datagrok-libraries/bio/src/utils/cons
|
|
|
7
7
|
import {
|
|
8
8
|
helmFieldsToPolyToolInputFields, R_GROUP_BLOCK_DUMMY
|
|
9
9
|
} from './const';
|
|
10
|
-
import {Monomer, RGroup} from '@datagrok-libraries/bio/src/types/
|
|
10
|
+
import {Monomer, RGroup} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
11
11
|
|
|
12
12
|
export class PolyToolMonomerLibHandler {
|
|
13
13
|
constructor(private rawLib: any[]) { }
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from './const';
|
|
29
29
|
|
|
30
30
|
import {_package} from '../package';
|
|
31
|
-
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/
|
|
31
|
+
import {IMonomerLibBase} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
32
32
|
import {MonomerHoverLink} from '@datagrok-libraries/bio/src/monomer-works/utils';
|
|
33
33
|
import {MonomerMap} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
34
34
|
import {ISeqMonomer} from '@datagrok-libraries/bio/src/helm/types';
|
|
@@ -42,7 +42,6 @@ import {addSubstructProvider, getMonomerHover, ISubstruct, setMonomerHover}
|
|
|
42
42
|
import {getMolHighlight} from '@datagrok-libraries/bio/src/monomer-works/seq-to-molfile';
|
|
43
43
|
import {ChemTags} from '@datagrok-libraries/chem-meta/src/consts';
|
|
44
44
|
import {mergeSubstructs} from '@datagrok-libraries/chem-meta/src/types';
|
|
45
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
46
45
|
import {dealGroups, helmToMol} from './conversion/pt-atomic';
|
|
47
46
|
|
|
48
47
|
type PolyToolConvertSerialized = {
|
|
@@ -94,13 +93,14 @@ export async function getPolyToolConvertDialog(srcCol?: DG.Column): Promise<DG.D
|
|
|
94
93
|
if (!srcColVal) {
|
|
95
94
|
if (srcColList.length < 1)
|
|
96
95
|
throw new Error(PT_ERROR_DATAFRAME);
|
|
97
|
-
|
|
96
|
+
|
|
98
97
|
if (customSrcCols.length < 1) {
|
|
99
98
|
const toAtomicLevelFunc = DG.Func.find({package: 'Bio', name: 'toAtomicLevel'})[0];
|
|
100
99
|
if (toAtomicLevelFunc) {
|
|
101
100
|
toAtomicLevelFunc.prepare().edit();
|
|
102
101
|
return null;
|
|
103
102
|
}
|
|
103
|
+
// eslint-disable-next-line max-len
|
|
104
104
|
grok.shell.warning('Polytool requires a macromolecule column with custom notation. \n\nUse Top menu | Bio | Transform | To Atomic Level.');
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
@@ -10,7 +10,7 @@ import {Unsubscribable} from 'rxjs';
|
|
|
10
10
|
|
|
11
11
|
import {GetMonomerResType, HelmAtom, MonomerNumberingTypes} from '@datagrok-libraries/helm-web-editor/src/types/org-helm';
|
|
12
12
|
import {getHelmHelper, HelmInputBase, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
13
|
-
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
13
|
+
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
14
14
|
import {HelmType, PolymerType} from '@datagrok-libraries/bio/src/helm/types';
|
|
15
15
|
import {helmTypeToPolymerType} from '@datagrok-libraries/bio/src/monomer-works/monomer-works';
|
|
16
16
|
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
@@ -169,7 +169,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
169
169
|
const seqCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, 'seq', [PT_HELM_EXAMPLE]);
|
|
170
170
|
seqCol.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
171
171
|
const _tempDf = DG.DataFrame.fromColumns([seqCol]);
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
seqCol.meta.units = NOTATION.HELM;
|
|
174
174
|
const sh = seqHelper.getSeqHandler(seqCol);
|
|
175
175
|
resSeqValue = sh.getValue(0);
|
|
@@ -187,7 +187,7 @@ async function getPolyToolEnumerateDialog(
|
|
|
187
187
|
const warningsTextDiv = ui.divText('', {style: {color: 'red'}});
|
|
188
188
|
// #### Inputs
|
|
189
189
|
inputs = {
|
|
190
|
-
macromolecule: helmHelper.createHelmInput(
|
|
190
|
+
macromolecule: helmHelper.createHelmInput(
|
|
191
191
|
'Macromolecule', {
|
|
192
192
|
editable: false,
|
|
193
193
|
editorOptions: {
|
|
@@ -590,7 +590,11 @@ async function getPolyToolEnumerateDialog(
|
|
|
590
590
|
return;
|
|
591
591
|
}
|
|
592
592
|
const monLibName = placeHoldersValue[0].monomers[0];
|
|
593
|
-
const monLib = await libHelper.
|
|
593
|
+
const monLib = await libHelper.readSingleLibraryByName(monLibName);
|
|
594
|
+
if (!monLib) {
|
|
595
|
+
grok.shell.warning(`Monomer Library '${monLibName}' was not found`);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
594
598
|
const peptideMonomers = monLib.getMonomerSymbolsByType(PolymerTypes.PEPTIDE);
|
|
595
599
|
placeHoldersValue[0].monomers = peptideMonomers;
|
|
596
600
|
enumerationType = PolyToolEnumeratorTypes.Single;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as ui from 'datagrok-api/ui';
|
|
2
3
|
import * as grok from 'datagrok-api/grok';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
import {PtBio} from './conversion/pt-tools-helmmol';
|
|
13
|
-
import {getAvailableMonomers} from './utils';
|
|
14
14
|
import {PolyToolEnumeratorParams, PolyToolEnumeratorTypes,
|
|
15
15
|
PolyToolPlaceholder, PolyToolBreadthPlaceholder} from './types';
|
|
16
16
|
|
|
@@ -42,7 +42,7 @@ export async function getPolyToolUnruleDialog(srcCol?: DG.Column<string>): Promi
|
|
|
42
42
|
});
|
|
43
43
|
let ruleFileList: string[];
|
|
44
44
|
const ruleInputs = new RuleInputs(RULES_PATH, RULES_STORAGE_NAME, '.json', {
|
|
45
|
-
onValueChanged: (value: string[]) => { ruleFileList = value;}
|
|
45
|
+
onValueChanged: (value: string[]) => { ruleFileList = value; }
|
|
46
46
|
});
|
|
47
47
|
const rulesHeader = ui.inlineText([PT_UI_RULES_USED]);
|
|
48
48
|
const rulesForm = await ruleInputs.getForm();
|
|
@@ -95,7 +95,7 @@ export async function polyToolUnrule(
|
|
|
95
95
|
const rules = await getRules(ruleFiles);
|
|
96
96
|
const resHelmList = doPolyToolUnrule(srcCol.toList(), rules, helmHelper);
|
|
97
97
|
const resHelmColName = `harmonized(srcCol.name)`;
|
|
98
|
-
const resHelmCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, resHelmColName, resHelmList
|
|
98
|
+
const resHelmCol = DG.Column.fromList(DG.COLUMN_TYPE.STRING, resHelmColName, resHelmList);
|
|
99
99
|
resHelmCol.semType = DG.SEMTYPE.MACROMOLECULE;
|
|
100
100
|
resHelmCol.meta.units = NOTATION.CUSTOM;
|
|
101
101
|
if (table) {
|
package/src/polytool/utils.ts
CHANGED
|
@@ -8,8 +8,8 @@ import {ALPHABET, ALIGNMENT, NOTATION} from '@datagrok-libraries/bio/src/utils/m
|
|
|
8
8
|
import {OrgType} from '@datagrok-libraries/bio/src/helm/types';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from '@datagrok-libraries/bio/src/
|
|
11
|
+
getMonomerLibHelper, IMonomerLibHelper
|
|
12
|
+
} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
13
13
|
|
|
14
14
|
declare const org: OrgType;
|
|
15
15
|
export const LIB_PATH = 'System:AppData/Bio/monomer-libraries/';
|
|
@@ -28,15 +28,23 @@ function addCommonTags(col: DG.Column<any>) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export async function getAvailableMonomers(screenLibrary: string): Promise<string[]> {
|
|
31
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
32
|
-
const monomerLib = await monomerLibHelper.
|
|
31
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
32
|
+
const monomerLib = await monomerLibHelper.readSingleLibraryByName(screenLibrary);
|
|
33
|
+
if (!monomerLib) {
|
|
34
|
+
_package.logger.error(`Monomer library '${screenLibrary}' not found.`);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
33
37
|
//NOTICE: works with Peptides only
|
|
34
38
|
return monomerLib.getMonomerSymbolsByType('PEPTIDE');
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export async function getAvailableMonomerMols(screenLibrary: string): Promise<{[monomerSymbol: string]: string}> {
|
|
38
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
39
|
-
const monomerLib = await monomerLibHelper.
|
|
42
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
43
|
+
const monomerLib = await monomerLibHelper.readSingleLibraryByName(screenLibrary);
|
|
44
|
+
if (!monomerLib) {
|
|
45
|
+
_package.logger.error(`Monomer library '${screenLibrary}' not found.`);
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
40
48
|
const monomers = monomerLib.getMonomerSymbolsByType('PEPTIDE');
|
|
41
49
|
const mols = new Array<string>(monomers.length);
|
|
42
50
|
|
|
@@ -45,7 +53,6 @@ export async function getAvailableMonomerMols(screenLibrary: string): Promise<{[
|
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export async function getLibrariesList(): Promise<string[]> {
|
|
48
|
-
const monomerLibHelper: IMonomerLibHelper = await
|
|
49
|
-
|
|
50
|
-
return monomerFileManager.getValidLibraryPaths();
|
|
56
|
+
const monomerLibHelper: IMonomerLibHelper = await getMonomerLibHelper();
|
|
57
|
+
return monomerLibHelper.getAvaliableLibraryNames();
|
|
51
58
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -81,7 +82,7 @@ category('PolyTool: Chain: parseNotation', () => {
|
|
|
81
82
|
'3-in-1-1-6-3': {inIdx: 1, spIdx: 2, outIdx: 3, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
82
83
|
'7-in-1-1-6-3': {inIdx: 5, spIdx: 2, outIdx: 7, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
83
84
|
'8-in-1-1-6-3': {inIdx: 0, spIdx: 3, outIdx: 8, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]},
|
|
84
|
-
// '11-in-1-1-6-3': {inIdx: 0, spIdx: 4}, src: {outIdx: 11, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]}},
|
|
85
|
+
// '11-in-1-1-6-3': {inIdx: 0, spIdx: 4}, src: {outIdx: 11, monomers: [['0'], ['1'], ['2', '3', '4', '5', '6', '7'], ['8', '9', '10']]}},
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
for (const [testName, {inIdx, spIdx, outIdx, monomers}] of Object.entries(innerIdxTests)) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
4
5
|
|
|
5
6
|
import {before, after, category, expect, test, expectArray, testEvent, expectObject}
|
|
6
7
|
from '@datagrok-libraries/utils/src/test';
|
|
7
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
8
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
9
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
10
|
import {
|
|
10
11
|
getUserLibSettings, setUserLibSettings
|
|
@@ -4,7 +4,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
4
4
|
|
|
5
5
|
import {before, after, category, expect, test, expectArray} from '@datagrok-libraries/utils/src/test';
|
|
6
6
|
import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
7
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
7
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
8
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
9
|
import {
|
|
10
10
|
getUserLibSettings, setUserLibSettings
|
|
@@ -94,15 +94,15 @@ category('PolyTool: Enumerate', () => {
|
|
|
94
94
|
],
|
|
95
95
|
},
|
|
96
96
|
tgt: [
|
|
97
|
-
{seq:
|
|
98
|
-
{seq:
|
|
99
|
-
{seq:
|
|
100
|
-
{seq:
|
|
101
|
-
{seq:
|
|
102
|
-
{seq:
|
|
103
|
-
{seq:
|
|
104
|
-
{seq:
|
|
105
|
-
{seq:
|
|
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
106
|
]
|
|
107
107
|
}
|
|
108
108
|
};
|
|
@@ -4,7 +4,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
4
4
|
|
|
5
5
|
import {before, after, category, expect, test, expectArray} from '@datagrok-libraries/utils/src/test';
|
|
6
6
|
import {getHelmHelper, IHelmHelper} from '@datagrok-libraries/bio/src/helm/helm-helper';
|
|
7
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
7
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
8
8
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
9
9
|
import {
|
|
10
10
|
getUserLibSettings, setUserLibSettings
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
4
5
|
|
|
5
6
|
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/
|
|
7
|
+
import {Monomer, MonomerLibData} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
7
8
|
|
|
8
9
|
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
9
10
|
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
10
11
|
import {UserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/types';
|
|
11
12
|
import {getUserLibSettings, setUserLibSettings} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
12
|
-
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/
|
|
13
|
+
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
13
14
|
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
14
15
|
import {getRdKitModule} from '@datagrok-libraries/bio/src/chem/rdkit-module';
|
|
15
16
|
import {RDModule} from '@datagrok-libraries/chem-meta/src/rdkit-api';
|
|
@@ -79,9 +80,8 @@ category('toAtomicLevel', () => {
|
|
|
79
80
|
const reactionRule = rules.reactionRules.find((r) => r.name == 'GGaz')!;
|
|
80
81
|
|
|
81
82
|
const [newSymbols, newMonomers] = getNewMonomers(rdKitModule, systemMonomerLib, reactionRule);
|
|
82
|
-
expect(newSymbols[0], 'azG_GGaz');
|
|
83
|
-
|
|
84
|
-
const mol = rdKitModule.get_mol(newMonomers[0].molfile);
|
|
83
|
+
expect(newSymbols?.[0], 'azG_GGaz');
|
|
84
|
+
const mol = rdKitModule.get_mol(newMonomers[0]!.molfile);
|
|
85
85
|
try {
|
|
86
86
|
const molInchi = mol.get_inchi();
|
|
87
87
|
const molInchiKey = rdKitModule.get_inchikey_for_inchi(molInchi);
|