@datagrok/peptides 1.23.14 → 1.23.15
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 +0 -3
- 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 +6 -6
- package/src/viewers/position-statistics-viewer.ts +39 -9
- package/test-console-output-1.log +165 -99
- 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.23.
|
|
4
|
+
"version": "1.23.15",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Davit Rizhinashvili",
|
|
7
7
|
"email": "drizhinashvili@datagrok.ai"
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"directory": "packages/Peptides"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@datagrok-libraries/bio": "^5.
|
|
16
|
+
"@datagrok-libraries/bio": "^5.54.5",
|
|
17
17
|
"@datagrok-libraries/math": "^1.2.5",
|
|
18
|
-
"@datagrok-libraries/ml": "^6.
|
|
18
|
+
"@datagrok-libraries/ml": "^6.10.4",
|
|
19
19
|
"@datagrok-libraries/statistics": "^1.2.12",
|
|
20
20
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
21
|
-
"@datagrok-libraries/utils": "^4.
|
|
21
|
+
"@datagrok-libraries/utils": "^4.6.3",
|
|
22
22
|
"@webgpu/types": "^0.1.40",
|
|
23
23
|
"cash-dom": "^8.1.5",
|
|
24
|
-
"datagrok-api": "^1.
|
|
24
|
+
"datagrok-api": "^1.25.0",
|
|
25
25
|
"file-loader": "^6.2.0",
|
|
26
26
|
"rxjs": "^6.5.5",
|
|
27
27
|
"uuid": "^10.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
41
41
|
"@typescript-eslint/parser": "^8.8.1",
|
|
42
42
|
"css-loader": "^7.1.2",
|
|
43
|
-
"datagrok-tools": "^4.14.
|
|
43
|
+
"datagrok-tools": "^4.14.37",
|
|
44
44
|
"eslint": "^8.57.1",
|
|
45
45
|
"eslint-config-google": "^0.14.0",
|
|
46
46
|
"style-loader": "^4.0.0",
|
|
@@ -5,7 +5,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
5
5
|
import wu from 'wu';
|
|
6
6
|
import $ from 'cash-dom';
|
|
7
7
|
import {PeptideUtils} from '../peptideUtils';
|
|
8
|
-
import {TAGS as bioTAGS} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
8
|
+
import {TAGS as bioTAGS, MONOMER_MOTIF_SPLITTER} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
9
9
|
|
|
10
10
|
export const POSITION_HIDDEN_NAME = '~sequence_position_monomers';
|
|
11
11
|
|
|
@@ -15,12 +15,17 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
15
15
|
private _positionColumn?: DG.Column;
|
|
16
16
|
private _boxPlotViewer?: DG.Viewer;
|
|
17
17
|
public valueColumnName: string;
|
|
18
|
-
|
|
18
|
+
public leftMotifLength: number = 0;
|
|
19
|
+
public rightMotifLength: number = 0;
|
|
20
|
+
public showPositionInfo: boolean = true;
|
|
19
21
|
constructor() {
|
|
20
22
|
super();
|
|
21
23
|
this.position = this.int('position', 0, {nullable: false});
|
|
22
24
|
this.sequenceColumnName = this.column('sequence', {semType: DG.SEMTYPE.MACROMOLECULE, nullable: false});
|
|
23
25
|
this.valueColumnName = this.column('value', {columnTypeFilter: 'numerical', nullable: false});
|
|
26
|
+
this.leftMotifLength = this.int('leftMotifLength', 0, {nullable: false, min: 0, max: 10});
|
|
27
|
+
this.rightMotifLength = this.int('rightMotifLength', 0, {nullable: false, min: 0, max: 10});
|
|
28
|
+
this.showPositionInfo = this.bool('showPositionInfo', true, {nullable: false, defaultValue: true, description: 'Show position and overhangs info in the viewer header'});
|
|
24
29
|
grok.events.onContextMenu.subscribe((e) => {
|
|
25
30
|
if (e.causedBy && e.causedBy.target && this._boxPlotViewer?.root.contains(e.causedBy.target)) {
|
|
26
31
|
e.causedBy.preventDefault();
|
|
@@ -74,19 +79,44 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
74
79
|
const seqHelper = PeptideUtils.getSeqHelper();
|
|
75
80
|
const sequenceColumn = this.dataFrame.col(this.sequenceColumnName)!;
|
|
76
81
|
const seqHandler = seqHelper.getSeqHandler(sequenceColumn);
|
|
77
|
-
const
|
|
78
|
-
|
|
82
|
+
const leftOverhang = Math.min(Math.max(this.leftMotifLength ?? 0, 0), 10);
|
|
83
|
+
const rightOverhang = Math.min(Math.max(this.rightMotifLength ?? 0, 0), 10);
|
|
84
|
+
const start = Math.max(0, this.position - leftOverhang);
|
|
85
|
+
const end = rightOverhang + this.position;
|
|
86
|
+
const canonicals = Array.from({length: end - start + 1}).fill('')
|
|
87
|
+
.map((_, i) => seqHandler.getMonomersAtPosition(start + i, true));
|
|
88
|
+
this._positionColumn.init((i) => canonicals.map((c) => c[i]).join(MONOMER_MOTIF_SPLITTER));
|
|
79
89
|
|
|
80
90
|
this._boxPlotViewer = this.dataFrame.plot.box({categoryColumnNames: [this._positionColumn.name], plotStyle: 'violin',
|
|
81
91
|
valueColumnName: this.valueColumnName, colorColumnName: this._positionColumn.name, showColorSelector: false, showSizeSelector: false, showCategorySelector: false,
|
|
82
|
-
legendVisibility: DG.VisibilityMode.Never,
|
|
92
|
+
legendVisibility: DG.VisibilityMode.Never, markerColorColumnName: this._positionColumn.name, title: 'Sequence Position Statistics',
|
|
83
93
|
autoLayout: false, labelOrientation: 'Vert',
|
|
84
94
|
});
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
const leftOverhangInput = ui.input.int('Left Overhang', {value: leftOverhang, min: 0, max: 10, step: 1, showSlider: false, showPlusMinus: true,
|
|
97
|
+
onValueChanged: (v) => {
|
|
98
|
+
this.getProperty('leftMotifLength')!.set(this, leftOverhangInput.value);
|
|
99
|
+
}, tooltipText: 'Left overhang motif length from the selected position',
|
|
100
|
+
});
|
|
101
|
+
const rightOverhangInput = ui.input.int('Right Overhang', {value: rightOverhang, min: 0, max: 10, step: 1, showSlider: false, showPlusMinus: true,
|
|
102
|
+
onValueChanged: (v) => {
|
|
103
|
+
this.getProperty('rightMotifLength')!.set(this, rightOverhangInput.value);
|
|
104
|
+
}, tooltipText: 'Right overhang motif length from the selected position',
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const descriptionDiv = ui.divH([
|
|
108
|
+
leftOverhangInput.root, ui.h2(`${this.sequenceColumnName}: Position ${this.position + 1}`),
|
|
109
|
+
rightOverhangInput.root,
|
|
110
|
+
], {style: {alignItems: 'center', justifyContent: 'space-around', width: '100%'}});
|
|
111
|
+
if (this.showPositionInfo) {
|
|
112
|
+
this.root.appendChild(descriptionDiv);
|
|
113
|
+
leftOverhangInput.input.style.width = '20px';
|
|
114
|
+
rightOverhangInput.input.style.width = '20px';
|
|
115
|
+
}
|
|
116
|
+
// setTimeout(() => {
|
|
117
|
+
// this._boxPlotViewer!.props.title = 'Sequence Position Statistics';
|
|
118
|
+
// this._boxPlotViewer!.props.description = `${this.sequenceColumnName}: Position ${this.position + 1}`;
|
|
119
|
+
// }, 200);
|
|
90
120
|
|
|
91
121
|
this._boxPlotViewer.props.statistics = ['min', 'max', 'avg', 'med', 'count'];
|
|
92
122
|
|