@datagrok/bio 2.8.2 → 2.8.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 +12 -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 +4 -3
- package/src/package.ts +1 -1
- package/src/viewers/web-logo-viewer.ts +35 -48
- package/scripts/admet-requirements.txt +0 -7
- package/scripts/admet-run.py +0 -27
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.8.
|
|
8
|
+
"version": "2.8.4",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@biowasm/aioli": "^3.1.0",
|
|
37
|
-
"@datagrok-libraries/bio": "^5.34.
|
|
37
|
+
"@datagrok-libraries/bio": "^5.34.3",
|
|
38
38
|
"@datagrok-libraries/chem-meta": "^1.0.1",
|
|
39
39
|
"@datagrok-libraries/ml": "^6.3.39",
|
|
40
40
|
"@datagrok-libraries/tutorials": "^1.3.6",
|
|
@@ -70,11 +70,12 @@
|
|
|
70
70
|
"link-bio": "npm link @datagrok-libraries/bio",
|
|
71
71
|
"link-ml": "npm link @datagrok-libraries/ml",
|
|
72
72
|
"link-utils": "npm link @datagrok-libraries/utils",
|
|
73
|
-
"link-all": "npm link datagrok-api @datagrok-libraries/utils @datagrok-libraries/bio @datagrok-libraries/
|
|
73
|
+
"link-all": "npm link @datagrok-libraries/chem-meta datagrok-api @datagrok-libraries/utils @datagrok-libraries/ml @datagrok-libraries/bio @datagrok-libraries/tutorials",
|
|
74
74
|
"debug-sequences1": "webpack && grok publish",
|
|
75
75
|
"release-sequences1": "webpack && grok publish --release",
|
|
76
76
|
"build-sequences1": "webpack",
|
|
77
77
|
"build": "webpack",
|
|
78
|
+
"build-all": "npm --prefix ./../../libraries/chem-meta run build && npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/utils run build && npm --prefix ./../../libraries/ml run build && npm --prefix ./../../libraries/bio run build && npm --prefix ./../../libraries/tutorials run build && npm run build",
|
|
78
79
|
"debug-sequences1-local": "webpack && grok publish local",
|
|
79
80
|
"release-sequences1-local": "webpack && grok publish local --release",
|
|
80
81
|
"debug-sequences1-dev": "webpack && grok publish dev",
|
package/src/package.ts
CHANGED
|
@@ -246,7 +246,7 @@ export function webLogoViewer() {
|
|
|
246
246
|
//tags: viewer, panel
|
|
247
247
|
//meta.icon: files/icons/vdregions-viewer.svg
|
|
248
248
|
//output: viewer result
|
|
249
|
-
export function
|
|
249
|
+
export function vdRegionsViewer() {
|
|
250
250
|
return new VdRegionsViewer();
|
|
251
251
|
}
|
|
252
252
|
|
|
@@ -157,36 +157,6 @@ export class PositionInfo {
|
|
|
157
157
|
positionWidthWithMargin: number, positionWidth: number, r: number, axisHeight: number
|
|
158
158
|
): void {
|
|
159
159
|
const dpr = window.devicePixelRatio;
|
|
160
|
-
// const rowCount = this.positions[jPos].rowCount;
|
|
161
|
-
// const alphabetSize = this.getAlphabetSize();
|
|
162
|
-
// if ((this.positionHeight == PositionHeight.Entropy) && (alphabetSize == null))
|
|
163
|
-
// grok.shell.error('WebLogo: alphabet is undefined.');
|
|
164
|
-
//
|
|
165
|
-
// const alphabetSizeLog = Math.log2(alphabetSize);
|
|
166
|
-
// const maxHeight = (this.positionHeight == PositionHeight.Entropy) ?
|
|
167
|
-
// (absoluteMaxHeight * (alphabetSizeLog - (this.positions[jPos].sumForHeightCalc)) / alphabetSizeLog) :
|
|
168
|
-
// absoluteMaxHeight;
|
|
169
|
-
//
|
|
170
|
-
// let y: number = this.axisHeight * r + (absoluteMaxHeight - maxHeight - 1);
|
|
171
|
-
//
|
|
172
|
-
// const entries = Object.entries(freq).sort((a, b) => {
|
|
173
|
-
// if (a[0] !== '-' && b[0] !== '-')
|
|
174
|
-
// return b[1].count - a[1].count;
|
|
175
|
-
// else if (a[0] === '-' && b[0] === '-')
|
|
176
|
-
// return 0;
|
|
177
|
-
// else if (a[0] === '-')
|
|
178
|
-
// return -1;
|
|
179
|
-
// else /* (b[0] === '-') */
|
|
180
|
-
// return +1;
|
|
181
|
-
// });
|
|
182
|
-
// for (const entry of entries) {
|
|
183
|
-
// const pmInfo: PositionMonomerInfo = entry[1];
|
|
184
|
-
// // const m: string = entry[0];
|
|
185
|
-
// const h: number = maxHeight * pmInfo.count / rowCount;
|
|
186
|
-
//
|
|
187
|
-
// pmInfo.bounds = new DG.Rect(jPos * this.positionWidthWithMargin, y, this._positionWidth, h);
|
|
188
|
-
// y += h;
|
|
189
|
-
// }
|
|
190
160
|
|
|
191
161
|
const maxHeight = (heightMode == PositionHeight.Entropy) ?
|
|
192
162
|
(absoluteMaxHeight * (alphabetSizeLog - (this.sumForHeightCalc)) / alphabetSizeLog) :
|
|
@@ -271,6 +241,7 @@ export enum PROPS {
|
|
|
271
241
|
fitArea = 'fitArea',
|
|
272
242
|
minHeight = 'minHeight',
|
|
273
243
|
maxHeight = 'maxHeight',
|
|
244
|
+
showPositionLabels = 'showPositionLabels',
|
|
274
245
|
positionMarginState = 'positionMarginState',
|
|
275
246
|
positionMargin = 'positionMargin',
|
|
276
247
|
|
|
@@ -286,6 +257,8 @@ enum RecalcLevel {
|
|
|
286
257
|
Freqs = 2,
|
|
287
258
|
}
|
|
288
259
|
|
|
260
|
+
const POSITION_LABELS_HEIGHT: number = 12;
|
|
261
|
+
|
|
289
262
|
export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
290
263
|
public static residuesSet = 'nucleotides';
|
|
291
264
|
private static viewerCount: number = -1;
|
|
@@ -305,8 +278,6 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
305
278
|
private slider: DG.RangeSlider;
|
|
306
279
|
private readonly textBaseline: CanvasTextBaseline;
|
|
307
280
|
|
|
308
|
-
private axisHeight: number = 12;
|
|
309
|
-
|
|
310
281
|
private seqCol: DG.Column<string> | null = null;
|
|
311
282
|
// private maxLength: number = 100;
|
|
312
283
|
private positions: PositionInfo[] = [];
|
|
@@ -328,6 +299,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
328
299
|
public minHeight: number;
|
|
329
300
|
public backgroundColor: number = 0xFFFFFFFF;
|
|
330
301
|
public maxHeight: number;
|
|
302
|
+
public showPositionLabels: boolean;
|
|
331
303
|
public positionMarginState: PositionMarginStates;
|
|
332
304
|
public positionMargin: number = 0;
|
|
333
305
|
public startPositionName: string | null;
|
|
@@ -452,6 +424,8 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
452
424
|
{category: PROPS_CATS.LAYOUT/*, editor: 'slider', min: 25, max: 250, postfix: 'px'*/});
|
|
453
425
|
this.maxHeight = this.float(PROPS.maxHeight, defaults.maxHeight,
|
|
454
426
|
{category: PROPS_CATS.LAYOUT/*, editor: 'slider', min: 25, max: 500, postfix: 'px'*/});
|
|
427
|
+
this.showPositionLabels = this.bool(PROPS.showPositionLabels, defaults.showPositionLabels,
|
|
428
|
+
{category: PROPS_CATS.LAYOUT});
|
|
455
429
|
this.positionMarginState = this.string(PROPS.positionMarginState, defaults.positionMarginState,
|
|
456
430
|
{category: PROPS_CATS.LAYOUT, choices: Object.values(PositionMarginStates)}) as PositionMarginStates;
|
|
457
431
|
let defaultValueForPositionMargin = 0;
|
|
@@ -713,6 +687,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
713
687
|
case PROPS.positionMargin:
|
|
714
688
|
this.updateSlider();
|
|
715
689
|
break;
|
|
690
|
+
case PROPS.showPositionLabels:
|
|
716
691
|
case PROPS.shrinkEmptyTail:
|
|
717
692
|
case PROPS.skipEmptyPositions:
|
|
718
693
|
this.updatePositions();
|
|
@@ -722,6 +697,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
722
697
|
switch (property.name) {
|
|
723
698
|
case PROPS.fixWidth:
|
|
724
699
|
case PROPS.fitArea:
|
|
700
|
+
case PROPS.showPositionLabels:
|
|
725
701
|
case PROPS.positionWidth:
|
|
726
702
|
case PROPS.positionMargin:
|
|
727
703
|
this.render(RecalcLevel.Layout, 'onPropertyChanged');
|
|
@@ -842,12 +818,12 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
842
818
|
};
|
|
843
819
|
|
|
844
820
|
/** Calculate layout of monomers on screen (canvas) based on freqs, required to handle mouse events */
|
|
845
|
-
const calculateLayoutInt = (dpr: number): void => {
|
|
821
|
+
const calculateLayoutInt = (dpr: number, positionLabelsHeight: number): void => {
|
|
846
822
|
_package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);
|
|
847
823
|
|
|
848
824
|
const length = this.positions.length;
|
|
849
825
|
this.calcSize();
|
|
850
|
-
const absoluteMaxHeight = this.canvas.height -
|
|
826
|
+
const absoluteMaxHeight = this.canvas.height - positionLabelsHeight * dpr;
|
|
851
827
|
const alphabetSize = this.getAlphabetSize();
|
|
852
828
|
if ((this.positionHeight == PositionHeight.Entropy) && (alphabetSize == null))
|
|
853
829
|
grok.shell.error('WebLogo: alphabet is undefined.');
|
|
@@ -855,7 +831,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
855
831
|
|
|
856
832
|
for (let jPos = 0; jPos < length; jPos++) {
|
|
857
833
|
this.positions[jPos].calcScreen(jPos, absoluteMaxHeight, this.positionHeight as PositionHeight,
|
|
858
|
-
alphabetSizeLog, this.positionWidthWithMargin, this._positionWidth, dpr,
|
|
834
|
+
alphabetSizeLog, this.positionWidthWithMargin, this._positionWidth, dpr, positionLabelsHeight);
|
|
859
835
|
}
|
|
860
836
|
};
|
|
861
837
|
|
|
@@ -884,8 +860,10 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
884
860
|
this.slider.root.style.width = `${this.host.clientWidth}px`;
|
|
885
861
|
|
|
886
862
|
const dpr: number = window.devicePixelRatio;
|
|
863
|
+
/** 0 is for no position labels */
|
|
864
|
+
const positionLabelsHeight = this.showPositionLabels ? POSITION_LABELS_HEIGHT : 0;
|
|
887
865
|
if (recalcLevel >= RecalcLevel.Freqs) calculateFreqsInt();
|
|
888
|
-
if (recalcLevel >= RecalcLevel.Layout) calculateLayoutInt(window.devicePixelRatio);
|
|
866
|
+
if (recalcLevel >= RecalcLevel.Layout) calculateLayoutInt(window.devicePixelRatio, positionLabelsHeight);
|
|
889
867
|
|
|
890
868
|
const length: number = this.Length;
|
|
891
869
|
g.resetTransform();
|
|
@@ -907,14 +885,9 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
907
885
|
const hScale = posNameMaxWidth < (this._positionWidth * dpr - 2) ? 1 :
|
|
908
886
|
(this._positionWidth * dpr - 2) / posNameMaxWidth;
|
|
909
887
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
g.setTransform(
|
|
914
|
-
hScale, 0, 0, 1,
|
|
915
|
-
jPos * this.positionWidthWithMargin * dpr + this._positionWidth * dpr / 2 -
|
|
916
|
-
this.positionWidthWithMargin * firstVisibleIndex, 0);
|
|
917
|
-
g.fillText(pos.label, 0, 0);
|
|
888
|
+
if (positionLabelsHeight > 0) {
|
|
889
|
+
renderPositionLabels(g, dpr, hScale, this.positionWidthWithMargin, this._positionWidth,
|
|
890
|
+
this.positions, this.firstVisibleIndex, lastVisibleIndex);
|
|
918
891
|
}
|
|
919
892
|
//#endregion Plot positionNames
|
|
920
893
|
const fontStyle = '16px Roboto, Roboto Local, sans-serif';
|
|
@@ -974,7 +947,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
974
947
|
this._positionWidth = this.positionWidth * scale;
|
|
975
948
|
}
|
|
976
949
|
|
|
977
|
-
width = this.Length * this.positionWidthWithMargin
|
|
950
|
+
width = this.Length * this.positionWidthWithMargin;
|
|
978
951
|
|
|
979
952
|
this.canvas.width = this.root.clientWidth * dpr;
|
|
980
953
|
this.canvas.style.width = `${this.root.clientWidth}px`;
|
|
@@ -1015,13 +988,13 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
1015
988
|
// horizontal alignment
|
|
1016
989
|
let hostLeftMargin = 0;
|
|
1017
990
|
switch (this.horizontalAlignment) {
|
|
1018
|
-
case
|
|
991
|
+
case HorizontalAlignments.LEFT:
|
|
1019
992
|
hostLeftMargin = 0;
|
|
1020
993
|
break;
|
|
1021
|
-
case
|
|
994
|
+
case HorizontalAlignments.CENTER:
|
|
1022
995
|
hostLeftMargin = Math.max(0, (this.root.clientWidth - width) / 2);
|
|
1023
996
|
break;
|
|
1024
|
-
case
|
|
997
|
+
case HorizontalAlignments.RIGHT:
|
|
1025
998
|
hostLeftMargin = Math.max(0, this.root.clientWidth - width);
|
|
1026
999
|
break;
|
|
1027
1000
|
}
|
|
@@ -1170,6 +1143,20 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
1170
1143
|
}
|
|
1171
1144
|
}
|
|
1172
1145
|
|
|
1146
|
+
function renderPositionLabels(g: CanvasRenderingContext2D,
|
|
1147
|
+
dpr: number, hScale: number, positionWidthWithMargin: number, positionWidth: number,
|
|
1148
|
+
positions: PositionInfo[], firstVisibleIndex: number, lastVisibleIndex: number): void {
|
|
1149
|
+
for (let jPos = firstVisibleIndex; jPos < lastVisibleIndex; jPos++) {
|
|
1150
|
+
const pos: PositionInfo = positions[jPos];
|
|
1151
|
+
g.resetTransform();
|
|
1152
|
+
g.setTransform(
|
|
1153
|
+
hScale, 0, 0, 1,
|
|
1154
|
+
jPos * positionWidthWithMargin * dpr + positionWidth * dpr / 2 -
|
|
1155
|
+
positionWidthWithMargin * firstVisibleIndex, 0);
|
|
1156
|
+
g.fillText(pos.label, 0, 1);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1173
1160
|
export function checkSeqForMonomerAtPos(
|
|
1174
1161
|
df: DG.DataFrame, unitsHandler: UnitsHandler, filter: DG.BitSet, rowI: number, monomer: string, at: PositionInfo,
|
|
1175
1162
|
): boolean {
|
package/scripts/admet-run.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python2
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
Created on Mon Feb 19 17:30:46 2018
|
|
5
|
-
|
|
6
|
-
@author: cbdd
|
|
7
|
-
"""
|
|
8
|
-
from sklearn.externals import joblib
|
|
9
|
-
import numpy as np
|
|
10
|
-
import pandas as pd
|
|
11
|
-
import os
|
|
12
|
-
|
|
13
|
-
###################################### Load model ##########
|
|
14
|
-
# current_path = os.path.split(os.path.realpath(__file__))[0]
|
|
15
|
-
cf = joblib.load('CYP3A4-substrate.pkl')
|
|
16
|
-
|
|
17
|
-
###################################### Load descriptors ##########
|
|
18
|
-
fingerprint_content = pd.read_csv('des.csv').ix[:, 1:]
|
|
19
|
-
des_list = np.array(fingerprint_content)
|
|
20
|
-
|
|
21
|
-
###################################### Prediction ##########
|
|
22
|
-
y_predict_label = cf.predict(des_list)
|
|
23
|
-
y_predict_proba = cf.predict_proba(des_list)
|
|
24
|
-
print('#' * 10 + 'Results labels' + '#' * 10)
|
|
25
|
-
print(y_predict_label)
|
|
26
|
-
print('#' * 10 + 'Results probabilities' + '#' * 10)
|
|
27
|
-
print(y_predict_proba)
|