Skip to content

Commit

Permalink
Merge pull request #256 from ebi-webcomponents/master
Browse files Browse the repository at this point in the history
Binding site tooltip and PTM changes
  • Loading branch information
Swaathik authored Jun 1, 2023
2 parents 5373882 + b8618d3 commit 196e101
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 31 deletions.
10 changes: 5 additions & 5 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightingale-showcase-app",
"version": "3.8.10",
"version": "3.8.11",
"private": true,
"description": "A website to showcase all nightingale components",
"files": [
Expand All @@ -21,7 +21,7 @@
"interaction-viewer": "^3.8.4",
"protvista-coloured-sequence": "^3.8.10",
"protvista-datatable": "^3.8.10",
"protvista-feature-adapter": "^3.8.10",
"protvista-feature-adapter": "^3.8.11",
"protvista-filter": "^3.8.4",
"protvista-interpro-track": "^3.8.10",
"protvista-links": "^3.8.10",
Expand All @@ -30,14 +30,14 @@
"protvista-navigation": "^3.8.10",
"protvista-saver": "^3.8.4",
"protvista-sequence": "^3.8.10",
"protvista-structure": "^3.8.4",
"protvista-structure": "^3.8.11",
"protvista-tooltip": "^3.8.4",
"protvista-track": "^3.8.10",
"protvista-uniprot": "^2.0.3",
"protvista-variation": "^3.8.10",
"protvista-variation-adapter": "^3.8.10",
"protvista-variation-adapter": "^3.8.11",
"protvista-variation-graph": "^3.8.10",
"protvista-vcf-adapter": "^3.8.10",
"protvista-vcf-adapter": "^3.8.11",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-router": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": ["app", "packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "3.8.10"
"version": "3.8.11"
}
2 changes: 1 addition & 1 deletion packages/protvista-feature-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protvista-feature-adapter",
"version": "3.8.10",
"version": "3.8.11",
"files": [
"dist",
"src"
Expand Down
22 changes: 17 additions & 5 deletions packages/protvista-feature-adapter/src/BasicHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,25 @@ export const formatTooltip = (feature) => {
dbReferences.map((ref) => ref.id)
);

let { description } = feature;

if (feature.type === "BINDING" || feature.type === "Binding site") {
let bindingDescription = "";
if (feature.ligandPart) {
bindingDescription += `${feature.ligandPart.name} of `;
}
if (feature.ligand) {
bindingDescription += feature.ligand.name;
}
if (feature.description) {
bindingDescription += `; ${feature.description}`;
}
description = bindingDescription;
}

try {
return `
${
feature.description
? `<h5>Description</h5><p>${feature.description}</p>`
: ``
}
${description ? `<h5>Description</h5><p>${description}</p>` : ``}
${
feature.matchScore
? `<h5>Match score</h5><p>${feature.matchScore}%</p>`
Expand Down
4 changes: 2 additions & 2 deletions packages/protvista-proteomics-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"url": "https://github.com/ebi-webcomponents/nightingale/issues"
},
"homepage": "https://ebi-webcomponents.github.io/nightingale/",
"version": "3.8.10",
"version": "3.8.11",
"gitHead": "726779864966d11f966f337f2dd84aa4f58d944a",
"dependencies": {
"protvista-feature-adapter": "^3.8.10",
"protvista-feature-adapter": "^3.8.11",
"uuid": "^8.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,77 @@
import ProtvistaFeatureAdapter, {
renameProperties,
formatTooltip
formatTooltip,
} from "protvista-feature-adapter";
import { v1 } from "uuid";

export const transformData = data => {
const proteomicsTrackProperties = (feature) => {
return {
category: "PROTEOMICS",
type: feature.unique ? "unique" : "non_unique",
tooltipContent: formatTooltip(feature),
protvistaFeatureId: v1(),
};
};

export const transformData = (data) => {
let adaptedData = [];

if (data && data.length !== 0) {
adaptedData = data.features.map(feature => {
return Object.assign(feature, {
category: "PROTEOMICS",
type: feature.unique ? "unique" : "non_unique",
tooltipContent: formatTooltip(feature),
protvistaFeatureId: v1()
});
/* 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.
Once they are available in the data, there is no need for the below merging */

// 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]
const ptmMap = {};
data.features.forEach((feature) => {
let ft = `${feature.begin}-${feature.end}`;
if (feature.ptms) {
feature.ptms.forEach((ptm) => {
ft += `-${ptm.position}`;
});
ptmMap[ft] = ft in ptmMap ? [...ptmMap[ft], feature] : [feature];
}
});

// The else part alone is enough if the PTM information need not be merged.
if (Object.keys(ptmMap).length) {
adaptedData = Object.values(ptmMap).map((features) => {
// Only the dbReferences have to be merged as the rest is all the same
const mergedDbReferences = [];
features.forEach((feature) => {
feature.ptms.forEach((ptm) => {
ptm.dbReferences.forEach((dbReference) => {
mergedDbReferences.push(dbReference);
});
});
});

const mergedFeatures = {
type: features[0].type,
begin: features[0].begin,
end: features[0].end,
xrefs: features[0].xrefs,
evidences: features[0].evidences,
peptide: features[0].peptide,
unique: features[0].unique,
ptms: features[0].ptms.map((ptm) => ({
name: ptm.name,
position: ptm.position,
sources: ptm.sources,
dbReferences: mergedDbReferences,
})),
};

return Object.assign(
mergedFeatures,
proteomicsTrackProperties(mergedFeatures)
);
}, []);
} else {
adaptedData = data.features.map((feature) => {
return Object.assign(feature, proteomicsTrackProperties(feature));
});
}

adaptedData = renameProperties(adaptedData);
}
return adaptedData;
Expand Down
4 changes: 2 additions & 2 deletions packages/protvista-structure-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protvista-structure-adapter",
"version": "3.8.10",
"version": "3.8.11",
"description": "A dataloader and parser (ProtVista compliant) for 3D structures",
"main": "dist/protvista-structure-adapter.js",
"module": "src/ProtVistaStructureAdapter.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
"license": "Apache-2.0",
"gitHead": "726779864966d11f966f337f2dd84aa4f58d944a",
"dependencies": {
"protvista-feature-adapter": "^3.8.10",
"protvista-feature-adapter": "^3.8.11",
"uuid": "^8.3.1"
}
}
2 changes: 1 addition & 1 deletion packages/protvista-structure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protvista-structure",
"version": "3.8.4",
"version": "3.8.11",
"description": "A custom element wrapper for Mol*",
"main": "dist/protvista-structure.js",
"module": "dist/es/protvista-structure.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/protvista-variation-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protvista-variation-adapter",
"version": "3.8.10",
"version": "3.8.11",
"description": "Data adapter for variation data",
"files": [
"dist",
Expand Down Expand Up @@ -34,7 +34,7 @@
"d3-scale": "^3.2.3",
"data-loader": "^3.8.4",
"lodash-es": "^4.17.11",
"protvista-feature-adapter": "^3.8.10",
"protvista-feature-adapter": "^3.8.11",
"protvista-variation": "^3.8.10",
"uuid": "^8.3.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/protvista-vcf-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protvista-vcf-adapter",
"version": "3.8.10",
"version": "3.8.11",
"files": [
"dist",
"types",
Expand Down Expand Up @@ -28,9 +28,9 @@
"dependencies": {
"data-loader": "^3.8.4",
"lit-html": "^1.3.0",
"protvista-feature-adapter": "^3.8.10",
"protvista-feature-adapter": "^3.8.11",
"protvista-variation": "^3.8.10",
"protvista-variation-adapter": "^3.8.10",
"protvista-variation-adapter": "^3.8.11",
"vcftojson": "^1.1.0"
},
"gitHead": "726779864966d11f966f337f2dd84aa4f58d944a"
Expand Down

0 comments on commit 196e101

Please sign in to comment.