diff --git a/frontend/src/lib/venomeMolstarUtils.ts b/frontend/src/lib/venomeMolstarUtils.ts index 0ffad3e..5ac4e92 100644 --- a/frontend/src/lib/venomeMolstarUtils.ts +++ b/frontend/src/lib/venomeMolstarUtils.ts @@ -132,17 +132,8 @@ export function pLDDTToAlphaFoldResidueColors(pLDDT: number[]): ResidueColor[] { } export function pLDDTToResidueColors(pLDDT: number[]): ResidueColor[] { - const colors = pLDDT.map((d) => { - if (d > 90) { - return alphafoldColorscheme[0]; - } else if (d > 70) { - return alphafoldColorscheme[1]; - } else if (d > 50) { - return alphafoldColorscheme[2]; - } else { - return alphafoldColorscheme[3]; - } - }); + const interpolate = d3.interpolateSpectral; + const colors = pLDDT.map((d) => interpolate(d / 100)); return colors.map((c) => { const rgb = d3.color(c)!.rgb()!; return { r: rgb.r, g: rgb.g, b: rgb.b }; diff --git a/frontend/src/routes/Protein.svelte b/frontend/src/routes/Protein.svelte index c953241..abd692d 100644 --- a/frontend/src/routes/Protein.svelte +++ b/frontend/src/routes/Protein.svelte @@ -13,22 +13,16 @@ import References from "../lib/References.svelte"; import { ChevronDownSolid, - PaletteOutline, PenOutline, - RefreshOutline, UndoOutline, - UndoSolid, } from "flowbite-svelte-icons"; import EntryCard from "../lib/EntryCard.svelte"; import SimilarProteins from "../lib/SimilarProteins.svelte"; import DelayedSpinner from "../lib/DelayedSpinner.svelte"; import { user } from "../lib/stores/user"; import { AccordionItem, Accordion } from "flowbite-svelte"; - import { - pLDDTToAlphaFoldResidueColors, - pLDDTToResidueColors, - } from "../lib/venomeMolstarUtils"; - import type { ChainColors, ChainpLDDT } from "../lib/venomeMolstarUtils"; + import { pLDDTToAlphaFoldResidueColors } from "../lib/venomeMolstarUtils"; + import type { ChainColors } from "../lib/venomeMolstarUtils"; const fileDownloadDropdown = ["pdb", "fasta"]; @@ -187,7 +181,9 @@ pLDDTPerResidue, ] of Object.entries(pLDDTPerChain)) { chainColors[chainId] = - pLDDTToResidueColors(pLDDTPerResidue); + pLDDTToAlphaFoldResidueColors( + pLDDTPerResidue + ); } }} >