Skip to content

Commit

Permalink
Group feature
Browse files Browse the repository at this point in the history
  • Loading branch information
liambai committed Nov 2, 2024
1 parent 4172719 commit 6d3cfe0
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 36 deletions.
95 changes: 81 additions & 14 deletions viz/src/SAEConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type CuratedFeature = {
name: string;
dim: number;
desc: string;
group?: string;
};

export type SAEConfig = {
Expand All @@ -24,163 +25,229 @@ export const SAE_CONFIGS: Record<string, SAEConfig> = {
name: "free alpha helix",
dim: 2293,
desc: "This feature activates on interspersed amino acids in alpha helices that tend to be isolated from other structures. It alternates between firing strongly and weakly in each turn of the helix.",
group: "structural",
},
{
name: "beta strand channel",
dim: 3883,
desc: "This feature activates on channel-like structures consisting of beta strands. It fires only on a subset of beta strands making up the channel and more strongly one side of the channel.",
group: "structural",
},
{
name: "hugging helices",
dim: 3348,
desc: "This feature activates on the interfacing residues of bunched-together alpha helices. In addition to understanding the geometric orientation of the helices, it seems to also capture the concept of the binding interface because it fires on either a single amino acid or 2 adjacent amino acids depending on the surface exposed to the opposing helix.",
group: "structural",
},
{
name: "long helix every turn",
dim: 214,
desc: "This feature activates on interspersed amino acids in long helices in the pattern 100100010010001..., which corresponds to every turn.",
group: "structural",
},
{
name: "beta strand motif",
dim: 88,
desc: "This feature activates on a specific beta strand motif in ABC transporters. The highlighted beta strand is always the one that opposes an alpha helix.",
group: "structural",
},
{
name: "perpendicular helix",
dim: 2320,
desc: "This feature activates on parts of alpha helices. The highlighted parts tend to be perpendicular to a nearby helix.",
group: "structural",
},
{
name: "single beta strand",
dim: 1299,
desc: "Activates on a single beta strand",
group: "structural",
},
{
name: "helix: first aa",
name: "alpha helix: first aa",
dim: 3451,
desc: "Activates on the first amino acid in a specific alpha helix",
group: "structural",
},
{
name: "beta strand: first aa",
dim: 782,
desc: "Activates on the first amino acid in a specific beta strand",
group: "structural",
},
{
name: "beta helix",
dim: 250,
desc: "Activates on short beta strands in beta helices",
group: "structural",
},
{
name: "alpha helix turn",
dim: 56,
desc: "Activates on the turn between two alpha helices in ABC transporter proteins",
group: "structural",
},
{
name: "long alpha helices",
dim: 1008,
desc: "Activates on most amino acids in long alpha helices",
group: "structural",
},
{
name: "disordered",
dim: 2763,
desc: "Activates on disordered regions containing K, A, and P residues",
group: "structural",
},
{
name: "leucine rich repeats",
dim: 3425,
desc: "Activates on the amino acid before the start of a beta strand in a leucine rich repeat",
group: "structural",
},
{
name: "helix bunch",
dim: 3055,
desc: "Activates on a bunch of alpha helices",
group: "structural",
},
{
name: "start M",
dim: 600,
desc: "Activates on the M amino acid at the start of a sequence",
group: "amino acid position",
},
{
name: "second residue",
dim: 3728,
desc: "Mostly activates on the second amino acid in a sequence",
group: "amino acid position",
},
{
name: "alanine",
dim: 3267,
desc: "Activates on alanine residues",
group: "amino acid identity",
},
{ name: "alanine", dim: 3267, desc: "Activates on alanine residues" },
{
name: "aspartic acid",
dim: 2830,
desc: "Activates on aspartic acid residues",
group: "amino acid identity",
},
{
name: "glutamic acid",
dim: 2152,
desc: "Activates on glutamic acid residues",
group: "amino acid identity",
},
{
name: "phenylalanine",
dim: 252,
desc: "Activates on phenylalanine residues",
group: "amino acid identity",
},
{
name: "aspartic acid",
dim: 3830,
desc: "Activates on aspartic acid residues",
group: "amino acid identity",
},
{
name: "histidine",
dim: 743,
desc: "Activates on histidine residues",
group: "amino acid identity",
},
{ name: "histidine", dim: 743, desc: "Activates on histidine residues" },
{
name: "isoleucine",
dim: 3978,
desc: "Activates on isoleucine residues",
group: "amino acid identity",
},
{
name: "lysine",
dim: 3073,
desc: "Activates on lysine residues",
group: "amino acid identity",
},
{
name: "leucine",
dim: 1497,
desc: "Activates on leucine residues",
group: "amino acid identity",
},
{ name: "lysine", dim: 3073, desc: "Activates on lysine residues" },
{ name: "leucine", dim: 1497, desc: "Activates on leucine residues" },
{
name: "methionine",
dim: 444,
desc: "Activates on methionine residues",
group: "amino acid identity",
},
{
name: "asparagine",
dim: 21,
desc: "Activates on asparagine residues",
group: "amino acid identity",
},
{
name: "proline",
dim: 1386,
desc: "Activates on proline residues",
group: "amino acid identity",
},
{
name: "glutamine",
dim: 1266,
desc: "Activates on glutamine residues",
group: "amino acid identity",
},
{ name: "asparagine", dim: 21, desc: "Activates on asparagine residues" },
{ name: "proline", dim: 1386, desc: "Activates on proline residues" },
{ name: "glutamine", dim: 1266, desc: "Activates on glutamine residues" },
{ name: "arginine", dim: 3569, desc: "Activates on arginine residues" },
{ name: "serine", dim: 1473, desc: "Activates on serine residues" },
{ name: "threonine", dim: 220, desc: "Activates on threonine residues" },
{ name: "valine", dim: 3383, desc: "Activates on valine residues" },
{
name: "tryptophan",
dim: 2685,
desc: "Activates on tryptophan residues",
group: "amino acid identity",
},
{
name: "tyrosine",
dim: 3481,
desc: "Activates on tyrosine residues",
group: "amino acid identity",
},
{ name: "tyrosine", dim: 3481, desc: "Activates on tyrosine residues" },
{
name: "kinase helix",
dim: 594,
desc: "Activates strongly on the C-helix in kinase domains and weakly on surrounding beta strands",
group: "structural",
},
{
name: "kinase beta strands",
dim: 3642,
desc: "Activates on some beta strands in kinase domains and weakly on the C-helix",
group: "structural",
},
{
name: "middle residues in kinase beta strands",
name: "kinase beta mids",
dim: 294,
desc: "Activates on the middle residues in kinase domain beta strands",
group: "structural",
},
{
name: "kinase beta strand",
dim: 3260,
desc: "Activates on a beta strand in kinase domains",
group: "structural",
},
{
name: "kinase beta strand",
dim: 16,
desc: "Activates on a beta strand in kinase domains",
group: "structural",
},
{
name: "beta strand hammock",
dim: 179,
desc: "Activates on a beta strand and the disordered regions at each end",
group: "structural",
},
],
defaultDim: 2293,
Expand Down
62 changes: 40 additions & 22 deletions viz/src/SAEVisualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
SidebarHeader,
SidebarTrigger,
useSidebar,
SidebarGroup,
SidebarGroupLabel,
} from "@/components/ui/sidebar";
import { Separator } from "@/components/ui/separator";
import HomeNavigator from "@/components/HomeNavigator";
Expand Down Expand Up @@ -44,30 +46,46 @@ function FeatureList({ config, feature, setFeature }: FeatureListProps) {
setOpenMobile(false);
};

const groupedFeatures = config.curated?.reduce((acc, feature) => {
const group = feature.group;
if (!acc[group]) acc[group] = [];
acc[group].push(feature);
return acc;
}, {} as Record<string, CuratedFeature[]>);

return (
<ul className="space-y-2 font-medium">
{config.curated?.map((c) => (
<Toggle
key={`feature-${c.dim}`}
style={{ width: "100%", paddingLeft: 20, textAlign: "left" }}
className="justify-start"
pressed={feature === c.dim}
onPressedChange={() => handleFeatureChange(c.dim)}
>
{c.name}
</Toggle>
))}
{Array.from({ length: config.numHiddenDims }, (_, i) => i).map((i) => (
<Toggle
key={`feature-${i}`}
style={{ width: "100%", paddingLeft: 20 }}
className="justify-start"
pressed={feature === i}
onPressedChange={() => handleFeatureChange(i)}
>
{i}
</Toggle>
))}
{groupedFeatures &&
Object.entries(groupedFeatures).map(([group, features]) => (
<SidebarGroup key={group}>
<SidebarGroupLabel>{group}</SidebarGroupLabel>
{features.map((c) => (
<Toggle
key={`feature-${c.dim}`}
style={{ width: "100%", paddingLeft: 20, textAlign: "left" }}
className="justify-start"
pressed={feature === c.dim}
onPressedChange={() => handleFeatureChange(c.dim)}
>
{c.name}
</Toggle>
))}
</SidebarGroup>
))}
<SidebarGroup>
<SidebarGroupLabel>all features</SidebarGroupLabel>
{Array.from({ length: config.numHiddenDims }, (_, i) => i).map((i) => (
<Toggle
key={`feature-${i}`}
style={{ width: "100%", paddingLeft: 20 }}
className="justify-start"
pressed={feature === i}
onPressedChange={() => handleFeatureChange(i)}
>
{i}
</Toggle>
))}
</SidebarGroup>
</ul>
);
}
Expand Down

0 comments on commit 6d3cfe0

Please sign in to comment.