react-msaview 9.5.0 → 9.7.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.
package/src/model.ts CHANGED
@@ -46,6 +46,7 @@ import {
46
46
  defaultScrollZoomAxis,
47
47
  defaultShowDomainLegend,
48
48
  defaultShowDomains,
49
+ domainFills,
49
50
  defaultSubFeatureRows,
50
51
  fontSizeFor,
51
52
  labelFitFontSize,
@@ -57,6 +58,7 @@ import {
57
58
  minColWidth,
58
59
  minLetterColWidth,
59
60
  minLetterRowHeight,
61
+ isSiteType,
60
62
  minRowHeight,
61
63
  minTreeWidth,
62
64
  pxPerTreeDepth,
@@ -67,6 +69,7 @@ import {
67
69
  segmentFeatureTypes,
68
70
  segmentShades,
69
71
  settingsPanelWidth,
72
+ siteFills,
70
73
  treeScaleBarHeight,
71
74
  } from './constants.ts'
72
75
  import { createPaletteMap } from './createPaletteMap.ts'
@@ -3591,21 +3594,19 @@ function stateModelFactory({
3591
3594
  /**
3592
3595
  * #getter
3593
3596
  * categorical feature types (InterPro domains and the like) that each get
3594
- * their own color and a legend entry, in palette order: grouped by
3595
- * feature type, types in the order they first appear. A GenPept
3596
- * record's CDD Sites follow every Region, so the palette spends the
3597
- * colors after the domains' on the sites inside them
3597
+ * their own color and a legend entry
3598
3598
  */
3599
3599
  get categoricalDomainTypes() {
3600
- const types = [...self.annotationTypes.values()].filter(
3600
+ return [...self.annotationTypes.values()].filter(
3601
3601
  d => !segmentFeatureTypes.has(d.featureType ?? ''),
3602
3602
  )
3603
- const typeOrder = [...new Set(types.map(d => d.featureType))]
3604
- return types.toSorted(
3605
- (a, b) =>
3606
- typeOrder.indexOf(a.featureType) - typeOrder.indexOf(b.featureType),
3607
- )
3608
3603
  },
3604
+ /**
3605
+ * #getter
3606
+ * accession -> fill: segments alternate two shades, a domain takes a
3607
+ * mid-light color and a site a dark one, so a site's residues stand out on
3608
+ * the domain around them
3609
+ */
3609
3610
  get fillPalette() {
3610
3611
  const segments = Object.fromEntries(
3611
3612
  this.segmentDomainTypes.map((d, i) => [
@@ -3613,10 +3614,15 @@ function stateModelFactory({
3613
3614
  segmentShades[i % segmentShades.length]!,
3614
3615
  ]),
3615
3616
  )
3616
- const categorical = createPaletteMap(
3617
- this.categoricalDomainTypes.map(d => d.accession),
3618
- )
3619
- return { ...segments, ...categorical }
3617
+ const accessions = (site: boolean) =>
3618
+ this.categoricalDomainTypes
3619
+ .filter(d => isSiteType(d.featureType) === site)
3620
+ .map(d => d.accession)
3621
+ return {
3622
+ ...segments,
3623
+ ...createPaletteMap(accessions(false), domainFills, 75),
3624
+ ...createPaletteMap(accessions(true), siteFills, 40),
3625
+ }
3620
3626
  },
3621
3627
  /**
3622
3628
  * #getter
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '9.5.0'
1
+ export const version = '9.7.0'