@datagrok/peptides 1.27.7 → 1.27.8
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 +13 -0
- package/CLAUDE.md +0 -12
- 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 +2 -2
- package/src/model.ts +13 -3
- package/src/viewers/mutation-cliffs-viewer.ts +9 -2
- package/src/viewers/position-statistics-viewer.ts +2 -2
- package/src/viewers/sar-viewer.ts +19 -4
- package/src/widgets/manual-alignment.ts +1 -1
- package/test-console-output-1.log +138 -68
- package/test-record-1.mp4 +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/peptides",
|
|
3
3
|
"friendlyName": "Peptides",
|
|
4
|
-
"version": "1.27.
|
|
4
|
+
"version": "1.27.8",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"directory": "packages/Peptides"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@datagrok-libraries/bio": "^5.63.
|
|
16
|
+
"@datagrok-libraries/bio": "^5.63.6",
|
|
17
17
|
"@datagrok-libraries/math": "^1.2.6",
|
|
18
18
|
"@datagrok-libraries/ml": "^6.10.7",
|
|
19
19
|
"@datagrok-libraries/statistics": "^1.2.12",
|
package/src/model.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {ITSNEOptions, IUMAPOptions}
|
|
|
50
50
|
import {DimReductionMethods} from '@datagrok-libraries/ml/src/multi-column-dimensionality-reduction/types';
|
|
51
51
|
import {AggregationColumns, MonomerPositionStats} from './utils/statistics';
|
|
52
52
|
import {splitAlignedSequences} from '@datagrok-libraries/bio/src/utils/splitter';
|
|
53
|
+
import {MONOMER_CANONICALIZER_FUNC_TAG} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
53
54
|
import {getDbscanWorker} from '@datagrok-libraries/math';
|
|
54
55
|
import {DistanceAggregationMethods} from '@datagrok-libraries/ml/src/distance-matrix/types';
|
|
55
56
|
import {ClusterMaxActivityViewer, IClusterMaxActivity} from './viewers/cluster-max-activity-viewer';
|
|
@@ -748,9 +749,14 @@ export class PeptidesModel {
|
|
|
748
749
|
const positionColumns = splitSeqDf.columns.names();
|
|
749
750
|
if (positionColumns.every((colName) => cols.contains(colName))) {
|
|
750
751
|
positionColumns.forEach((colName) => {
|
|
751
|
-
this.df.col(colName)
|
|
752
|
-
|
|
753
|
-
|
|
752
|
+
const col = this.df.col(colName)!;
|
|
753
|
+
col.setTag(C.TAGS.ANALYSIS_COL, `${true}`);
|
|
754
|
+
col.setTag(C.TAGS.POSITION_COL, `${true}`);
|
|
755
|
+
// Propagate canonicalizer tag from split columns if present
|
|
756
|
+
const canonTag = splitSeqDf.getCol(colName).getTag(MONOMER_CANONICALIZER_FUNC_TAG);
|
|
757
|
+
if (canonTag)
|
|
758
|
+
col.setTag(MONOMER_CANONICALIZER_FUNC_TAG, canonTag);
|
|
759
|
+
CR.setMonomerRenderer(col, this.alphabet);
|
|
754
760
|
});
|
|
755
761
|
} else {
|
|
756
762
|
for (const colName of positionColumns) {
|
|
@@ -763,6 +769,10 @@ export class PeptidesModel {
|
|
|
763
769
|
col = cols.addNew(newCol.name, newCol.type).init((i) => newColCat[newColData[i]]);
|
|
764
770
|
col.setTag(C.TAGS.ANALYSIS_COL, `${true}`);
|
|
765
771
|
col.setTag(C.TAGS.POSITION_COL, `${true}`);
|
|
772
|
+
// Propagate canonicalizer tag from split columns if present
|
|
773
|
+
const canonTag = newCol.getTag(MONOMER_CANONICALIZER_FUNC_TAG);
|
|
774
|
+
if (canonTag)
|
|
775
|
+
col.setTag(MONOMER_CANONICALIZER_FUNC_TAG, canonTag);
|
|
766
776
|
CR.setMonomerRenderer(col, this.alphabet);
|
|
767
777
|
}
|
|
768
778
|
}
|
|
@@ -10,6 +10,8 @@ import $ from 'cash-dom';
|
|
|
10
10
|
import {PeptidesModel} from '../model';
|
|
11
11
|
import {extractColInfo} from '../utils/misc';
|
|
12
12
|
import {Subscription} from 'rxjs';
|
|
13
|
+
import {SeqTemps} from '@datagrok-libraries/bio/src/utils/macromolecule/seq-handler';
|
|
14
|
+
import {MONOMER_CANONICALIZER_FUNC_TAG} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
13
15
|
export type MutationCliffsWithMonomers = {
|
|
14
16
|
cliffs: MutationCliffs,
|
|
15
17
|
monomers: string[]
|
|
@@ -267,15 +269,20 @@ export class MutationCliffsViewer extends DG.JsViewer {
|
|
|
267
269
|
this._positionColumns = posCols;
|
|
268
270
|
return this._positionColumns;
|
|
269
271
|
}
|
|
270
|
-
// fallback: generate columns
|
|
272
|
+
// fallback: generate columns using original (non-canonical) monomers
|
|
271
273
|
const seqCol = this.dataFrame.col(this.sequenceColumnName)!;
|
|
272
274
|
const seqHelper = PeptideUtils.getSeqHelper();
|
|
273
275
|
const seqHandler = seqHelper.getSeqHandler(seqCol);
|
|
274
276
|
const length = seqHandler.maxLength;
|
|
275
277
|
const cols: DG.Column[] = [];
|
|
278
|
+
// Propagate canonicalizer tag if the source column has a notation provider with one
|
|
279
|
+
const notationProvider: any = seqCol.temp[SeqTemps.notationProvider] ?? null;
|
|
280
|
+
const canonFuncName: string | null = notationProvider?.monomerCanonicalizerFuncName ?? null;
|
|
276
281
|
for (let i = 0; i < length; i++) {
|
|
277
|
-
const monomersAtPosition = seqHandler.getMonomersAtPosition(i,
|
|
282
|
+
const monomersAtPosition = seqHandler.getMonomersAtPosition(i, false);
|
|
278
283
|
const monomerCol = DG.Column.fromList('string', `Position ${i + 1}`, monomersAtPosition);
|
|
284
|
+
if (canonFuncName)
|
|
285
|
+
monomerCol.setTag(MONOMER_CANONICALIZER_FUNC_TAG, canonFuncName);
|
|
279
286
|
cols.push(monomerCol);
|
|
280
287
|
}
|
|
281
288
|
this._positionColumns = cols;
|
|
@@ -93,8 +93,8 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
93
93
|
const seqHandler = seqHelper.getSeqHandler(sequenceColumn);
|
|
94
94
|
const maxPos = seqHandler.maxLength;
|
|
95
95
|
|
|
96
|
-
const
|
|
97
|
-
this._positionColumn.init((i) =>
|
|
96
|
+
const originals = positions.map((p) => seqHandler.getMonomersAtPosition(p - 1, false));
|
|
97
|
+
this._positionColumn.init((i) => originals.map((c) => c[i]).join(MONOMER_MOTIF_SPLITTER));
|
|
98
98
|
|
|
99
99
|
this._boxPlotViewer = this.dataFrame.plot.box({categoryColumnNames: [this._positionColumn.name], plotStyle: 'violin',
|
|
100
100
|
valueColumnName: this.valueColumnName, colorColumnName: this._positionColumn.name, showColorSelector: false, showSizeSelector: false, showCategorySelector: false,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from '../utils/misc';
|
|
37
37
|
import {splitAlignedSequences} from '@datagrok-libraries/bio/src/utils/splitter';
|
|
38
38
|
import {LogoSummaryTable} from './logo-summary';
|
|
39
|
-
import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
39
|
+
import {TAGS as bioTAGS, MONOMER_CANONICALIZER_FUNC_TAG} from '@datagrok-libraries/bio/src/utils/macromolecule/consts';
|
|
40
40
|
import {ALPHABET} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
41
41
|
import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-library';
|
|
42
42
|
import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
@@ -246,6 +246,16 @@ export abstract class SARViewer extends DG.JsViewer implements ISARViewer {
|
|
|
246
246
|
return this._positionColumns!;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/** Copies the monomer canonicalizer tag from the sequence column to a monomer column. */
|
|
250
|
+
protected propagateCanonicalizerTag(monomerCol: DG.Column): void {
|
|
251
|
+
const seqCol = this.dataFrame?.col(this.sequenceColumnName);
|
|
252
|
+
if (!seqCol) return;
|
|
253
|
+
const notationProvider: any = seqCol.temp[SeqTemps.notationProvider] ?? null;
|
|
254
|
+
const canonFuncName: string | null = notationProvider?.monomerCanonicalizerFuncName ?? null;
|
|
255
|
+
if (canonFuncName)
|
|
256
|
+
monomerCol.setTag(MONOMER_CANONICALIZER_FUNC_TAG, canonFuncName);
|
|
257
|
+
}
|
|
258
|
+
|
|
249
259
|
_monomerPositionStats: MonomerPositionStats | null = null;
|
|
250
260
|
|
|
251
261
|
/**
|
|
@@ -469,7 +479,8 @@ export abstract class SARViewer extends DG.JsViewer implements ISARViewer {
|
|
|
469
479
|
*/
|
|
470
480
|
onPropertyChanged(property: DG.Property): void {
|
|
471
481
|
super.onPropertyChanged(property);
|
|
472
|
-
|
|
482
|
+
if (!this.dataFrame)
|
|
483
|
+
return;
|
|
473
484
|
|
|
474
485
|
this.doRender = true;
|
|
475
486
|
switch (property.name) {
|
|
@@ -899,6 +910,8 @@ export class MonomerPosition extends SARViewer {
|
|
|
899
910
|
*/
|
|
900
911
|
onPropertyChanged(property: DG.Property): void {
|
|
901
912
|
super.onPropertyChanged(property);
|
|
913
|
+
if (!this.dataFrame)
|
|
914
|
+
return;
|
|
902
915
|
switch (property.name) {
|
|
903
916
|
case SAR_PROPERTIES.SEQUENCE:
|
|
904
917
|
this._invariantMapSelection = null;
|
|
@@ -1066,6 +1079,7 @@ export class MonomerPosition extends SARViewer {
|
|
|
1066
1079
|
sumGridCol.visible = false;
|
|
1067
1080
|
const monomerCol = monomerPositionDf.getCol(C.COLUMNS_NAMES.MONOMER);
|
|
1068
1081
|
CR.setMonomerRenderer(monomerCol, this.alphabet, true);
|
|
1082
|
+
this.propagateCanonicalizerTag(monomerCol);
|
|
1069
1083
|
this.cacheInvariantMapColors();
|
|
1070
1084
|
|
|
1071
1085
|
grid.onCellRender.subscribe((args: DG.GridCellRenderArgs) => renderCell(args, this,
|
|
@@ -1266,7 +1280,7 @@ export class MonomerPosition extends SARViewer {
|
|
|
1266
1280
|
/** Renders the MonomerPosition viewer body. */
|
|
1267
1281
|
render(): void {
|
|
1268
1282
|
$(this.root).empty();
|
|
1269
|
-
if (!this.activityColumnName || !this.sequenceColumnName) {
|
|
1283
|
+
if (!this.dataFrame || !this.activityColumnName || !this.sequenceColumnName) {
|
|
1270
1284
|
this.root.appendChild(ui.divText('Please, select a sequence and activity columns in the viewer properties'));
|
|
1271
1285
|
return;
|
|
1272
1286
|
}
|
|
@@ -1493,6 +1507,7 @@ export class MostPotentResidues extends SARViewer {
|
|
|
1493
1507
|
|
|
1494
1508
|
// Setting Monomer column renderer
|
|
1495
1509
|
CR.setMonomerRenderer(monomerCol, this.alphabet, true);
|
|
1510
|
+
this.propagateCanonicalizerTag(monomerCol);
|
|
1496
1511
|
grid.onCellRender.subscribe(
|
|
1497
1512
|
(args: DG.GridCellRenderArgs) => renderCell(args, this, false, undefined, undefined));
|
|
1498
1513
|
|
|
@@ -1625,7 +1640,7 @@ export class MostPotentResidues extends SARViewer {
|
|
|
1625
1640
|
/** Renders the MostPotentResidues viewer body. */
|
|
1626
1641
|
render(): void {
|
|
1627
1642
|
$(this.root).empty();
|
|
1628
|
-
if (!this.activityColumnName || !this.sequenceColumnName) {
|
|
1643
|
+
if (!this.dataFrame || !this.activityColumnName || !this.sequenceColumnName) {
|
|
1629
1644
|
this.root.appendChild(ui.divText('Please, select a sequence and activity columns in the viewer properties'));
|
|
1630
1645
|
return;
|
|
1631
1646
|
}
|
|
@@ -24,7 +24,7 @@ export function manualAlignmentWidget(alignedSequenceCol: DG.Column<string>, cur
|
|
|
24
24
|
const affectedRowIndex = currentDf.currentRowIdx;
|
|
25
25
|
alignedSequenceCol.set(affectedRowIndex, newSequence);
|
|
26
26
|
for (let i = 0; i < splitSequence.length; i++) {
|
|
27
|
-
const part = splitSequence.
|
|
27
|
+
const part = splitSequence.getOriginal(i);
|
|
28
28
|
if (currentDf.col(i.toString()) !== null)
|
|
29
29
|
currentDf.set(i.toString(), affectedRowIndex, part);
|
|
30
30
|
}
|