protvista-uniprot 4.4.7 → 4.5.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,8 +1,8 @@
1
- import { AlphafoldPayload } from './types/alphafold';
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
2
  type PartialProtein = {
3
3
  sequence: {
4
4
  sequence: string;
5
5
  };
6
6
  };
7
- declare const transformData: (data: AlphafoldPayload, protein: PartialProtein) => Promise<string>;
7
+ declare const transformData: (data: AlphaFoldPayload, protein: PartialProtein) => Promise<string>;
8
8
  export default transformData;
@@ -1,8 +1,8 @@
1
- import { AlphafoldPayload } from './types/alphafold';
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
2
  type PartialProtein = {
3
3
  sequence: {
4
4
  sequence: string;
5
5
  };
6
6
  };
7
- declare const transformData: (data: AlphafoldPayload, protein: PartialProtein) => Promise<Record<string, string>[]>;
7
+ declare const transformData: (data: AlphaFoldPayload, protein: PartialProtein) => Promise<Record<string, string>[]>;
8
8
  export default transformData;
@@ -1,4 +1,4 @@
1
- import { AlphafoldPayload } from './types/alphafold';
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
2
  export declare const rowSplitter: RegExp;
3
3
  export declare const cellSplitter: RegExp;
4
4
  type PartialProtein = {
@@ -6,5 +6,5 @@ type PartialProtein = {
6
6
  sequence: string;
7
7
  };
8
8
  };
9
- declare const transformData: (data: AlphafoldPayload, protein: PartialProtein) => Promise<string>;
9
+ declare const transformData: (data: AlphaFoldPayload, protein: PartialProtein) => Promise<string>;
10
10
  export default transformData;
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.4.7",
4
+ "version": "4.5.0",
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.2",
40
- "@nightingale-elements/nightingale-structure": "5.7.0",
40
+ "@nightingale-elements/nightingale-structure": "5.8.0",
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",
@@ -0,0 +1,3 @@
1
+ {
2
+ "window.title": "${rootPath}${separator}[new-ptm-builds]"
3
+ }
@@ -1,4 +1,4 @@
1
- import { AlphafoldPayload } from './types/alphafold';
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
2
 
3
3
  type AlphafoldConfidencePayload = {
4
4
  residueNumber: Array<number>;
@@ -6,7 +6,7 @@ type AlphafoldConfidencePayload = {
6
6
  confidenceCategory: Array<string>;
7
7
  };
8
8
 
9
- const getConfidenceURLFromPayload = (data: AlphafoldPayload) => {
9
+ const getConfidenceURLFromPayload = (data: AlphaFoldPayload) => {
10
10
  const cifURL = data?.[0]?.cifUrl;
11
11
  return cifURL?.length
12
12
  ? cifURL.replace('-model', '-confidence').replace('.cif', '.json')
@@ -31,12 +31,17 @@ type PartialProtein = {
31
31
  };
32
32
 
33
33
  const transformData = async (
34
- data: AlphafoldPayload,
34
+ data: AlphaFoldPayload,
35
35
  protein: PartialProtein
36
36
  ) => {
37
37
  const confidenceUrl = getConfidenceURLFromPayload(data);
38
- const { uniprotSequence } = data?.[0] || {};
39
- if (confidenceUrl && uniprotSequence === protein.sequence.sequence) {
38
+ if (!confidenceUrl) {
39
+ return;
40
+ }
41
+ const alphaFoldSequenceMatch = data?.filter(
42
+ ({ sequence }) => protein.sequence.sequence === sequence
43
+ );
44
+ if (alphaFoldSequenceMatch.length) {
40
45
  const confidenceData = await loadConfidence(confidenceUrl);
41
46
  return confidenceData?.confidenceCategory.join('');
42
47
  }
@@ -1,8 +1,9 @@
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
+
1
3
  import {
2
4
  cellSplitter,
3
5
  rowSplitter,
4
6
  } from './alphamissense-pathogenicity-adapter';
5
- import { AlphafoldPayload } from './types/alphafold';
6
7
 
7
8
  const parseCSV = (rawText: string): Array<Record<string, string>> => {
8
9
  const data = [];
@@ -43,13 +44,22 @@ type PartialProtein = {
43
44
  };
44
45
 
45
46
  const transformData = async (
46
- data: AlphafoldPayload,
47
+ data: AlphaFoldPayload,
47
48
  protein: PartialProtein
48
49
  ) => {
49
- const { amAnnotationsUrl, uniprotSequence } = data?.[0] || {};
50
- if (amAnnotationsUrl && uniprotSequence === protein.sequence.sequence) {
51
- const heatmapData = await loadAndParseAnnotations(amAnnotationsUrl);
50
+ const alphaFoldSequenceMatch = data?.filter(
51
+ ({ sequence, amAnnotationsUrl }) =>
52
+ protein.sequence.sequence === sequence && amAnnotationsUrl
53
+ );
54
+ if (alphaFoldSequenceMatch.length === 1) {
55
+ const heatmapData = await loadAndParseAnnotations(
56
+ alphaFoldSequenceMatch[0].amAnnotationsUrl
57
+ );
52
58
  return heatmapData;
59
+ } else if (alphaFoldSequenceMatch.length > 1) {
60
+ console.warn(
61
+ `Found more than one matches (${alphaFoldSequenceMatch.length}) for AlphaMissense pathogenicity against protein sequence: ${protein.sequence}`
62
+ );
53
63
  }
54
64
  };
55
65
 
@@ -1,4 +1,4 @@
1
- import { AlphafoldPayload } from './types/alphafold';
1
+ import { AlphaFoldPayload } from '@nightingale-elements/nightingale-structure';
2
2
 
3
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
4
  const certainlyBenign = 0;
@@ -95,7 +95,7 @@ const loadAndParseAnnotations = async (url: string): Promise<string> => {
95
95
  const rawCSV = await payload.text();
96
96
  return parseCSV(rawCSV);
97
97
  } catch (e) {
98
- console.error('Could not load AlphaMissense pathogenicity', e);
98
+ console.error('Could not load AlphaMissense pathogenicity score', e);
99
99
  }
100
100
  };
101
101
 
@@ -106,14 +106,22 @@ type PartialProtein = {
106
106
  };
107
107
 
108
108
  const transformData = async (
109
- data: AlphafoldPayload,
109
+ data: AlphaFoldPayload,
110
110
  protein: PartialProtein
111
111
  ) => {
112
- const { amAnnotationsUrl, uniprotSequence } = data?.[0] || {};
113
- if (amAnnotationsUrl && uniprotSequence === protein.sequence.sequence) {
114
- const variationData = await loadAndParseAnnotations(amAnnotationsUrl);
115
- // return confidenceData?.confidenceCategory.join('');
116
- return variationData;
112
+ const alphaFoldSequenceMatch = data?.filter(
113
+ ({ sequence, amAnnotationsUrl }) =>
114
+ protein.sequence.sequence === sequence && amAnnotationsUrl
115
+ );
116
+ if (alphaFoldSequenceMatch.length === 1) {
117
+ const heatmapData = await loadAndParseAnnotations(
118
+ alphaFoldSequenceMatch[0].amAnnotationsUrl
119
+ );
120
+ return heatmapData;
121
+ } else if (alphaFoldSequenceMatch.length > 1) {
122
+ console.warn(
123
+ `Found more than one matches (${alphaFoldSequenceMatch.length}) for AlphaMissense pathogenicity score against protein sequence: ${protein.sequence}`
124
+ );
117
125
  }
118
126
  };
119
127
 
package/src/config.ts CHANGED
@@ -815,8 +815,10 @@ const config: ProtvistaConfig = {
815
815
  name: 'ALPHAMISSENSE_PATHOGENICITY',
816
816
  label: 'AlphaMissense',
817
817
  trackType: 'nightingale-colored-sequence',
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',
818
+ scale:
819
+ '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',
820
+ 'color-range':
821
+ '#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
822
  tracks: [
821
823
  {
822
824
  name: 'alphamissense_pathogenicity',
@@ -836,13 +838,13 @@ const config: ProtvistaConfig = {
836
838
  {
837
839
  name: 'alphamissense_pathogenicity_heatmap',
838
840
  label: 'AlphaMissense Pathogenicity',
839
- labelUrl: 'https://alphafold.ebi.ac.uk/entry/{accession}',
841
+ labelUrl: `${alphafoldEntry}{accession}`,
840
842
  trackType: 'nightingale-sequence-heatmap',
841
843
  data: [
842
844
  {
843
845
  adapter: 'alphamissense-heatmap-adapter',
844
846
  url: [
845
- 'https://alphafold.ebi.ac.uk/api/prediction/{accession}',
847
+ `${alphafoldApi}prediction/{accession}`,
846
848
  `${proteinsApiServices.proteins}{accession}`,
847
849
  ],
848
850
  },
@@ -2,7 +2,7 @@ import { LitElement, html, svg, TemplateResult, css, nothing } from 'lit';
2
2
  import { customElement, state } from 'lit/decorators.js';
3
3
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
4
4
  import NightingaleStructure, {
5
- PredictionData,
5
+ AlphaFoldPayload,
6
6
  } from '@nightingale-elements/nightingale-structure';
7
7
  import ProtvistaDatatable from 'protvista-datatable';
8
8
  import { fetchAll, loadComponent } from './utils';
@@ -164,13 +164,13 @@ const processPDBData = (data: UniProtKBData): ProcessedStructureData[] =>
164
164
  transformedItem !== undefined
165
165
  );
166
166
 
167
- const processAFData = (data: PredictionData[]): ProcessedStructureData[] =>
167
+ const processAFData = (data: AlphaFoldPayload): ProcessedStructureData[] =>
168
168
  data.map((d) => ({
169
- id: d.entryId,
169
+ id: d.modelEntityId,
170
170
  source: 'AlphaFold',
171
171
  method: 'Predicted',
172
- positions: `${d.uniprotStart}-${d.uniprotEnd}`,
173
- protvistaFeatureId: d.entryId,
172
+ positions: `${d.sequenceStart}-${d.sequenceEnd}`,
173
+ protvistaFeatureId: d.modelEntityId,
174
174
  downloadLink: d.pdbUrl,
175
175
  }));
176
176
 
@@ -178,16 +178,21 @@ const process3DBeaconsData = (data: BeaconsData): ProcessedStructureData[] => {
178
178
  const otherStructures = data?.structures?.filter(({ summary }) =>
179
179
  providersFrom3DBeacons.includes(summary.provider)
180
180
  );
181
- return otherStructures?.map(({ summary }) => ({
182
- id: summary['model_identifier'],
183
- source: summary.provider,
184
- method: sourceMethods.get(summary.provider),
185
- positions: `${summary['uniprot_start']}-${summary['uniprot_end']}`,
186
- protvistaFeatureId: summary['model_identifier'],
187
- downloadLink: summary['model_url'],
188
- // isoform.io does not have a model page url. Link to their homepage instead.
189
- sourceDBLink: summary.provider === 'isoform.io' ? 'https://www.isoform.io/home' : summary['model_page_url'],
190
- })) || [];
181
+ return (
182
+ otherStructures?.map(({ summary }) => ({
183
+ id: summary['model_identifier'],
184
+ source: summary.provider,
185
+ method: sourceMethods.get(summary.provider),
186
+ positions: `${summary['uniprot_start']}-${summary['uniprot_end']}`,
187
+ protvistaFeatureId: summary['model_identifier'],
188
+ downloadLink: summary['model_url'],
189
+ // isoform.io does not have a model page url. Link to their homepage instead.
190
+ sourceDBLink:
191
+ summary.provider === 'isoform.io'
192
+ ? 'https://www.isoform.io/home'
193
+ : summary['model_page_url'],
194
+ })) || []
195
+ );
191
196
  };
192
197
 
193
198
  const AFMetaInfo = html`
@@ -303,14 +308,16 @@ class ProtvistaUniprotStructure extends LitElement {
303
308
  const pdbData = processPDBData(rawData[pdbUrl] || []);
304
309
  let afData = [];
305
310
  // Check if AF sequence matches UniProt sequence
306
- if (
307
- rawData[pdbUrl].sequence?.value === rawData[alphaFoldUrl]?.[0]?.sequence
308
- ) {
309
- afData = processAFData(rawData[alphaFoldUrl] || []);
310
- this.alphamissenseAvailable = rawData[alphaFoldUrl].some(
311
- (data) => data.amAnnotationsUrl
311
+ const alphaFoldSequenceMatch = rawData[alphaFoldUrl]?.filter(
312
+ ({ sequence }) => rawData[pdbUrl].sequence?.value === sequence
312
313
  );
314
+ if (alphaFoldSequenceMatch.length) {
315
+ afData = processAFData(alphaFoldSequenceMatch);
316
+ this.alphamissenseAvailable = alphaFoldSequenceMatch.some(
317
+ (data) => data.amAnnotationsUrl
318
+ );
313
319
  }
320
+
314
321
  const beaconsData = process3DBeaconsData(rawData[beaconsUrl] || []);
315
322
 
316
323
  // TODO: return if no data at all
@@ -370,8 +377,10 @@ class ProtvistaUniprotStructure extends LitElement {
370
377
  }) {
371
378
  if (providersFrom3DBeacons.includes(source)) {
372
379
  this.modelUrl = downloadLink;
380
+ // Reset the rest
373
381
  this.structureId = undefined;
374
382
  this.metaInfo = undefined;
383
+ this.colorTheme = 'alphafold';
375
384
  } else {
376
385
  this.structureId = id;
377
386
  this.modelUrl = undefined;
@@ -503,7 +512,6 @@ class ProtvistaUniprotStructure extends LitElement {
503
512
  ${this.modelUrl
504
513
  ? html`<nightingale-structure
505
514
  model-url=${this.modelUrl}
506
- color-theme=${this.colorTheme}
507
515
  ></nightingale-structure>`
508
516
  : html``}
509
517
  </div>
@@ -1,25 +0,0 @@
1
- export type AlphafoldPayload = Array<{
2
- entryId: string;
3
- gene: string;
4
- uniprotAccession: string;
5
- uniprotId: string;
6
- uniprotDescription: string;
7
- taxId: number;
8
- organismScientificName: string;
9
- uniprotStart: number;
10
- uniprotEnd: number;
11
- uniprotSequence: string;
12
- modelCreatedDate: string;
13
- latestVersion: number;
14
- allVersions: number[];
15
- isReviewed: boolean;
16
- isReferenceProteome: boolean;
17
- cifUrl?: string;
18
- bcifUrl?: string;
19
- amAnnotationsUrl?: string;
20
- amAnnotationsHg19Url?: string;
21
- amAnnotationsHg38Url?: string;
22
- pdbUrl: string;
23
- paeImageUrl: string;
24
- paeDocUrl: string;
25
- }>;
@@ -1,25 +0,0 @@
1
- export type AlphafoldPayload = Array<{
2
- entryId: string;
3
- gene: string;
4
- uniprotAccession: string;
5
- uniprotId: string;
6
- uniprotDescription: string;
7
- taxId: number;
8
- organismScientificName: string;
9
- uniprotStart: number;
10
- uniprotEnd: number;
11
- uniprotSequence: string;
12
- modelCreatedDate: string;
13
- latestVersion: number;
14
- allVersions: number[];
15
- isReviewed: boolean;
16
- isReferenceProteome: boolean;
17
- cifUrl?: string;
18
- bcifUrl?: string;
19
- amAnnotationsUrl?: string;
20
- amAnnotationsHg19Url?: string;
21
- amAnnotationsHg38Url?: string;
22
- pdbUrl: string;
23
- paeImageUrl: string;
24
- paeDocUrl: string;
25
- }>;