@datagrok/bio 2.21.11 → 2.22.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 +6 -0
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +6 -6
- package/dist/package.js.map +1 -1
- package/package.json +3 -3
- package/src/package.ts +5 -6
- package/src/utils/seq-helper/seq-handler.ts +1 -1
- package/src/viewers/web-logo-viewer.ts +1 -1
- package/src/widgets/composition-analysis-widget.ts +1 -38
- package/src/widgets/sequence-scrolling-widget.ts +492 -89
- package/test-console-output-1.log +315 -327
- package/test-record-1.mp4 +0 -0
- package/src/package.js +0 -529
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.22.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",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@biowasm/aioli": "^3.1.0",
|
|
47
|
-
"@datagrok-libraries/bio": "^5.53.
|
|
47
|
+
"@datagrok-libraries/bio": "^5.53.4",
|
|
48
48
|
"@datagrok-libraries/chem-meta": "^1.2.7",
|
|
49
49
|
"@datagrok-libraries/math": "^1.2.4",
|
|
50
|
-
"@datagrok-libraries/ml": "^6.10.
|
|
50
|
+
"@datagrok-libraries/ml": "^6.10.2",
|
|
51
51
|
"@datagrok-libraries/tutorials": "^1.6.1",
|
|
52
52
|
"@datagrok-libraries/utils": "^4.5.7",
|
|
53
53
|
"datagrok-api": "^1.25.0",
|
package/src/package.ts
CHANGED
|
@@ -82,7 +82,7 @@ export const _package = new BioPackage(/*{debug: true}/**/);
|
|
|
82
82
|
// let monomerLib: MonomerLib | null = null;
|
|
83
83
|
|
|
84
84
|
//name: getMonomerLibHelper
|
|
85
|
-
//description:
|
|
85
|
+
//description: Returns an instance of the monomer library helper
|
|
86
86
|
//output: object result
|
|
87
87
|
export async function getMonomerLibHelper(): Promise<IMonomerLibHelper> {
|
|
88
88
|
return await MonomerLibManager.getInstance();
|
|
@@ -377,7 +377,6 @@ export function macromoleculeDifferenceCellRenderer(): MacromoleculeDifferenceCe
|
|
|
377
377
|
|
|
378
378
|
//name: sequenceAlignment
|
|
379
379
|
//input: string alignType {choices: ['Local alignment', 'Global alignment']}
|
|
380
|
-
// eslint-disable-next-line max-len
|
|
381
380
|
//input: string alignTable {choices: ['AUTO', 'NUCLEOTIDES', 'BLOSUM45', 'BLOSUM50', 'BLOSUM62','BLOSUM80','BLOSUM90','PAM30','PAM70','PAM250','SCHNEIDER','TRANS']}
|
|
382
381
|
//input: double gap
|
|
383
382
|
//input: string seq1
|
|
@@ -464,7 +463,7 @@ export async function activityCliffs(table: DG.DataFrame, molecules: DG.Column<s
|
|
|
464
463
|
options?: (IUMAPOptions | ITSNEOptions) & Options, demo?: boolean): Promise<DG.Viewer | undefined> {
|
|
465
464
|
//workaround for functions which add viewers to tableView (can be run only on active table view)
|
|
466
465
|
if (table.name !== grok.shell.tv.dataFrame.name) {
|
|
467
|
-
grok.shell.error(`Table ${table.name} is not
|
|
466
|
+
grok.shell.error(`Table ${table.name} is not a current table view`);
|
|
468
467
|
return;
|
|
469
468
|
}
|
|
470
469
|
if (!checkInputColumnUI(molecules, 'Activity Cliffs'))
|
|
@@ -595,7 +594,7 @@ export async function sequenceSpaceTopMenu(table: DG.DataFrame, molecules: DG.Co
|
|
|
595
594
|
): Promise<DG.ScatterPlotViewer | undefined> {
|
|
596
595
|
//workaround for functions which add viewers to tableView (can be run only on active table view)
|
|
597
596
|
if (table.name !== grok.shell.tv.dataFrame.name) {
|
|
598
|
-
grok.shell.error(`Table ${table.name} is not
|
|
597
|
+
grok.shell.error(`Table ${table.name} is not a current table view`);
|
|
599
598
|
return;
|
|
600
599
|
}
|
|
601
600
|
const tableView =
|
|
@@ -975,12 +974,12 @@ export async function manageMonomersView() {
|
|
|
975
974
|
await monomerManager.getViewRoot();
|
|
976
975
|
}
|
|
977
976
|
|
|
978
|
-
//name:
|
|
977
|
+
//name: Manage Monomer Libraries
|
|
979
978
|
//tags: app
|
|
980
979
|
//meta.browsePath: Peptides
|
|
981
980
|
//meta.icon: files/icons/monomers.png
|
|
982
981
|
//output: view v
|
|
983
|
-
export async function
|
|
982
|
+
export async function manageMonomerLibrariesView(): Promise<DG.View> {
|
|
984
983
|
return await showManageLibrariesView(false);
|
|
985
984
|
}
|
|
986
985
|
|
|
@@ -415,7 +415,7 @@ export class SeqHandler implements ISeqHandler {
|
|
|
415
415
|
public get maxLength(): number {
|
|
416
416
|
if (this._maxLength === null) {
|
|
417
417
|
this._maxLength = this.column.length === 0 ? 0 :
|
|
418
|
-
|
|
418
|
+
wu.count(0).take(this.column.length).map((rowIdx) => this.getSplitted(rowIdx).length).reduce((a, b) => a > b ? a : b, 0);
|
|
419
419
|
}
|
|
420
420
|
return this._maxLength!;
|
|
421
421
|
}
|
|
@@ -30,10 +30,10 @@ import {HelmType} from '@datagrok-libraries/bio/src/helm/types';
|
|
|
30
30
|
import {undefinedColor} from '@datagrok-libraries/bio/src/utils/cell-renderer-monomer-placer';
|
|
31
31
|
|
|
32
32
|
import {AggFunc, getAgg} from '../utils/agg';
|
|
33
|
-
import {buildCompositionTable} from '../widgets/composition-analysis-widget';
|
|
34
33
|
|
|
35
34
|
import {_package, getMonomerLibHelper} from '../package';
|
|
36
35
|
import {numbersWithinMaxDiff} from './utils';
|
|
36
|
+
import {buildCompositionTable} from '@datagrok-libraries/bio/src/utils/composition-table';
|
|
37
37
|
|
|
38
38
|
declare global {
|
|
39
39
|
interface HTMLCanvasElement {
|
|
@@ -12,6 +12,7 @@ import {HelmTypes} from '@datagrok-libraries/bio/src/helm/consts';
|
|
|
12
12
|
|
|
13
13
|
import '../../css/composition-analysis.css';
|
|
14
14
|
import {ISeqHelper} from '@datagrok-libraries/bio/src/utils/seq-helper';
|
|
15
|
+
import {buildCompositionTable} from '@datagrok-libraries/bio/src/utils/composition-table';
|
|
15
16
|
|
|
16
17
|
export function getCompositionAnalysisWidget(
|
|
17
18
|
val: DG.SemanticValue, monomerLib: IMonomerLibBase, seqHelper: ISeqHelper
|
|
@@ -43,41 +44,3 @@ export function getCompositionAnalysisWidget(
|
|
|
43
44
|
return new DG.Widget(host);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export function buildCompositionTable(
|
|
47
|
-
counts: { [m: string]: number }, biotype: HelmType, monomerLib: IMonomerLibBase
|
|
48
|
-
): HTMLTableElement {
|
|
49
|
-
let sumValue: number = 0;
|
|
50
|
-
let maxValue: number | null = null;
|
|
51
|
-
for (const value of Object.values(counts)) {
|
|
52
|
-
sumValue = sumValue + value;
|
|
53
|
-
maxValue = maxValue === null ? value : Math.max(maxValue, value);
|
|
54
|
-
}
|
|
55
|
-
const maxRatio = maxValue! / sumValue;
|
|
56
|
-
const elMap: { [m: string]: HTMLElement } = Object.assign({}, ...Array.from(Object.entries(counts))
|
|
57
|
-
.sort((a, b) => b[1] - a[1])
|
|
58
|
-
.map(([cm, value]) => {
|
|
59
|
-
const ratio = value / sumValue;
|
|
60
|
-
const wem = monomerLib.getWebEditorMonomer(biotype, cm)!;
|
|
61
|
-
const color = wem.backgroundcolor!;
|
|
62
|
-
const barDiv = ui.div('', {classes: 'macromolecule-cell-comp-analysis-bar'});
|
|
63
|
-
barDiv.style.width = `${50 * ratio / maxRatio}px`;
|
|
64
|
-
barDiv.style.backgroundColor = color;
|
|
65
|
-
if (GAP_SYMBOL === cm) {
|
|
66
|
-
barDiv.style.borderWidth = '1px';
|
|
67
|
-
barDiv.style.borderStyle = 'solid';
|
|
68
|
-
barDiv.style.borderColor = DG.Color.toHtml(DG.Color.lightGray);
|
|
69
|
-
}
|
|
70
|
-
const displayMonomer: string = GAP_SYMBOL === cm ? '-' : cm;
|
|
71
|
-
const valueDiv = ui.div(`${(100 * ratio).toFixed(2)}%`);
|
|
72
|
-
const el = ui.div([barDiv, valueDiv], {classes: 'macromolecule-cell-comp-analysis-value'});
|
|
73
|
-
return ({[displayMonomer]: el});
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
|
-
const table = ui.tableFromMap(elMap);
|
|
77
|
-
Array.from(table.rows).forEach((row) => {
|
|
78
|
-
const barCol = (row.getElementsByClassName('macromolecule-cell-comp-analysis-bar')[0] as HTMLDivElement)
|
|
79
|
-
.style.backgroundColor;
|
|
80
|
-
row.cells[0].style.color = barCol;
|
|
81
|
-
});
|
|
82
|
-
return table;
|
|
83
|
-
}
|