@datagrok/bio 2.17.1 → 2.17.3
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 +8 -0
- package/README.md +7 -0
- package/dist/package-test.js +2 -2
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/package.json +9 -2
- package/src/package-types.ts +11 -0
- package/src/package.ts +23 -8
- package/src/tests/renderers-monomer-placer-tests.ts +6 -3
- package/src/utils/cell-renderer.ts +2 -1
- package/src/utils/convert.ts +2 -5
- package/src/utils/sequence-to-mol.ts +1 -1
- package/src/viewers/web-logo-viewer.ts +5 -1
- package/src/widgets/representations.ts +22 -2
- package/src/global.d.ts +0 -13
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.17.
|
|
8
|
+
"version": "2.17.3",
|
|
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",
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
"directory": "packages/Bio"
|
|
14
14
|
},
|
|
15
15
|
"properties": [
|
|
16
|
+
{
|
|
17
|
+
"name": "FontSize",
|
|
18
|
+
"description": "Font size for monomer symbols in the sequence renderer",
|
|
19
|
+
"propertyType": "int",
|
|
20
|
+
"defaultValue": "12",
|
|
21
|
+
"nullable": false
|
|
22
|
+
},
|
|
16
23
|
{
|
|
17
24
|
"name": "MaxMonomerLength",
|
|
18
25
|
"description": "The max length of monomer symbol displayed without shortening, 'long' to no limit",
|
|
@@ -37,7 +44,7 @@
|
|
|
37
44
|
],
|
|
38
45
|
"dependencies": {
|
|
39
46
|
"@biowasm/aioli": "^3.1.0",
|
|
40
|
-
"@datagrok-libraries/bio": "^5.
|
|
47
|
+
"@datagrok-libraries/bio": "^5.46.0",
|
|
41
48
|
"@datagrok-libraries/chem-meta": "^1.2.7",
|
|
42
49
|
"@datagrok-libraries/math": "^1.2.2",
|
|
43
50
|
"@datagrok-libraries/ml": "^6.7.4",
|
package/src/package-types.ts
CHANGED
|
@@ -16,6 +16,7 @@ export const enum BioPackagePropertiesNames {
|
|
|
16
16
|
MaxMonomerLength = 'MaxMonomerLength',
|
|
17
17
|
TooltipWebLogo = 'TooltipWebLogo',
|
|
18
18
|
DefaultSeparator = 'DefaultSeparator',
|
|
19
|
+
FontSize = 'FontSize',
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
|
|
@@ -23,6 +24,16 @@ export class BioPackageProperties extends Map<string, any> {
|
|
|
23
24
|
private _onPropertyChanged: Subject<string> = new Subject<string>();
|
|
24
25
|
public get onPropertyChanged(): Observable<string> { return this._onPropertyChanged; }
|
|
25
26
|
|
|
27
|
+
public get fontSize(): number {
|
|
28
|
+
const vs = super.get(BioPackagePropertiesNames.FontSize);
|
|
29
|
+
return !!vs && !isNaN(vs) ? Number.parseInt(vs) : 12;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public set fontSize(value: number) {
|
|
33
|
+
super.set(BioPackagePropertiesNames.FontSize, value);
|
|
34
|
+
this._onPropertyChanged.next(BioPackagePropertiesNames.FontSize);
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
/** Monomer symbol maximum length displayed, null for unlimited. */
|
|
27
38
|
public get maxMonomerLength(): number | null {
|
|
28
39
|
const vs = super.get(BioPackagePropertiesNames.MaxMonomerLength);
|
package/src/package.ts
CHANGED
|
@@ -419,14 +419,6 @@ export function getRegion(
|
|
|
419
419
|
start ?? null, end ?? null, name ?? null);
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
//top-menu: Bio | Manage | Monomers
|
|
423
|
-
//name: manageMonomersView
|
|
424
|
-
//description: Edit and create monomers
|
|
425
|
-
export async function manageMonomersView() {
|
|
426
|
-
const monomerManager = await MonomerManager.getInstance();
|
|
427
|
-
await monomerManager.getViewRoot();
|
|
428
|
-
}
|
|
429
|
-
|
|
430
422
|
//top-menu: Bio | Convert | Get Region...
|
|
431
423
|
//name: Get Region Top Menu
|
|
432
424
|
//description: Get sequences for a region specified from a Macromolecule
|
|
@@ -961,6 +953,29 @@ export async function manageLibrariesView(): Promise<void> {
|
|
|
961
953
|
await showManageLibrariesView();
|
|
962
954
|
}
|
|
963
955
|
|
|
956
|
+
//top-menu: Bio | Manage | Monomers
|
|
957
|
+
//name: manageMonomersView
|
|
958
|
+
//description: Edit and create monomers
|
|
959
|
+
export async function manageMonomersView() {
|
|
960
|
+
const monomerManager = await MonomerManager.getInstance();
|
|
961
|
+
await monomerManager.getViewRoot();
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
//name: Manage Monomers
|
|
965
|
+
//tags: app
|
|
966
|
+
//meta.browsePath: Peptides | Monomers
|
|
967
|
+
export async function manageMonomersApp() {
|
|
968
|
+
const monomerManager = await MonomerManager.getInstance();
|
|
969
|
+
await monomerManager.getViewRoot();
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
//name: Manage Libraries
|
|
973
|
+
//tags: app
|
|
974
|
+
//meta.browsePath: Peptides | Monomers
|
|
975
|
+
export async function manageLibrariesApp(): Promise<void> {
|
|
976
|
+
await showManageLibrariesView();
|
|
977
|
+
}
|
|
978
|
+
|
|
964
979
|
//name: saveAsFasta
|
|
965
980
|
//description: As FASTA...
|
|
966
981
|
//tags: fileExporter
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-lines-per-function */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as DG from 'datagrok-api/dg';
|
|
3
4
|
import * as ui from 'datagrok-api/ui';
|
|
@@ -49,7 +50,7 @@ category('renderers: monomerPlacer', () => {
|
|
|
49
50
|
{src: {row: 1, x: 6}, tgt: {pos: 0}},
|
|
50
51
|
{src: {row: 1, x: 26}, tgt: {pos: 1}},
|
|
51
52
|
{src: {row: 1, x: 160}, tgt: {pos: 6}},
|
|
52
|
-
{src: {row: 1, x:
|
|
53
|
+
{src: {row: 1, x: 190}, tgt: {pos: 7}},
|
|
53
54
|
{src: {row: 2, x: 140}, tgt: {pos: 5}},
|
|
54
55
|
{src: {row: 2, x: 145}, tgt: {pos: 5}},
|
|
55
56
|
]
|
|
@@ -115,7 +116,8 @@ id3,QHIRE--LT
|
|
|
115
116
|
const colTemp: MonomerPlacer = new MonomerPlacer(null, seqCol, _package.logger, monLength,
|
|
116
117
|
() => {
|
|
117
118
|
return {
|
|
118
|
-
|
|
119
|
+
font: '12px monospace',
|
|
120
|
+
fontCharWidth: charWidth,
|
|
119
121
|
separatorWidth: sepWidth,
|
|
120
122
|
monomerToShort: monomerToShort,
|
|
121
123
|
};
|
|
@@ -209,7 +211,8 @@ id3,QHIRE--LT
|
|
|
209
211
|
const sepWidth: number = 12;
|
|
210
212
|
const colTemp = new MonomerPlacer(null, seqCol, _package.logger, monLengthLimit, () => {
|
|
211
213
|
return {
|
|
212
|
-
|
|
214
|
+
fontCharWidth: charWidth,
|
|
215
|
+
font: '12px monospace',
|
|
213
216
|
separatorWidth: sepWidth,
|
|
214
217
|
monomerToShort: monomerToShort,
|
|
215
218
|
};
|
|
@@ -168,8 +168,9 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
|
|
|
168
168
|
if (!seqColTemp) {
|
|
169
169
|
seqColTemp = temp.rendererBack = new MonomerPlacer(gridCol, tableCol, _package.logger, maxLengthOfMonomer,
|
|
170
170
|
() => {
|
|
171
|
+
const {font, fontWidth} = MonomerPlacer.getFontSettings(tableCol);
|
|
171
172
|
return {
|
|
172
|
-
|
|
173
|
+
font: font, fontCharWidth: fontWidth, separatorWidth: !sh.isMsa() ? gapLength : msaGapLength,
|
|
173
174
|
monomerToShort: monomerToShortFunction,
|
|
174
175
|
};
|
|
175
176
|
});
|
package/src/utils/convert.ts
CHANGED
|
@@ -41,11 +41,6 @@ export function convert(col: DG.Column<string> | undefined, seqHelper: ISeqHelpe
|
|
|
41
41
|
NOTATION.HELM,
|
|
42
42
|
];
|
|
43
43
|
const toggleColumn = (newCol: DG.Column) => {
|
|
44
|
-
if (newCol.semType !== DG.SEMTYPE.MACROMOLECULE) {
|
|
45
|
-
targetColumnInput.value = srcCol;
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
44
|
srcCol = newCol;
|
|
50
45
|
converterSh = seqHelper.getSeqHandler(srcCol);
|
|
51
46
|
currentNotation = converterSh.notation;
|
|
@@ -69,6 +64,8 @@ export function convert(col: DG.Column<string> | undefined, seqHelper: ISeqHelpe
|
|
|
69
64
|
|
|
70
65
|
const targetColumnInput = ui.input.column('Column', {
|
|
71
66
|
table: grok.shell.t, value: srcCol,
|
|
67
|
+
filter: (col: DG.Column) => col.semType === DG.SEMTYPE.MACROMOLECULE,
|
|
68
|
+
nullable: false,
|
|
72
69
|
onValueChanged: (value) => toggleColumn(value)
|
|
73
70
|
});
|
|
74
71
|
|
|
@@ -34,7 +34,7 @@ export async function sequenceToMolfile(
|
|
|
34
34
|
df.columns.add(helmCol, false);
|
|
35
35
|
}
|
|
36
36
|
try {
|
|
37
|
-
res = await seqHelper.helmToAtomicLevel(helmCol, true, true);
|
|
37
|
+
res = await seqHelper.helmToAtomicLevel(helmCol, true, true, monomerLib);
|
|
38
38
|
} finally {
|
|
39
39
|
if (helmCol !== macroMolecule) {
|
|
40
40
|
df.columns.remove(helmCol.name);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
/* eslint-disable max-params */
|
|
4
|
+
/* eslint-disable max-lines-per-function */
|
|
1
5
|
import * as grok from 'datagrok-api/grok';
|
|
2
6
|
import * as ui from 'datagrok-api/ui';
|
|
3
7
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -548,7 +552,7 @@ export class WebLogoViewer extends DG.JsViewer implements IWebLogoViewer {
|
|
|
548
552
|
style: {
|
|
549
553
|
display: 'flex',
|
|
550
554
|
flexDirection: 'row',
|
|
551
|
-
flexGrow: 0,
|
|
555
|
+
flexGrow: '0',
|
|
552
556
|
/** For alignContent to have an effect */ flexWrap: 'wrap',
|
|
553
557
|
/* backgroundColor: '#EEFFEE' */
|
|
554
558
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-lines-per-function */
|
|
1
2
|
import * as grok from 'datagrok-api/grok';
|
|
2
3
|
import * as ui from 'datagrok-api/ui';
|
|
3
4
|
import * as DG from 'datagrok-api/dg';
|
|
@@ -49,6 +50,24 @@ export function getMacromoleculeColumnPropertyPanel(col: DG.Column): DG.Widget {
|
|
|
49
50
|
tooltipText: `The max length of monomer symbol displayed without shortening, empty to no limit`
|
|
50
51
|
});
|
|
51
52
|
|
|
53
|
+
let fontSize: number | null = (_package.properties ? _package.properties.fontSize : 12);
|
|
54
|
+
if (MmcrTemps.fontSize in col.temp && !!col.temp[MmcrTemps.fontSize] && !isNaN(col.temp[MmcrTemps.fontSize]))
|
|
55
|
+
fontSize = col.temp[MmcrTemps.fontSize];
|
|
56
|
+
|
|
57
|
+
const fontSizeInput = ui.input.int('Font Size', {
|
|
58
|
+
value: fontSize!,
|
|
59
|
+
nullable: true, min: 1, max: 50, step: 1,
|
|
60
|
+
onValueChanged: (value) => {
|
|
61
|
+
if (value && value > 0) {
|
|
62
|
+
const newValue = value ?? 12;
|
|
63
|
+
col.temp[MmcrTemps.fontSize] = newValue;
|
|
64
|
+
col.temp[MmcrTemps.rendererSettingsChanged] = rendererSettingsChangedState.true;
|
|
65
|
+
col.dataFrame.fireValuesChanged();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
tooltipText: `The font size of monomer symbol in sequence renderer`
|
|
69
|
+
});
|
|
70
|
+
|
|
52
71
|
const gapLengthInput = ui.input.int('Monomer Margin', {
|
|
53
72
|
value: col.temp[MmcrTemps.gapLength] ?? 0,
|
|
54
73
|
onValueChanged: (value) => {
|
|
@@ -88,7 +107,8 @@ export function getMacromoleculeColumnPropertyPanel(col: DG.Column): DG.Widget {
|
|
|
88
107
|
tooltipText: 'When on, all sequences get rendered in the "diff" mode'
|
|
89
108
|
});
|
|
90
109
|
|
|
91
|
-
const
|
|
110
|
+
const sequenceConfigInputs = ui.inputs([
|
|
111
|
+
fontSizeInput,
|
|
92
112
|
maxMonomerLengthInput,
|
|
93
113
|
gapLengthInput,
|
|
94
114
|
referenceSequenceInput,
|
|
@@ -96,7 +116,7 @@ export function getMacromoleculeColumnPropertyPanel(col: DG.Column): DG.Widget {
|
|
|
96
116
|
compareWithCurrentInput,
|
|
97
117
|
]);
|
|
98
118
|
|
|
99
|
-
return new DG.Widget(
|
|
119
|
+
return new DG.Widget(sequenceConfigInputs);
|
|
100
120
|
}
|
|
101
121
|
|
|
102
122
|
/**
|
package/src/global.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as grokNamespace from 'datagrok-api/grok';
|
|
2
|
-
import * as uiNamespace from 'datagrok-api/ui';
|
|
3
|
-
import * as DGNamespace from 'datagrok-api/dg';
|
|
4
|
-
import * as rxjsNamespace from 'rxjs';
|
|
5
|
-
import $Namespace from 'cash-dom';
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
const grok: typeof grokNamespace;
|
|
9
|
-
const ui: typeof uiNamespace;
|
|
10
|
-
const DG: typeof DGNamespace;
|
|
11
|
-
const rjxs: typeof rxjsNamespace;
|
|
12
|
-
const $: typeof $Namespace;
|
|
13
|
-
}
|