@datagrok/peptides 1.17.2 → 1.17.4
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 +2 -3
- package/CHANGELOG.md +6 -1
- package/dist/356.js +2 -0
- package/dist/436.js +2 -2
- package/dist/796.js +2 -0
- package/dist/8473fcbfb6e85ca6c852.wasm +0 -0
- package/dist/9a8fbf37666e32487835.wasm +0 -0
- package/dist/package-test.js +2 -2
- package/dist/package.js +2 -2
- package/package.json +3 -2
- package/src/model.ts +185 -173
- package/src/package.ts +2 -4
- package/src/tests/benchmarks.ts +11 -17
- package/src/tests/core.ts +1 -1
- package/src/utils/algorithms.ts +15 -30
- package/src/utils/misc.ts +1 -2
- package/src/utils/types.ts +5 -2
- package/src/viewers/logo-summary.ts +27 -47
- package/src/viewers/sar-viewer.ts +60 -103
- package/src/widgets/peptides.ts +47 -10
- package/src/widgets/settings.ts +25 -17
- package/dist/214.js +0 -2
- package/dist/802.js +0 -2
- package/src/utils/distance-matrix.worker.ts +0 -16
- package/src/utils/worker-creator.ts +0 -16
package/src/package.ts
CHANGED
|
@@ -88,9 +88,8 @@ export function peptidesDialog(): DG.Dialog {
|
|
|
88
88
|
const analyzeObject = analyzePeptidesUI(grok.shell.t);
|
|
89
89
|
const dialog = ui.dialog('Analyze Peptides').add(analyzeObject.host).onOK(async () => {
|
|
90
90
|
const startSuccess = analyzeObject.callback();
|
|
91
|
-
if (!startSuccess)
|
|
91
|
+
if (!startSuccess)
|
|
92
92
|
dialog.show();
|
|
93
|
-
}
|
|
94
93
|
});
|
|
95
94
|
return dialog.show();
|
|
96
95
|
}
|
|
@@ -138,9 +137,8 @@ export function manualAlignment(_monomer: string): DG.Widget {
|
|
|
138
137
|
//TODO: recalculate Molfile and Molecule panels on sequence update
|
|
139
138
|
const df = grok.shell.t;
|
|
140
139
|
const model: PeptidesModel | null = df?.temp[PeptidesModel.modelName];
|
|
141
|
-
if (!model)
|
|
140
|
+
if (!model)
|
|
142
141
|
return new DG.Widget(ui.divText('Manual alignment works with peptides analysis'));
|
|
143
|
-
}
|
|
144
142
|
|
|
145
143
|
|
|
146
144
|
const col = df.getCol(model.settings!.sequenceColumnName!);
|
package/src/tests/benchmarks.ts
CHANGED
|
@@ -15,25 +15,23 @@ import * as C from '../utils/constants';
|
|
|
15
15
|
const benchmarkDatasetSizes = [5, 50, 100, 200];
|
|
16
16
|
|
|
17
17
|
category('Benchmarks: Mutation Cliffs', () => {
|
|
18
|
-
for (const size of benchmarkDatasetSizes)
|
|
19
|
-
test(`${size}k sequences`, async () => await mutationCliffsBenchmark(size), {timeout:
|
|
20
|
-
}
|
|
18
|
+
for (const size of benchmarkDatasetSizes)
|
|
19
|
+
test(`${size}k sequences`, async () => await mutationCliffsBenchmark(size), {timeout: 180000});
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
category('Benchmarks: Cluster stats', () => {
|
|
24
23
|
for (const size of benchmarkDatasetSizes) {
|
|
25
24
|
test(`${size}k sequences`, async () => {
|
|
26
|
-
if (!DG.Test.isInBenchmark)
|
|
25
|
+
if (!DG.Test.isInBenchmark)
|
|
27
26
|
return null;
|
|
28
|
-
}
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
const df = (await _package.files.readBinaryDataFrames(`tests/${size}k.d42`))[0];
|
|
32
30
|
const clustersColumnName = 'cluster';
|
|
33
31
|
const scaledActivity = scaleActivity(df.getCol('activity'), C.SCALING_METHODS.NONE);
|
|
34
|
-
if (df.columns.names().map((s) => s.toLowerCase()).includes(scaledActivity.name.toLowerCase()))
|
|
32
|
+
if (df.columns.names().map((s) => s.toLowerCase()).includes(scaledActivity.name.toLowerCase()))
|
|
35
33
|
df.columns.remove(scaledActivity.name);
|
|
36
|
-
|
|
34
|
+
|
|
37
35
|
|
|
38
36
|
df.columns.add(scaledActivity);
|
|
39
37
|
DG.time(`Cluster stats benchmark - ${size}k`,
|
|
@@ -45,9 +43,8 @@ category('Benchmarks: Cluster stats', () => {
|
|
|
45
43
|
category('Benchmarks: Monomer-Position stats', () => {
|
|
46
44
|
for (const size of benchmarkDatasetSizes) {
|
|
47
45
|
test(`${size}k sequences`, async () => {
|
|
48
|
-
if (!DG.Test.isInBenchmark)
|
|
46
|
+
if (!DG.Test.isInBenchmark)
|
|
49
47
|
return null;
|
|
50
|
-
}
|
|
51
48
|
|
|
52
49
|
|
|
53
50
|
const df = (await _package.files.readBinaryDataFrames(`tests/${size}k.d42`))[0];
|
|
@@ -58,9 +55,9 @@ category('Benchmarks: Monomer-Position stats', () => {
|
|
|
58
55
|
++i;
|
|
59
56
|
}
|
|
60
57
|
const scaledActivity = scaleActivity(df.getCol('activity'), C.SCALING_METHODS.NONE);
|
|
61
|
-
if (df.columns.names().map((s) => s.toLowerCase()).includes(scaledActivity.name.toLowerCase()))
|
|
58
|
+
if (df.columns.names().map((s) => s.toLowerCase()).includes(scaledActivity.name.toLowerCase()))
|
|
62
59
|
df.columns.remove(scaledActivity.name);
|
|
63
|
-
|
|
60
|
+
|
|
64
61
|
|
|
65
62
|
df.columns.add(scaledActivity);
|
|
66
63
|
DG.time(`Monomer-Position stats benchmark - ${size}k`,
|
|
@@ -72,9 +69,8 @@ category('Benchmarks: Monomer-Position stats', () => {
|
|
|
72
69
|
category('Benchmarks: Analysis start', () => {
|
|
73
70
|
for (const size of benchmarkDatasetSizes) {
|
|
74
71
|
test(`${size}k sequences`, async () => {
|
|
75
|
-
if (!DG.Test.isInBenchmark)
|
|
72
|
+
if (!DG.Test.isInBenchmark)
|
|
76
73
|
return;
|
|
77
|
-
}
|
|
78
74
|
|
|
79
75
|
|
|
80
76
|
const df = (await _package.files.readBinaryDataFrames(`tests/${size}k.d42`))[0];
|
|
@@ -88,18 +84,16 @@ category('Benchmarks: Analysis start', () => {
|
|
|
88
84
|
await DG.timeAsync('Analysis start', async () => {
|
|
89
85
|
const model = await startAnalysis(activityCol, sequenceCol, clustersCol, df, scaledActivityCol,
|
|
90
86
|
C.SCALING_METHODS.NONE);
|
|
91
|
-
if (model)
|
|
87
|
+
if (model)
|
|
92
88
|
grok.shell.closeTable(model.df);
|
|
93
|
-
}
|
|
94
89
|
});
|
|
95
90
|
}, {timeout: 100000});
|
|
96
91
|
}
|
|
97
92
|
});
|
|
98
93
|
|
|
99
94
|
async function mutationCliffsBenchmark(size: number): Promise<void> {
|
|
100
|
-
if (!DG.Test.isInBenchmark)
|
|
95
|
+
if (!DG.Test.isInBenchmark)
|
|
101
96
|
return;
|
|
102
|
-
}
|
|
103
97
|
|
|
104
98
|
|
|
105
99
|
const df = (await _package.files.readBinaryDataFrames(`tests/${size}k.d42`))[0];
|
package/src/tests/core.ts
CHANGED
package/src/utils/algorithms.ts
CHANGED
|
@@ -31,9 +31,8 @@ export type MutationCliffsOptions = {
|
|
|
31
31
|
export async function findMutations(activityArray: type.RawData, monomerInfoArray: type.RawColumn[],
|
|
32
32
|
options: MutationCliffsOptions = {}): Promise<type.MutationCliffs> {
|
|
33
33
|
const nCols = monomerInfoArray.length;
|
|
34
|
-
if (nCols === 0)
|
|
34
|
+
if (nCols === 0)
|
|
35
35
|
throw new Error(`PepAlgorithmError: Couldn't find any column of semType '${C.SEM_TYPES.MONOMER}'`);
|
|
36
|
-
}
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
options.minActivityDelta ??= 0;
|
|
@@ -68,9 +67,8 @@ export function calculateMonomerPositionStatistics(activityCol: DG.Column<number
|
|
|
68
67
|
sourceDfLen = filter.trueCount;
|
|
69
68
|
const tempActivityData = new Float64Array(sourceDfLen);
|
|
70
69
|
const selectedIndexes = filter.getSelectedIndexes();
|
|
71
|
-
for (let i = 0; i < sourceDfLen; ++i)
|
|
70
|
+
for (let i = 0; i < sourceDfLen; ++i)
|
|
72
71
|
tempActivityData[i] = activityColData[selectedIndexes[i]];
|
|
73
|
-
}
|
|
74
72
|
|
|
75
73
|
|
|
76
74
|
activityColData = tempActivityData;
|
|
@@ -79,9 +77,8 @@ export function calculateMonomerPositionStatistics(activityCol: DG.Column<number
|
|
|
79
77
|
options.columns ??= positionColumns.map((col) => col.name);
|
|
80
78
|
|
|
81
79
|
for (const posCol of positionColumns) {
|
|
82
|
-
if (!options.columns.includes(posCol.name))
|
|
80
|
+
if (!options.columns.includes(posCol.name))
|
|
83
81
|
continue;
|
|
84
|
-
}
|
|
85
82
|
|
|
86
83
|
|
|
87
84
|
const posColData = posCol.getRawData();
|
|
@@ -90,16 +87,14 @@ export function calculateMonomerPositionStatistics(activityCol: DG.Column<number
|
|
|
90
87
|
|
|
91
88
|
for (let categoryIndex = 0; categoryIndex < posColCateogries.length; ++categoryIndex) {
|
|
92
89
|
const monomer = posColCateogries[categoryIndex];
|
|
93
|
-
if (monomer === '')
|
|
90
|
+
if (monomer === '')
|
|
94
91
|
continue;
|
|
95
|
-
}
|
|
96
92
|
|
|
97
93
|
|
|
98
94
|
const boolArray: boolean[] = new Array(sourceDfLen).fill(false);
|
|
99
95
|
for (let i = 0; i < sourceDfLen; ++i) {
|
|
100
|
-
if (posColData[i] === categoryIndex)
|
|
96
|
+
if (posColData[i] === categoryIndex)
|
|
101
97
|
boolArray[i] = true;
|
|
102
|
-
}
|
|
103
98
|
}
|
|
104
99
|
const bitArray = BitArray.fromValues(boolArray);
|
|
105
100
|
const stats = bitArray.allFalse || bitArray.allTrue ?
|
|
@@ -123,66 +118,57 @@ export function calculateMonomerPositionStatistics(activityCol: DG.Column<number
|
|
|
123
118
|
*/
|
|
124
119
|
export function getSummaryStats(genObj: SummaryStats, stats: StatsItem | null = null,
|
|
125
120
|
summaryStats: SummaryStats | null = null): void {
|
|
126
|
-
if (stats === null && summaryStats === null)
|
|
121
|
+
if (stats === null && summaryStats === null)
|
|
127
122
|
throw new Error(`MonomerPositionStatsError: either stats or summaryStats must be present`);
|
|
128
|
-
}
|
|
129
123
|
|
|
130
124
|
|
|
131
125
|
const possibleMaxCount = stats?.count ?? summaryStats!.maxCount;
|
|
132
126
|
genObj.maxCount ??= possibleMaxCount;
|
|
133
|
-
if (genObj.maxCount < possibleMaxCount)
|
|
127
|
+
if (genObj.maxCount < possibleMaxCount)
|
|
134
128
|
genObj.maxCount = possibleMaxCount;
|
|
135
|
-
}
|
|
136
129
|
|
|
137
130
|
|
|
138
131
|
const possibleMinCount = stats?.count ?? summaryStats!.minCount;
|
|
139
132
|
genObj.minCount ??= possibleMinCount;
|
|
140
|
-
if (genObj.minCount > possibleMinCount)
|
|
133
|
+
if (genObj.minCount > possibleMinCount)
|
|
141
134
|
genObj.minCount = possibleMinCount;
|
|
142
|
-
}
|
|
143
135
|
|
|
144
136
|
|
|
145
137
|
const possibleMaxMeanDifference = stats?.meanDifference ?? summaryStats!.maxMeanDifference;
|
|
146
138
|
genObj.maxMeanDifference ??= possibleMaxMeanDifference;
|
|
147
|
-
if (genObj.maxMeanDifference < possibleMaxMeanDifference)
|
|
139
|
+
if (genObj.maxMeanDifference < possibleMaxMeanDifference)
|
|
148
140
|
genObj.maxMeanDifference = possibleMaxMeanDifference;
|
|
149
|
-
}
|
|
150
141
|
|
|
151
142
|
|
|
152
143
|
const possibleMinMeanDifference = stats?.meanDifference ?? summaryStats!.minMeanDifference;
|
|
153
144
|
genObj.minMeanDifference ??= possibleMinMeanDifference;
|
|
154
|
-
if (genObj.minMeanDifference > possibleMinMeanDifference)
|
|
145
|
+
if (genObj.minMeanDifference > possibleMinMeanDifference)
|
|
155
146
|
genObj.minMeanDifference = possibleMinMeanDifference;
|
|
156
|
-
}
|
|
157
147
|
|
|
158
148
|
|
|
159
149
|
if (!isNaN(stats?.pValue ?? NaN)) {
|
|
160
150
|
const possibleMaxPValue = stats?.pValue ?? summaryStats!.maxPValue;
|
|
161
151
|
genObj.maxPValue ??= possibleMaxPValue;
|
|
162
|
-
if (genObj.maxPValue < possibleMaxPValue)
|
|
152
|
+
if (genObj.maxPValue < possibleMaxPValue)
|
|
163
153
|
genObj.maxPValue = possibleMaxPValue;
|
|
164
|
-
}
|
|
165
154
|
|
|
166
155
|
|
|
167
156
|
const possibleMinPValue = stats?.pValue ?? summaryStats!.minPValue;
|
|
168
157
|
genObj.minPValue ??= possibleMinPValue;
|
|
169
|
-
if (genObj.minPValue > possibleMinPValue)
|
|
158
|
+
if (genObj.minPValue > possibleMinPValue)
|
|
170
159
|
genObj.minPValue = possibleMinPValue;
|
|
171
|
-
}
|
|
172
160
|
}
|
|
173
161
|
|
|
174
162
|
const possibleMaxRatio = stats?.ratio ?? summaryStats!.maxRatio;
|
|
175
163
|
genObj.maxRatio ??= possibleMaxRatio;
|
|
176
|
-
if (genObj.maxRatio < possibleMaxRatio)
|
|
164
|
+
if (genObj.maxRatio < possibleMaxRatio)
|
|
177
165
|
genObj.maxRatio = possibleMaxRatio;
|
|
178
|
-
}
|
|
179
166
|
|
|
180
167
|
|
|
181
168
|
const possibleMinRatio = stats?.ratio ?? summaryStats!.minRatio;
|
|
182
169
|
genObj.minRatio ??= possibleMinRatio;
|
|
183
|
-
if (genObj.minRatio > possibleMinRatio)
|
|
170
|
+
if (genObj.minRatio > possibleMinRatio)
|
|
184
171
|
genObj.minRatio = possibleMinRatio;
|
|
185
|
-
}
|
|
186
172
|
}
|
|
187
173
|
|
|
188
174
|
/**
|
|
@@ -201,9 +187,8 @@ export function calculateClusterStatistics(df: DG.DataFrame, clustersColumnName:
|
|
|
201
187
|
const origClustColCat = origClustCol.categories;
|
|
202
188
|
const origClustMasks: BitArray[] = Array.from({length: origClustColCat.length},
|
|
203
189
|
() => new BitArray(rowCount, false));
|
|
204
|
-
for (let rowIdx = 0; rowIdx < rowCount; ++rowIdx)
|
|
190
|
+
for (let rowIdx = 0; rowIdx < rowCount; ++rowIdx)
|
|
205
191
|
origClustMasks[origClustColData[rowIdx]].setTrue(rowIdx);
|
|
206
|
-
}
|
|
207
192
|
|
|
208
193
|
|
|
209
194
|
const customClustMasks = customClusters.map(
|
package/src/utils/misc.ts
CHANGED
|
@@ -210,9 +210,8 @@ export function setGridProps(grid: DG.Grid, autosize: boolean = true): void {
|
|
|
210
210
|
grid.props.showCurrentRowIndicator = false;
|
|
211
211
|
grid.root.style.width = '100%';
|
|
212
212
|
grid.root.style.maxWidth = '100%';
|
|
213
|
-
if (autosize)
|
|
213
|
+
if (autosize)
|
|
214
214
|
grid.autoSize(1000, 175, 0, 0, true);
|
|
215
|
-
}
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
/**
|
package/src/utils/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
2
2
|
import {ClusterType} from '../viewers/logo-summary';
|
|
3
3
|
import {SCALING_METHODS} from './constants';
|
|
4
4
|
import {AggregationColumns} from './statistics';
|
|
5
|
-
import {
|
|
5
|
+
import {MmDistanceFunctionsNames} from '@datagrok-libraries/ml/src/macromolecule-distance-functions';
|
|
6
6
|
|
|
7
7
|
export type RawData = Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
8
8
|
export type UTypedArray = Uint8Array | Uint16Array | Uint32Array;
|
|
@@ -25,13 +25,16 @@ export interface PeptidesSettings {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class SequenceSpaceParams {
|
|
28
|
-
distanceF:
|
|
28
|
+
distanceF: MmDistanceFunctionsNames = MmDistanceFunctionsNames.NEEDLEMANN_WUNSCH;
|
|
29
29
|
gapOpen: number = 1;
|
|
30
30
|
gapExtend: number = 0.6;
|
|
31
31
|
clusterEmbeddings: boolean = true;
|
|
32
32
|
epsilon: number = 0.01;
|
|
33
33
|
minPts: number = 4;
|
|
34
34
|
fingerprintType: string = 'Morgan';
|
|
35
|
+
constructor(clusterEmbeddings?: boolean) {
|
|
36
|
+
this.clusterEmbeddings = !!clusterEmbeddings;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
export type PartialPeptidesSettings = Partial<PeptidesSettings>;
|
|
@@ -109,7 +109,7 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
109
109
|
choices: [PositionHeight.full, PositionHeight.Entropy],
|
|
110
110
|
category: LST_CATEGORIES.STYLE,
|
|
111
111
|
});
|
|
112
|
-
this.membersRatioThreshold = this.float(LST_PROPERTIES.MEMBERS_RATIO_THRESHOLD, 0.
|
|
112
|
+
this.membersRatioThreshold = this.float(LST_PROPERTIES.MEMBERS_RATIO_THRESHOLD, 0.1,
|
|
113
113
|
{
|
|
114
114
|
min: 0,
|
|
115
115
|
max: 1.0,
|
|
@@ -206,24 +206,21 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
206
206
|
* @return - position columns.
|
|
207
207
|
*/
|
|
208
208
|
get positionColumns(): DG.Column<string>[] {
|
|
209
|
-
if (this._positionColumns != null)
|
|
209
|
+
if (this._positionColumns != null)
|
|
210
210
|
return this._positionColumns;
|
|
211
|
-
}
|
|
212
211
|
|
|
213
212
|
|
|
214
213
|
const getSharedPositionColumns = (viewerType: VIEWER_TYPE): DG.Column<string>[] | null => {
|
|
215
214
|
const viewer = this.model.findViewer(viewerType) as SARViewer | null;
|
|
216
|
-
if (this.sequenceColumnName === viewer?.sequenceColumnName)
|
|
215
|
+
if (this.sequenceColumnName === viewer?.sequenceColumnName)
|
|
217
216
|
return viewer._positionColumns;
|
|
218
|
-
}
|
|
219
217
|
|
|
220
218
|
|
|
221
219
|
return null;
|
|
222
220
|
};
|
|
223
221
|
|
|
224
|
-
if (this.model.positionColumns != null && this.sequenceColumnName === this.model.settings?.sequenceColumnName)
|
|
222
|
+
if (this.model.positionColumns != null && this.sequenceColumnName === this.model.settings?.sequenceColumnName)
|
|
225
223
|
this._positionColumns = this.model.positionColumns;
|
|
226
|
-
}
|
|
227
224
|
|
|
228
225
|
|
|
229
226
|
this._positionColumns ??= getSharedPositionColumns(VIEWER_TYPE.MONOMER_POSITION) ??
|
|
@@ -261,9 +258,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
261
258
|
*/
|
|
262
259
|
getScaledActivityColumn(isFiltered: boolean = false): DG.Column<number> {
|
|
263
260
|
if (this.model.settings?.activityColumnName === this.activityColumnName &&
|
|
264
|
-
this.model.settings?.activityScaling === this.activityScaling)
|
|
261
|
+
this.model.settings?.activityScaling === this.activityScaling)
|
|
265
262
|
this._scaledActivityColumn = this.model.getScaledActivityColumn(isFiltered);
|
|
266
|
-
}
|
|
267
263
|
|
|
268
264
|
|
|
269
265
|
this._scaledActivityColumn ??= scaleActivity(this.dataFrame.getCol(this.activityColumnName),
|
|
@@ -380,9 +376,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
380
376
|
doRender = true;
|
|
381
377
|
break;
|
|
382
378
|
}
|
|
383
|
-
if (doRender)
|
|
379
|
+
if (doRender)
|
|
384
380
|
this.render();
|
|
385
|
-
}
|
|
386
381
|
}
|
|
387
382
|
|
|
388
383
|
/**
|
|
@@ -399,11 +394,10 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
399
394
|
const newClusterSelection = {} as type.Selection;
|
|
400
395
|
newClusterSelection[CLUSTER_TYPE.ORIGINAL] = [];
|
|
401
396
|
newClusterSelection[CLUSTER_TYPE.CUSTOM] = [];
|
|
402
|
-
if (options.notify)
|
|
397
|
+
if (options.notify)
|
|
403
398
|
this.clusterSelection = newClusterSelection;
|
|
404
|
-
|
|
399
|
+
else
|
|
405
400
|
this._clusterSelection = newClusterSelection;
|
|
406
|
-
}
|
|
407
401
|
|
|
408
402
|
|
|
409
403
|
return this.clusterSelection;
|
|
@@ -473,9 +467,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
473
467
|
const customClustCol = customClustColList[rowIdx];
|
|
474
468
|
customLSTClustCol.set(rowIdx, customClustCol.name);
|
|
475
469
|
const bitArray = BitArray.fromUint32Array(filteredDfRowCount, customClustCol.getRawData() as Uint32Array);
|
|
476
|
-
if (bitArray.allFalse || bitArray.allTrue)
|
|
470
|
+
if (bitArray.allFalse || bitArray.allTrue)
|
|
477
471
|
continue;
|
|
478
|
-
}
|
|
479
472
|
|
|
480
473
|
|
|
481
474
|
const bsMask = DG.BitSet.fromBytes(bitArray.buffer.buffer, filteredDfRowCount);
|
|
@@ -504,9 +497,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
504
497
|
const origLSTCols = origLST.columns;
|
|
505
498
|
const origLSTClustCol: DG.Column<string> = origLST.getCol(clustersColName);
|
|
506
499
|
origLSTClustCol.name = C.LST_COLUMN_NAMES.CLUSTER;
|
|
507
|
-
if (origLSTClustCol.type !== DG.COLUMN_TYPE.STRING)
|
|
500
|
+
if (origLSTClustCol.type !== DG.COLUMN_TYPE.STRING)
|
|
508
501
|
origLST.columns.replace(origLSTClustCol, origLSTClustCol.convertTo(DG.COLUMN_TYPE.STRING));
|
|
509
|
-
}
|
|
510
502
|
|
|
511
503
|
|
|
512
504
|
const origLSTClustColCat = origLSTClustCol.categories;
|
|
@@ -528,9 +520,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
528
520
|
|
|
529
521
|
for (let rowIdx = 0; rowIdx < origLSTLen; ++rowIdx) {
|
|
530
522
|
const mask = origClustMasks[rowIdx];
|
|
531
|
-
if (mask.allFalse || mask.allTrue)
|
|
523
|
+
if (mask.allFalse || mask.allTrue)
|
|
532
524
|
continue;
|
|
533
|
-
}
|
|
534
525
|
|
|
535
526
|
|
|
536
527
|
const bsMask = DG.BitSet.fromBytes(mask.buffer.buffer, filteredDfRowCount);
|
|
@@ -586,9 +577,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
586
577
|
grid.onCellRender.subscribe(async (gridCellArgs) => {
|
|
587
578
|
const gridCell = gridCellArgs.cell;
|
|
588
579
|
const currentRowIdx = gridCell.tableRowIndex;
|
|
589
|
-
if (!gridCell.isTableCell || currentRowIdx === null || currentRowIdx === -1)
|
|
580
|
+
if (!gridCell.isTableCell || currentRowIdx === null || currentRowIdx === -1)
|
|
590
581
|
return;
|
|
591
|
-
}
|
|
592
582
|
|
|
593
583
|
|
|
594
584
|
const canvasContext = gridCellArgs.g;
|
|
@@ -613,13 +603,12 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
613
603
|
const viewerProps = viewer.getProperties();
|
|
614
604
|
|
|
615
605
|
for (const prop of viewerProps) {
|
|
616
|
-
if (prop.name === 'positionHeight' && prop.get(viewer) !== this.webLogoMode)
|
|
606
|
+
if (prop.name === 'positionHeight' && prop.get(viewer) !== this.webLogoMode)
|
|
617
607
|
prop.set(viewer, this.webLogoMode);
|
|
618
|
-
|
|
608
|
+
else if (prop.name === 'positionWidth' && prop.get(viewer) !== positionWidth)
|
|
619
609
|
prop.set(viewer, positionWidth);
|
|
620
|
-
|
|
610
|
+
else if (prop.name === 'minHeight' && prop.get(viewer) !== height)
|
|
621
611
|
prop.set(viewer, height);
|
|
622
|
-
}
|
|
623
612
|
}
|
|
624
613
|
const viewerRoot = $(viewer.root).css('height', `${height}px`);//;
|
|
625
614
|
viewerRoot.children().first().css('overflow-y', 'hidden !important');
|
|
@@ -667,15 +656,13 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
667
656
|
});
|
|
668
657
|
grid.root.addEventListener('mouseleave', (_ev) => this.model.unhighlight());
|
|
669
658
|
DG.debounce(grid.onCurrentCellChanged, 500).subscribe((gridCell) => {
|
|
670
|
-
if (!gridCell.isTableCell)
|
|
659
|
+
if (!gridCell.isTableCell)
|
|
671
660
|
return;
|
|
672
|
-
}
|
|
673
661
|
|
|
674
662
|
|
|
675
663
|
try {
|
|
676
|
-
if (!this.keyPress || gridCell.tableColumn?.name !== C.LST_COLUMN_NAMES.CLUSTER)
|
|
664
|
+
if (!this.keyPress || gridCell.tableColumn?.name !== C.LST_COLUMN_NAMES.CLUSTER)
|
|
677
665
|
return;
|
|
678
|
-
}
|
|
679
666
|
|
|
680
667
|
|
|
681
668
|
if (this.currentRowIndex !== null && this.currentRowIndex !== -1) {
|
|
@@ -698,14 +685,13 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
698
685
|
});
|
|
699
686
|
grid.root.addEventListener('keydown', (ev) => {
|
|
700
687
|
this.keyPress = ev.key.startsWith('Arrow');
|
|
701
|
-
if (this.keyPress)
|
|
688
|
+
if (this.keyPress)
|
|
702
689
|
return;
|
|
703
|
-
}
|
|
704
690
|
|
|
705
691
|
|
|
706
|
-
if (ev.key === 'Escape' || (ev.code === 'KeyA' && ev.shiftKey && ev.ctrlKey))
|
|
692
|
+
if (ev.key === 'Escape' || (ev.code === 'KeyA' && ev.shiftKey && ev.ctrlKey))
|
|
707
693
|
this.initClusterSelection({notify: false});
|
|
708
|
-
|
|
694
|
+
else if (ev.code === 'KeyA' && ev.ctrlKey) {
|
|
709
695
|
for (let rowIdx = 0; rowIdx < this.logoSummaryTable.rowCount; ++rowIdx) {
|
|
710
696
|
this.modifyClusterSelection(this.getCluster(grid.cell(C.LST_COLUMN_NAMES.CLUSTER, rowIdx)),
|
|
711
697
|
{
|
|
@@ -719,9 +705,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
719
705
|
});
|
|
720
706
|
grid.root.addEventListener('click', (ev) => {
|
|
721
707
|
const gridCell = grid.hitTest(ev.offsetX, ev.offsetY);
|
|
722
|
-
if (!gridCell || !gridCell.isTableCell || gridCell.tableColumn?.name !== C.LST_COLUMN_NAMES.CLUSTER)
|
|
708
|
+
if (!gridCell || !gridCell.isTableCell || gridCell.tableColumn?.name !== C.LST_COLUMN_NAMES.CLUSTER)
|
|
723
709
|
return;
|
|
724
|
-
}
|
|
725
710
|
|
|
726
711
|
|
|
727
712
|
const selection = this.getCluster(gridCell);
|
|
@@ -743,9 +728,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
743
728
|
|
|
744
729
|
const cluster = this.getCluster(gridCell);
|
|
745
730
|
this.highlightCluster(cluster);
|
|
746
|
-
if (gridCell.tableColumn?.name === C.LST_COLUMN_NAMES.CLUSTER)
|
|
731
|
+
if (gridCell.tableColumn?.name === C.LST_COLUMN_NAMES.CLUSTER)
|
|
747
732
|
this.showTooltip(cluster, x, y);
|
|
748
|
-
}
|
|
749
733
|
|
|
750
734
|
|
|
751
735
|
return true;
|
|
@@ -829,9 +813,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
829
813
|
col.name === C.LST_COLUMN_NAMES.RATIO ? stats.ratio :
|
|
830
814
|
col.name in aggregatedValues ? aggregatedValues[col.name] :
|
|
831
815
|
undefined;
|
|
832
|
-
if (typeof newClusterVals[i] === 'undefined')
|
|
816
|
+
if (typeof newClusterVals[i] === 'undefined')
|
|
833
817
|
_package.logger.warning(`PeptidesLSTWarn: value for column ${col.name} is undefined`);
|
|
834
|
-
}
|
|
835
818
|
}
|
|
836
819
|
this.logoSummaryTable.rows.addNew(newClusterVals);
|
|
837
820
|
|
|
@@ -893,11 +876,10 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
893
876
|
shiftPressed: false,
|
|
894
877
|
ctrlPressed: false,
|
|
895
878
|
}, notify: boolean = true): void {
|
|
896
|
-
if (notify)
|
|
879
|
+
if (notify)
|
|
897
880
|
this.clusterSelection = modifySelection(this.clusterSelection, cluster, options);
|
|
898
|
-
|
|
881
|
+
else
|
|
899
882
|
this._clusterSelection = modifySelection(this.clusterSelection, cluster, options);
|
|
900
|
-
}
|
|
901
883
|
}
|
|
902
884
|
|
|
903
885
|
/**
|
|
@@ -922,9 +904,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
922
904
|
const seekValue = origClustColCategories.indexOf(cluster.monomerOrCluster);
|
|
923
905
|
|
|
924
906
|
for (let i = 0; i < rowCount; ++i) {
|
|
925
|
-
if (origClustColData[i] === seekValue)
|
|
907
|
+
if (origClustColData[i] === seekValue)
|
|
926
908
|
bitArray.setTrue(i);
|
|
927
|
-
}
|
|
928
909
|
}
|
|
929
910
|
bitArray.incrementVersion();
|
|
930
911
|
} else {
|
|
@@ -935,9 +916,8 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
|
|
|
935
916
|
const stats = bs.anyFalse ? getStats(activityColData, bitArray) :
|
|
936
917
|
this.clusterStats[cluster.positionOrClusterType as ClusterType][cluster.monomerOrCluster];
|
|
937
918
|
|
|
938
|
-
if (!stats.count)
|
|
919
|
+
if (!stats.count)
|
|
939
920
|
return null;
|
|
940
|
-
}
|
|
941
921
|
|
|
942
922
|
|
|
943
923
|
const mask = DG.BitSet.fromBytes(bitArray.buffer.buffer, rowCount);
|