@datagrok/peptides 1.18.7 → 1.19.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/CHANGELOG.md +8 -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/package.json +7 -7
- package/src/model.ts +10 -8
- package/src/package-test.ts +1 -1
- package/src/package.ts +12 -0
- package/src/peptideUtils.ts +14 -0
- package/src/tests/benchmarks.ts +14 -1
- package/src/tests/core.ts +5 -2
- package/src/tests/misc.ts +3 -0
- package/src/tests/model.ts +2 -0
- package/src/tests/table-view.ts +3 -0
- package/src/tests/viewers.ts +3 -0
- package/src/tests/widgets.ts +9 -0
- package/src/viewers/logo-summary.ts +3 -1
- package/src/viewers/sar-viewer.ts +2 -1
- package/src/widgets/manual-alignment.ts +3 -3
- package/test-console-output-1.log +960 -0
- package/test-record-1.mp4 +0 -0
- package/src/global.d.ts +0 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/peptides",
|
|
3
3
|
"friendlyName": "Peptides",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.19.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"directory": "packages/Peptides"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@datagrok-libraries/bio": "^5.
|
|
16
|
+
"@datagrok-libraries/bio": "^5.46.1",
|
|
17
17
|
"@datagrok-libraries/math": "^1.2.3",
|
|
18
|
-
"@datagrok-libraries/ml": "^6.7.
|
|
18
|
+
"@datagrok-libraries/ml": "^6.7.5",
|
|
19
19
|
"@datagrok-libraries/statistics": "^1.2.12",
|
|
20
20
|
"@datagrok-libraries/tutorials": "^1.4.2",
|
|
21
|
-
"@datagrok-libraries/utils": "^4.3.
|
|
22
|
-
"datagrok-api": "^1.
|
|
21
|
+
"@datagrok-libraries/utils": "^4.3.10",
|
|
22
|
+
"datagrok-api": "^1.22.0",
|
|
23
23
|
"@webgpu/types": "^0.1.40",
|
|
24
24
|
"cash-dom": "^8.1.5",
|
|
25
25
|
"file-loader": "^6.2.0",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@datagrok-libraries/helm-web-editor": "^1.1.7",
|
|
32
32
|
"@datagrok-libraries/js-draw-lite": "^0.0.5",
|
|
33
|
-
"@datagrok/bio": "^2.
|
|
33
|
+
"@datagrok/bio": "^2.16.9",
|
|
34
34
|
"@datagrok/chem": "^1.12.0",
|
|
35
35
|
"@datagrok/dendrogram": "^1.2.33",
|
|
36
|
-
"@datagrok/helm": "^2.5.
|
|
36
|
+
"@datagrok/helm": "^2.5.9",
|
|
37
37
|
"@types/uuid": "^10.0.0",
|
|
38
38
|
"@types/wu": "^2.1.44",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
package/src/model.ts
CHANGED
|
@@ -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';
|
|
@@ -13,7 +14,7 @@ import {DistanceMatrix} from '@datagrok-libraries/ml/src/distance-matrix';
|
|
|
13
14
|
import {BitArrayMetrics} from '@datagrok-libraries/ml/src/typed-metrics';
|
|
14
15
|
import {TAGS as _treeTAGS} from '@datagrok-libraries/bio/src/trees';
|
|
15
16
|
import BitArray from '@datagrok-libraries/utils/src/bit-array';
|
|
16
|
-
import {
|
|
17
|
+
import {getSeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
17
18
|
import wu from 'wu';
|
|
18
19
|
import * as rxjs from 'rxjs';
|
|
19
20
|
import $ from 'cash-dom';
|
|
@@ -54,6 +55,7 @@ import {markovCluster} from '@datagrok-libraries/ml/src/MCL/clustering-view';
|
|
|
54
55
|
import {DistanceAggregationMethods} from '@datagrok-libraries/ml/src/distance-matrix/types';
|
|
55
56
|
import {ClusterMaxActivityViewer, IClusterMaxActivity} from './viewers/cluster-max-activity-viewer';
|
|
56
57
|
import {MCL_OPTIONS_TAG, MCLSerializableOptions} from '@datagrok-libraries/ml/src/MCL';
|
|
58
|
+
import {PeptideUtils} from './peptideUtils';
|
|
57
59
|
|
|
58
60
|
export enum VIEWER_TYPE {
|
|
59
61
|
SEQUENCE_VARIABILITY_MAP = 'Sequence Variability Map',
|
|
@@ -613,7 +615,7 @@ export class PeptidesModel {
|
|
|
613
615
|
(requestSource as SARViewer | LogoSummaryTable).getScaledActivityColumn(),
|
|
614
616
|
gridColumns: trueModel.analysisView.grid.columns,
|
|
615
617
|
colorPalette: pickUpPalette(trueModel.df.getCol(isModelSource ? trueModel.settings!.sequenceColumnName :
|
|
616
|
-
(requestSource as SARViewer | LogoSummaryTable).sequenceColumnName)),
|
|
618
|
+
(requestSource as SARViewer | LogoSummaryTable).sequenceColumnName), PeptideUtils.getSeqHelper()),
|
|
617
619
|
tableSelection: trueModel.getCombinedSelection(),
|
|
618
620
|
isAnalysis: trueModel.settings !== null && (isModelSource ||
|
|
619
621
|
areObjectsEqual(trueModel.settings.columns, (requestSource as PeptideViewer).getAggregationColumns())),
|
|
@@ -652,7 +654,7 @@ export class PeptidesModel {
|
|
|
652
654
|
selectionCallback: (monomerPosition: type.SelectionItem, options: type.SelectionOptions): void =>
|
|
653
655
|
this.modifyWebLogoSelection(monomerPosition, options),
|
|
654
656
|
unhighlightCallback: (): void => this.unhighlight(),
|
|
655
|
-
colorPalette: () => pickUpPalette(this.df.getCol(this.settings!.sequenceColumnName)),
|
|
657
|
+
colorPalette: () => pickUpPalette(this.df.getCol(this.settings!.sequenceColumnName), PeptideUtils.getSeqHelper()),
|
|
656
658
|
webLogoBounds: () => this.webLogoBounds,
|
|
657
659
|
cachedWebLogoTooltip: () => this.cachedWebLogoTooltip,
|
|
658
660
|
highlightCallback: (mp: type.SelectionItem, df: DG.DataFrame, mpStats: MonomerPositionStats): void =>
|
|
@@ -686,7 +688,7 @@ export class PeptidesModel {
|
|
|
686
688
|
// append splitSeqDf columns to source table and make sure columns are not added more than once
|
|
687
689
|
const name = this.df.name;
|
|
688
690
|
const cols = this.df.columns;
|
|
689
|
-
const splitSeqDf = splitAlignedSequences(this.df.getCol(this.settings!.sequenceColumnName));
|
|
691
|
+
const splitSeqDf = splitAlignedSequences(this.df.getCol(this.settings!.sequenceColumnName), PeptideUtils.getSeqHelper());
|
|
690
692
|
const positionColumns = splitSeqDf.columns.names();
|
|
691
693
|
for (const colName of positionColumns) {
|
|
692
694
|
let col = this.df.col(colName);
|
|
@@ -1049,7 +1051,7 @@ export class PeptidesModel {
|
|
|
1049
1051
|
'Adds a column with fractions of matching monomers against sequence in the current row');
|
|
1050
1052
|
calculateIdentity.onclick = (): void => {
|
|
1051
1053
|
const seqCol = this.df.getCol(this.settings!.sequenceColumnName);
|
|
1052
|
-
calculateScores(this.df, seqCol, seqCol.get(this.df.currentRowIdx), SCORE.IDENTITY)
|
|
1054
|
+
calculateScores(this.df, seqCol, seqCol.get(this.df.currentRowIdx), SCORE.IDENTITY, PeptideUtils.getSeqHelper())
|
|
1053
1055
|
.then((col: DG.Column<number>) => col.setTag(C.TAGS.IDENTITY_TEMPLATE, seqCol.get(this.df.currentRowIdx)))
|
|
1054
1056
|
.catch((e) => _package.logger.debug(e));
|
|
1055
1057
|
};
|
|
@@ -1061,7 +1063,7 @@ export class PeptidesModel {
|
|
|
1061
1063
|
'Adds a column with sequence similarity scores against sequence in the current row');
|
|
1062
1064
|
calculateSimilarity.onclick = (): void => {
|
|
1063
1065
|
const seqCol = this.df.getCol(this.settings!.sequenceColumnName);
|
|
1064
|
-
calculateScores(this.df, seqCol, seqCol.get(this.df.currentRowIdx), SCORE.SIMILARITY)
|
|
1066
|
+
calculateScores(this.df, seqCol, seqCol.get(this.df.currentRowIdx), SCORE.SIMILARITY, PeptideUtils.getSeqHelper())
|
|
1065
1067
|
.then((col: DG.Column<number>) => col.setTag(C.TAGS.SIMILARITY_TEMPLATE, seqCol.get(this.df.currentRowIdx)))
|
|
1066
1068
|
.catch((e) => _package.logger.debug(e));
|
|
1067
1069
|
};
|
|
@@ -1356,7 +1358,7 @@ export class PeptidesModel {
|
|
|
1356
1358
|
this._sequenceSpaceCols.forEach((col) => this.df.columns.remove(col));
|
|
1357
1359
|
this._sequenceSpaceCols = [];
|
|
1358
1360
|
let seqCol = this.df.getCol(this.settings!.sequenceColumnName!);
|
|
1359
|
-
const sh =
|
|
1361
|
+
const sh = PeptideUtils.getSeqHelper().getSeqHandler(seqCol);
|
|
1360
1362
|
const isHelm = sh.isHelm();
|
|
1361
1363
|
if (isHelm) {
|
|
1362
1364
|
try {
|
|
@@ -1460,7 +1462,7 @@ export class PeptidesModel {
|
|
|
1460
1462
|
menu.item('Modify Sequence space parameters', () => {
|
|
1461
1463
|
getSettingsDialog(this);
|
|
1462
1464
|
});
|
|
1463
|
-
} catch (
|
|
1465
|
+
} catch (_) {
|
|
1464
1466
|
}
|
|
1465
1467
|
});
|
|
1466
1468
|
}
|
package/src/package-test.ts
CHANGED
|
@@ -21,7 +21,7 @@ export async function test(category: string, test: string, testContext: TestCont
|
|
|
21
21
|
// const helmInit = DG.Func.find({name: 'initHelm'})[0];
|
|
22
22
|
// if (helmInit)
|
|
23
23
|
// await helmInit.apply();
|
|
24
|
-
testContext.catchUnhandled = false;
|
|
24
|
+
testContext?.catchUnhandled && (testContext.catchUnhandled = false);
|
|
25
25
|
const data = await runTests({category, test, testContext});
|
|
26
26
|
return DG.DataFrame.fromObjects(data)!;
|
|
27
27
|
}
|
package/src/package.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
/* Do not change these import lines. Datagrok will import API library in exactly the same manner */
|
|
2
3
|
import * as grok from 'datagrok-api/grok';
|
|
3
4
|
import * as ui from 'datagrok-api/ui';
|
|
@@ -15,6 +16,7 @@ import {macromoleculeSarFastaDemoUI} from './demo/fasta';
|
|
|
15
16
|
import {u2} from '@datagrok-libraries/utils/src/u2';
|
|
16
17
|
import {ClusterMaxActivityViewer} from './viewers/cluster-max-activity-viewer';
|
|
17
18
|
import {LSTPieChartRenderer} from './utils/cell-renderer';
|
|
19
|
+
import {PeptideUtils} from './peptideUtils';
|
|
18
20
|
|
|
19
21
|
let monomerWorks: MonomerWorks | null = null;
|
|
20
22
|
let treeHelper: ITreeHelper;
|
|
@@ -34,6 +36,7 @@ export async function initPeptides(): Promise<void> {
|
|
|
34
36
|
try {
|
|
35
37
|
monomerWorks ??= new MonomerWorks(await grok.functions.call('Bio:getBioLib'));
|
|
36
38
|
treeHelper ??= await getTreeHelper();
|
|
39
|
+
await PeptideUtils.loadSeqHelper();
|
|
37
40
|
} catch (e) {
|
|
38
41
|
grok.log.error(e as string);
|
|
39
42
|
}
|
|
@@ -90,6 +93,12 @@ export function peptidesDialog(): DG.Dialog | null {
|
|
|
90
93
|
grok.shell.warning('SAR Analysis requires an active table with Macromolecule column');
|
|
91
94
|
return null;
|
|
92
95
|
}
|
|
96
|
+
|
|
97
|
+
if (!DG.Utils.firstOrNull(grok.shell.t.columns.numerical)) {
|
|
98
|
+
grok.shell.warning('SAR Analysis requires an active table with at least one numerical column for activity');
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
93
102
|
const analyzeObject = analyzePeptidesUI(grok.shell.t);
|
|
94
103
|
const dialog = ui.dialog('Analyze Peptides').add(analyzeObject.host).onOK(async () => {
|
|
95
104
|
const startSuccess = analyzeObject.callback();
|
|
@@ -112,6 +121,8 @@ export async function testInitFunctionPeptides(v: DG.Viewer): Promise<void> {
|
|
|
112
121
|
//input: column col {semType: Macromolecule}
|
|
113
122
|
//output: widget result
|
|
114
123
|
export function peptidesPanel(col: DG.Column): DG.Widget {
|
|
124
|
+
if (!col.dataFrame || !DG.Utils.firstOrNull(col.dataFrame.columns.numerical))
|
|
125
|
+
return new DG.Widget(ui.divText('SAR Analysis requires an active table with at least one numerical column for activity'));
|
|
115
126
|
const analyzeObject = analyzePeptidesUI(col.dataFrame, col);
|
|
116
127
|
return new DG.Widget(analyzeObject.host);
|
|
117
128
|
}
|
|
@@ -169,6 +180,7 @@ export function manualAlignment(_monomer: string): DG.Widget {
|
|
|
169
180
|
//name: Macromolecule SAR Analysis
|
|
170
181
|
//description: Macromolecule SAR Analysis demo on peptide sequences in FASTA format
|
|
171
182
|
//meta.demoPath: Bioinformatics | Macromolecule SAR Analysis
|
|
183
|
+
//meta.demoSkip: GROK-14320
|
|
172
184
|
export async function macromoleculeSarFastaDemo(): Promise<void> {
|
|
173
185
|
return await macromoleculeSarFastaDemoUI();
|
|
174
186
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {getSeqHelper, ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
2
|
+
|
|
3
|
+
export class PeptideUtils {
|
|
4
|
+
private static _secHelper: ISeqHelper;
|
|
5
|
+
public static getSeqHelper(): ISeqHelper {
|
|
6
|
+
if (!this._secHelper)
|
|
7
|
+
throw new Error('SeqHelper is not initialized');
|
|
8
|
+
return this._secHelper;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public static async loadSeqHelper(): Promise<void> {
|
|
12
|
+
this._secHelper ??= await getSeqHelper();
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/tests/benchmarks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as grok from 'datagrok-api/grok';
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
|
|
4
|
-
import {category, test} from '@datagrok-libraries/utils/src/test';
|
|
4
|
+
import {before, category, test} from '@datagrok-libraries/utils/src/test';
|
|
5
5
|
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
6
6
|
|
|
7
7
|
import {_package} from '../package-test';
|
|
@@ -10,16 +10,23 @@ import * as type from '../utils/types';
|
|
|
10
10
|
import {scaleActivity} from '../utils/misc';
|
|
11
11
|
import {startAnalysis} from '../widgets/peptides';
|
|
12
12
|
import * as C from '../utils/constants';
|
|
13
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
const benchmarkDatasetSizes = [5, 50, 100, 200];
|
|
16
17
|
|
|
17
18
|
category('Benchmarks: Mutation Cliffs', () => {
|
|
19
|
+
before(async () => {
|
|
20
|
+
await PeptideUtils.loadSeqHelper();
|
|
21
|
+
});
|
|
18
22
|
for (const size of benchmarkDatasetSizes)
|
|
19
23
|
test(`${size}k sequences`, async () => await mutationCliffsBenchmark(size), {timeout: 300000});
|
|
20
24
|
}, {benchmarks: true});
|
|
21
25
|
|
|
22
26
|
category('Benchmarks: Cluster stats', () => {
|
|
27
|
+
before(async () => {
|
|
28
|
+
await PeptideUtils.loadSeqHelper();
|
|
29
|
+
});
|
|
23
30
|
for (const size of benchmarkDatasetSizes) {
|
|
24
31
|
test(`${size}k sequences`, async () => {
|
|
25
32
|
if (!DG.Test.isInBenchmark)
|
|
@@ -41,6 +48,9 @@ category('Benchmarks: Cluster stats', () => {
|
|
|
41
48
|
}, {benchmarks: true});
|
|
42
49
|
|
|
43
50
|
category('Benchmarks: Monomer-Position stats', () => {
|
|
51
|
+
before(async () => {
|
|
52
|
+
await PeptideUtils.loadSeqHelper();
|
|
53
|
+
});
|
|
44
54
|
for (const size of benchmarkDatasetSizes) {
|
|
45
55
|
test(`${size}k sequences`, async () => {
|
|
46
56
|
if (!DG.Test.isInBenchmark)
|
|
@@ -67,6 +77,9 @@ category('Benchmarks: Monomer-Position stats', () => {
|
|
|
67
77
|
}, {benchmarks: true});
|
|
68
78
|
|
|
69
79
|
category('Benchmarks: Analysis start', () => {
|
|
80
|
+
before(async () => {
|
|
81
|
+
await PeptideUtils.loadSeqHelper();
|
|
82
|
+
});
|
|
70
83
|
for (const size of benchmarkDatasetSizes) {
|
|
71
84
|
test(`${size}k sequences`, async () => {
|
|
72
85
|
if (!DG.Test.isInBenchmark)
|
package/src/tests/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as grok from 'datagrok-api/grok';
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
|
|
4
|
-
import {awaitCheck, category, delay, expect, test} from '@datagrok-libraries/utils/src/test';
|
|
4
|
+
import {awaitCheck, before, category, delay, expect, test} from '@datagrok-libraries/utils/src/test';
|
|
5
5
|
|
|
6
6
|
import {_package} from '../package-test';
|
|
7
7
|
import {startAnalysis} from '../widgets/peptides';
|
|
@@ -10,10 +10,13 @@ import * as C from '../utils/constants';
|
|
|
10
10
|
import {scaleActivity} from '../utils/misc';
|
|
11
11
|
import {ALIGNMENT, ALPHABET, NOTATION, TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
12
12
|
import {MonomerPosition} from '../viewers/sar-viewer';
|
|
13
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
13
14
|
|
|
14
15
|
category('Core', () => {
|
|
15
16
|
const alignedSequenceCol = 'AlignedSequence';
|
|
16
|
-
|
|
17
|
+
before(async () => {
|
|
18
|
+
await PeptideUtils.loadSeqHelper();
|
|
19
|
+
});
|
|
17
20
|
let model: PeptidesModel | null = null;
|
|
18
21
|
test('Start analysis: simple', async () => {
|
|
19
22
|
const simpleActivityColName = 'IC50';
|
package/src/tests/misc.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {before, category, expect, test} from '@datagrok-libraries/utils/src/test
|
|
|
5
5
|
import {findMutations, MutationCliffsOptions} from '../utils/algorithms';
|
|
6
6
|
import * as type from '../utils/types';
|
|
7
7
|
import {extractColInfo} from '../utils/misc';
|
|
8
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
8
9
|
|
|
9
10
|
category('Algorithms', () => {
|
|
10
11
|
let activityCol: type.RawData;
|
|
@@ -13,6 +14,8 @@ category('Algorithms', () => {
|
|
|
13
14
|
let targetCol: type.RawColumn;
|
|
14
15
|
|
|
15
16
|
before(async () => {
|
|
17
|
+
await PeptideUtils.loadSeqHelper();
|
|
18
|
+
|
|
16
19
|
activityCol = DG.Column.fromList('int', 'test', [1, 2, 5]).getRawData();
|
|
17
20
|
monomerColumns = [
|
|
18
21
|
DG.Column.fromList('string', '1', 'AAA'.split('')),
|
package/src/tests/model.ts
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
import {
|
|
44
44
|
MonomerPosition,
|
|
45
45
|
} from '../viewers/sar-viewer';
|
|
46
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
46
47
|
|
|
47
48
|
category('Model: Settings', () => {
|
|
48
49
|
let df: DG.DataFrame;
|
|
@@ -62,6 +63,7 @@ category('Model: Settings', () => {
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
before(async () => {
|
|
66
|
+
await PeptideUtils.loadSeqHelper();
|
|
65
67
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
66
68
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
67
69
|
sequenceCol = df.getCol(TEST_COLUMN_NAMES.SEQUENCE);
|
package/src/tests/table-view.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {COLUMNS_NAMES, SCALING_METHODS} from '../utils/constants';
|
|
|
10
10
|
import {TEST_COLUMN_NAMES} from './utils';
|
|
11
11
|
import {CLUSTER_TYPE, LogoSummaryTable} from '../viewers/logo-summary';
|
|
12
12
|
import {MonomerPosition} from '../viewers/sar-viewer';
|
|
13
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
13
14
|
|
|
14
15
|
category('Table view', () => {
|
|
15
16
|
let df: DG.DataFrame;
|
|
@@ -26,6 +27,8 @@ category('Table view', () => {
|
|
|
26
27
|
const secondCluster = {monomerOrCluster: '1', positionOrClusterType: CLUSTER_TYPE.ORIGINAL, count: 3};
|
|
27
28
|
|
|
28
29
|
before(async () => {
|
|
30
|
+
await PeptideUtils.loadSeqHelper();
|
|
31
|
+
|
|
29
32
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
30
33
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
31
34
|
sequenceCol = df.getCol(TEST_COLUMN_NAMES.SEQUENCE);
|
package/src/tests/viewers.ts
CHANGED
|
@@ -12,11 +12,14 @@ import {CLUSTER_TYPE, LogoSummaryTable, LST_PROPERTIES} from '../viewers/logo-su
|
|
|
12
12
|
import {PositionHeight} from '@datagrok-libraries/bio/src/viewers/web-logo';
|
|
13
13
|
import {TEST_COLUMN_NAMES} from './utils';
|
|
14
14
|
import {showTooltip} from '../utils/tooltips';
|
|
15
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
15
16
|
|
|
16
17
|
category('Viewers: Basic', () => {
|
|
17
18
|
let df: DG.DataFrame;
|
|
18
19
|
|
|
19
20
|
before(async () => {
|
|
21
|
+
await PeptideUtils.loadSeqHelper();
|
|
22
|
+
|
|
20
23
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
21
24
|
await delay(500);
|
|
22
25
|
});
|
package/src/tests/widgets.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {TEST_COLUMN_NAMES} from './utils';
|
|
|
15
15
|
import wu from 'wu';
|
|
16
16
|
import {CLUSTER_TYPE, LogoSummaryTable} from '../viewers/logo-summary';
|
|
17
17
|
import {MonomerPosition} from '../viewers/sar-viewer';
|
|
18
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
18
19
|
|
|
19
20
|
category('Widgets: Settings', () => {
|
|
20
21
|
let df: DG.DataFrame;
|
|
@@ -25,6 +26,8 @@ category('Widgets: Settings', () => {
|
|
|
25
26
|
let scaledActivityCol: DG.Column<number>;
|
|
26
27
|
|
|
27
28
|
before(async () => {
|
|
29
|
+
await PeptideUtils.loadSeqHelper();
|
|
30
|
+
|
|
28
31
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
29
32
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
30
33
|
sequenceCol = df.getCol(TEST_COLUMN_NAMES.SEQUENCE);
|
|
@@ -70,6 +73,8 @@ category('Widgets: Distribution panel', () => {
|
|
|
70
73
|
let scaledActivityCol: DG.Column<number>;
|
|
71
74
|
|
|
72
75
|
before(async () => {
|
|
76
|
+
await PeptideUtils.loadSeqHelper();
|
|
77
|
+
|
|
73
78
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
74
79
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
75
80
|
sequenceCol = df.getCol(TEST_COLUMN_NAMES.SEQUENCE);
|
|
@@ -109,6 +114,8 @@ category('Widgets: Mutation cliffs', () => {
|
|
|
109
114
|
let scaledActivityCol: DG.Column<number>;
|
|
110
115
|
|
|
111
116
|
before(async () => {
|
|
117
|
+
await PeptideUtils.loadSeqHelper();
|
|
118
|
+
|
|
112
119
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
113
120
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
114
121
|
sequenceCol = df.getCol(TEST_COLUMN_NAMES.SEQUENCE);
|
|
@@ -152,6 +159,8 @@ category('Widgets: Actions', () => {
|
|
|
152
159
|
let scaledActivityCol: DG.Column<number>;
|
|
153
160
|
|
|
154
161
|
before(async () => {
|
|
162
|
+
await PeptideUtils.loadSeqHelper();
|
|
163
|
+
|
|
155
164
|
df = DG.DataFrame.fromCsv(await _package.files.readAsText('tests/HELM_small.csv'));
|
|
156
165
|
await df.meta.detectSemanticTypes();
|
|
157
166
|
activityCol = df.getCol(TEST_COLUMN_NAMES.ACTIVITY);
|
|
@@ -34,6 +34,7 @@ import {_package} from '../package';
|
|
|
34
34
|
import {calculateClusterStatistics} from '../utils/algorithms';
|
|
35
35
|
import {splitAlignedSequences} from '@datagrok-libraries/bio/src/utils/splitter';
|
|
36
36
|
import {SARViewer} from './sar-viewer';
|
|
37
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
37
38
|
|
|
38
39
|
const getAggregatedColName = (aggF: string, colName: string): string => `${aggF}(${colName})`;
|
|
39
40
|
|
|
@@ -229,7 +230,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
229
230
|
|
|
230
231
|
this._positionColumns ??= getSharedPositionColumns(VIEWER_TYPE.SEQUENCE_VARIABILITY_MAP) ??
|
|
231
232
|
getSharedPositionColumns(VIEWER_TYPE.MOST_POTENT_RESIDUES) ??
|
|
232
|
-
splitAlignedSequences(this.dataFrame.getCol(this.sequenceColumnName)
|
|
233
|
+
splitAlignedSequences(this.dataFrame.getCol(this.sequenceColumnName),
|
|
234
|
+
PeptideUtils.getSeqHelper()).columns.toList();
|
|
233
235
|
return this._positionColumns!;
|
|
234
236
|
}
|
|
235
237
|
|
|
@@ -40,6 +40,7 @@ import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule/c
|
|
|
40
40
|
import {ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
41
41
|
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
|
|
42
42
|
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
43
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
43
44
|
|
|
44
45
|
export enum SELECTION_MODE {
|
|
45
46
|
MUTATION_CLIFFS = 'Mutation Cliffs',
|
|
@@ -231,7 +232,7 @@ export abstract class SARViewer extends DG.JsViewer implements ISARViewer {
|
|
|
231
232
|
|
|
232
233
|
|
|
233
234
|
this._positionColumns ??= getSharedPositionColumns(VIEWER_TYPE.LOGO_SUMMARY_TABLE) ??
|
|
234
|
-
splitAlignedSequences(this.dataFrame.getCol(this.sequenceColumnName)).columns.toList();
|
|
235
|
+
splitAlignedSequences(this.dataFrame.getCol(this.sequenceColumnName), PeptideUtils.getSeqHelper()).columns.toList();
|
|
235
236
|
return this._positionColumns!;
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -5,7 +5,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
5
5
|
import $ from 'cash-dom';
|
|
6
6
|
import '../styles.css';
|
|
7
7
|
import {PeptidesModel} from '../model';
|
|
8
|
-
import {
|
|
8
|
+
import {PeptideUtils} from '../peptideUtils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Allows to edit sequence and apply changes to the table and analysis.
|
|
@@ -18,9 +18,9 @@ export function manualAlignmentWidget(alignedSequenceCol: DG.Column<string>, cur
|
|
|
18
18
|
$(sequenceInput.root).addClass('pep-textinput');
|
|
19
19
|
|
|
20
20
|
const applyChangesBtn = ui.button('Apply', async () => {
|
|
21
|
-
const sh =
|
|
21
|
+
const sh = PeptideUtils.getSeqHelper().getSeqHandler(alignedSequenceCol);
|
|
22
22
|
const newSequence = sequenceInput.value;
|
|
23
|
-
const splitSequence = sh.
|
|
23
|
+
const splitSequence = sh.splitter(newSequence);
|
|
24
24
|
const affectedRowIndex = currentDf.currentRowIdx;
|
|
25
25
|
alignedSequenceCol.set(affectedRowIndex, newSequence);
|
|
26
26
|
for (let i = 0; i < splitSequence.length; i++) {
|