@datagrok/bio 2.8.3 → 2.8.6

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.
@@ -1,12 +1,16 @@
1
1
  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
+
5
+ import wu from 'wu';
6
+
4
7
  import {TAGS as bioTAGS, ALPHABET, getPaletteByType} from '@datagrok-libraries/bio/src/utils/macromolecule';
5
8
  import {SeqPalette} from '@datagrok-libraries/bio/src/seq-palettes';
6
9
  import {UnknownSeqPalettes} from '@datagrok-libraries/bio/src/unknown';
7
10
  import '../../css/composition-analysis.css';
8
11
  import {UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
9
12
 
13
+
10
14
  export function getCompositionAnalysisWidget(val: DG.SemanticValue) {
11
15
  const host = ui.div();
12
16
  host.classList.add('macromolecule-cell-comp-analysis-host');
@@ -30,14 +34,14 @@ export function getCompositionAnalysisWidget(val: DG.SemanticValue) {
30
34
  const splitter = uh.getSplitter();
31
35
  const parts = splitter(val.value);
32
36
  const len = parts.length;
33
- parts.filter((p) => p && p !== '').forEach((c: string) => {
37
+ wu(parts).filter((p) => !!p && p !== '').forEach((c: string) => {
34
38
  const count = counts.get(c) || 0;
35
39
  counts.set(c, count + 1);
36
40
  max = Math.max(max, count + 1);
37
41
  });
38
42
  max /= len;// percentage
39
43
  // calculate frequencies
40
- const compositionMap: {[key: string]: HTMLElement} = {};
44
+ const compositionMap: { [key: string]: HTMLElement } = {};
41
45
  const valueArray = Array.from(counts.entries());
42
46
  valueArray.sort((a, b) => b[1] - a[1]);
43
47
  valueArray.forEach(([key, value]) => {