@datagrok/peptides 1.23.2 → 1.23.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/CHANGELOG.md +10 -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 +1 -1
- package/src/model.ts +13 -6
- package/src/widgets/mutation-cliffs.ts +20 -4
- package/src/widgets/selection.ts +6 -7
- package/test-console-output-1.log +60 -66
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
package/src/model.ts
CHANGED
|
@@ -378,20 +378,27 @@ export class PeptidesModel {
|
|
|
378
378
|
model.subs.push(DG.debounce(dataFrame.onSelectionChanged, 10).subscribe((_) => {
|
|
379
379
|
//clear all selections if user cleared the selection.
|
|
380
380
|
if (wasEmptySelectionBefore || dataFrame.selection.anyTrue || !model._analysisView || !document.contains(model._analysisView.root) ||
|
|
381
|
-
model._analysisView.dataFrame !== dataFrame
|
|
381
|
+
model._analysisView.dataFrame !== dataFrame) {
|
|
382
382
|
wasEmptySelectionBefore = !dataFrame?.selection?.anyTrue;
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
if (model.positionColumns)
|
|
386
|
+
model.webLogoSelection = initSelection(model.positionColumns);
|
|
386
387
|
const mpViewer = model.findViewer(VIEWER_TYPE.SEQUENCE_VARIABILITY_MAP) as MonomerPosition | null;
|
|
387
388
|
if (mpViewer != null) {
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
const posCols = model.positionColumns ?? mpViewer.positionColumns;
|
|
390
|
+
if (posCols) {
|
|
391
|
+
mpViewer.invariantMapSelection = initSelection(posCols);
|
|
392
|
+
mpViewer.mutationCliffsSelection = initSelection(posCols);
|
|
393
|
+
}
|
|
390
394
|
}
|
|
391
395
|
const mprViewer = model.findViewer(VIEWER_TYPE.MOST_POTENT_RESIDUES) as MostPotentResidues | null;
|
|
392
396
|
if (mprViewer != null) {
|
|
393
|
-
|
|
394
|
-
|
|
397
|
+
const posCols = model.positionColumns ?? mprViewer.positionColumns;
|
|
398
|
+
if (posCols) {
|
|
399
|
+
mprViewer.mutationCliffsSelection = initSelection(posCols);
|
|
400
|
+
mprViewer.invariantMapSelection = initSelection(posCols);
|
|
401
|
+
}
|
|
395
402
|
}
|
|
396
403
|
const lstViewer = model.findViewer(VIEWER_TYPE.LOGO_SUMMARY_TABLE) as LogoSummaryTable | null;
|
|
397
404
|
if (lstViewer != null) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as ui from 'datagrok-api/ui';
|
|
2
3
|
import * as DG from 'datagrok-api/dg';
|
|
3
4
|
import * as C from '../utils/constants';
|
|
@@ -83,7 +84,7 @@ function cliffsPairsWidgetParts(table: DG.DataFrame, options: MutationCliffsOpti
|
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
const substitutionsArray: string[] = [];
|
|
86
|
-
const deltaArray: number[] = [];
|
|
87
|
+
const deltaArray: (number | null)[] = [];
|
|
87
88
|
const substitutedToArray: string[] = [];
|
|
88
89
|
const mutationsGroupsArray: string[] = [];
|
|
89
90
|
const fromIdxArray: number[] = [];
|
|
@@ -123,7 +124,8 @@ function cliffsPairsWidgetParts(table: DG.DataFrame, options: MutationCliffsOpti
|
|
|
123
124
|
const forbiddentIndexes = seenIndexes.get(referenceIdx) ?? [];
|
|
124
125
|
const baseSequence = alignedSeqColCategories[alignedSeqColData[referenceIdx]];
|
|
125
126
|
const baseActivity = activityScaledColData[referenceIdx];
|
|
126
|
-
|
|
127
|
+
// activities can be null, and when getting raw data, they will come up as DG.FLOAT_NULL, so very close to 0, leading to incorrect deltas.
|
|
128
|
+
const actBaseActivity = options.activityCol.isNone(referenceIdx) ? null : baseActivity;
|
|
127
129
|
for (const subIdx of indexArray) {
|
|
128
130
|
if (forbiddentIndexes.includes(subIdx) || !filteredIndexes.includes(subIdx))
|
|
129
131
|
continue;
|
|
@@ -134,11 +136,13 @@ function cliffsPairsWidgetParts(table: DG.DataFrame, options: MutationCliffsOpti
|
|
|
134
136
|
|
|
135
137
|
|
|
136
138
|
const subSeq = alignedSeqColCategories[alignedSeqColData[subIdx]];
|
|
137
|
-
|
|
139
|
+
// same here, check for null
|
|
140
|
+
const actActivity = options.activityCol.isNone(subIdx) ? null : activityScaledColData[subIdx];
|
|
141
|
+
const delta = actBaseActivity == null || actActivity == null ? null : actBaseActivity - actActivity;
|
|
138
142
|
seenIndexes.get(subIdx)!.push(referenceIdx);
|
|
139
143
|
substitutionsArray.push(`${baseSequence}#${subSeq}`);
|
|
140
144
|
mutationsGroupsArray.push(`${group}`);
|
|
141
|
-
deltaArray.push(
|
|
145
|
+
deltaArray.push(delta);
|
|
142
146
|
substitutedToArray.push(posColCategories[posColData[subIdx]]);
|
|
143
147
|
fromIdxArray.push(referenceIdx);
|
|
144
148
|
toIdxArray.push(subIdx);
|
|
@@ -238,6 +242,18 @@ function cliffsPairsWidgetParts(table: DG.DataFrame, options: MutationCliffsOpti
|
|
|
238
242
|
pairsGrid.invalidate();
|
|
239
243
|
uniqueSequencesGrid.invalidate();
|
|
240
244
|
});
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
// just a cosmetic thing, draw null values in delta column as N/A
|
|
248
|
+
pairsGrid.onCellPrepare((gc) => {
|
|
249
|
+
if (gc?.isTableCell && gc?.gridColumn?.name?.toLowerCase() == 'delta' && (gc?.cell?.value == null || gc?.cell?.value == DG.FLOAT_NULL)) {
|
|
250
|
+
try {
|
|
251
|
+
gc.customText = 'N/A';
|
|
252
|
+
} catch (_) {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
241
257
|
pairsGrid.onCellRender.subscribe((gcArgs) => {
|
|
242
258
|
if (gcArgs.cell.tableColumn?.name !== substCol.name || !pairsSelectedIndexes.includes(gcArgs.cell.tableRowIndex!))
|
|
243
259
|
return;
|
package/src/widgets/selection.ts
CHANGED
|
@@ -30,7 +30,6 @@ export function getSelectionWidget(table: DG.DataFrame, options: SelectionWidget
|
|
|
30
30
|
const newTable = DG.DataFrame.create(table.rowCount);
|
|
31
31
|
newTable.name = 'Selected compounds';
|
|
32
32
|
newTable.filter.copyFrom(options.tableSelection);
|
|
33
|
-
const numericalCols = wu(table.columns.numerical);
|
|
34
33
|
let gridSortOrder: {cols: DG.Column[], types: boolean[]} | null = null;
|
|
35
34
|
for (let gridColIdx = 1; gridColIdx < options.gridColumns.length; gridColIdx++) {
|
|
36
35
|
const gridCol = options.gridColumns.byIndex(gridColIdx)!;
|
|
@@ -57,14 +56,14 @@ export function getSelectionWidget(table: DG.DataFrame, options: SelectionWidget
|
|
|
57
56
|
sourceColCategories = sourceCol.categories;
|
|
58
57
|
} catch (_e) {
|
|
59
58
|
}
|
|
60
|
-
const getValue = !sourceColRawData || !sourceColCategories ?
|
|
59
|
+
const getValue = (!sourceColRawData || !sourceColCategories ?
|
|
61
60
|
(i: number): any => sourceCol.get(i) :
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
(sourceCol.isNumerical ? (i: number): number => sourceColRawData[i] :
|
|
62
|
+
(i: number): string => sourceColCategories[sourceColRawData[i]]));
|
|
63
|
+
const getNullableValue = (i: number): any => sourceCol.isNone(i) ? null : getValue(i);
|
|
65
64
|
const col = sourceCol.name === options.activityColumn.name ?
|
|
66
|
-
newTable.columns.addNewFloat(gridCol.name).init((i) =>
|
|
67
|
-
newTable.columns.addNewVirtual(gridCol.name, (i) =>
|
|
65
|
+
newTable.columns.addNewFloat(gridCol.name).init((i) => getNullableValue(i) as number) :
|
|
66
|
+
newTable.columns.addNewVirtual(gridCol.name, (i) => getNullableValue(i) as unknown, sourceCol.type as DG.TYPE);
|
|
68
67
|
for (const [tag, value] of sourceCol.tags)
|
|
69
68
|
col.setTag(tag, value);
|
|
70
69
|
}
|