@datagrok/peptides 1.7.2 → 1.8.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.
@@ -3,21 +3,46 @@ import * as DG from 'datagrok-api/dg';
3
3
 
4
4
  import * as type from '../utils/types';
5
5
  import * as C from '../utils/constants';
6
- import {PeptidesModel} from '../model';
6
+ import {PeptidesModel, VIEWER_TYPE} from '../model';
7
7
 
8
8
  import $ from 'cash-dom';
9
+ import wu from 'wu';
9
10
 
10
11
  //TODO: show sliderInput values
11
12
  export function getSettingsDialog(model: PeptidesModel): DG.Dialog {
12
13
  const accordion = ui.accordion();
13
14
  const settings = model.settings;
14
15
  const result: type.PeptidesSettings = {columns: {}};
16
+
17
+ // General pane options
15
18
  const activityScaling = ui.choiceInput('Activity scaling', settings.scaling ?? 'none', ['none', 'lg', '-lg'],
16
19
  () => result.scaling = activityScaling.value! as type.ScalingMethods);
17
20
  const bidirectionalAnalysis = ui.boolInput('Bidirectional analysis', settings.isBidirectional ?? false,
18
21
  () => result.isBidirectional = bidirectionalAnalysis.value!);
22
+
19
23
  accordion.addPane('General', () => ui.inputs([activityScaling, bidirectionalAnalysis]), true);
20
24
 
25
+ // Viewers pane options
26
+ /* FIXME: combinations of adding and deleting viewers are not working properly
27
+ const isMPEnabled = wu(model.analysisView.viewers).some((v) => v.type === VIEWER_TYPE.MONOMER_POSITION);
28
+ const monomerPosition = ui.boolInput(VIEWER_TYPE.MONOMER_POSITION, isMPEnabled ?? false,
29
+ () => result.showMostPotentResidues = monomerPosition.value!);
30
+ const isMPREnabled = wu(model.analysisView.viewers).some((v) => v.type === VIEWER_TYPE.MOST_POTENT_RESIDUES);
31
+ const mostPotentResidues = ui.boolInput(VIEWER_TYPE.MOST_POTENT_RESIDUES, isMPREnabled ?? false,
32
+ () => result.showMonomerPosition = mostPotentResidues.value!);
33
+ const isLSTEnabled = wu(model.analysisView.viewers).some((v) => v.type === VIEWER_TYPE.LOGO_SUMMARY_TABLE);
34
+ const logoSummaryTable = ui.boolInput(VIEWER_TYPE.LOGO_SUMMARY_TABLE, isLSTEnabled ?? false,
35
+ () => result.showLogoSummaryTable = logoSummaryTable.value!);
36
+ logoSummaryTable.enabled = typeof settings.clustersColumnName !== 'undefined';
37
+ */
38
+ const isDendrogramEnabled = wu(model.analysisView.viewers).some((v) => v.type === VIEWER_TYPE.DENDROGRAM);
39
+ const dendrogram = ui.boolInput(VIEWER_TYPE.DENDROGRAM, isDendrogramEnabled ?? false,
40
+ () => result.showDendrogram = dendrogram.value!);
41
+
42
+ accordion.addPane('Viewers',
43
+ () => ui.inputs([dendrogram]), true);
44
+
45
+ // Mutation Cliffs pane options
21
46
  const maxMutations = ui.sliderInput('Max mutations', settings.maxMutations ?? 1, 0, 50, () => {
22
47
  const val = Math.round(maxMutations.value!);
23
48
  $(maxMutations.root).find('label.ui-input-description').remove();
@@ -34,6 +59,7 @@ export function getSettingsDialog(model: PeptidesModel): DG.Dialog {
34
59
  minActivityDelta.addPostfix((settings.minActivityDelta ?? 0).toString());
35
60
  accordion.addPane('Mutation Cliffs', () => ui.inputs([maxMutations, minActivityDelta]), true);
36
61
 
62
+ // Columns to include pane options
37
63
  const inputsRows: HTMLElement[] = [];
38
64
  for (const col of model.df.columns.numerical) {
39
65
  const colName = col.name;
@@ -43,17 +69,17 @@ export function getSettingsDialog(model: PeptidesModel): DG.Dialog {
43
69
  const isIncludedInput = ui.boolInput('', typeof (settings.columns ?? {})[colName] !== 'undefined',
44
70
  () => {
45
71
  if (isIncludedInput.value)
46
- result.columns![colName] = aggregationInput.stringValue;
72
+ result.columns![colName] = aggregationInput.value;
47
73
  else
48
74
  delete result.columns![colName];
49
75
  }) as DG.InputBase<boolean>;
50
76
  const aggregationInput = ui.choiceInput('Aggregation', (settings.columns ?? {})[colName] ?? 'avg',
51
77
  Object.values(DG.STATS), () => {
52
78
  if (isIncludedInput.value)
53
- result.columns![colName] = aggregationInput.stringValue;
79
+ result.columns![colName] = aggregationInput.value;
54
80
  else
55
81
  delete result.columns![col.name];
56
- }) as DG.InputBase<string>;
82
+ }) as DG.InputBase<DG.AggregationType>;
57
83
  $(aggregationInput.root).find('label').css('width', 'auto');
58
84
  const inputsRow = ui.inputsRow(col.name, [isIncludedInput, aggregationInput]);
59
85
  $(inputsRow).find('div.ui-div').css('display', 'inline-flex');