@datagrok/peptides 1.3.4 → 1.3.6
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/package-test.js +57958 -1959
- package/dist/package.js +57929 -1930
- package/package.json +5 -3
- package/setup-unlink-clean.cmd +2 -0
- package/setup.cmd +2 -0
- package/setup.sh +38 -15
- package/src/model.ts +53 -22
- package/src/tests/core.ts +10 -9
- package/src/utils/types.ts +2 -1
- package/src/viewers/sar-viewer.ts +7 -5
- package/src/widgets/distribution.ts +10 -6
- package/src/widgets/peptides.ts +1 -1
- package/test-Peptides-916a90d7d48b-d2f9014f.html +0 -276
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/peptides",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Volodymyr Dyma",
|
|
6
6
|
"email": "vdyma@datagrok.ai"
|
|
@@ -12,17 +12,19 @@
|
|
|
12
12
|
"directory": "packages/Peptides"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@datagrok-libraries/bio": "^5.
|
|
15
|
+
"@datagrok-libraries/bio": "^5.6.0",
|
|
16
16
|
"@datagrok-libraries/ml": "^2.0.1",
|
|
17
17
|
"@datagrok-libraries/statistics": "^0.1.6",
|
|
18
18
|
"@datagrok-libraries/utils": "^1.11.1",
|
|
19
19
|
"cash-dom": "latest",
|
|
20
20
|
"datagrok-api": "^1.6.0",
|
|
21
21
|
"file-loader": "^6.2.0",
|
|
22
|
-
"rxjs": "^6.5.5"
|
|
22
|
+
"rxjs": "^6.5.5",
|
|
23
|
+
"wu": "latest"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/jquery": "^3.5.6",
|
|
27
|
+
"@types/wu": "latest",
|
|
26
28
|
"@typescript-eslint/eslint-plugin": "latest",
|
|
27
29
|
"@typescript-eslint/parser": "latest",
|
|
28
30
|
"css-loader": "^5.2.4",
|
package/setup-unlink-clean.cmd
CHANGED
package/setup.cmd
CHANGED
package/setup.sh
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
./setup-unlink-clean.sh
|
|
4
|
+
|
|
5
|
+
GREEN='\e[0;32m'
|
|
6
|
+
NO_COLOR='\e[0m'
|
|
7
|
+
|
|
8
|
+
package_dir=$(pwd)
|
|
9
|
+
|
|
10
|
+
dirs=(
|
|
11
|
+
"../../js-api/"
|
|
12
|
+
"../../libraries/utils/"
|
|
13
|
+
"../../libraries/ml/"
|
|
14
|
+
"../../libraries/bio/"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
for dir in ${dirs[@]}; do
|
|
18
|
+
cd $package_dir
|
|
19
|
+
cd $dir
|
|
20
|
+
echo -e $GREEN npm install in $(pwd) $NO_COLOR
|
|
21
|
+
npm install
|
|
22
|
+
echo -e $GREEN npm link in $(pwd) $NO_COLOR
|
|
23
|
+
npm link
|
|
24
|
+
done
|
|
25
|
+
|
|
26
|
+
for dir in ${dirs[@]}; do
|
|
27
|
+
cd $package_dir
|
|
28
|
+
cd $dir
|
|
29
|
+
if [ $dir != "../../js-api/" ]; then
|
|
30
|
+
echo -e $GREEN npm link-all in $(pwd) $NO_COLOR
|
|
31
|
+
npm run link-all
|
|
32
|
+
fi
|
|
33
|
+
echo -e $GREEN npm run build in$(pwd) $NO_COLOR
|
|
34
|
+
npm run build || exit
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
cd $package_dir
|
|
38
|
+
npm run link-all
|
package/src/model.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as ui from 'datagrok-api/ui';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
3
|
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
import * as bio from '@datagrok-libraries/bio';
|
|
4
5
|
|
|
5
6
|
import {splitAlignedSequences} from '@datagrok-libraries/bio/src/utils/splitter';
|
|
6
7
|
|
|
8
|
+
import wu from 'wu';
|
|
7
9
|
import * as rxjs from 'rxjs';
|
|
8
10
|
|
|
9
11
|
import * as C from './utils/constants';
|
|
@@ -49,12 +51,13 @@ export class PeptidesModel {
|
|
|
49
51
|
mutationCliffsViewer!: MutationCliffsViewer;
|
|
50
52
|
mostPotentResiduesViewer!: MostPotentResiduesViewer;
|
|
51
53
|
|
|
52
|
-
_usedProperties: {[propName: string]: string | number | boolean} = {};
|
|
53
|
-
monomerMap: {[key: string]: {molfile: string, fullName: string}} = {};
|
|
54
|
+
_usedProperties: { [propName: string]: string | number | boolean } = {};
|
|
55
|
+
monomerMap: { [key: string]: { molfile: string, fullName: string } } = {};
|
|
54
56
|
barData: type.MonomerDfStats = {};
|
|
55
|
-
barsBounds: {[position: string]: type.BarCoordinates} = {};
|
|
56
|
-
cachedBarchartTooltip: {bar: string, tooltip: null | HTMLDivElement} = {bar: '', tooltip: null};
|
|
57
|
-
monomerLib:
|
|
57
|
+
barsBounds: { [position: string]: type.BarCoordinates } = {};
|
|
58
|
+
cachedBarchartTooltip: { bar: string, tooltip: null | HTMLDivElement } = {bar: '', tooltip: null};
|
|
59
|
+
monomerLib: bio.IMonomerLib | null = null; // To get monomers from lib(s)
|
|
60
|
+
monomerWorks: bio.MonomerWorks | null = null; // To get processed monomers
|
|
58
61
|
|
|
59
62
|
private constructor(dataFrame: DG.DataFrame) {
|
|
60
63
|
this.df = dataFrame;
|
|
@@ -82,6 +85,7 @@ export class PeptidesModel {
|
|
|
82
85
|
this._mutationCliffsSelection ??= JSON.parse(this.df.tags[C.TAGS.SELECTION] || '{}');
|
|
83
86
|
return this._mutationCliffsSelection;
|
|
84
87
|
}
|
|
88
|
+
|
|
85
89
|
set mutationCliffsSelection(selection: type.PositionToAARList) {
|
|
86
90
|
this._mutationCliffsSelection = selection;
|
|
87
91
|
this.df.tags[C.TAGS.SELECTION] = JSON.stringify(selection);
|
|
@@ -93,6 +97,7 @@ export class PeptidesModel {
|
|
|
93
97
|
this._invariantMapSelection ??= JSON.parse(this.df.tags[C.TAGS.FILTER] || '{}');
|
|
94
98
|
return this._invariantMapSelection;
|
|
95
99
|
}
|
|
100
|
+
|
|
96
101
|
set invariantMapSelection(selection: type.PositionToAARList) {
|
|
97
102
|
this._invariantMapSelection = selection;
|
|
98
103
|
this.df.tags[C.TAGS.FILTER] = JSON.stringify(selection);
|
|
@@ -104,6 +109,7 @@ export class PeptidesModel {
|
|
|
104
109
|
this._logoSummarySelection ??= JSON.parse(this.df.tags[C.TAGS.CLUSTER_SELECTION] || '[]');
|
|
105
110
|
return this._logoSummarySelection;
|
|
106
111
|
}
|
|
112
|
+
|
|
107
113
|
set logoSummarySelection(selection: number[]) {
|
|
108
114
|
this._logoSummarySelection = selection;
|
|
109
115
|
this.df.tags[C.TAGS.CLUSTER_SELECTION] = JSON.stringify(selection);
|
|
@@ -111,11 +117,12 @@ export class PeptidesModel {
|
|
|
111
117
|
this.invalidateGrids();
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
get usedProperties(): {[propName: string]: string | number | boolean} {
|
|
120
|
+
get usedProperties(): { [propName: string]: string | number | boolean } {
|
|
115
121
|
this._usedProperties = JSON.parse(this.df.tags['sarProperties'] ?? '{}');
|
|
116
122
|
return this._usedProperties;
|
|
117
123
|
}
|
|
118
|
-
|
|
124
|
+
|
|
125
|
+
set usedProperties(properties: { [propName: string]: string | number | boolean }) {
|
|
119
126
|
this.df.tags['sarProperties'] = JSON.stringify(properties);
|
|
120
127
|
this._usedProperties = properties;
|
|
121
128
|
}
|
|
@@ -124,6 +131,7 @@ export class PeptidesModel {
|
|
|
124
131
|
const splitByPosFlag = (this.df.tags['distributionSplit'] ?? '00')[0];
|
|
125
132
|
return splitByPosFlag == '1' ? true : false;
|
|
126
133
|
}
|
|
134
|
+
|
|
127
135
|
set splitByPos(flag: boolean) {
|
|
128
136
|
const splitByAARFlag = (this.df.tags['distributionSplit'] ?? '00')[1];
|
|
129
137
|
this.df.tags['distributionSplit'] = `${flag ? 1 : 0}${splitByAARFlag}`;
|
|
@@ -133,6 +141,7 @@ export class PeptidesModel {
|
|
|
133
141
|
const splitByPosFlag = (this.df.tags['distributionSplit'] ?? '00')[1];
|
|
134
142
|
return splitByPosFlag == '1' ? true : false;
|
|
135
143
|
}
|
|
144
|
+
|
|
136
145
|
set splitByAAR(flag: boolean) {
|
|
137
146
|
const splitByAARFlag = (this.df.tags['distributionSplit'] ?? '00')[0];
|
|
138
147
|
this.df.tags['distributionSplit'] = `${splitByAARFlag}${flag ? 1 : 0}`;
|
|
@@ -141,10 +150,22 @@ export class PeptidesModel {
|
|
|
141
150
|
get isInvariantMap(): boolean {
|
|
142
151
|
return this.df.getTag('isInvariantMap') === '1';
|
|
143
152
|
}
|
|
153
|
+
|
|
144
154
|
set isInvariantMap(x: boolean) {
|
|
145
155
|
this.df.setTag('isInvariantMap', x ? '1' : '0');
|
|
146
156
|
}
|
|
147
157
|
|
|
158
|
+
get isMutationCliffSelectionEmpty(): boolean {
|
|
159
|
+
for (const aarList of Object.values(this.mutationCliffsSelection))
|
|
160
|
+
if (aarList.length !== 0)
|
|
161
|
+
return false;
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
get isLogoSummarySelectionEmpty(): boolean {
|
|
166
|
+
return this.logoSummarySelection.length === 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
148
169
|
createAccordion(): DG.Accordion {
|
|
149
170
|
const acc = ui.accordion();
|
|
150
171
|
acc.root.style.width = '100%';
|
|
@@ -295,7 +316,7 @@ export class PeptidesModel {
|
|
|
295
316
|
continue;
|
|
296
317
|
|
|
297
318
|
let substCounterFlag = false;
|
|
298
|
-
const tempData: {pos: string, seq1monomer: string, seq2monomer: string, seq1Idx: number, seq2Idx: number}[] =
|
|
319
|
+
const tempData: { pos: string, seq1monomer: string, seq2monomer: string, seq1Idx: number, seq2Idx: number }[] =
|
|
299
320
|
[];
|
|
300
321
|
for (const currentPosCol of columnList) {
|
|
301
322
|
const seq1monomer = currentPosCol.get(seq1Idx)!;
|
|
@@ -396,7 +417,7 @@ export class PeptidesModel {
|
|
|
396
417
|
for (let i = 1; i < this.sourceGrid.columns.length; i++)
|
|
397
418
|
colNames.push(this.sourceGrid.columns.byIndex(i)!);
|
|
398
419
|
|
|
399
|
-
colNames.sort((a, b)=>{
|
|
420
|
+
colNames.sort((a, b) => {
|
|
400
421
|
if (a.column!.semType == C.SEM_TYPES.MONOMER) {
|
|
401
422
|
if (b.column!.semType == C.SEM_TYPES.MONOMER)
|
|
402
423
|
return 0;
|
|
@@ -426,7 +447,7 @@ export class PeptidesModel {
|
|
|
426
447
|
|
|
427
448
|
//calculate p-values based on t-test
|
|
428
449
|
const matrixCols = matrixDf.columns;
|
|
429
|
-
const mdCol= matrixCols.addNewFloat(C.COLUMNS_NAMES.MEAN_DIFFERENCE);
|
|
450
|
+
const mdCol = matrixCols.addNewFloat(C.COLUMNS_NAMES.MEAN_DIFFERENCE);
|
|
430
451
|
const pValCol = matrixCols.addNewFloat(C.COLUMNS_NAMES.P_VALUE);
|
|
431
452
|
const countCol = matrixCols.addNewInt(C.COLUMNS_NAMES.COUNT);
|
|
432
453
|
const ratioCol = matrixCols.addNewFloat(C.COLUMNS_NAMES.RATIO);
|
|
@@ -457,7 +478,7 @@ export class PeptidesModel {
|
|
|
457
478
|
const statsDf = this.df.groupBy([C.COLUMNS_NAMES.CLUSTERS]).aggregate();
|
|
458
479
|
const clustersCol = statsDf.getCol(C.COLUMNS_NAMES.CLUSTERS);
|
|
459
480
|
const statsDfCols = statsDf.columns;
|
|
460
|
-
const mdCol= statsDfCols.addNewFloat(C.COLUMNS_NAMES.MEAN_DIFFERENCE);
|
|
481
|
+
const mdCol = statsDfCols.addNewFloat(C.COLUMNS_NAMES.MEAN_DIFFERENCE);
|
|
461
482
|
const pValCol = statsDfCols.addNewFloat(C.COLUMNS_NAMES.P_VALUE);
|
|
462
483
|
const countCol = statsDfCols.addNewInt(C.COLUMNS_NAMES.COUNT);
|
|
463
484
|
const ratioCol = statsDfCols.addNewFloat(C.COLUMNS_NAMES.RATIO);
|
|
@@ -507,7 +528,7 @@ export class PeptidesModel {
|
|
|
507
528
|
.aggregate();
|
|
508
529
|
|
|
509
530
|
let tempStats: DG.Stats;
|
|
510
|
-
const maxAtPos: {[index: string]: number} = {};
|
|
531
|
+
const maxAtPos: { [index: string]: number } = {};
|
|
511
532
|
const posColCategories = sequenceDf.getCol(C.COLUMNS_NAMES.POSITION).categories;
|
|
512
533
|
const mdCol = sequenceDf.getCol(C.COLUMNS_NAMES.MEAN_DIFFERENCE);
|
|
513
534
|
const posCol = sequenceDf.getCol(C.COLUMNS_NAMES.POSITION);
|
|
@@ -655,7 +676,7 @@ export class PeptidesModel {
|
|
|
655
676
|
.subscribe((mouseMove: MouseEvent) => eventAction(mouseMove));
|
|
656
677
|
}
|
|
657
678
|
|
|
658
|
-
findAARandPosition(cell: DG.GridCell, ev: MouseEvent): {monomer: string, position: string} | null {
|
|
679
|
+
findAARandPosition(cell: DG.GridCell, ev: MouseEvent): { monomer: string, position: string } | null {
|
|
659
680
|
const barCoords = this.barsBounds[cell.tableColumn!.name];
|
|
660
681
|
for (const [monomer, coords] of Object.entries(barCoords)) {
|
|
661
682
|
const isIntersectingX = ev.offsetX >= coords.x && ev.offsetX <= coords.x + coords.width;
|
|
@@ -667,7 +688,7 @@ export class PeptidesModel {
|
|
|
667
688
|
return null;
|
|
668
689
|
}
|
|
669
690
|
|
|
670
|
-
requestBarchartAction(ev: MouseEvent, barPart: {position: string, monomer: string} | null): void {
|
|
691
|
+
requestBarchartAction(ev: MouseEvent, barPart: { position: string, monomer: string } | null): void {
|
|
671
692
|
if (!barPart)
|
|
672
693
|
return;
|
|
673
694
|
const monomer = barPart.monomer;
|
|
@@ -793,7 +814,11 @@ export class PeptidesModel {
|
|
|
793
814
|
|
|
794
815
|
showMonomerTooltip(aar: string, x: number, y: number): void {
|
|
795
816
|
const tooltipElements: HTMLDivElement[] = [];
|
|
796
|
-
const
|
|
817
|
+
const monomerName = aar.toLowerCase();
|
|
818
|
+
|
|
819
|
+
const monomer: bio.Monomer | null = wu(['HELM_AA', 'HELM_CHEM'])
|
|
820
|
+
.map((monomerType) => this.monomerWorks!.getCappedMonomer(monomerType, monomerName))
|
|
821
|
+
.find((m) => m != null) ?? null;
|
|
797
822
|
|
|
798
823
|
if (monomer) {
|
|
799
824
|
tooltipElements.push(ui.div(monomer.n));
|
|
@@ -974,14 +999,16 @@ export class PeptidesModel {
|
|
|
974
999
|
selection.onChanged.subscribe(() => changeSelectionBitset(selection));
|
|
975
1000
|
filter.onChanged.subscribe(() => {
|
|
976
1001
|
const positionList = Object.keys(this.invariantMapSelection);
|
|
977
|
-
|
|
1002
|
+
for (let index = 0; index < this.df.rowCount; ++index) {
|
|
978
1003
|
let result = true;
|
|
979
1004
|
for (const position of positionList) {
|
|
980
1005
|
const aarList = this.invariantMapSelection[position];
|
|
981
|
-
result &&= aarList.length
|
|
1006
|
+
result &&= aarList.length === 0 || aarList.includes(this.df.get(position, index));
|
|
1007
|
+
if (!result)
|
|
1008
|
+
break;
|
|
982
1009
|
}
|
|
983
|
-
|
|
984
|
-
}
|
|
1010
|
+
filter.set(index, filter.get(index) && result, false);
|
|
1011
|
+
}
|
|
985
1012
|
});
|
|
986
1013
|
this.isBitsetChangedInitialized = true;
|
|
987
1014
|
}
|
|
@@ -1044,7 +1071,7 @@ export class PeptidesModel {
|
|
|
1044
1071
|
const [sourceViewer, targetViewer] = isSourceSAR ? [this.mutationCliffsViewer, this.mostPotentResiduesViewer] :
|
|
1045
1072
|
[this.mostPotentResiduesViewer, this.mutationCliffsViewer];
|
|
1046
1073
|
const properties = sourceViewer.props.getProperties();
|
|
1047
|
-
const newProps: {[propName: string]: string | number | boolean} = {};
|
|
1074
|
+
const newProps: { [propName: string]: string | number | boolean } = {};
|
|
1048
1075
|
for (const property of properties) {
|
|
1049
1076
|
const propName = property.name;
|
|
1050
1077
|
const propVal = property.get(sourceViewer);
|
|
@@ -1061,8 +1088,12 @@ export class PeptidesModel {
|
|
|
1061
1088
|
if (this.isInitialized)
|
|
1062
1089
|
return;
|
|
1063
1090
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1091
|
+
// Get monomer library through bio library
|
|
1092
|
+
this.monomerLib = await bio.getMonomerLib();
|
|
1093
|
+
this.monomerLib.onChanged.subscribe(() => {
|
|
1094
|
+
this.sourceGrid.invalidate();
|
|
1095
|
+
});
|
|
1096
|
+
this.monomerWorks = new bio.MonomerWorks(this.monomerLib);
|
|
1066
1097
|
|
|
1067
1098
|
this.currentView = this.df.tags[C.PEPTIDES_ANALYSIS] == 'true' ? grok.shell.v as DG.TableView :
|
|
1068
1099
|
grok.shell.addTableView(this.df);
|
package/src/tests/core.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as grok from 'datagrok-api/grok';
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
|
+
import * as bio from '@datagrok-libraries/bio';
|
|
3
4
|
|
|
4
5
|
import {category, test, expect, delay} from '@datagrok-libraries/utils/src/test';
|
|
5
6
|
|
|
@@ -32,9 +33,9 @@ category('Core', () => {
|
|
|
32
33
|
simpleActivityCol = simpleTable.getCol(simpleActivityColName);
|
|
33
34
|
simpleAlignedSeqCol = simpleTable.getCol(alignedSequenceCol);
|
|
34
35
|
simpleAlignedSeqCol.semType = C.SEM_TYPES.MACROMOLECULE;
|
|
35
|
-
simpleAlignedSeqCol.
|
|
36
|
-
simpleAlignedSeqCol.
|
|
37
|
-
simpleAlignedSeqCol.
|
|
36
|
+
simpleAlignedSeqCol.setTag(C.TAGS.ALPHABET, bio.ALPHABET.PT);
|
|
37
|
+
simpleAlignedSeqCol.setTag(DG.TAGS.UNITS, bio.NOTATION.FASTA);
|
|
38
|
+
simpleAlignedSeqCol.setTag(bio.TAGS.aligned, bio.ALIGNMENT.SEQ_MSA);
|
|
38
39
|
simpleScaledCol = scaleActivity('-lg', simpleActivityCol);
|
|
39
40
|
|
|
40
41
|
model = await startAnalysis(simpleActivityCol, simpleAlignedSeqCol, null, simpleTable, simpleScaledCol, '-lg');
|
|
@@ -52,9 +53,9 @@ category('Core', () => {
|
|
|
52
53
|
complexActivityCol = complexTable.getCol(complexActivityColName);
|
|
53
54
|
complexAlignedSeqCol = complexTable.getCol('MSA');
|
|
54
55
|
complexAlignedSeqCol.semType = C.SEM_TYPES.MACROMOLECULE;
|
|
55
|
-
complexAlignedSeqCol.
|
|
56
|
-
complexAlignedSeqCol.
|
|
57
|
-
complexAlignedSeqCol.
|
|
56
|
+
complexAlignedSeqCol.setTag(C.TAGS.ALPHABET, bio.ALPHABET.UN);
|
|
57
|
+
complexAlignedSeqCol.setTag(DG.TAGS.UNITS, bio.NOTATION.SEPARATOR);
|
|
58
|
+
complexAlignedSeqCol.setTag(bio.TAGS.aligned, bio.ALIGNMENT.SEQ_MSA);
|
|
58
59
|
complexAlignedSeqCol.tags[C.TAGS.SEPARATOR] = '/';
|
|
59
60
|
complexScaledCol = scaleActivity('-lg', complexActivityCol);
|
|
60
61
|
|
|
@@ -74,9 +75,9 @@ category('Core', () => {
|
|
|
74
75
|
simpleActivityCol = simpleTable.getCol(simpleActivityColName);
|
|
75
76
|
simpleAlignedSeqCol = simpleTable.getCol(alignedSequenceCol);
|
|
76
77
|
simpleAlignedSeqCol.semType = C.SEM_TYPES.MACROMOLECULE;
|
|
77
|
-
simpleAlignedSeqCol.
|
|
78
|
-
simpleAlignedSeqCol.
|
|
79
|
-
simpleAlignedSeqCol.
|
|
78
|
+
simpleAlignedSeqCol.setTag(C.TAGS.ALPHABET, bio.ALPHABET.PT);
|
|
79
|
+
simpleAlignedSeqCol.setTag(DG.TAGS.UNITS, bio.NOTATION.FASTA);
|
|
80
|
+
simpleAlignedSeqCol.setTag(bio.TAGS.aligned, bio.ALIGNMENT.SEQ_MSA);
|
|
80
81
|
simpleScaledCol = scaleActivity('-lg', simpleActivityCol);
|
|
81
82
|
|
|
82
83
|
model = await startAnalysis(simpleActivityCol, simpleAlignedSeqCol, null, simpleTable, simpleScaledCol, '-lg');
|
package/src/utils/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
import * as bio from '@datagrok-libraries/bio';
|
|
2
3
|
|
|
3
4
|
export type DataFrameDict = {[key: string]: DG.DataFrame};
|
|
4
5
|
|
|
@@ -7,7 +8,7 @@ export type UTypedArray = Uint8Array | Uint16Array | Uint32Array;
|
|
|
7
8
|
export type SubstitutionsInfo = Map<string, Map<string, Map<number, number[] | UTypedArray>>>;
|
|
8
9
|
export type PositionToAARList = {[postiton: string]: string[]};
|
|
9
10
|
|
|
10
|
-
export type HELMMonomer =
|
|
11
|
+
export type HELMMonomer = bio.Monomer;
|
|
11
12
|
|
|
12
13
|
export type MonomerColStats = {[monomer: string]: {count: number, selected: number}};
|
|
13
14
|
export type MonomerDfStats = {[position: string]: MonomerColStats};
|
|
@@ -53,10 +53,10 @@ export class SARViewerBase extends DG.JsViewer {
|
|
|
53
53
|
|
|
54
54
|
detach(): void {this.subs.forEach((sub) => sub.unsubscribe());}
|
|
55
55
|
|
|
56
|
-
get
|
|
57
|
-
return this.dataFrame.getTag(C.TAGS.SAR_MODE) ?? '
|
|
56
|
+
get isMutationCliffsMode(): string {
|
|
57
|
+
return this.dataFrame.getTag(C.TAGS.SAR_MODE) ?? '1';
|
|
58
58
|
}
|
|
59
|
-
set
|
|
59
|
+
set isMutationCliffsMode(s: string) {
|
|
60
60
|
this.dataFrame.setTag(C.TAGS.SAR_MODE, s);
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -67,22 +67,24 @@ export class SARViewerBase extends DG.JsViewer {
|
|
|
67
67
|
$(this.root).empty();
|
|
68
68
|
let switchHost = ui.div();
|
|
69
69
|
if (this.name == 'MC') {
|
|
70
|
-
const mutationCliffsMode = ui.boolInput('', this.
|
|
70
|
+
const mutationCliffsMode = ui.boolInput('', this.isMutationCliffsMode === '1', () => {
|
|
71
71
|
if (this.isModeChanging)
|
|
72
72
|
return;
|
|
73
73
|
this.isModeChanging = true;
|
|
74
74
|
invariantMapMode.value = !invariantMapMode.value;
|
|
75
|
+
this.isMutationCliffsMode = '1';
|
|
75
76
|
this.isModeChanging = false;
|
|
76
77
|
this._titleHost.innerText = 'Mutation Cliffs';
|
|
77
78
|
this.model.isInvariantMap = false;
|
|
78
79
|
this.viewerGrid.invalidate();
|
|
79
80
|
});
|
|
80
81
|
mutationCliffsMode.addPostfix('Mutation Cliffs');
|
|
81
|
-
const invariantMapMode = ui.boolInput('', this.
|
|
82
|
+
const invariantMapMode = ui.boolInput('', this.isMutationCliffsMode === '0', () => {
|
|
82
83
|
if (this.isModeChanging)
|
|
83
84
|
return;
|
|
84
85
|
this.isModeChanging = true;
|
|
85
86
|
mutationCliffsMode.value = !mutationCliffsMode.value;
|
|
87
|
+
this.isMutationCliffsMode = '0';
|
|
86
88
|
this.isModeChanging = false;
|
|
87
89
|
this._titleHost.innerText = 'Invariant Map';
|
|
88
90
|
this.model.isInvariantMap = true;
|
|
@@ -15,9 +15,6 @@ export function getDistributionWidget(table: DG.DataFrame, model: PeptidesModel)
|
|
|
15
15
|
const activityScaledCol = table.columns.bySemType(C.SEM_TYPES.ACTIVITY_SCALED)!;
|
|
16
16
|
const rowCount = activityScaledCol.length;
|
|
17
17
|
const selectionObject = model.mutationCliffsSelection;
|
|
18
|
-
let isMutationCliffsSelectionEmpty = true;
|
|
19
|
-
for (const aarList of Object.values(selectionObject))
|
|
20
|
-
isMutationCliffsSelectionEmpty &&= aarList.length === 0;
|
|
21
18
|
const clustersObject = model.logoSummarySelection;
|
|
22
19
|
const positions = Object.keys(selectionObject);
|
|
23
20
|
const positionsLen = positions.length;
|
|
@@ -145,16 +142,23 @@ export function getDistributionWidget(table: DG.DataFrame, model: PeptidesModel)
|
|
|
145
142
|
};
|
|
146
143
|
|
|
147
144
|
const setDefaultProperties = (input: DG.InputBase): void => {
|
|
148
|
-
input.enabled = !
|
|
145
|
+
input.enabled = !model.isMutationCliffSelectionEmpty;
|
|
149
146
|
$(input.root).find('.ui-input-editor').css('margin', '0px');
|
|
150
147
|
$(input.root).find('.ui-input-description').css('padding', '0px').css('padding-left', '5px');
|
|
151
148
|
};
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
let defaultValuePos = model.splitByPos;
|
|
151
|
+
let defaultValueAAR = model.splitByAAR;
|
|
152
|
+
if (!model.isLogoSummarySelectionEmpty && model.isMutationCliffSelectionEmpty) {
|
|
153
|
+
defaultValuePos = false;
|
|
154
|
+
defaultValueAAR = false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const splitByPosition = ui.boolInput('', defaultValuePos, updateDistributionHost);
|
|
154
158
|
splitByPosition.addPostfix('Split by position');
|
|
155
159
|
setDefaultProperties(splitByPosition);
|
|
156
160
|
$(splitByPosition.root).css('margin-right', '10px');
|
|
157
|
-
const splitByAAR = ui.boolInput('',
|
|
161
|
+
const splitByAAR = ui.boolInput('', defaultValueAAR, updateDistributionHost);
|
|
158
162
|
splitByAAR.addPostfix('Split by monomer');
|
|
159
163
|
setDefaultProperties(splitByAAR);
|
|
160
164
|
|
package/src/widgets/peptides.ts
CHANGED
|
@@ -74,7 +74,7 @@ export async function analyzePeptidesWidget(df: DG.DataFrame, col: DG.Column): P
|
|
|
74
74
|
});
|
|
75
75
|
startBtn.style.alignSelf = 'center';
|
|
76
76
|
|
|
77
|
-
const viewer = await df.plot.fromType('WebLogo') as bio.
|
|
77
|
+
const viewer = await df.plot.fromType('WebLogo') as bio.WebLogoViewer;
|
|
78
78
|
viewer.root.style.setProperty('height', '130px');
|
|
79
79
|
const logoHost = ui.div();
|
|
80
80
|
$(logoHost).empty().append(viewer.root);
|