@datagrok/bio 2.17.1 → 2.17.2

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Leonid Stolbov",
6
6
  "email": "lstolbov@datagrok.ai"
7
7
  },
8
- "version": "2.17.1",
8
+ "version": "2.17.2",
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.45.11",
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",
@@ -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);
@@ -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: 185}, tgt: {pos: 7}},
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
- monomerCharWidth: charWidth,
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
- monomerCharWidth: charWidth,
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
- monomerCharWidth: 7, separatorWidth: !sh.isMsa() ? gapLength : msaGapLength,
173
+ font: font, fontCharWidth: fontWidth, separatorWidth: !sh.isMsa() ? gapLength : msaGapLength,
173
174
  monomerToShort: monomerToShortFunction,
174
175
  };
175
176
  });
@@ -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 rdKitInputs = ui.inputs([
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(rdKitInputs);
119
+ return new DG.Widget(sequenceConfigInputs);
100
120
  }
101
121
 
102
122
  /**