@datagrok/peptides 1.27.0 → 1.27.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@datagrok/peptides",
3
3
  "friendlyName": "Peptides",
4
- "version": "1.27.0",
4
+ "version": "1.27.2",
5
5
  "author": {
6
6
  "name": "Davit Rizhinashvili",
7
7
  "email": "drizhinashvili@datagrok.ai"
package/src/styles.css CHANGED
@@ -60,3 +60,14 @@
60
60
  left: 5px;
61
61
  top: 1px;
62
62
  }
63
+
64
+ .panel-base:has(.peptides-viewer-show-title:only-child) > .panel-titlebar > .panel-titlebar-text {
65
+ visibility: visible;
66
+ display: block;
67
+ text-align: center;
68
+ margin-left: 36px;
69
+ padding: 0;
70
+ width: 100%;
71
+ font-size: 14px !important;
72
+ color: #4d5261 !important;
73
+ }
package/src/utils/misc.ts CHANGED
@@ -500,3 +500,13 @@ export function debounce<T extends Array<any>, K>(f: (...args: T) => Promise<K>,
500
500
  export function isInDemo(): boolean {
501
501
  return 'isInDemo' in grok.shell && !!grok.shell.isInDemo;
502
502
  }
503
+
504
+ export function dartLike<T extends any>(obj: T) {
505
+ return {
506
+ set: function<K extends keyof T>(key: K, value: T[K]) {
507
+ (obj as any)[key] = value;
508
+ return this;
509
+ },
510
+ };
511
+ }
512
+
@@ -76,7 +76,6 @@ export interface ILogoSummaryTable {
76
76
 
77
77
  /** LogoSummaryTable viewer shows per cluster information. */
78
78
  export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
79
- _titleHost = ui.divText(VIEWER_TYPE.LOGO_SUMMARY_TABLE, {id: 'pep-viewer-title'});
80
79
  sequenceColumnName: string;
81
80
  clustersColumnName: string;
82
81
  webLogoMode: string;
@@ -98,6 +97,7 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
98
97
  /** Creates LogoSummaryTable properties. */
99
98
  constructor() {
100
99
  super();
100
+ this.root.classList.add('peptides-viewer-show-title');
101
101
 
102
102
  this.sequenceColumnName = this.column(LST_PROPERTIES.SEQUENCE,
103
103
  {
@@ -365,7 +365,7 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
365
365
  if (!this.logoSummaryTable.filter.anyTrue) {
366
366
  const emptyDf = ui.divText('No clusters to satisfy the threshold. ' +
367
367
  'Please, lower the threshold in viewer proeperties to include clusters');
368
- this.root.appendChild(ui.divV([this._titleHost, emptyDf]));
368
+ this.root.appendChild(ui.divV([emptyDf]));
369
369
  return;
370
370
  }
371
371
  const expand = ui.iconFA('expand-alt', () => {
@@ -380,7 +380,7 @@ export class LogoSummaryTable extends DG.JsViewer implements ILogoSummaryTable {
380
380
  this.viewerGrid.root.style.height = 'auto';
381
381
  this.viewerGrid.root.style.overflow = 'hidden';
382
382
  this.root.appendChild(ui.divV([
383
- ui.divH([this._titleHost, expand], {
383
+ ui.divH([expand], {
384
384
  style: {
385
385
  alignSelf: 'center',
386
386
  lineHeight: 'normal',
@@ -30,6 +30,7 @@ export class MutationCliffsViewer extends DG.JsViewer {
30
30
  this.position = this.int('position', 1, {nullable: false, showSlider: false, min: 1, max: 100, showPlusMinus: true, description: 'Position in the sequence to analyze (1 Based).', category: 'Data'});
31
31
  this.yAxisType = this.string('yAxisType', 'Linear', {choices: ['Linear', 'Logarithmic'], description: 'Y-Axis scale type.', nullable: false, category: 'Data'}) as 'Linear' | 'Logarithmic';
32
32
  this.currentRowMutationsOnly = this.bool('currentRowMutationsOnly', false, {nullable: false, defaultValue: false, description: 'When enabled, the viewer will show mutations related to the peptide in current row in the dataframe and selected position.', category: 'Data'});
33
+ this.root.classList.add('peptides-viewer-show-title');
33
34
  }
34
35
 
35
36
  onTableAttached(): void {
@@ -332,6 +333,7 @@ export class MutationCliffsViewer extends DG.JsViewer {
332
333
  showXSelector: false,
333
334
  showYSelector: true,
334
335
  showSplitSelector: false,
336
+ packCategories: false,
335
337
  xAxisLabelOrientation: 'Auto',
336
338
  axisFont: 'normal normal 14px "Roboto"',
337
339
  controlsFont: 'normal normal 14px "Roboto"',
@@ -23,6 +23,7 @@ import {
23
23
  import {showTooltip} from '../utils/tooltips';
24
24
  import {calculateCliffsStatistics, calculateMonomerPositionStatistics, findMutations, MutationCliffsOptions} from '../utils/algorithms';
25
25
  import {
26
+ dartLike,
26
27
  debounce,
27
28
  extractColInfo,
28
29
  getTotalAggColumns,
@@ -41,7 +42,6 @@ import {getMonomerLibHelper} from '@datagrok-libraries/bio/src/types/monomer-lib
41
42
  import {PolymerTypes} from '@datagrok-libraries/bio/src/helm/consts';
42
43
  import {PeptideUtils} from '../peptideUtils';
43
44
  import {StringDictionary} from '@datagrok-libraries/utils/src/type-declarations';
44
- import BitArray from '@datagrok-libraries/utils/src/bit-array';
45
45
 
46
46
  export enum SELECTION_MODE {
47
47
  MUTATION_CLIFFS = 'Mutation Cliffs',
@@ -177,6 +177,7 @@ export abstract class SARViewer extends DG.JsViewer implements ISARViewer {
177
177
  // this.targetCategoryInput.root.style.display = 'none';
178
178
  // this.targetCategoryInput.root.style.maxWidth = '50%';
179
179
  // this.targetCategoryInput.root.style.marginLeft = '8px'
180
+ this.root.classList.add('peptides-viewer-show-title');
180
181
  }
181
182
 
182
183
  _viewerGrid: DG.Grid | null = null;
@@ -678,7 +679,7 @@ export class MonomerPosition extends SARViewer {
678
679
  this.customColorRange = this.bool(MONOMER_POSITION_PROPERTIES.CUSTOM_COLOR_RANGE, false, {category: PROPERTY_CATEGORIES.INVARIANT_MAP});
679
680
  this.minColorValue = this.float(MONOMER_POSITION_PROPERTIES.MIN_COLOR_VALUE, 0, {category: PROPERTY_CATEGORIES.INVARIANT_MAP});
680
681
  this.maxColorValue = this.float(MONOMER_POSITION_PROPERTIES.MAX_COLOR_VALUE, 0, {category: PROPERTY_CATEGORIES.INVARIANT_MAP});
681
- this.showFilterControls = this.bool(MONOMER_POSITION_PROPERTIES.SHOW_FILTER_CONTROLS, true, {category: PROPERTY_CATEGORIES.GENERAL, description: 'Show monomer search and target controls'});
682
+ this.showFilterControls = this.bool(MONOMER_POSITION_PROPERTIES.SHOW_FILTER_CONTROLS, true, {category: PROPERTY_CATEGORIES.GENERAL, description: 'Show monomer search and target controls', userEditable: false}); // Old stuff. Not used anymore
682
683
  this.monomerSearchInput = ui.input.string('Search', {
683
684
  value: '', nullable: true, placeholder: 'Search monomer', tooltipText: 'Search for monomer by symbol. For multiple monomers use comma as a separator.',
684
685
  onValueChanged: () => {
@@ -832,7 +833,7 @@ export class MonomerPosition extends SARViewer {
832
833
  let maxColorVal = -9999999;
833
834
  const filter = (this.dataSource === 'Filtered' && this.dataFrame.filter.anyFalse) ?
834
835
  this.dataFrame.filter : null;
835
- const isTarget = filter == null ? (index: number) => true : (index: number) => filter.get(index);
836
+ const isTarget = filter == null ? (_index: number) => true : (index: number) => filter.get(index);
836
837
  for (const pCol of this.positionColumns) {
837
838
  pCol.temp[C.TAGS.INVARIANT_MAP_COLOR_CACHE] = {};
838
839
  const colorCache = pCol.temp[C.TAGS.INVARIANT_MAP_COLOR_CACHE];
@@ -1104,6 +1105,8 @@ export class MonomerPosition extends SARViewer {
1104
1105
  };
1105
1106
  }
1106
1107
 
1108
+ private _showSearchInput = false;
1109
+
1107
1110
  /** Renders the MonomerPosition viewer body. */
1108
1111
  render(): void {
1109
1112
  $(this.root).empty();
@@ -1150,20 +1153,20 @@ export class MonomerPosition extends SARViewer {
1150
1153
  }
1151
1154
  const viewerRoot = this.viewerGrid.root;
1152
1155
  viewerRoot.style.width = 'auto';
1153
- // expand button
1154
- const expand = ui.iconFA('expand-alt', () => {
1155
- const dialog = ui.dialog();
1156
- dialog.add(ui.divV([switchHost, viewerRoot], {style: {height: '100%'}}));
1157
- dialog.onCancel(() => this.render());
1158
- dialog.showModal(true);
1159
- this.viewerGrid.invalidate();
1160
- }, 'Show Sequence Variability Map Table in full screen');
1161
- $(expand).addClass('pep-help-icon');
1162
- this.monomerSearchInput.root.style.marginRight = '8px';
1163
- const targetInputsHost = ui.divH([this.monomerSearchInput.input],
1156
+ // search icon
1157
+ const searchIcon = ui.icons.search(() => {
1158
+ this._showSearchInput = !this._showSearchInput;
1159
+ this.monomerSearchInput.input.style.display = this._showSearchInput ? 'block' : 'none';
1160
+ }, 'Toggle monomer search input visibility');
1161
+
1162
+ this.monomerSearchInput.input.style.display = this._showSearchInput ? 'block' : 'none';
1163
+ $(searchIcon).addClass('pep-help-icon');
1164
+ dartLike(searchIcon.style).set('top', '3px').set('fontSize', '14px');
1165
+
1166
+ const filtersHost = ui.divH([this.monomerSearchInput.input], // plural because might expand in future
1164
1167
  {style: {alignSelf: 'center', justifyContent: 'center', width: '100%', flexWrap: 'wrap'}});
1165
- targetInputsHost.style.display = this.showFilterControls ? 'flex' : 'none';
1166
- const header = ui.divH([expand, switchHost, targetInputsHost], {style: {alignSelf: 'center', lineHeight: 'normal', flexDirection: 'column', width: '100%'}});
1168
+ // targetInputsHost.style.display = this.showFilterControls ? 'flex' : 'none';
1169
+ const header = ui.divH([searchIcon, switchHost, filtersHost], {style: {alignSelf: 'center', lineHeight: 'normal', flexDirection: 'column', width: '100%'}});
1167
1170
  this.root.appendChild(ui.divV([header, viewerRoot]));
1168
1171
  this.viewerGrid?.invalidate();
1169
1172
  this.monomerSearchInput.fireChanged();
@@ -1470,11 +1473,11 @@ export class MostPotentResidues extends SARViewer {
1470
1473
  this.root.appendChild(ui.divText('Please, select a sequence and activity columns in the viewer properties'));
1471
1474
  return;
1472
1475
  }
1473
- const switchHost = ui.divText(VIEWER_TYPE.MOST_POTENT_RESIDUES, {id: 'pep-viewer-title'});
1476
+
1474
1477
  const viewerRoot = this.viewerGrid.root;
1475
1478
  viewerRoot.style.width = 'auto';
1476
- const header = ui.divH([switchHost], {style: {alignSelf: 'center', lineHeight: 'normal'}});
1477
- this.root.appendChild(ui.divV([header, viewerRoot]));
1479
+
1480
+ this.root.appendChild(ui.divV([viewerRoot]));
1478
1481
  this.viewerGrid?.invalidate();
1479
1482
  }
1480
1483
  }