@datagrok/bio 2.10.29 → 2.11.0
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 +4 -2
- 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/apps/web-logo-app.ts +7 -3
- package/src/package.ts +14 -0
- package/src/tests/WebLogo-positions-test.ts +3 -3
- package/src/utils/agg.ts +29 -0
- package/src/viewers/web-logo-viewer.ts +235 -119
- package/src/widgets/composition-analysis-widget.ts +35 -23
- package/webpack.config.js +1 -1
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
|
+
"version": "2.11.0",
|
|
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.
|
|
37
|
+
"@datagrok-libraries/bio": "^5.39.0",
|
|
38
38
|
"@datagrok-libraries/chem-meta": "^1.0.1",
|
|
39
39
|
"@datagrok-libraries/ml": "^6.3.50",
|
|
40
40
|
"@datagrok-libraries/tutorials": "^1.3.6",
|
package/src/apps/web-logo-app.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
4
4
|
|
|
5
5
|
import wu from 'wu';
|
|
6
6
|
|
|
7
|
-
import {IWebLogoViewer} from '@datagrok-libraries/bio/src/viewers/web-logo';
|
|
7
|
+
import {IWebLogoViewer, WebLogoProps} from '@datagrok-libraries/bio/src/viewers/web-logo';
|
|
8
8
|
|
|
9
9
|
import {PROPS as wlPROPS} from '../viewers/web-logo-viewer';
|
|
10
10
|
|
|
@@ -14,7 +14,11 @@ export class WebLogoApp {
|
|
|
14
14
|
df: DG.DataFrame;
|
|
15
15
|
view: DG.TableView;
|
|
16
16
|
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
private readonly urlParams: URLSearchParams,
|
|
19
|
+
private readonly funcName: string,
|
|
20
|
+
private readonly options: Partial<WebLogoProps> = {}
|
|
21
|
+
) {}
|
|
18
22
|
|
|
19
23
|
async init(df: DG.DataFrame): Promise<void> {
|
|
20
24
|
this.df = df;
|
|
@@ -32,7 +36,7 @@ export class WebLogoApp {
|
|
|
32
36
|
this.view = grok.shell.addTableView(this.df);
|
|
33
37
|
this.view.path = this.view.basePath = `func/${_package.name}.${this.funcName}?${urlParamsTxt}`;
|
|
34
38
|
|
|
35
|
-
const options: { [p: string]: any } = {sequenceColumnName: 'sequence'};
|
|
39
|
+
const options: { [p: string]: any } = {...this.options, ...{sequenceColumnName: 'sequence'}};
|
|
36
40
|
for (const [optName, optValue] of this.urlParams.entries()) {
|
|
37
41
|
switch (optName) {
|
|
38
42
|
// boolean
|
package/src/package.ts
CHANGED
|
@@ -976,6 +976,20 @@ export async function webLogoLargeApp(): Promise<void> {
|
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
+
//name: webLogoAggApp
|
|
980
|
+
export async function webLogoAggApp(): Promise<void> {
|
|
981
|
+
const pi = DG.TaskBarProgressIndicator.create('WebLogo ...');
|
|
982
|
+
try {
|
|
983
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
984
|
+
const app = new WebLogoApp(urlParams, 'webLogoAggApp');
|
|
985
|
+
const df: DG.DataFrame = await _package.files.readCsv('data/sample_FASTA_PT_activity.csv');
|
|
986
|
+
await grok.data.detectSemanticTypes(df);
|
|
987
|
+
await app.init(df);
|
|
988
|
+
} finally {
|
|
989
|
+
pi.close();
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
979
993
|
//name: getRegionApp
|
|
980
994
|
export async function getRegionApp(): Promise<void> {
|
|
981
995
|
const pi = DG.TaskBarProgressIndicator.create('getRegion ...');
|
|
@@ -55,7 +55,7 @@ ATC-G-TTGC--
|
|
|
55
55
|
for (let i = 0; i < positions.length; i++) {
|
|
56
56
|
expect(positions[i].name, resAllDf1[i].name);
|
|
57
57
|
for (const m of positions[i].getMonomers())
|
|
58
|
-
expect(positions[i].getFreq(m).
|
|
58
|
+
expect(positions[i].getFreq(m).rowCount, resAllDf1[i].getFreq(m).rowCount);
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -104,7 +104,7 @@ ATC-G-TTGC--
|
|
|
104
104
|
for (let i = 0; i < positions.length; i++) {
|
|
105
105
|
expect(positions[i].name, resAllDf1[i].name);
|
|
106
106
|
for (const m of positions[i].getMonomers())
|
|
107
|
-
expect(positions[i].getFreq(m).
|
|
107
|
+
expect(positions[i].getFreq(m).rowCount, resAllDf1[i].getFreq(m).rowCount);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -204,7 +204,7 @@ function expectPositionInfo(actualPos: PI, expectedPos: PI): void {
|
|
|
204
204
|
expectArray(actualPos.getMonomers(), expectedPos.getMonomers());
|
|
205
205
|
for (const key of actualPos.getMonomers()) {
|
|
206
206
|
//
|
|
207
|
-
expect(actualPos.getFreq(key).
|
|
207
|
+
expect(actualPos.getFreq(key).rowCount, expectedPos.getFreq(key).rowCount);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
package/src/utils/agg.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
export type AggValueListType = (number | null)[] | Float32Array | Int32Array;
|
|
6
|
+
export type AggFunc = (valueList: AggValueListType) => number | null;
|
|
7
|
+
|
|
8
|
+
export function getAgg(agg: DG.AggregationType): AggFunc {
|
|
9
|
+
let res: AggFunc;
|
|
10
|
+
|
|
11
|
+
function buildCol(valueList: AggValueListType): DG.Column<number> {
|
|
12
|
+
let resCol: DG.Column<number>;
|
|
13
|
+
const resColName = `agg`;
|
|
14
|
+
if (valueList instanceof Float32Array)
|
|
15
|
+
resCol = DG.Column.fromFloat32Array(resColName, valueList as Float32Array);
|
|
16
|
+
else if (valueList instanceof Int32Array)
|
|
17
|
+
resCol = DG.Column.fromInt32Array(resColName, valueList as Int32Array);
|
|
18
|
+
else
|
|
19
|
+
resCol = DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, resColName, valueList as (number | null)[]);
|
|
20
|
+
|
|
21
|
+
return resCol;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (valueList: AggValueListType): number | null => {
|
|
25
|
+
const aggCol = buildCol(valueList);
|
|
26
|
+
const res = aggCol.aggregate(agg);
|
|
27
|
+
return res;
|
|
28
|
+
};
|
|
29
|
+
}
|