@datagrok/peptides 1.23.15 → 1.23.16
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.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
- package/src/viewers/position-statistics-viewer.ts +11 -8
- package/test-console-output-1.log +101 -131
- 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.16",
|
|
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.54.
|
|
16
|
+
"@datagrok-libraries/bio": "^5.54.6",
|
|
17
17
|
"@datagrok-libraries/math": "^1.2.5",
|
|
18
18
|
"@datagrok-libraries/ml": "^6.10.4",
|
|
19
19
|
"@datagrok-libraries/statistics": "^1.2.12",
|
|
@@ -20,7 +20,8 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
20
20
|
public showPositionInfo: boolean = true;
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
|
-
|
|
23
|
+
// starting from 1!
|
|
24
|
+
this.position = this.int('position', 1, {nullable: false, showSlider: false, min: 1});
|
|
24
25
|
this.sequenceColumnName = this.column('sequence', {semType: DG.SEMTYPE.MACROMOLECULE, nullable: false});
|
|
25
26
|
this.valueColumnName = this.column('value', {columnTypeFilter: 'numerical', nullable: false});
|
|
26
27
|
this.leftMotifLength = this.int('leftMotifLength', 0, {nullable: false, min: 0, max: 10});
|
|
@@ -36,14 +37,15 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
getPositionFromColumn(): number {
|
|
40
|
+
// also starting from 1!
|
|
39
41
|
const col = this.dataFrame.col(this.sequenceColumnName);
|
|
40
42
|
if (col == null)
|
|
41
|
-
return
|
|
43
|
+
return 1;
|
|
42
44
|
const positionString = col.getTag(bioTAGS.selectedPosition) ?? '1';
|
|
43
45
|
const position = parseInt(positionString);
|
|
44
46
|
if (Number.isNaN(position))
|
|
45
|
-
return
|
|
46
|
-
return Math.max(
|
|
47
|
+
return 1;
|
|
48
|
+
return Math.max(1, position);
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
onTableAttached(): void {
|
|
@@ -71,7 +73,8 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
render(): void {
|
|
74
|
-
|
|
76
|
+
const position0Based = (this.position ?? -1) - 1;
|
|
77
|
+
if (this.dataFrame == null || !this.sequenceColumnName || position0Based < 0 || !this._positionColumn || !this.valueColumnName)
|
|
75
78
|
return;
|
|
76
79
|
|
|
77
80
|
$(this.root).empty();
|
|
@@ -81,8 +84,8 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
81
84
|
const seqHandler = seqHelper.getSeqHandler(sequenceColumn);
|
|
82
85
|
const leftOverhang = Math.min(Math.max(this.leftMotifLength ?? 0, 0), 10);
|
|
83
86
|
const rightOverhang = Math.min(Math.max(this.rightMotifLength ?? 0, 0), 10);
|
|
84
|
-
const start = Math.max(0,
|
|
85
|
-
const end = rightOverhang +
|
|
87
|
+
const start = Math.max(0, position0Based - leftOverhang);
|
|
88
|
+
const end = rightOverhang + position0Based;
|
|
86
89
|
const canonicals = Array.from({length: end - start + 1}).fill('')
|
|
87
90
|
.map((_, i) => seqHandler.getMonomersAtPosition(start + i, true));
|
|
88
91
|
this._positionColumn.init((i) => canonicals.map((c) => c[i]).join(MONOMER_MOTIF_SPLITTER));
|
|
@@ -105,7 +108,7 @@ export class SequencePositionStatsViewer extends DG.JsViewer {
|
|
|
105
108
|
});
|
|
106
109
|
|
|
107
110
|
const descriptionDiv = ui.divH([
|
|
108
|
-
leftOverhangInput.root, ui.h2(`${this.sequenceColumnName}: Position ${this.position
|
|
111
|
+
leftOverhangInput.root, ui.h2(`${this.sequenceColumnName}: Position ${this.position}`),
|
|
109
112
|
rightOverhangInput.root,
|
|
110
113
|
], {style: {alignItems: 'center', justifyContent: 'space-around', width: '100%'}});
|
|
111
114
|
if (this.showPositionInfo) {
|