@datagrok/bio 2.11.21 → 2.11.22
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 +2 -0
- package/detectors.js +0 -13
- 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/utils/macromolecule-column-widget.ts +6 -1
- package/src/viewers/web-logo-viewer.ts +36 -37
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.11.
|
|
8
|
+
"version": "2.11.22",
|
|
9
9
|
"description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -12,7 +12,7 @@ import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
|
12
12
|
export class MacromoleculeColumnWidget extends DG.Widget {
|
|
13
13
|
private viewed: boolean = false;
|
|
14
14
|
|
|
15
|
-
private seqCol: DG.Column<string>;
|
|
15
|
+
private readonly seqCol: DG.Column<string>;
|
|
16
16
|
|
|
17
17
|
private wlViewer: WebLogoViewer;
|
|
18
18
|
|
|
@@ -44,4 +44,9 @@ export class MacromoleculeColumnWidget extends DG.Widget {
|
|
|
44
44
|
this.root.style.width = '100%';
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
override detach() {
|
|
49
|
+
this.wlViewer.detach();
|
|
50
|
+
super.detach();
|
|
51
|
+
}
|
|
47
52
|
}
|
|
@@ -2,6 +2,7 @@ import * as grok from 'datagrok-api/grok';
|
|
|
2
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
3
|
import * as DG from 'datagrok-api/dg';
|
|
4
4
|
|
|
5
|
+
import $ from 'cash-dom';
|
|
5
6
|
import wu from 'wu';
|
|
6
7
|
import {fromEvent, Observable, Subject, Unsubscribable} from 'rxjs';
|
|
7
8
|
|
|
@@ -558,7 +559,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
558
559
|
this.viewSubs.push(
|
|
559
560
|
fromEvent<WheelEvent>(this.canvas, 'wheel').subscribe(this.canvasOnWheel.bind(this)));
|
|
560
561
|
|
|
561
|
-
|
|
562
|
+
this.render(WlRenderLevel.Freqs, 'buildView');
|
|
562
563
|
_package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`);
|
|
563
564
|
}
|
|
564
565
|
|
|
@@ -589,7 +590,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
589
590
|
this.unitsHandler = UnitsHandler.getOrCreate(this.seqCol);
|
|
590
591
|
|
|
591
592
|
this.palette = pickUpPalette(this.seqCol);
|
|
592
|
-
this.
|
|
593
|
+
this.render(WlRenderLevel.Freqs, 'updateSeqCol()');
|
|
593
594
|
this.error = null;
|
|
594
595
|
} catch (err: any) {
|
|
595
596
|
this.seqCol = null;
|
|
@@ -608,36 +609,6 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
608
609
|
}
|
|
609
610
|
}
|
|
610
611
|
|
|
611
|
-
/** Updates {@link positionNames} and calculates {@link startPosition} and {@link endPosition}.
|
|
612
|
-
* Calls {@link render}() with {@link WlRenderLevel.Freqs}
|
|
613
|
-
*/
|
|
614
|
-
private updatePositions(): void {
|
|
615
|
-
if (!this.seqCol) return;
|
|
616
|
-
|
|
617
|
-
const dfFilter = this.getFilter();
|
|
618
|
-
const maxLength: number = dfFilter.trueCount === 0 ? this.unitsHandler!.maxLength :
|
|
619
|
-
wu.enumerate(this.unitsHandler!.splitted).map(([mList, rowI]) => {
|
|
620
|
-
return dfFilter.get(rowI) && !!mList ? mList.length : 0;
|
|
621
|
-
}).reduce((max, l) => Math.max(max, l), 0);
|
|
622
|
-
|
|
623
|
-
/** positionNames and positionLabel can be set up through the column's tags only */
|
|
624
|
-
const positionNamesTxt = this.seqCol.getTag(bioTAGS.positionNames);
|
|
625
|
-
const positionLabelsTxt = this.seqCol.getTag(bioTAGS.positionLabels);
|
|
626
|
-
this.positionNames = !!positionNamesTxt ? positionNamesTxt.split(positionSeparator).map((v) => v.trim()) :
|
|
627
|
-
[...Array(maxLength).keys()].map((jPos) => `${jPos + 1}`)/* fallback if tag is not provided */;
|
|
628
|
-
this.positionLabels = !!positionLabelsTxt ? positionLabelsTxt.split(positionSeparator).map((v) => v.trim()) :
|
|
629
|
-
undefined;
|
|
630
|
-
|
|
631
|
-
this.startPosition = (this.startPositionName && this.positionNames &&
|
|
632
|
-
this.positionNames.includes(this.startPositionName)) ?
|
|
633
|
-
this.positionNames.indexOf(this.startPositionName) : 0;
|
|
634
|
-
this.endPosition = (this.endPositionName && this.positionNames &&
|
|
635
|
-
this.positionNames.includes(this.endPositionName)) ?
|
|
636
|
-
this.positionNames.indexOf(this.endPositionName) : (maxLength - 1);
|
|
637
|
-
|
|
638
|
-
this.render(WlRenderLevel.Freqs, 'updatePositions');
|
|
639
|
-
}
|
|
640
|
-
|
|
641
612
|
private getFilter(): DG.BitSet {
|
|
642
613
|
let dfFilterRes: DG.BitSet;
|
|
643
614
|
switch (this.filterSource) {
|
|
@@ -851,13 +822,13 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
851
822
|
case PROPS.shrinkEmptyTail:
|
|
852
823
|
case PROPS.skipEmptyPositions:
|
|
853
824
|
case PROPS.positionHeight: {
|
|
854
|
-
this.
|
|
825
|
+
this.render(WlRenderLevel.Freqs, `onPropertyChanged( ${property.name} )`);
|
|
855
826
|
break;
|
|
856
827
|
}
|
|
857
828
|
|
|
858
829
|
case PROPS.valueColumnName:
|
|
859
830
|
case PROPS.valueAggrType: {
|
|
860
|
-
this.render(WlRenderLevel.Freqs, `onPropertyChanged(${property.name})`);
|
|
831
|
+
this.render(WlRenderLevel.Freqs, `onPropertyChanged( ${property.name} )`);
|
|
861
832
|
break;
|
|
862
833
|
}
|
|
863
834
|
// this.positionWidth obtains a new value
|
|
@@ -892,7 +863,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
892
863
|
}
|
|
893
864
|
|
|
894
865
|
/** Remove all handlers when table is a detach */
|
|
895
|
-
public override
|
|
866
|
+
public override detach() {
|
|
896
867
|
const logPrefix = `${this.viewerToLog()}.detach()`;
|
|
897
868
|
_package.logger.debug(`${logPrefix}, in`);
|
|
898
869
|
|
|
@@ -984,6 +955,31 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
984
955
|
_package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `);
|
|
985
956
|
if (!this.host || !this.seqCol || !this.dataFrame) return;
|
|
986
957
|
|
|
958
|
+
// region updatePositions
|
|
959
|
+
|
|
960
|
+
const dfFilter = this.getFilter();
|
|
961
|
+
const maxLength: number = dfFilter.trueCount === 0 ? this.unitsHandler!.maxLength :
|
|
962
|
+
wu.enumerate(this.unitsHandler!.splitted).map(([mList, rowI]) => {
|
|
963
|
+
return dfFilter.get(rowI) && !!mList ? mList.length : 0;
|
|
964
|
+
}).reduce((max, l) => Math.max(max, l), 0);
|
|
965
|
+
|
|
966
|
+
/** positionNames and positionLabel can be set up through the column's tags only */
|
|
967
|
+
const positionNamesTxt = this.seqCol.getTag(bioTAGS.positionNames);
|
|
968
|
+
const positionLabelsTxt = this.seqCol.getTag(bioTAGS.positionLabels);
|
|
969
|
+
this.positionNames = !!positionNamesTxt ? positionNamesTxt.split(positionSeparator).map((v) => v.trim()) :
|
|
970
|
+
[...Array(maxLength).keys()].map((jPos) => `${jPos + 1}`)/* fallback if tag is not provided */;
|
|
971
|
+
this.positionLabels = !!positionLabelsTxt ? positionLabelsTxt.split(positionSeparator).map((v) => v.trim()) :
|
|
972
|
+
undefined;
|
|
973
|
+
|
|
974
|
+
this.startPosition = (this.startPositionName && this.positionNames &&
|
|
975
|
+
this.positionNames.includes(this.startPositionName)) ?
|
|
976
|
+
this.positionNames.indexOf(this.startPositionName) : 0;
|
|
977
|
+
this.endPosition = (this.endPositionName && this.positionNames &&
|
|
978
|
+
this.positionNames.includes(this.endPositionName)) ?
|
|
979
|
+
this.positionNames.indexOf(this.endPositionName) : (maxLength - 1);
|
|
980
|
+
|
|
981
|
+
// endregion updatePositions
|
|
982
|
+
|
|
987
983
|
const length: number = this.startPosition <= this.endPosition ? this.endPosition - this.startPosition + 1 : 0;
|
|
988
984
|
this.unitsHandler = UnitsHandler.getOrCreate(this.seqCol);
|
|
989
985
|
const posCount: number = this.startPosition <= this.endPosition ? this.endPosition - this.startPosition + 1 : 0;
|
|
@@ -996,7 +992,6 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
996
992
|
}
|
|
997
993
|
|
|
998
994
|
// 2022-05-05 askalkin instructed to show WebLogo based on filter (not selection)
|
|
999
|
-
const dfFilter = this.getFilter();
|
|
1000
995
|
const dfRowCount = this.dataFrame.rowCount;
|
|
1001
996
|
const splitted = this.unitsHandler.splitted;
|
|
1002
997
|
|
|
@@ -1136,6 +1131,11 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
1136
1131
|
}
|
|
1137
1132
|
|
|
1138
1133
|
private renderRequestOnDebounce(renderLevel: WlRenderLevel): void {
|
|
1134
|
+
const logPrefix = `${this.viewerToLog()}.renderRequestOnDebounce()`;
|
|
1135
|
+
if ($(this.root).offsetParent().get()[0]?.tagName === 'HTML') {
|
|
1136
|
+
_package.logger.warning(`${logPrefix}, $(this.root).offsetParent() is the 'HTML' tag.`);
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
1139
|
this.requestedRenderLevel = WlRenderLevel.None;
|
|
1140
1140
|
this.renderInt(renderLevel)
|
|
1141
1141
|
.catch((err: any) => {
|
|
@@ -1176,7 +1176,6 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
1176
1176
|
private dataFrameFilterOnChanged(_value: any): void {
|
|
1177
1177
|
_package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);
|
|
1178
1178
|
try {
|
|
1179
|
-
this.updatePositions();
|
|
1180
1179
|
if (this.filterSource === FilterSources.Filtered)
|
|
1181
1180
|
this.render(WlRenderLevel.Freqs, 'dataFrameFilterOnChanged');
|
|
1182
1181
|
} catch (err: any) {
|