protvista-uniprot 2.13.2 → 3.0.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.
- package/dist/es/__spec__/filter-config.spec.d.ts +1 -0
- package/dist/es/__spec__/filter-config.spec.js +123 -0
- package/dist/es/__spec__/filter-config.spec.js.map +1 -0
- package/dist/es/adapters/__tests__/__mocks__/uniprotkb-entry-data.d.ts +47 -0
- package/dist/es/adapters/__tests__/__mocks__/uniprotkb-entry-data.js +75 -0
- package/dist/es/adapters/__tests__/__mocks__/uniprotkb-entry-data.js.map +1 -0
- package/dist/es/adapters/__tests__/structure-adapter.spec.d.ts +1 -0
- package/dist/es/adapters/__tests__/structure-adapter.spec.js +14 -0
- package/dist/es/adapters/__tests__/structure-adapter.spec.js.map +1 -0
- package/dist/es/adapters/alphafold-confidence-adapter.d.ts +8 -0
- package/dist/es/{protvista-alphafold-confidence.js → adapters/alphafold-confidence-adapter.js} +4 -3
- package/dist/es/adapters/alphafold-confidence-adapter.js.map +1 -0
- package/dist/es/adapters/alphamissense-heatmap-adapter.d.ts +8 -0
- package/dist/es/{protvista-alphamissense-heatmap.js → adapters/alphamissense-heatmap-adapter.js} +4 -3
- package/dist/es/adapters/alphamissense-heatmap-adapter.js.map +1 -0
- package/dist/es/adapters/alphamissense-pathogenicity-adapter.d.ts +10 -0
- package/dist/es/{protvista-alphamissense-pathogenicity.js → adapters/alphamissense-pathogenicity-adapter.js} +3 -2
- package/dist/es/adapters/alphamissense-pathogenicity-adapter.js.map +1 -0
- package/dist/es/adapters/config/evidence.d.ts +14 -0
- package/dist/es/adapters/config/evidence.js +101 -0
- package/dist/es/adapters/config/evidence.js.map +1 -0
- package/dist/es/adapters/feature-adapter.d.ts +2 -0
- package/dist/es/adapters/feature-adapter.js +18 -0
- package/dist/es/adapters/feature-adapter.js.map +1 -0
- package/dist/es/adapters/interpro-adapter.d.ts +2 -0
- package/dist/es/adapters/interpro-adapter.js +60 -0
- package/dist/es/adapters/interpro-adapter.js.map +1 -0
- package/dist/es/adapters/proteomics-adapter.d.ts +2 -0
- package/dist/es/adapters/proteomics-adapter.js +66 -0
- package/dist/es/adapters/proteomics-adapter.js.map +1 -0
- package/dist/es/{protvista-ptm-exchange.d.ts → adapters/ptm-exchange-adapter.d.ts} +2 -2
- package/dist/es/{protvista-ptm-exchange.js → adapters/ptm-exchange-adapter.js} +3 -2
- package/dist/es/adapters/ptm-exchange-adapter.js.map +1 -0
- package/dist/es/adapters/structure-adapter.d.ts +4 -0
- package/dist/es/adapters/structure-adapter.js +89 -0
- package/dist/es/adapters/structure-adapter.js.map +1 -0
- package/dist/es/adapters/types/alphafold.js +2 -0
- package/dist/es/adapters/types/alphafold.js.map +1 -0
- package/dist/es/adapters/variation-adapter.d.ts +7 -0
- package/dist/es/adapters/variation-adapter.js +31 -0
- package/dist/es/adapters/variation-adapter.js.map +1 -0
- package/dist/es/{protvista-variation-graph-adapter.d.ts → adapters/variation-graph-adapter.d.ts} +2 -1
- package/dist/es/{protvista-variation-graph-adapter.js → adapters/variation-graph-adapter.js} +12 -5
- package/dist/es/adapters/variation-graph-adapter.js.map +1 -0
- package/dist/es/config.json +54 -54
- package/dist/es/filter-config.d.ts +24 -0
- package/dist/es/{filterConfig.js → filter-config.js} +1 -1
- package/dist/es/filter-config.js.map +1 -0
- package/dist/es/index.d.ts +6 -11
- package/dist/es/index.js +6 -16
- package/dist/es/index.js.map +1 -1
- package/dist/es/protvista-uniprot-structure.js +15 -9
- package/dist/es/protvista-uniprot-structure.js.map +1 -1
- package/dist/es/protvista-uniprot.d.ts +1 -100
- package/dist/es/protvista-uniprot.js +46 -60
- package/dist/es/protvista-uniprot.js.map +1 -1
- package/dist/es/styles/protvista-styles.js +2 -1
- package/dist/es/styles/protvista-styles.js.map +1 -1
- package/dist/es/tooltips/featureTooltip.d.ts +4 -0
- package/dist/es/tooltips/featureTooltip.js +160 -0
- package/dist/es/tooltips/featureTooltip.js.map +1 -0
- package/dist/es/tooltips/structureTooltip.d.ts +2 -0
- package/dist/es/tooltips/structureTooltip.js +15 -0
- package/dist/es/tooltips/structureTooltip.js.map +1 -0
- package/dist/es/tooltips/variationTooltip.d.ts +3 -0
- package/dist/es/tooltips/variationTooltip.js +82 -0
- package/dist/es/tooltips/variationTooltip.js.map +1 -0
- package/dist/es/utils.d.ts +3 -0
- package/dist/es/utils.js +28 -0
- package/dist/es/utils.js.map +1 -0
- package/dist/protvista-uniprot.js +24 -13
- package/dist/protvista-uniprot.js.map +1 -1
- package/package.json +25 -30
- package/src/__spec__/filter-config.spec.ts +143 -0
- package/src/adapters/__tests__/__mocks__/uniprotkb-entry-data.ts +76 -0
- package/src/adapters/__tests__/__snapshots__/structure-adapter.spec.ts.snap +157 -0
- package/src/adapters/__tests__/structure-adapter.spec.ts +19 -0
- package/src/{protvista-alphafold-confidence.ts → adapters/alphafold-confidence-adapter.ts} +5 -3
- package/src/{protvista-alphamissense-heatmap.ts → adapters/alphamissense-heatmap-adapter.ts} +8 -4
- package/src/{protvista-alphamissense-pathogenicity.ts → adapters/alphamissense-pathogenicity-adapter.ts} +4 -2
- package/src/adapters/config/evidence.ts +105 -0
- package/src/adapters/feature-adapter.ts +19 -0
- package/src/adapters/interpro-adapter.ts +71 -0
- package/src/adapters/proteomics-adapter.ts +76 -0
- package/src/{protvista-ptm-exchange.ts → adapters/ptm-exchange-adapter.ts} +3 -1
- package/src/adapters/structure-adapter.ts +105 -0
- package/src/adapters/variation-adapter.ts +44 -0
- package/src/{protvista-variation-graph-adapter.ts → adapters/variation-graph-adapter.ts} +25 -18
- package/src/config.json +54 -54
- package/src/{filterConfig.ts → filter-config.ts} +17 -12
- package/src/index.ts +14 -18
- package/src/protvista-uniprot-structure.ts +6 -14
- package/src/protvista-uniprot.ts +66 -96
- package/src/styles/protvista-styles.ts +2 -1
- package/src/tooltips/featureTooltip.ts +223 -0
- package/src/tooltips/structureTooltip.ts +20 -0
- package/src/tooltips/variationTooltip.ts +139 -0
- package/src/utils.ts +37 -0
- package/dist/es/commonTypes.js +0 -2
- package/dist/es/commonTypes.js.map +0 -1
- package/dist/es/filterConfig.d.ts +0 -20
- package/dist/es/filterConfig.js.map +0 -1
- package/dist/es/loadComponents.d.ts +0 -2
- package/dist/es/loadComponents.js +0 -7
- package/dist/es/loadComponents.js.map +0 -1
- package/dist/es/protvista-alphafold-confidence.d.ts +0 -9
- package/dist/es/protvista-alphafold-confidence.js.map +0 -1
- package/dist/es/protvista-alphamissense-heatmap.d.ts +0 -8
- package/dist/es/protvista-alphamissense-heatmap.js.map +0 -1
- package/dist/es/protvista-alphamissense-pathogenicity.d.ts +0 -10
- package/dist/es/protvista-alphamissense-pathogenicity.js.map +0 -1
- package/dist/es/protvista-ptm-exchange.js.map +0 -1
- package/dist/es/protvista-variation-graph-adapter.js.map +0 -1
- package/src/loadComponents.ts +0 -10
- package/src/types/nightingale-components.d.ts +0 -13
- package/src/types/nightingale-sequence-heatmap.d.ts +0 -1
- package/src/types/protvista-feature-adapter.d.ts +0 -1
- package/src/types/protvista-interpro-adapter.d.ts +0 -1
- package/src/types/protvista-proteomics-adapter.d.ts +0 -1
- package/src/types/protvista-structure-adapter.d.ts +0 -1
- package/src/types/protvista-structure.d.ts +0 -1
- package/src/types/protvista-variation.d.ts +0 -15
- /package/dist/es/{commonTypes.d.ts → adapters/types/alphafold.d.ts} +0 -0
- /package/src/{commonTypes.ts → adapters/types/alphafold.ts} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { renameProperties } from '../utils';
|
|
2
|
+
import formatTooltip from '../tooltips/featureTooltip';
|
|
3
|
+
|
|
4
|
+
const transformData = (data) => {
|
|
5
|
+
let transformedData = [];
|
|
6
|
+
const { features } = data;
|
|
7
|
+
if (features && features.length > 0) {
|
|
8
|
+
transformedData = features.map((feature) => {
|
|
9
|
+
return {
|
|
10
|
+
...feature,
|
|
11
|
+
tooltipContent: formatTooltip(feature),
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
transformedData = renameProperties(transformedData);
|
|
15
|
+
}
|
|
16
|
+
return transformedData;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default transformData;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import ColorHash from 'color-hash';
|
|
2
|
+
|
|
3
|
+
// Copied from InterPro to replicate the same colours for the representative domains
|
|
4
|
+
/* eslint-disable no-magic-numbers */
|
|
5
|
+
const colorHash = new ColorHash({
|
|
6
|
+
hash: 'bkdr',
|
|
7
|
+
saturation: [0.65, 0.35, 0.5],
|
|
8
|
+
lightness: [0.65, 0.35, 0.5],
|
|
9
|
+
});
|
|
10
|
+
/* eslint-enable no-magic-numbers */
|
|
11
|
+
|
|
12
|
+
const transformData = (data) => {
|
|
13
|
+
try {
|
|
14
|
+
return data?.results?.map(({ metadata, proteins }) => ({
|
|
15
|
+
...metadata,
|
|
16
|
+
locations: proteins[0].entry_protein_locations,
|
|
17
|
+
start: proteins[0].entry_protein_locations
|
|
18
|
+
? Math.min(
|
|
19
|
+
...proteins[0].entry_protein_locations.map((location) =>
|
|
20
|
+
Math.min(...location.fragments.map((fragment) => fragment.start))
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
: '',
|
|
24
|
+
end: proteins[0].entry_protein_locations
|
|
25
|
+
? Math.max(
|
|
26
|
+
...proteins[0].entry_protein_locations?.map((location) =>
|
|
27
|
+
Math.max(...location.fragments.map((fragment) => fragment.end))
|
|
28
|
+
)
|
|
29
|
+
)
|
|
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
|
+
}));
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error('Failed transforming the data');
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default transformData;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { renameProperties } from '../utils';
|
|
2
|
+
import formatTooltip from '../tooltips/featureTooltip';
|
|
3
|
+
|
|
4
|
+
const proteomicsTrackProperties = (feature) => {
|
|
5
|
+
return {
|
|
6
|
+
category: 'PROTEOMICS',
|
|
7
|
+
type: feature.unique ? 'unique' : 'non_unique',
|
|
8
|
+
tooltipContent: formatTooltip(feature),
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const transformData = (data) => {
|
|
13
|
+
let adaptedData = [];
|
|
14
|
+
|
|
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
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
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
|
+
ptms: 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)
|
|
63
|
+
);
|
|
64
|
+
}, []);
|
|
65
|
+
} else {
|
|
66
|
+
adaptedData = data.features.map((feature) => {
|
|
67
|
+
return Object.assign(feature, proteomicsTrackProperties(feature));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
adaptedData = renameProperties(adaptedData);
|
|
72
|
+
}
|
|
73
|
+
return adaptedData;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default transformData;
|
|
@@ -135,7 +135,7 @@ const convertPtmExchangePtms = (
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
const transformData = (data: ProteomicsPtm) => {
|
|
139
139
|
if (data) {
|
|
140
140
|
const { features } = data;
|
|
141
141
|
|
|
@@ -178,3 +178,5 @@ export const transformData = (data: ProteomicsPtm) => {
|
|
|
178
178
|
}
|
|
179
179
|
return [];
|
|
180
180
|
};
|
|
181
|
+
|
|
182
|
+
export default transformData;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import formatTooltip from '../tooltips/structureTooltip';
|
|
2
|
+
|
|
3
|
+
const featureType = 'PDBE_COVER';
|
|
4
|
+
const featureCategory = 'STRUCTURE_COVERAGE';
|
|
5
|
+
|
|
6
|
+
const capitalizeFirstLetter = (word) => {
|
|
7
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getDescription = (properties) => {
|
|
11
|
+
return Object.keys(properties).reduce(
|
|
12
|
+
(accumulator, propertyKey) =>
|
|
13
|
+
`${accumulator}${capitalizeFirstLetter(propertyKey)}: ${
|
|
14
|
+
properties[propertyKey]
|
|
15
|
+
}. `,
|
|
16
|
+
''
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const parseChainString = (value) => {
|
|
21
|
+
const posEqual = value.indexOf('=');
|
|
22
|
+
const posDash = value.indexOf('-');
|
|
23
|
+
if (posEqual === -1 || posDash === -1) {
|
|
24
|
+
return { start: 0, end: 0 };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
start: +value.slice(posEqual + 1, posDash),
|
|
28
|
+
end: +value.slice(posDash + 1),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Iterate over references and extract chain start and end
|
|
33
|
+
export const getAllFeatureStructures = (data) => {
|
|
34
|
+
return data.dbReferences
|
|
35
|
+
.filter((reference) => {
|
|
36
|
+
return reference.type === 'PDB';
|
|
37
|
+
})
|
|
38
|
+
.map((structureReference) => {
|
|
39
|
+
const parsedChain = structureReference.properties.chains
|
|
40
|
+
? parseChainString(structureReference.properties.chains)
|
|
41
|
+
: { start: 0, end: 0 };
|
|
42
|
+
return {
|
|
43
|
+
type: featureType,
|
|
44
|
+
category: featureCategory,
|
|
45
|
+
structures: [
|
|
46
|
+
{
|
|
47
|
+
description: getDescription(structureReference.properties),
|
|
48
|
+
start: parsedChain.start,
|
|
49
|
+
end: parsedChain.end,
|
|
50
|
+
source: {
|
|
51
|
+
id: structureReference.id,
|
|
52
|
+
url: `http://www.ebi.ac.uk/pdbe-srv/view/entry/${structureReference.id}`,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
start: parsedChain.start,
|
|
57
|
+
end: parsedChain.end,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const mergeOverlappingIntervals = (structures) => {
|
|
63
|
+
if (!structures || structures.length <= 0) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
// Sort by start position
|
|
67
|
+
const sortedStructures = structures.sort((a, b) => a.start - b.start);
|
|
68
|
+
const mergedIntervals = [];
|
|
69
|
+
sortedStructures.forEach((structure) => {
|
|
70
|
+
const lastItem = mergedIntervals[mergedIntervals.length - 1];
|
|
71
|
+
if (
|
|
72
|
+
!lastItem ||
|
|
73
|
+
// If item doesn't overlap, push it
|
|
74
|
+
lastItem.end < structure.start
|
|
75
|
+
) {
|
|
76
|
+
mergedIntervals.push(structure);
|
|
77
|
+
}
|
|
78
|
+
// If the end is bigger update the last one
|
|
79
|
+
else if (lastItem.end < structure.end) {
|
|
80
|
+
lastItem.end = structure.end;
|
|
81
|
+
lastItem.structures.push(structure.structures[0]);
|
|
82
|
+
}
|
|
83
|
+
// Otherwise just add to last item
|
|
84
|
+
else {
|
|
85
|
+
lastItem.structures.push(structure.structures[0]);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return mergedIntervals;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const transformData = (data) => {
|
|
92
|
+
let transformedData = [];
|
|
93
|
+
if (data && data.length !== 0) {
|
|
94
|
+
const allFeatureStructures = getAllFeatureStructures(data);
|
|
95
|
+
transformedData = mergeOverlappingIntervals(allFeatureStructures);
|
|
96
|
+
|
|
97
|
+
transformedData.forEach((feature) => {
|
|
98
|
+
/* eslint-disable no-param-reassign */
|
|
99
|
+
feature.tooltipContent = formatTooltip(feature);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return transformedData;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default transformData;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProteinsAPIVariation,
|
|
3
|
+
AminoAcid,
|
|
4
|
+
SourceType,
|
|
5
|
+
Variant,
|
|
6
|
+
Xref,
|
|
7
|
+
VariationDatum,
|
|
8
|
+
} from '@nightingale-elements/nightingale-variation';
|
|
9
|
+
|
|
10
|
+
import formatTooltip from '../tooltips/variationTooltip';
|
|
11
|
+
|
|
12
|
+
export type TransformedVariant = VariationDatum & Variant;
|
|
13
|
+
|
|
14
|
+
const getSourceType = (xrefs: Xref[], sourceType: SourceType) => {
|
|
15
|
+
const xrefNames = xrefs ? xrefs.map((ref) => ref.name) : [];
|
|
16
|
+
if (sourceType === 'uniprot' || sourceType === 'mixed') {
|
|
17
|
+
xrefNames.push('uniprot');
|
|
18
|
+
}
|
|
19
|
+
return xrefNames;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const transformData = (
|
|
23
|
+
data: ProteinsAPIVariation
|
|
24
|
+
): {
|
|
25
|
+
sequence: string;
|
|
26
|
+
variants: TransformedVariant[];
|
|
27
|
+
} => {
|
|
28
|
+
const { sequence, features } = data;
|
|
29
|
+
const variants = features.map((variant) => ({
|
|
30
|
+
...variant,
|
|
31
|
+
accession: variant.genomicLocation?.join(', '),
|
|
32
|
+
variant: variant.alternativeSequence
|
|
33
|
+
? variant.alternativeSequence
|
|
34
|
+
: AminoAcid.Empty,
|
|
35
|
+
start: +variant.begin,
|
|
36
|
+
xrefNames: getSourceType(variant.xrefs, variant.sourceType),
|
|
37
|
+
hasPredictions: variant.predictions && variant.predictions.length > 0,
|
|
38
|
+
tooltipContent: formatTooltip(variant),
|
|
39
|
+
}));
|
|
40
|
+
if (!variants) return null;
|
|
41
|
+
return { sequence, variants };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default transformData;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const transformData = (data) => {
|
|
2
2
|
if (data.sequence && data.features.length) {
|
|
3
3
|
const variants = data.features.map((variant) => ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
...variant,
|
|
5
|
+
accession: variant.genomicLocation?.join(', '),
|
|
6
|
+
start: variant.begin,
|
|
7
|
+
}));
|
|
8
8
|
|
|
9
9
|
const total = new Uint8ClampedArray(data.sequence.length);
|
|
10
10
|
const diseaseTotal = new Uint8ClampedArray(data.sequence.length);
|
|
@@ -28,20 +28,27 @@ export const transformData = (data) => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const graphData = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
{
|
|
32
|
+
name: 'variant',
|
|
33
|
+
range: [0, Math.max(Math.max(...total), Math.max(...diseaseTotal))],
|
|
34
|
+
color: 'darkgrey',
|
|
35
|
+
values: [...total].map((value, index) => ({
|
|
36
|
+
position: index,
|
|
37
|
+
value: value,
|
|
38
|
+
})),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'disease causing variant',
|
|
42
|
+
range: [0, Math.max(Math.max(...total), Math.max(...diseaseTotal))],
|
|
43
|
+
color: 'red',
|
|
44
|
+
values: [...diseaseTotal].map((value, index) => ({
|
|
45
|
+
position: index,
|
|
46
|
+
value: value,
|
|
47
|
+
})),
|
|
48
|
+
},
|
|
49
|
+
];
|
|
44
50
|
return graphData;
|
|
45
51
|
}
|
|
46
52
|
};
|
|
47
53
|
|
|
54
|
+
export default transformData;
|