@datagrok/bio 2.4.45 → 2.4.47

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.
@@ -0,0 +1,28 @@
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
+ import {_package} from '../package';
5
+
6
+ export class PackageSettingsEditorWidget extends DG.Widget {
7
+ maxMonomerLengthProp: DG.Property;
8
+
9
+ constructor(propList: DG.Property[]) {
10
+ super(ui.div([], {}));
11
+
12
+ const props: { [name: string]: DG.Property } =
13
+ Object.assign({}, ...propList.map((p) => ({[p.name]: p})));
14
+
15
+ this.maxMonomerLengthProp = props['MaxMonomerLength'];
16
+ }
17
+
18
+ async init(): Promise<void> {
19
+ const maxMonomerLengthInput = ui.intInput('Max monomer length',
20
+ _package.properties.maxMonomerLength,
21
+ (value: number) => {
22
+ // Handle user changed value
23
+ _package.properties.maxMonomerLength = value;
24
+ });
25
+
26
+ this.root.appendChild(ui.form([maxMonomerLengthInput,]));
27
+ }
28
+ }
@@ -2,13 +2,16 @@ import * as grok from 'datagrok-api/grok';
2
2
  import * as ui from 'datagrok-api/ui';
3
3
  import * as DG from 'datagrok-api/dg';
4
4
  import {getMolfilesFromSingleSeq} from '@datagrok-libraries/bio/src/monomer-works/monomer-utils';
5
+ import {Tags as mmcrTags, Temps as mmcrTemps, MonomerWidthMode} from '../utils/cell-renderer-consts';
6
+ import {_package} from '../package';
7
+
5
8
 
6
9
  /**
7
10
  * @export
8
11
  * @param {DG.Column} col macromolecule cell.
9
12
  * @return {Promise<DG.Widget>} Widget.
10
13
  */
11
- export function getMacroMolColumnPropertyPanel(col: DG.Column): DG.Widget {
14
+ export function getMacromoleculeColumnPropertyPanel(col: DG.Column): DG.Widget {
12
15
  // TODO: replace with an efficient version, bySemTypesExact won't help; GROK-8094
13
16
  const columnsList = Array.from(col.dataFrame.columns as any).filter(
14
17
  (c: any) => c.semType === DG.SEMTYPE.MOLECULE).map((c: any) => c.name);
@@ -20,11 +23,22 @@ export function getMacroMolColumnPropertyPanel(col: DG.Column): DG.Widget {
20
23
  ['short', 'long'],
21
24
  (s: string) => {
22
25
  col.temp['monomer-width'] = s;
23
- col.setTag('.calculatedCellRender', '0');
26
+ col.setTag(mmcrTags.calculated, '0');
24
27
  col.dataFrame.fireValuesChanged();
25
28
  });
26
29
  monomerWidth.setTooltip(
27
- 'In short mode, only the first character should be visible, followed by .. if there are more characters',
30
+ `In short mode, only the 'Max monomer length' characters are displayed, followed by .. if there are more`,
31
+ );
32
+
33
+ const maxMonomerLength: DG.InputBase = ui.intInput('Max monomer length',
34
+ col.temp[mmcrTemps.maxMonomerLength] ?? _package.properties.maxMonomerLength,
35
+ (value: number) => {
36
+ col.temp[mmcrTemps.maxMonomerLength] = value;
37
+ col.setTag(mmcrTags.calculated, '0');
38
+ col.dataFrame.fireValuesChanged();
39
+ });
40
+ maxMonomerLength.setTooltip(
41
+ `The max length of monomer name displayed without shortening in '${MonomerWidthMode.short}' monomer width mode.`
28
42
  );
29
43
 
30
44
  const colorCode = ui.boolInput('Color code',
@@ -53,6 +67,7 @@ export function getMacroMolColumnPropertyPanel(col: DG.Column): DG.Widget {
53
67
 
54
68
  const rdKitInputs = ui.inputs([
55
69
  monomerWidth,
70
+ maxMonomerLength,
56
71
  colorCode,
57
72
  referenceSequence,
58
73
  compareWithCurrent,