Skip to content

Commit

Permalink
feat: home page v2
Browse files Browse the repository at this point in the history
  • Loading branch information
xnought committed May 8, 2024
1 parent e45174b commit 5887241
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 44 deletions.
Binary file added frontend/public/group-2024.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed frontend/src/images/dummy.png
Binary file not shown.
16 changes: 0 additions & 16 deletions frontend/src/images/github.svg

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/lib/BigNavLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
>
<div>
<div class="title-nav">{title}</div>
<div class="desc-nav">{desc}</div>
<div class="desc-nav">{@html desc}</div>
</div>
<div class={hovering ? "arrow-icon-active" : "arrow-icon"}>
<svg
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/lib/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import logo from "../images/logo.svg";
import { links } from "svelte-routing";
import { onMount } from "svelte";
import {
Expand Down Expand Up @@ -29,7 +28,7 @@
<div class="nav-container">
<div id="logo">
<a href="/">
<img src={logo} alt="Venome Logo" />
<img src="logo.svg" alt="Venome Logo" />
</a>
</div>
<div class="nav">
Expand Down
17 changes: 13 additions & 4 deletions frontend/src/lib/venomeMolstarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,17 @@ export function pLDDTToAlphaFoldResidueColors(pLDDT: number[]): ResidueColor[] {
export function pLDDTToResidueColors(pLDDT: number[]): ResidueColor[] {
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 };
});
return colors.map(jsColorToResidueColor);
}

export function jsColorToResidueColor(color: string): ResidueColor {
const rgb = d3.color(color)!.rgb()!;
return { r: rgb.r, g: rgb.g, b: rgb.b };
}

export function colorEntireChain(
color: ResidueColor,
numResiduesInChain: number
) {
return new Array(numResiduesInChain).fill(color);
}
98 changes: 77 additions & 21 deletions frontend/src/routes/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import BigNavLink from "../lib/BigNavLink.svelte";
import Molstar from "../lib/Molstar.svelte";
import ProteinLinkCard from "../lib/ProteinLinkCard.svelte";
import { colorScheme } from "../lib/venomeMolstarUtils";
import { Card } from "flowbite-svelte";
import {
colorEntireChain,
colorScheme,
jsColorToResidueColor,
} from "../lib/venomeMolstarUtils";
import EntryCard from "../lib/EntryCard.svelte";
import * as d3 from "d3";
const quickLinks = [
{
title: "Search for Venom Proteins",
desc: "Search over 400 proteins parasitoid wasp venom proteins using filtering or search.",
desc: "Search over 400 proteins parasitoid wasp venom proteins using filtering or search. <b>Sneak peak below ↓</b>.",
href: "/search",
},
{
Expand All @@ -31,10 +35,20 @@
},
];
let randomProtein: ProteinEntry;
const numRandomProteins = 4;
const homeColorScheme = [
colorScheme[0],
colorScheme[1],
d3.schemeSet1[1],
d3.schemeSet1[0],
]; // add more colors here if you increase numRandomProteins
let randomProteins: ProteinEntry[] = new Array(numRandomProteins).fill(
undefined
);
onMount(async () => {
randomProtein = await Backend.getRandomProtein();
console.log(randomProtein);
for (let i = 0; i < randomProteins.length; i++) {
randomProteins[i] = await Backend.getRandomProtein();
}
});
</script>

Expand Down Expand Up @@ -69,22 +83,17 @@
</div>
</div>

{#if randomProtein}
<div>
<EntryCard title="Random Protein" style="margin-top: 0;">
<div class="flex gap-5">
<div>
<ProteinLinkCard
color={colorScheme[0]}
entry={randomProtein}
/>
</div>
<div class="flex justify-center">
<div class="flex gap-5 flex-wrap content-start">
{#each randomProteins.filter((d) => d !== undefined) as randomProtein, i}
{@const hexColor = homeColorScheme[i]}
<div class="flex gap-5 flex-col">
<div>
<Molstar
format="pdb"
url="{BACKEND_URL}/protein/pdb/{randomProtein.name}"
width={600}
height={500}
width={375}
height={350}
zIndex={990}
hideCanvasControls={[
"animation",
Expand All @@ -93,13 +102,60 @@
"expand",
"controlInfo",
]}
chainColors={{
A: colorEntireChain(
jsColorToResidueColor(hexColor),
randomProtein.length
),
}}
/>
</div>
<ProteinLinkCard color={hexColor} entry={randomProtein} />
</div>
</EntryCard>
{/each}
</div>
{/if}
<div>About us here</div>
</div>
<div>
<EntryCard title="Who created Venome?" style="margin-top: 5px;">
<div>
<div style="font-weight: 300;" class="flex gap-2 flex-col">
<div style="width: 400px;">
<img
src="group-2024.jpg"
width="400"
alt="Founding Venome team picture in 2024."
/>
</div>
<div>
This website started in Fall 2023 as a Senior Computer
Science Capstone project in collaboration with the <a
href="https://venombiochemistrylab.weebly.com/"
target="_blank"
>Venom Biochemistry and Molecular Biology Laboratory</a
> at Oregon State University.
</div>
<div>
Why the name? Just as a collection of genes is a genome,
a collection of venom proteins is a venome.
</div>
<div>
Pictured here, the founding group was <a
href="https://donnybertucci.com"
target="_blank">Donald Bertucci</a
>, Ansen Garvin, Cora Bailey, Amanda Sinha,
<a
href="https://biochem.oregonstate.edu/directory/michael-youkhateh"
target="_blank">Michael Youkhateh</a
>, and
<a
href="https://biochem.oregonstate.edu/directory/nathan-mortimer"
target="_blank">Nathan Mortimer</a
>.
</div>
</div>
</div>
</EntryCard>
</div>
</section>

<style>
Expand Down

0 comments on commit 5887241

Please sign in to comment.