@datagrok/bio 2.15.0 → 2.15.2
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/CHANGELOG.md +11 -0
- package/dist/731.js +1 -1
- package/dist/731.js.map +1 -1
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/package.json +7 -7
- package/src/tests/detectors-benchmark-tests.ts +16 -30
- package/src/tests/monomer-libraries-tests.ts +2 -4
- package/src/tests/pepsea-tests.ts +1 -1
- package/src/utils/monomer-lib/monomer-manager/monomer-manager.ts +8 -1
- package/src/utils/pepsea.ts +2 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Aleksandr Tanas",
|
|
6
6
|
"email": "atanas@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.15.
|
|
8
|
+
"version": "2.15.2",
|
|
9
9
|
"description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@biowasm/aioli": "^3.1.0",
|
|
40
|
-
"@datagrok-libraries/bio": "^5.
|
|
40
|
+
"@datagrok-libraries/bio": "^5.43.0",
|
|
41
41
|
"@datagrok-libraries/chem-meta": "^1.2.5",
|
|
42
42
|
"@datagrok-libraries/math": "^1.2.0",
|
|
43
|
-
"@datagrok-libraries/ml": "^6.7.
|
|
43
|
+
"@datagrok-libraries/ml": "^6.7.1",
|
|
44
44
|
"@datagrok-libraries/tutorials": "^1.4.0",
|
|
45
|
-
"@datagrok-libraries/utils": "^4.3.
|
|
45
|
+
"@datagrok-libraries/utils": "^4.3.3",
|
|
46
46
|
"@webgpu/types": "^0.1.40",
|
|
47
47
|
"ajv": "^8.12.0",
|
|
48
48
|
"ajv-errors": "^3.0.0",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"link-bio": "npm link @datagrok-libraries/bio",
|
|
84
84
|
"link-ml": "npm link @datagrok-libraries/ml",
|
|
85
85
|
"link-utils": "npm link @datagrok-libraries/utils",
|
|
86
|
-
"link-all": "npm link @datagrok-libraries/chem-meta datagrok-api @datagrok-libraries/
|
|
86
|
+
"link-all": "npm link @datagrok-libraries/chem-meta datagrok-api @datagrok-libraries/math @datagrok-libraries/utils @datagrok-libraries/ml @datagrok-libraries/bio @datagrok-libraries/tutorials",
|
|
87
87
|
"debug-sequences1": "webpack && grok publish",
|
|
88
88
|
"release-sequences1": "webpack && grok publish --release",
|
|
89
89
|
"build-sequences1": "webpack",
|
|
90
90
|
"build": "webpack",
|
|
91
|
-
"build-all": "npm --prefix ./../../libraries/chem-meta run build && npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/
|
|
91
|
+
"build-all": "npm --prefix ./../../libraries/chem-meta run build && npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/math run build && npm --prefix ./../../libraries/utils run build && npm --prefix ./../../libraries/ml run build && npm --prefix ./../../libraries/bio run build && npm --prefix ./../../libraries/tutorials run build && npm run build",
|
|
92
92
|
"debug-sequences1-local": "webpack && grok publish local",
|
|
93
93
|
"release-sequences1-local": "webpack && grok publish local --release",
|
|
94
94
|
"debug-sequences1-dev": "webpack && grok publish dev",
|
|
@@ -153,4 +153,4 @@
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|
|
@@ -52,17 +52,17 @@ category('detectorsBenchmark', () => {
|
|
|
52
52
|
maxET: number, notation: NOTATION, alphabet: ALPHABET, length: number, count: number, separator?: string,
|
|
53
53
|
): Promise<number> {
|
|
54
54
|
return await benchmark<DG.FuncCall, DG.Column>(maxET,
|
|
55
|
-
async (): Promise<DG.FuncCall> => {
|
|
55
|
+
/* prepare */ async (): Promise<DG.FuncCall> => {
|
|
56
56
|
const col: DG.Column = generate(notation, [...getAlphabet(alphabet)], length, count, separator);
|
|
57
57
|
const funcCall: DG.FuncCall = detectFunc.prepare({col: col});
|
|
58
58
|
// warm-up Bio
|
|
59
|
-
|
|
59
|
+
testDetector(funcCall);
|
|
60
60
|
return funcCall;
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
/* test */ (funcCall: DG.FuncCall): DG.Column => { // sync call for stability
|
|
63
63
|
return testDetector(funcCall);
|
|
64
64
|
},
|
|
65
|
-
(col: DG.Column) => {
|
|
65
|
+
/* check */ (col: DG.Column) => {
|
|
66
66
|
checkDetectorRes(col, {
|
|
67
67
|
semType: DG.SEMTYPE.MACROMOLECULE,
|
|
68
68
|
notation: notation,
|
|
@@ -115,9 +115,8 @@ category('detectorsBenchmark', () => {
|
|
|
115
115
|
|
|
116
116
|
type TgtType = { semType: string, notation: NOTATION, alphabet: ALPHABET, separator?: string };
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
await funcCall.call();
|
|
118
|
+
function testDetector(funcCall: DG.FuncCall): DG.Column {
|
|
119
|
+
funcCall.callSync();
|
|
121
120
|
const semType = funcCall.getOutputParamValue() as string;
|
|
122
121
|
|
|
123
122
|
const col: DG.Column = funcCall.inputs.col as unknown as DG.Column;
|
|
@@ -137,34 +136,21 @@ category('detectorsBenchmark', () => {
|
|
|
137
136
|
|
|
138
137
|
//Returns ET [ms] of test()
|
|
139
138
|
async function benchmark<TData, TRes>(
|
|
140
|
-
maxET: number, prepare: () => Promise<TData>, test: (data: TData) =>
|
|
139
|
+
maxET: number, prepare: () => Promise<TData>, test: (data: TData) => TRes, check: (res: TRes) => void,
|
|
141
140
|
): Promise<number> {
|
|
142
141
|
const data: TData = await prepare();
|
|
143
142
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
let resET: number = 0;
|
|
150
|
-
for (let tryI = 0; tryI < 20; ++tryI) {
|
|
151
|
-
const t1: number = Date.now();
|
|
152
|
-
// console.profile();
|
|
153
|
-
const res: TRes = await test(data);
|
|
154
|
-
//console.profileEnd();
|
|
155
|
-
const t2: number = Date.now();
|
|
156
|
-
|
|
157
|
-
resET = resEtList[tryI] = t2 - t1;
|
|
158
|
-
if (resET > maxET) {
|
|
159
|
-
outCount++;
|
|
160
|
-
outResET = Math.max(outResET, resET);
|
|
161
|
-
}
|
|
143
|
+
const t1: number = Date.now();
|
|
144
|
+
// console.profile();
|
|
145
|
+
const res: TRes = test(data); // sync call for stability
|
|
146
|
+
//console.profileEnd();
|
|
147
|
+
const t2: number = Date.now();
|
|
162
148
|
|
|
163
|
-
|
|
164
|
-
}
|
|
149
|
+
check(res);
|
|
165
150
|
|
|
166
|
-
|
|
167
|
-
|
|
151
|
+
const resET = t2 - t1;
|
|
152
|
+
if (resET > maxET) {
|
|
153
|
+
const errMsg = `ET ${resET} ms is more than max allowed ${maxET} ms.`;
|
|
168
154
|
console.error(errMsg);
|
|
169
155
|
throw new Error(errMsg);
|
|
170
156
|
} else
|
|
@@ -3,11 +3,11 @@ import * as DG from 'datagrok-api/dg';
|
|
|
3
3
|
import * as ui from 'datagrok-api/ui';
|
|
4
4
|
|
|
5
5
|
import {test, after, before, category, expect} from '@datagrok-libraries/utils/src/test';
|
|
6
|
-
|
|
7
6
|
import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
8
7
|
import {
|
|
9
8
|
getUserLibSettings, setUserLibSettings, setUserLibSettingsForTests
|
|
10
9
|
} from '@datagrok-libraries/bio/src/monomer-works/lib-settings';
|
|
10
|
+
import {expectMonomerLib} from '@datagrok-libraries/bio/src/tests/monomer-lib-tests';
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
category('monomerLibraries', () => {
|
|
@@ -41,9 +41,7 @@ category('monomerLibraries', () => {
|
|
|
41
41
|
// Currently default monomer lib set is of all files at LIB_PATH (at least HELMCoreLibrary.json)
|
|
42
42
|
const currentMonomerLib = monomerLibHelper.getMonomerLib();
|
|
43
43
|
// HELMCoreLibrary.json checks
|
|
44
|
-
|
|
45
|
-
expect(currentMonomerLib.getMonomerSymbolsByType('PEPTIDE').length, 324);
|
|
46
|
-
expect(currentMonomerLib.getMonomerSymbolsByType('RNA').length, 383);
|
|
44
|
+
expectMonomerLib(currentMonomerLib);
|
|
47
45
|
});
|
|
48
46
|
|
|
49
47
|
test('empty', async () => {
|
|
@@ -907,6 +907,13 @@ function capSmiles(smiles: string, rgroups: RGroup[]) {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
function monomerFromDfRow(dfRow: DG.Row): Monomer {
|
|
910
|
+
// hacky way for now, but meta object for now only supports key value pairs and not nested objects
|
|
911
|
+
const metaJSON = JSON.parse(dfRow.get(MONOMER_DF_COLUMN_NAMES.META) ?? '{}');
|
|
912
|
+
for (const key in metaJSON) {
|
|
913
|
+
if (typeof metaJSON[key] === 'object')
|
|
914
|
+
metaJSON[key] = JSON.stringify(metaJSON[key]);
|
|
915
|
+
}
|
|
916
|
+
|
|
910
917
|
return {
|
|
911
918
|
symbol: dfRow.get(MONOMER_DF_COLUMN_NAMES.SYMBOL),
|
|
912
919
|
name: dfRow.get(MONOMER_DF_COLUMN_NAMES.NAME),
|
|
@@ -917,7 +924,7 @@ function monomerFromDfRow(dfRow: DG.Row): Monomer {
|
|
|
917
924
|
naturalAnalog: dfRow.get(MONOMER_DF_COLUMN_NAMES.NATURAL_ANALOG),
|
|
918
925
|
id: dfRow.get(MONOMER_DF_COLUMN_NAMES.ID),
|
|
919
926
|
rgroups: JSON.parse(dfRow.get(MONOMER_DF_COLUMN_NAMES.R_GROUPS) ?? '[]'),
|
|
920
|
-
meta:
|
|
927
|
+
meta: metaJSON,
|
|
921
928
|
author: dfRow.get(MONOMER_DF_COLUMN_NAMES.AUTHOR),
|
|
922
929
|
createDate: dfRow.get(MONOMER_DF_COLUMN_NAMES.CREATE_DATE),
|
|
923
930
|
};
|
package/src/utils/pepsea.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {Subject} from 'rxjs';
|
|
|
7
7
|
|
|
8
8
|
import {testEvent} from '@datagrok-libraries/utils/src/test';
|
|
9
9
|
import {NOTATION, TAGS as bioTAGS, ALIGNMENT, ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
10
|
+
import { fetchWrapper } from '@datagrok-libraries/utils/src/fetch-utils';
|
|
10
11
|
import {ILogger} from '@datagrok-libraries/bio/src/utils/logger';
|
|
11
12
|
|
|
12
13
|
import {checkForSingleSeqClusters} from './multiple-sequence-alignment';
|
|
@@ -79,7 +80,7 @@ export async function runPepsea(srcCol: DG.Column<string>, unUsedName: string,
|
|
|
79
80
|
|
|
80
81
|
const alignedSequences: string[] = new Array(peptideCount);
|
|
81
82
|
for (const body of bodies) { // getting aligned sequences for each cluster
|
|
82
|
-
const alignedObject = await requestAlignedObjects(pepseaContainer.id, body, method, gapOpen, gapExtend, logger);
|
|
83
|
+
const alignedObject = await fetchWrapper(() => requestAlignedObjects(pepseaContainer.id, body, method, gapOpen, gapExtend, logger));
|
|
83
84
|
const alignments = alignedObject.Alignment;
|
|
84
85
|
|
|
85
86
|
for (const alignment of alignments) { // filling alignedSequencesCol
|