protvista-uniprot 4.2.0 → 4.2.1

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.
Files changed (27) hide show
  1. package/README.md +6 -0
  2. package/dist/protvista-uniprot.mjs +113 -100
  3. package/dist/protvista-uniprot.mjs.map +1 -1
  4. package/dist/types/adapters/types/interpro.d.ts +1 -1
  5. package/dist/types/index.d.ts +3 -3
  6. package/dist/types/tooltips/interpro-tooltip.d.ts +3 -0
  7. package/dist/types/tooltips/{ptmTooltip.d.ts → ptm-tooltip.d.ts} +1 -1
  8. package/package.json +1 -1
  9. package/src/adapters/feature-adapter.ts +1 -1
  10. package/src/adapters/interpro-adapter.ts +21 -42
  11. package/src/adapters/proteomics-adapter.ts +5 -2
  12. package/src/adapters/ptm-exchange-adapter.ts +7 -2
  13. package/src/adapters/rna-editing-adapter.ts +1 -1
  14. package/src/adapters/structure-adapter.ts +1 -1
  15. package/src/adapters/types/interpro.ts +1 -1
  16. package/src/adapters/variation-adapter.ts +1 -1
  17. package/src/index.ts +3 -3
  18. package/src/tooltips/{featureTooltip.ts → feature-tooltip.ts} +1 -1
  19. package/src/tooltips/interpro-tooltip.ts +43 -0
  20. package/src/tooltips/{ptmTooltip.ts → ptm-tooltip.ts} +6 -1
  21. package/src/tooltips/{variationTooltip.ts → variation-tooltip.ts} +1 -1
  22. /package/dist/types/tooltips/{featureTooltip.d.ts → feature-tooltip.d.ts} +0 -0
  23. /package/dist/types/tooltips/{rnaEditingTooltip.d.ts → rna-editing-tooltip.d.ts} +0 -0
  24. /package/dist/types/tooltips/{structureTooltip.d.ts → structure-tooltip.d.ts} +0 -0
  25. /package/dist/types/tooltips/{variationTooltip.d.ts → variation-tooltip.d.ts} +0 -0
  26. /package/src/tooltips/{rnaEditingTooltip.ts → rna-editing-tooltip.ts} +0 -0
  27. /package/src/tooltips/{structureTooltip.ts → structure-tooltip.ts} +0 -0
@@ -8,7 +8,7 @@ type Result = {
8
8
  metadata: Metadata;
9
9
  proteins: Protein[];
10
10
  };
11
- type Metadata = {
11
+ export type Metadata = {
12
12
  accession: string;
13
13
  name: string;
14
14
  source_database: string;
@@ -1,7 +1,7 @@
1
1
  import { default as ProtvistaUniprot } from './protvista-uniprot';
2
2
  export { default as filterConfig, colorConfig } from './filter-config';
3
- export { default as getFeatureTooltip } from './tooltips/featureTooltip';
4
- export { default as getStructureTooltip } from './tooltips/structureTooltip';
5
- export { default as getVariationTooltip } from './tooltips/variationTooltip';
3
+ export { default as getFeatureTooltip } from './tooltips/feature-tooltip';
4
+ export { default as getStructureTooltip } from './tooltips/structure-tooltip';
5
+ export { default as getVariationTooltip } from './tooltips/variation-tooltip';
6
6
  export { default as ProtvistaUniprotStructure } from './protvista-uniprot-structure';
7
7
  export default ProtvistaUniprot;
@@ -0,0 +1,3 @@
1
+ import { Metadata } from '../adapters/types/interpro';
2
+ declare const formatTooltip: (start: number | "", end: number | "", metadata: Metadata) => string;
3
+ export default formatTooltip;
@@ -1,5 +1,5 @@
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
- declare const formatTooltip: (ptms: PTM[], aa: string, confidenceScore: string) => string;
4
+ declare const formatTooltip: (title: string, ptms: PTM[], aa: string, confidenceScore: string) => string;
5
5
  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.2.0",
4
+ "version": "4.2.1",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
@@ -1,5 +1,5 @@
1
1
  import { renameProperties } from '../utils';
2
- import formatTooltip from '../tooltips/featureTooltip';
2
+ import formatTooltip from '../tooltips/feature-tooltip';
3
3
 
4
4
  const transformData = (data) => {
5
5
  let transformedData = [];
@@ -1,5 +1,7 @@
1
1
  import ColorHash from 'color-hash';
2
2
 
3
+ import formatTooltip from '../tooltips/interpro-tooltip';
4
+
3
5
  import { InterProProteinSearch, TransformedInterPro } from './types/interpro';
4
6
 
5
7
  // Copied from InterPro to replicate the same colours for the representative domains
@@ -11,58 +13,35 @@ const colorHash = new ColorHash({
11
13
 
12
14
  const transformData = (data: InterProProteinSearch): TransformedInterPro => {
13
15
  try {
14
- return data?.results?.map(({ metadata, proteins }) => ({
15
- ...metadata,
16
- locations: proteins[0].entry_protein_locations,
17
- start: proteins[0].entry_protein_locations
16
+ return data?.results?.map(({ metadata, proteins }) => {
17
+ const start = proteins[0].entry_protein_locations
18
18
  ? Math.min(
19
19
  ...proteins[0].entry_protein_locations.map((location) =>
20
20
  Math.min(...location.fragments.map((fragment) => fragment.start))
21
21
  )
22
22
  )
23
- : '',
24
- end: proteins[0].entry_protein_locations
23
+ : '';
24
+
25
+ const end = proteins[0].entry_protein_locations
25
26
  ? Math.max(
26
27
  ...proteins[0].entry_protein_locations?.map((location) =>
27
28
  Math.max(...location.fragments.map((fragment) => fragment.end))
28
29
  )
29
30
  )
30
- : '',
31
- color: colorHash.hex(
32
- metadata.accession.toLowerCase().split('').reverse().join('')
33
- ),
34
- tooltipContent: `
35
- <h5>Accession</h5>
36
- <p>
37
- <a
38
- target="_blank"
39
- rel="noopener"
40
- href="https://www.ebi.ac.uk/interpro/entry/${
41
- metadata.source_database
42
- }/${metadata.accession}/"
43
- >
44
- ${metadata.accession}
45
- </a>
46
- </p>
47
- <h5>Name</h5>
48
- <p>${metadata.name}</p>
49
- ${
50
- metadata.integrated
51
- ? `<h5>Integrated into </h5>
52
- <p>
53
- <a
54
- target="_blank"
55
- rel="noopener"
56
- href="https://www.ebi.ac.uk/interpro/entry/InterPro/${metadata.integrated}/"
57
- >
58
- ${metadata.integrated}
59
- </a>
60
- </p>`
61
- : ''
62
- }
63
- `,
64
- length: proteins[0].protein_length,
65
- }));
31
+ : '';
32
+
33
+ return {
34
+ ...metadata,
35
+ locations: proteins[0].entry_protein_locations,
36
+ start,
37
+ end,
38
+ color: colorHash.hex(
39
+ metadata.accession.toLowerCase().split('').reverse().join('')
40
+ ),
41
+ tooltipContent: formatTooltip(start, end, metadata),
42
+ length: proteins[0].protein_length,
43
+ };
44
+ });
66
45
  } catch (error) {
67
46
  throw new Error('Failed transforming the data');
68
47
  }
@@ -1,5 +1,5 @@
1
1
  import { renameProperties } from '../utils';
2
- import formatTooltip from '../tooltips/featureTooltip';
2
+ import formatTooltip from '../tooltips/feature-tooltip';
3
3
 
4
4
  const proteomicsTrackProperties = (feature, taxId) => {
5
5
  return {
@@ -64,7 +64,10 @@ const transformData = (data) => {
64
64
  }, []);
65
65
  } else {
66
66
  adaptedData = data.features.map((feature) => {
67
- return Object.assign(feature, proteomicsTrackProperties(feature, data.taxid));
67
+ return Object.assign(
68
+ feature,
69
+ proteomicsTrackProperties(feature, data.taxid)
70
+ );
68
71
  });
69
72
  }
70
73
 
@@ -1,4 +1,4 @@
1
- import formatTooltip from "../tooltips/ptmTooltip";
1
+ import formatTooltip from '../tooltips/ptm-tooltip';
2
2
 
3
3
  type ProteomicsPtm = {
4
4
  accession: string;
@@ -82,7 +82,12 @@ const convertPtmExchangePtms = (
82
82
  start: absolutePosition,
83
83
  end: absolutePosition,
84
84
  shape: 'triangle',
85
- tooltipContent: formatTooltip(ptms, aa, confidenceScore),
85
+ tooltipContent: formatTooltip(
86
+ `MOD_RES_LS ${absolutePosition}-${absolutePosition}`,
87
+ ptms,
88
+ aa,
89
+ confidenceScore
90
+ ),
86
91
  color:
87
92
  (confidenceScore && ConfidenceScoreColors[confidenceScore]) || 'black',
88
93
  };
@@ -1,7 +1,7 @@
1
1
  import { AminoAcid } from '@nightingale-elements/nightingale-variation';
2
2
 
3
3
  import { RnaEditing, TransformedRnaEditing } from './types/rna-editing';
4
- import formatTooltip from '../tooltips/rnaEditingTooltip';
4
+ import formatTooltip from '../tooltips/rna-editing-tooltip';
5
5
 
6
6
  const transformData = ({
7
7
  sequence,
@@ -1,4 +1,4 @@
1
- import formatTooltip from '../tooltips/structureTooltip';
1
+ import formatTooltip from '../tooltips/structure-tooltip';
2
2
 
3
3
  const featureType = 'PDBE_COVER';
4
4
  const featureCategory = 'STRUCTURE_COVERAGE';
@@ -10,7 +10,7 @@ type Result = {
10
10
  proteins: Protein[];
11
11
  };
12
12
 
13
- type Metadata = {
13
+ export type Metadata = {
14
14
  accession: string;
15
15
  name: string;
16
16
  source_database: string;
@@ -7,7 +7,7 @@ import {
7
7
  VariationDatum,
8
8
  } from '@nightingale-elements/nightingale-variation';
9
9
 
10
- import formatTooltip from '../tooltips/variationTooltip';
10
+ import formatTooltip from '../tooltips/variation-tooltip';
11
11
 
12
12
  export type TransformedVariant = VariationDatum & Variant;
13
13
 
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as filterConfig, colorConfig } from './filter-config';
2
- export { default as getFeatureTooltip } from './tooltips/featureTooltip';
3
- export { default as getStructureTooltip } from './tooltips/structureTooltip';
4
- export { default as getVariationTooltip } from './tooltips/variationTooltip';
2
+ export { default as getFeatureTooltip } from './tooltips/feature-tooltip';
3
+ export { default as getStructureTooltip } from './tooltips/structure-tooltip';
4
+ export { default as getVariationTooltip } from './tooltips/variation-tooltip';
5
5
  export { default as ProtvistaUniprotStructure } from './protvista-uniprot-structure';
6
6
  import ProtvistaUniprot from './protvista-uniprot';
7
7
  export default ProtvistaUniprot;
@@ -1,5 +1,5 @@
1
1
  import ecoMap from '../adapters/config/evidence';
2
- import { phosphorylate, sumoylate } from './ptmTooltip';
2
+ import { phosphorylate, sumoylate } from './ptm-tooltip';
3
3
 
4
4
  const taxIdToPeptideAtlasBuildData = {
5
5
  '36329': { build: '542', organism: 'Plasmodium' },
@@ -0,0 +1,43 @@
1
+ import { Metadata } from '../adapters/types/interpro';
2
+
3
+ const formatTooltip = (
4
+ start: number | '',
5
+ end: number | '',
6
+ metadata: Metadata
7
+ ) => `
8
+ ${
9
+ start && end
10
+ ? `<h4>InterPro Representative Domain ${start}-${end}</h4><hr />`
11
+ : ''
12
+ }
13
+ <h5>Accession</h5>
14
+ <p>
15
+ <a
16
+ target="_blank"
17
+ rel="noopener"
18
+ href="https://www.ebi.ac.uk/interpro/entry/${
19
+ metadata.source_database
20
+ }/${metadata.accession}/"
21
+ >
22
+ ${metadata.accession}
23
+ </a>
24
+ </p>
25
+ <h5>Name</h5>
26
+ <p>${metadata.name}</p>
27
+ ${
28
+ metadata.integrated
29
+ ? `<h5>Integrated into </h5>
30
+ <p>
31
+ <a
32
+ target="_blank"
33
+ rel="noopener"
34
+ href="https://www.ebi.ac.uk/interpro/entry/InterPro/${metadata.integrated}/"
35
+ >
36
+ ${metadata.integrated}
37
+ </a>
38
+ </p>`
39
+ : ''
40
+ }
41
+ `;
42
+
43
+ export default formatTooltip;
@@ -33,7 +33,7 @@ export const sumoylate = (aa: string) => {
33
33
  return '';
34
34
  };
35
35
 
36
- const formatTooltip = (ptms: PTM[], aa: string, confidenceScore: string): string => {
36
+ const formatTooltip = (title: string, ptms: PTM[], aa: string, confidenceScore: string): string => {
37
37
  const evidences = [
38
38
  ...ptms.flatMap(({ dbReferences }) =>
39
39
  dbReferences?.flatMap(({ id }) => [id])
@@ -55,6 +55,11 @@ const formatTooltip = (ptms: PTM[], aa: string, confidenceScore: string): string
55
55
  }
56
56
 
57
57
  return `
58
+ ${
59
+ title
60
+ ? `<h4>${title}</h4><hr />`
61
+ : ''
62
+ }
58
63
  <h5>Description</h5><p>${
59
64
  modification === 'Phosphorylation' ? phosphorylate(aa) : sumoylate(aa)
60
65
  }</p>
@@ -7,7 +7,7 @@ import {
7
7
  } from '@nightingale-elements/nightingale-variation';
8
8
  import groupBy from 'lodash-es/groupBy';
9
9
 
10
- import { formatXrefs, getEvidenceFromCodes } from './featureTooltip';
10
+ import { formatXrefs, getEvidenceFromCodes } from './feature-tooltip';
11
11
 
12
12
  const getDiseaseAssociations = (associations: Association[]): string =>
13
13
  associations