protvista-uniprot 4.3.5 → 4.3.7

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": "protvista-uniprot",
3
3
  "description": "ProtVista tool for the UniProt website",
4
- "version": "4.3.5",
4
+ "version": "4.3.7",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
@@ -36,8 +36,8 @@
36
36
  "@nightingale-elements/nightingale-manager": "5.6.0",
37
37
  "@nightingale-elements/nightingale-navigation": "5.6.0",
38
38
  "@nightingale-elements/nightingale-sequence": "5.6.0",
39
- "@nightingale-elements/nightingale-sequence-heatmap": "5.6.0",
40
- "@nightingale-elements/nightingale-structure": "5.6.1",
39
+ "@nightingale-elements/nightingale-sequence-heatmap": "5.6.2",
40
+ "@nightingale-elements/nightingale-structure": "5.6.2",
41
41
  "@nightingale-elements/nightingale-track-canvas": "5.6.0",
42
42
  "@nightingale-elements/nightingale-variation": "5.6.0",
43
43
  "color-hash": "2.0.2",
@@ -1,15 +1,38 @@
1
1
  import { AlphafoldPayload } from './types/alphafold';
2
2
 
3
- // from example data
4
- // benign: [0.0448,0.3397]: x < 0.34
5
- // ambiguous: [0.34,0.564]: 0.34 <= x <= 0.564
6
- // pathogenic: [0.5646,0.9999]: 0.564 < x
7
- const benign = 0.34;
8
- const pathogenic = 0.564;
3
+ // from color scale B:0,H:0.1132,V:0.2264,L:0.3395,A:0.4527,l:0.5895,h:0.7264,p:0.8632,P:1
4
+ const certainlyBenign = 0;
5
+ const benign = 0.1132;
6
+ const veryLikelyBenign = 0.2264;
7
+ const likelyBenign = 0.3395;
8
+ const ambiguous = 0.4527;
9
+ const likelyAmbiguous = 0.5895;
10
+ const likelyPathogenic = 0.7264;
11
+ const pathogenic = 0.8632;
12
+ const certainlyPathogenic = 1;
9
13
 
10
14
  export const rowSplitter = /\s*\n\s*/;
11
15
  export const cellSplitter = /^(.)(\d+)(.),(.+),(\w+)$/;
12
16
 
17
+ const pathogenicityCategories = [
18
+ { min: certainlyBenign, max: benign, code: 'H' },
19
+ { min: benign, max: veryLikelyBenign, code: 'V' },
20
+ { min: veryLikelyBenign, max: likelyBenign, code: 'L' },
21
+ { min: likelyBenign, max: ambiguous, code: 'A' },
22
+ { min: ambiguous, max: likelyAmbiguous, code: 'l' },
23
+ { min: likelyAmbiguous, max: likelyPathogenic, code: 'h' },
24
+ { min: likelyPathogenic, max: pathogenic, code: 'p' },
25
+ { min: pathogenic, max: certainlyPathogenic, code: 'P' },
26
+ ];
27
+
28
+ const getPathogenicityCode = (score) => {
29
+ for (const { min, max, code } of pathogenicityCategories) {
30
+ if (score >= min && score < max) {
31
+ return code;
32
+ }
33
+ }
34
+ };
35
+
13
36
  type Row = {
14
37
  wildType: string;
15
38
  position: number;
@@ -48,7 +71,6 @@ const parseCSV = (rawText: string): string => {
48
71
 
49
72
  const out = [];
50
73
  for (const position of positions) {
51
- let letter = 'A';
52
74
  // maximum
53
75
  // const value = Math.max(
54
76
  // ...position.map((variation) => variation.pathogenicityScore)
@@ -59,11 +81,7 @@ const parseCSV = (rawText: string): string => {
59
81
  (acc, variation) => acc + +variation.pathogenicityScore,
60
82
  0
61
83
  ) / position.length;
62
- if (value > pathogenic) {
63
- letter = 'P';
64
- } else if (value < benign) {
65
- letter = 'B';
66
- }
84
+ const letter = getPathogenicityCode(value);
67
85
  out.push(letter);
68
86
  }
69
87
 
package/src/config.ts CHANGED
@@ -815,8 +815,8 @@ const config: ProtvistaConfig = {
815
815
  name: 'ALPHAMISSENSE_PATHOGENICITY',
816
816
  label: 'AlphaMissense',
817
817
  trackType: 'nightingale-colored-sequence',
818
- scale: 'P:100,A:50,B:0',
819
- 'color-range': '#9a131a:100,#a8a9ad:50,#3d5493:0',
818
+ scale: 'B:0,H:0.1132,V:0.2264,L:0.3395,A:0.4527,l:0.5895,h:0.7264,p:0.8632,P:1',
819
+ 'color-range': '#2166ac:0,#4290bf:0.1132,#8cbcd4:0.2264,#c3d6e0:0.3395,#e2e2e2:0.4527,#edcdba:0.5895,#e99e7c:0.7264,#d15e4b:0.8632,#b2182b:1',
820
820
  tracks: [
821
821
  {
822
822
  name: 'alphamissense_pathogenicity',
@@ -16,6 +16,7 @@ import NightingaleSequenceHeatmap from '@nightingale-elements/nightingale-sequen
16
16
  import NightingaleFilter, {
17
17
  Filter,
18
18
  } from '@nightingale-elements/nightingale-filter';
19
+ import { amColorScale } from '@nightingale-elements/nightingale-structure';
19
20
 
20
21
  // adapters
21
22
  import featureAdapter from './adapters/feature-adapter';
@@ -294,6 +295,11 @@ class ProtvistaUniprot extends LitElement {
294
295
  ...new Set(heatmapData.map((hotMapItem) => hotMapItem.yValue)),
295
296
  ] as string[];
296
297
  heatmapComponent.setHeatmapData(xDomain, yDomain, heatmapData);
298
+ heatmapComponent.updateComplete.then(() => {
299
+ heatmapComponent.heatmapInstance.setColor((d) =>
300
+ amColorScale(d.score)
301
+ );
302
+ });
297
303
  }
298
304
  }
299
305
  }