protvista-uniprot 4.3.3 → 4.3.5

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,5 +1,7 @@
1
1
  import { PTM } from '../adapters/ptm-exchange-adapter';
2
2
  export declare const phosphorylate: (aa: string) => string;
3
3
  export declare const sumoylate: (aa: string) => string;
4
+ export declare const ubiquitinate: (aa: string) => string;
5
+ export declare const acetylate: (aa: string) => string;
4
6
  declare const formatTooltip: (title: string, ptms: PTM[], aa: string, confidenceScore: string) => string;
5
7
  export default formatTooltip;
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.3",
4
+ "version": "4.3.5",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
@@ -37,7 +37,7 @@
37
37
  "@nightingale-elements/nightingale-navigation": "5.6.0",
38
38
  "@nightingale-elements/nightingale-sequence": "5.6.0",
39
39
  "@nightingale-elements/nightingale-sequence-heatmap": "5.6.0",
40
- "@nightingale-elements/nightingale-structure": "5.6.0",
40
+ "@nightingale-elements/nightingale-structure": "5.6.1",
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",
@@ -13,64 +13,19 @@ const transformData = (data) => {
13
13
  let adaptedData = [];
14
14
 
15
15
  if (data && data.length !== 0) {
16
- /* Important: The PTM map is a temporary patch until multiple modifications are shown in the peptide. At this point, only 'phospho' sites are of interest.
17
- Once they are available in the data, there is no need for the below merging */
18
-
19
- // To merge PTM data present in same residue in a same length peptide, have a map [key: start-end-phospho site 1-... phosphosite n, value: corresponding feature elements]
20
- const ptmMap: Record<string, any> = {};
21
- data.features.forEach((feature) => {
22
- let ft = `${feature.begin}-${feature.end}`;
23
- if (feature.ptms) {
24
- feature.ptms.forEach((ptm) => {
25
- ft += `-${ptm.position}`;
26
- });
27
- ptmMap[ft] = ft in ptmMap ? [...ptmMap[ft], feature] : [feature];
28
- }
16
+ adaptedData = data.features.map((feature) => {
17
+ feature.residuesToHighlight = feature.ptms?.map((ptm) => ({
18
+ name: ptm.name,
19
+ position: ptm.position,
20
+ sources: ptm.sources,
21
+ dbReferences: ptm.dbReferences,
22
+ }));
23
+ return Object.assign(
24
+ feature,
25
+ proteomicsTrackProperties(feature, data.taxid)
26
+ );
29
27
  });
30
28
 
31
- // The else part alone is enough if the PTM information need not be merged.
32
- if (Object.keys(ptmMap).length) {
33
- adaptedData = Object.values(ptmMap).map((features) => {
34
- // Only the dbReferences have to be merged as the rest is all the same
35
- const mergedDbReferences = [];
36
- features.forEach((feature) => {
37
- feature.ptms.forEach((ptm) => {
38
- ptm.dbReferences.forEach((dbReference) => {
39
- mergedDbReferences.push(dbReference);
40
- });
41
- });
42
- });
43
-
44
- const mergedFeatures = {
45
- type: features[0].type,
46
- begin: features[0].begin,
47
- end: features[0].end,
48
- xrefs: features[0].xrefs,
49
- evidences: features[0].evidences,
50
- peptide: features[0].peptide,
51
- unique: features[0].unique,
52
- residuesToHighlight: features[0].ptms.map((ptm) => ({
53
- name: ptm.name,
54
- position: ptm.position,
55
- sources: ptm.sources,
56
- dbReferences: mergedDbReferences,
57
- })),
58
- };
59
-
60
- return Object.assign(
61
- mergedFeatures,
62
- proteomicsTrackProperties(mergedFeatures, data.taxid)
63
- );
64
- }, []);
65
- } else {
66
- adaptedData = data.features.map((feature) => {
67
- return Object.assign(
68
- feature,
69
- proteomicsTrackProperties(feature, data.taxid)
70
- );
71
- });
72
- }
73
-
74
29
  adaptedData = renameProperties(adaptedData);
75
30
  }
76
31
  return adaptedData;
@@ -59,38 +59,50 @@ const convertPtmExchangePtms = (
59
59
  aa: string,
60
60
  absolutePosition: number
61
61
  ) => {
62
- const confidenceScores = new Set(
63
- ptms.flatMap(({ dbReferences }) =>
64
- dbReferences?.map(({ properties }) => properties['Confidence score'])
65
- )
66
- );
67
- let confidenceScore: string | null = null;
68
-
69
- if (!confidenceScores.size) {
70
- console.log('PTM has no confidence score');
71
- } else if (confidenceScores.size > 1) {
72
- console.error(
73
- `PTM has a mixture of confidence scores: ${Array.from(confidenceScores)}`
74
- );
75
- } else {
76
- [confidenceScore] = confidenceScores;
62
+ const groupPtmsByModification: Record<string, PTM[]> = {};
63
+ for (const ptm of ptms) {
64
+ if (groupPtmsByModification[ptm.name]) {
65
+ groupPtmsByModification[ptm.name].push(ptm);
66
+ } else {
67
+ groupPtmsByModification[ptm.name] = [ptm];
68
+ }
77
69
  }
78
70
 
79
- return {
80
- source: 'PTMeXchange',
81
- type: 'MOD_RES_LS',
82
- start: absolutePosition,
83
- end: absolutePosition,
84
- shape: 'triangle',
85
- tooltipContent: formatTooltip(
86
- `MOD_RES_LS ${absolutePosition}-${absolutePosition}`,
87
- ptms,
88
- aa,
89
- confidenceScore
90
- ),
91
- color:
92
- (confidenceScore && ConfidenceScoreColors[confidenceScore]) || 'black',
93
- };
71
+ return Object.values(groupPtmsByModification).map((groupedPtms) => {
72
+ const confidenceScores = new Set(
73
+ groupedPtms.flatMap(({ dbReferences }) =>
74
+ dbReferences?.map(({ properties }) => properties['Confidence score'])
75
+ )
76
+ );
77
+ let confidenceScore: string | null = null;
78
+ if (confidenceScores.size) {
79
+ if (confidenceScores.size > 1) {
80
+ console.error(
81
+ `PTMeXchange PTM has a mixture of confidence scores: ${Array.from(
82
+ confidenceScores
83
+ )}`
84
+ );
85
+ } else {
86
+ [confidenceScore] = confidenceScores;
87
+ }
88
+ }
89
+
90
+ return {
91
+ source: 'PTMeXchange',
92
+ type: 'MOD_RES_LS',
93
+ start: absolutePosition,
94
+ end: absolutePosition,
95
+ shape: 'triangle',
96
+ tooltipContent: formatTooltip(
97
+ `MOD_RES_LS ${absolutePosition}-${absolutePosition}`,
98
+ groupedPtms,
99
+ aa,
100
+ confidenceScore
101
+ ),
102
+ color:
103
+ (confidenceScore && ConfidenceScoreColors[confidenceScore]) || 'black',
104
+ };
105
+ });
94
106
  };
95
107
 
96
108
  const transformData = (data: ProteomicsPtm) => {
@@ -130,7 +142,7 @@ const transformData = (data: ProteomicsPtm) => {
130
142
  return Object.entries(absolutePositionToPtms).map(
131
143
  ([absolutePosition, { ptms, aa }]) =>
132
144
  convertPtmExchangePtms(ptms, aa, +absolutePosition)
133
- );
145
+ ).flat();
134
146
  }
135
147
  }
136
148
  return [];
@@ -1,5 +1,10 @@
1
1
  import ecoMap from '../adapters/config/evidence';
2
- import { phosphorylate, sumoylate } from './ptm-tooltip';
2
+ import {
3
+ acetylate,
4
+ phosphorylate,
5
+ sumoylate,
6
+ ubiquitinate,
7
+ } from './ptm-tooltip';
3
8
 
4
9
  const taxIdToPeptideAtlasBuildData = {
5
10
  '36329': { build: '542', organism: 'Plasmodium' },
@@ -101,12 +106,18 @@ const findModifiedResidueName = (feature, ptm) => {
101
106
  const { peptide, begin: peptideStart } = feature;
102
107
  const proteinLocation = Number(peptideStart) + ptm.position - 1;
103
108
  const modifiedResidue = peptide.charAt(ptm.position - 1); // CharAt index starts from 0
104
- if (ptm.name === 'Phosphorylation') {
105
- return `${proteinLocation} ${phosphorylate(modifiedResidue)}`;
106
- } else if (ptm.name === 'SUMOylation') {
107
- return `${proteinLocation} ${sumoylate(modifiedResidue)}`;
109
+ switch (ptm.name) {
110
+ case 'Phosphorylation':
111
+ return `${proteinLocation} ${phosphorylate(modifiedResidue)}`;
112
+ case 'SUMOylation':
113
+ return `${proteinLocation} ${sumoylate(modifiedResidue)}`;
114
+ case 'Ubiquitinylation':
115
+ return `${proteinLocation} ${ubiquitinate(modifiedResidue)}`;
116
+ case 'Acetylation':
117
+ return `${proteinLocation} ${acetylate(modifiedResidue)}`;
118
+ default:
119
+ return '';
108
120
  }
109
- return '';
110
121
  };
111
122
 
112
123
  const formatTooltip = (feature, taxId?: string) => {
@@ -234,7 +245,7 @@ const formatTooltip = (feature, taxId?: string) => {
234
245
  }
235
246
  ${
236
247
  ref.properties['Universal Spectrum Id']
237
- ? `<li class="text-indent-2 nowrap">Universal Spectrum Id:
248
+ ? `<li class="text-indent-2 nowrap margin-bottom">Universal Spectrum Id:
238
249
  <a href="http://proteomecentral.proteomexchange.org/usi/?usi=${ref.properties['Universal Spectrum Id']}" target="_blank">View on ProteomeXchange</a>
239
250
  </li>`
240
251
  : ``
@@ -1,6 +1,10 @@
1
1
  import { PTM } from '../adapters/ptm-exchange-adapter';
2
2
 
3
- type Modification = 'Phosphorylation' | 'SUMOylation';
3
+ type Modification =
4
+ | 'Phosphorylation'
5
+ | 'SUMOylation'
6
+ | 'Ubiquitinylation'
7
+ | 'Acetylation';
4
8
 
5
9
  const aaToPhosphorylated = {
6
10
  R: 'Phosphoarginine',
@@ -15,6 +19,31 @@ const aaToSumoylated = {
15
19
  K: 'Sumoylated lysine',
16
20
  };
17
21
 
22
+ const aaToUbiquitinated = {
23
+ K: 'Ubiquitinated lysine',
24
+ S: 'Ubiquitinated serine',
25
+ T: 'Ubiquitinated threonine',
26
+ C: 'Ubiquitinated cysteine',
27
+ };
28
+
29
+ const aaToAcetylated = {
30
+ S: 'Acetylserine',
31
+ A: 'Acetylalanine',
32
+ G: 'Acetylglycine',
33
+ T: 'Acetylthreonine',
34
+ V: 'Acetylvaline',
35
+ C: 'Acetylcysteine',
36
+ E: 'Acetylglutamin acid',
37
+ D: 'Acetylaspartic acid',
38
+ N: 'Acetylasparagine',
39
+ Q: 'Acetylglutamine',
40
+ L: 'Acetyllucine',
41
+ I: 'Acetlyisolucine',
42
+ W: 'Acetyltryptophan',
43
+ F: 'Acetylphenylalanine',
44
+ K: 'Acetyllysine',
45
+ };
46
+
18
47
  export const phosphorylate = (aa: string) => {
19
48
  const AA = aa.toUpperCase();
20
49
  if (AA in aaToPhosphorylated) {
@@ -33,6 +62,39 @@ export const sumoylate = (aa: string) => {
33
62
  return '';
34
63
  };
35
64
 
65
+ export const ubiquitinate = (aa: string) => {
66
+ const AA = aa.toUpperCase();
67
+ if (AA in aaToUbiquitinated) {
68
+ return aaToUbiquitinated[AA as keyof typeof aaToUbiquitinated];
69
+ }
70
+ console.error(`${AA} not a valid amino acid for Ubiquitinylation`);
71
+ return '';
72
+ };
73
+
74
+ export const acetylate = (aa: string) => {
75
+ const AA = aa.toUpperCase();
76
+ if (AA in aaToAcetylated) {
77
+ return aaToAcetylated[AA as keyof typeof aaToAcetylated];
78
+ }
79
+ console.error(`${AA} not a valid amino acid for Acetylation`);
80
+ return '';
81
+ };
82
+
83
+ const getDescription = (modification: Modification, aa: string) => {
84
+ switch (modification) {
85
+ case 'Phosphorylation':
86
+ return phosphorylate(aa);
87
+ case 'SUMOylation':
88
+ return sumoylate(aa);
89
+ case 'Ubiquitinylation':
90
+ return ubiquitinate(aa);
91
+ case 'Acetylation':
92
+ return acetylate(aa);
93
+ default:
94
+ return '';
95
+ }
96
+ };
97
+
36
98
  const formatTooltip = (
37
99
  title: string,
38
100
  ptms: PTM[],
@@ -52,7 +114,7 @@ const formatTooltip = (
52
114
  if (modifications.size) {
53
115
  if (modifications.size > 1) {
54
116
  console.error(
55
- `PTMeXchange PTM has a mixture of modifications: ${Array.from(
117
+ `The ptms are grouped by modification, but more than one type detected: ${Array.from(
56
118
  modifications
57
119
  )}`
58
120
  );
@@ -63,9 +125,7 @@ const formatTooltip = (
63
125
 
64
126
  return `
65
127
  ${title ? `<h4>${title}</h4><hr />` : ''}
66
- <h5>Description</h5><p>${
67
- modification === 'Phosphorylation' ? phosphorylate(aa) : sumoylate(aa)
68
- }</p>
128
+ <h5>Description</h5><p>${getDescription(modification, aa)}</p>
69
129
  ${
70
130
  confidenceScore
71
131
  ? `<h5 data-article-id="mod_res_large_scale#confidence-score">Confidence Score</h5><p>${confidenceScore}</p>`
@@ -1,3 +0,0 @@
1
- {
2
- "window.title": "${rootPath}${separator}[new-ptm-builds]"
3
- }