protvista-uniprot 4.0.0 → 4.2.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.
@@ -1,4 +1,5 @@
1
1
  import ecoMap from '../adapters/config/evidence';
2
+ import { phosphorylate, sumoylate } from './ptmTooltip';
2
3
 
3
4
  const taxIdToPeptideAtlasBuildData = {
4
5
  '36329': { build: '542', organism: 'Plasmodium' },
@@ -98,27 +99,14 @@ const formatPTMPeptidoform = (peptide, ptms) => {
98
99
  return peptidoform;
99
100
  };
100
101
 
101
- // Amino acids for Phosphorylation modification
102
- const AAPhosphoSites = {
103
- A: 'alanine',
104
- S: 'serine',
105
- T: 'threonine',
106
- Y: 'tyrosine',
107
- };
108
-
109
- // Amino acids for SUMOylation modification
110
- const AASumoSites = {
111
- K: 'lysine',
112
- };
113
-
114
102
  const findModifiedResidueName = (feature, ptm) => {
115
103
  const { peptide, begin: peptideStart } = feature;
116
104
  const proteinLocation = Number(peptideStart) + ptm.position - 1;
117
105
  const modifiedResidue = peptide.charAt(ptm.position - 1); // CharAt index starts from 0
118
106
  if (ptm.name === 'Phosphorylation') {
119
- return `${proteinLocation} phospho${AAPhosphoSites[modifiedResidue]}`;
107
+ return `${proteinLocation} ${phosphorylate(modifiedResidue)}`;
120
108
  } else if (ptm.name === 'SUMOylation') {
121
- return `${proteinLocation} Sumoylated ${AASumoSites[modifiedResidue]}`;
109
+ return `${proteinLocation} ${sumoylate(modifiedResidue)}`;
122
110
  }
123
111
  return '';
124
112
  };
@@ -156,6 +144,11 @@ const formatTooltip = (feature, taxId?: string) => {
156
144
 
157
145
  try {
158
146
  return `
147
+ ${
148
+ feature.type && feature.begin && feature.end
149
+ ? `<h4>${feature.type} ${feature.begin}-${feature.end}</h4><hr />`
150
+ : ''
151
+ }
159
152
  ${description ? `<h5>Description</h5><p>${description}</p>` : ``}
160
153
  ${
161
154
  feature.matchScore
@@ -251,7 +244,7 @@ const formatTooltip = (feature, taxId?: string) => {
251
244
  .join('')}</ul>`
252
245
  : ''
253
246
  }
254
- `;
247
+ `;
255
248
  } catch (error) {
256
249
  console.error(error);
257
250
  return '';
@@ -0,0 +1,86 @@
1
+ import { PTM } from "../adapters/ptm-exchange-adapter";
2
+
3
+ type Modification = 'Phosphorylation' | 'SUMOylation';
4
+
5
+ const aaToPhosphorylated = {
6
+ R: 'Phosphoarginine',
7
+ C: 'Phosphocysteine',
8
+ H: 'Phosphohistidine',
9
+ S: 'Phosphoserine',
10
+ T: 'Phosphothreonine',
11
+ Y: 'Phosphotyrosine',
12
+ };
13
+
14
+ const aaToSumoylated = {
15
+ K: 'Sumoylated lysine',
16
+ };
17
+
18
+ export const phosphorylate = (aa: string) => {
19
+ const AA = aa.toUpperCase();
20
+ if (AA in aaToPhosphorylated) {
21
+ return aaToPhosphorylated[AA as keyof typeof aaToPhosphorylated];
22
+ }
23
+ console.error(`${AA} not a valid amino acid for phosphorylation`);
24
+ return '';
25
+ };
26
+
27
+ export const sumoylate = (aa: string) => {
28
+ const AA = aa.toUpperCase();
29
+ if (AA in aaToSumoylated) {
30
+ return aaToSumoylated[AA as keyof typeof aaToSumoylated];
31
+ }
32
+ console.error(`${AA} not a valid amino acid for SUMOylation`);
33
+ return '';
34
+ };
35
+
36
+ const formatTooltip = (ptms: PTM[], aa: string, confidenceScore: string): string => {
37
+ const evidences = [
38
+ ...ptms.flatMap(({ dbReferences }) =>
39
+ dbReferences?.flatMap(({ id }) => [id])
40
+ ),
41
+ ];
42
+
43
+ let modification: Modification | undefined;
44
+ const modifications = new Set(ptms.flatMap(({name}) => name as Modification));
45
+ if (modifications.size) {
46
+ if (modifications.size > 1) {
47
+ console.error(
48
+ `PTMeXchange PTM has a mixture of modifications: ${Array.from(
49
+ modifications
50
+ )}`
51
+ );
52
+ } else {
53
+ [modification] = modifications;
54
+ }
55
+ }
56
+
57
+ return `
58
+ <h5>Description</h5><p>${
59
+ modification === 'Phosphorylation' ? phosphorylate(aa) : sumoylate(aa)
60
+ }</p>
61
+ ${
62
+ confidenceScore
63
+ ? `<h5 data-article-id="mod_res_large_scale#confidence-score">Confidence Score</h5><p>${confidenceScore}</p>`
64
+ : ''
65
+ }
66
+ ${
67
+ evidences
68
+ ? `<h5>Evidence</h5><ul class="no-bullet">${evidences
69
+ .map((id) => {
70
+ const datasetID = id === 'Glue project' ? 'PXD012174' : id;
71
+ return `<li title='${datasetID}' style="padding: .25rem 0">${datasetID}&nbsp;
72
+ (<a href="https://proteomecentral.proteomexchange.org/dataset/${datasetID}" style="color:#FFF" target="_blank">ProteomeXchange</a>)
73
+ </li>
74
+ ${
75
+ id === 'Glue project'
76
+ ? `<li title="publication" style="padding: .25rem 0">Publication:&nbsp;31819260&nbsp;(<a href="https://pubmed.ncbi.nlm.nih.gov/31819260" style="color:#FFF" target="_blank">PubMed</a>)</li>`
77
+ : ''
78
+ }
79
+ `;
80
+ })
81
+ .join('')}</ul>`
82
+ : ''
83
+ }`;
84
+ };
85
+
86
+ export default formatTooltip;
@@ -0,0 +1,54 @@
1
+ import { TransformedRnaEditing } from '../adapters/types/rna-editing';
2
+
3
+ const getREDIportalId = (feature: TransformedRnaEditing) =>
4
+ feature.dbReferenceType.find((db) => db.type === 'rna_editing')?.id;
5
+
6
+ const getREDIportalLink = (id: string) =>
7
+ `http://srv00.recas.ba.infn.it/cgi/atlas/getpage_dev.py?query9=hg&query10=hg38&acc=${id}`;
8
+
9
+ const getEnsemblLink = (id: string) => `https://www.ensembl.org/id/${id}`;
10
+
11
+ const getLinks = (feature: TransformedRnaEditing) => {
12
+ const links = [];
13
+ const rediPortalId = getREDIportalId(feature);
14
+ if (rediPortalId) {
15
+ links.push(
16
+ `REDIportal <a href="${getREDIportalLink(
17
+ rediPortalId
18
+ )}" target="_blank">${rediPortalId}</a>`
19
+ );
20
+ }
21
+ for (const variantLocation of feature.variantType.variantLocation) {
22
+ if (variantLocation.source === 'Ensembl') {
23
+ links.push(
24
+ `Ensembl <a href="${getEnsemblLink(variantLocation.seqId)}" target="_blank">${
25
+ variantLocation.seqId
26
+ }</a>`
27
+ );
28
+ }
29
+ }
30
+ return links.length === 0
31
+ ? ''
32
+ : `<br><ul class="no-bullet">${links
33
+ .map((link) => `<li>${link}</li>`)
34
+ .join('')}</ul>`;
35
+ };
36
+
37
+ const formatTooltip = (feature: TransformedRnaEditing): string => `
38
+ ${
39
+ feature.start && feature.end
40
+ ? `<h4>RNA Edit ${feature.start}-${feature.end}</h4><hr />`
41
+ : ''
42
+ }
43
+ <h5>Variant</h5>
44
+ <p>${feature.variantType.wildType} > ${feature.variantType.mutatedType}</p>
45
+ <h5>Consequence</h5>
46
+ <p>${feature.consequenceType}</p>
47
+ <h5>Location</h5>
48
+ <ul class="no-bullet">${feature.variantType.genomicLocation
49
+ .map((l) => `<li>${l}</li>`)
50
+ .join('')}
51
+ ${getLinks(feature)}
52
+ `;
53
+
54
+ export default formatTooltip;
@@ -14,7 +14,15 @@ const getStructuresHTML = (structureList) => {
14
14
 
15
15
  const formatTooltip = (feature) => {
16
16
  const structuresHTML = getStructuresHTML(feature.structures);
17
- return `${structuresHTML ? `<h5>Structures</h5>${structuresHTML}` : ``}`;
17
+ return !structuresHTML
18
+ ? ''
19
+ : `
20
+ ${
21
+ feature.type && feature.start && feature.end
22
+ ? `<h4>${feature.type} ${feature.start}-${feature.end}</h4><hr />`
23
+ : ''
24
+ }
25
+ <h5>Structures</h5>${structuresHTML}`;
18
26
  };
19
27
 
20
28
  export default formatTooltip;
@@ -87,53 +87,39 @@ const getPredictions = (predictions: Prediction[]): string => {
87
87
 
88
88
  const formatTooltip = (variant: Variant): string =>
89
89
  `
90
- <h5>Variant</h5><p>${variant.wildType} > ${
90
+ ${
91
+ variant.type && variant.begin && variant.end
92
+ ? `<h4>${variant.type} ${variant.begin}-${variant.end}</h4><hr />`
93
+ : ''
94
+ }
95
+ <h5>Variant</h5><p>${variant.wildType} > ${
91
96
  variant.alternativeSequence || ''
92
97
  }</p>
93
- ${
94
- variant.populationFrequencies
95
- ? getPopulationFrequencies(variant.populationFrequencies)
96
- : ''
97
- }
98
- ${
99
- variant.consequenceType
100
- ? `<h5>Consequence</h5><p>${variant.consequenceType}</p>`
101
- : ``
102
- }
103
- ${
104
- variant.somaticStatus
105
- ? `<h5>Somatic</h5><p>${
106
- variant.somaticStatus === 0 ? 'No' : 'Yes'
107
- }</p>`
108
- : ``
109
- }
110
- ${
111
- variant.genomicLocation?.length
112
- ? `<h5>Location</h5><p>${variant.genomicLocation.join(
113
- ', '
114
- )}</p>`
115
- : ``
116
- }
117
- ${
118
- variant.ftId
119
- ? `<h5>Feature ID</h5><p>${variant.ftId}</p>`
120
- : ``
121
- }
122
- ${
123
- variant.descriptions
124
- ? getDescriptions(variant.descriptions)
125
- : ''
126
- }
127
- ${
128
- variant.association
129
- ? getDiseaseAssociations(variant.association)
130
- : ''
131
- }
132
- ${
133
- variant.predictions ? getPredictions(variant.predictions) : ''
134
- }
135
- ${getEnsemblCovidLinks(variant)}
136
-
137
- `;
98
+ ${
99
+ variant.populationFrequencies
100
+ ? getPopulationFrequencies(variant.populationFrequencies)
101
+ : ''
102
+ }
103
+ ${
104
+ variant.consequenceType
105
+ ? `<h5>Consequence</h5><p>${variant.consequenceType}</p>`
106
+ : ``
107
+ }
108
+ ${
109
+ variant.somaticStatus
110
+ ? `<h5>Somatic</h5><p>${variant.somaticStatus === 0 ? 'No' : 'Yes'}</p>`
111
+ : ``
112
+ }
113
+ ${
114
+ variant.genomicLocation?.length
115
+ ? `<h5>Location</h5><p>${variant.genomicLocation.join(', ')}</p>`
116
+ : ``
117
+ }
118
+ ${variant.ftId ? `<h5>Feature ID</h5><p>${variant.ftId}</p>` : ``}
119
+ ${variant.descriptions ? getDescriptions(variant.descriptions) : ''}
120
+ ${variant.association ? getDiseaseAssociations(variant.association) : ''}
121
+ ${variant.predictions ? getPredictions(variant.predictions) : ''}
122
+ ${getEnsemblCovidLinks(variant)}
123
+ `;
138
124
 
139
125
  export default formatTooltip;