lateral knowledge of alphafold so i can answer in my conference topic alphafold

Searching the Web

AlphaFold protein structure prediction overview 2024 2025

Searching PubMed

AlphaFold protein structure prediction

Reading Web Page

https://pmc.ncbi.nlm.nih.gov/articles/PMC12722022/

Reading Article

PMID: 40332289

Here's a comprehensive lateral knowledge guide on AlphaFold for your conference:

AlphaFold — Conference-Ready Knowledge Guide


1. The Problem It Solved: The Protein Folding Problem

  • Proteins are linear chains of amino acids that fold into precise 3D shapes determining their function.
  • Predicting this 3D shape from sequence alone had been unsolved for 50+ years (since Anfinsen's 1972 Nobel Prize-winning insight that sequence determines structure).
  • The Critical Assessment of Protein Structure Prediction (CASP) competition benchmarks progress every 2 years. Before AlphaFold, top models achieved ~40–50 TM-score. AlphaFold2 hit ~92 median GDT score at CASP14 (2020) — a near-experimental-quality leap.
  • As of October 2024, the Protein Data Bank (PDB) holds only ~226,000 experimentally determined structures — covering less than 0.1% of all known protein sequences.

2. The Three Generations

AlphaFold 1 (AF1) — CASP13, 2018

  • Integrated deep learning with evolutionary covariance analysis (co-evolution of paired residues as a structural signal).
  • Predicted interresidue distances using convolutional neural networks.
  • Came 1st at CASP13 but still with significant gaps to experimental accuracy.

AlphaFold 2 (AF2) — CASP14, 2020 → Published Nature 2021

  • Revolutionary architecture: the Evoformer — a deep attention-based transformer that jointly reasons over:
    • A Multiple Sequence Alignment (MSA) representation (evolutionary context across homologs)
    • A pair representation (pairwise residue relationships in 3D space)
  • A Structure Module then builds 3D coordinates using invariant point attention.
  • Key innovation: end-to-end differentiable — the whole pipeline trains together.
  • Achieved near-experimental accuracy (median TM-score ~0.92) — described by CASP assessors as "a solution to the protein folding problem."
  • 2024 Nobel Prize in Chemistry awarded to John Jumper (DeepMind) and Demis Hassabis for AF2 (shared with David Baker for de novo protein design).

AlphaFold 3 (AF3) — Nature, May 2024

  • Built by Google DeepMind + Isomorphic Labs.
  • Core change: replaced the structure module with a diffusion model (similar to image diffusion like DALL-E).
  • Extends beyond proteins to multi-molecular complexes:
    • Protein–protein
    • Protein–DNA/RNA
    • Protein–ligand (small molecules)
    • Post-translational modifications (glycosylation, phosphorylation)
  • Also introduced a Pairformer (lighter replacement for Evoformer).
  • Controversy: initial release was server-only, with restricted weights — criticized for limiting open science (RoseTTAFold All-Atom released open-source around the same time).
  • Later, weights were partially released for non-commercial academic use.

3. The AlphaFold Database (AFDB)

  • Launched 2021 jointly with EMBL-EBI.
  • 2022: expanded to 200 million+ structures covering virtually the entire UniProt.
  • 2024 update: 214 million protein sequences covered, enhanced PAE (Predicted Aligned Error) viewer, Google Cloud Public Dataset access, improved APIs. [PMID: 37933859]
  • 2025 redesign: updated interface, isoform coverage, underlying MSA access, improved APIs. [PMID: 41273079]
  • Structures include a pLDDT score (per-residue confidence, 0–100) and PAE (predicted error between residue pairs, useful for domain boundary identification).

4. Key Technical Concepts to Know

ConceptWhat It Means
pLDDTPer-residue confidence score (>90 = very high, 70–90 = confident, 50–70 = low, <50 = disordered)
PAE (Predicted Aligned Error)Positional error between residue pairs — low PAE = confident relative orientation (key for multi-domain proteins)
MSA (Multiple Sequence Alignment)Evolutionary information from homologs; essential input — fewer homologs = less accurate
EvoformerAF2's transformer block that processes MSA + pair features jointly
Diffusion model (AF3)Denoising approach; generates atomic coordinates from noise conditioned on inputs

5. Applications

Drug Discovery

  • Enables structure-based virtual screening without needing experimental crystallography.
  • Used to predict binding pockets for target proteins with no known structure.
  • Protein–ligand docking in AF3 accelerates early-stage drug design.
  • Companies like Isomorphic Labs, Schrödinger, and Insilico Medicine now routinely use AF predictions.

Fundamental Biology

  • Mapping entire proteomes (structuromes) — organisms whose proteins were structurally unknown are now fully modeled.
  • Studying orphan proteins (no known homolog structure) — now tractable.
  • Understanding disease mutations: predicting how SNPs/missense mutations destabilize protein structure (e.g., TREM2 R47H in Alzheimer's disease).

Synthetic Biology & Protein Design

  • Inverse use: AlphaDesign — using AF as a fitness oracle to guide de novo protein design.
  • RFdiffusion, ProteinMPNN combined with AF2 for protein engineering pipelines.
  • Designing novel enzymes, binders, and vaccines.

Structural Bioinformatics

  • Foldseek: fast protein structure search (Nature Biotechnology 2024) enabled by AF structures.
  • Clustering the entire known protein universe by structure (Nature 2023).
  • Function prediction from predicted structures — binding site prediction at proteome scale.

6. Limitations (Critical for Balanced Conference Discussion)

  1. Disordered regions (IDRs): Intrinsically disordered proteins/regions score low pLDDT but AF gives a static structure — can be misleading.
  2. Conformational flexibility: Predicts one conformation (energy minimum), not the full ensemble. Cannot capture conformational states or allosteric changes easily (though workarounds like MSA subsampling exist).
  3. Novel folds: Proteins with few evolutionary homologs (small MSA) = reduced accuracy. Truly novel folds remain challenging.
  4. Complexes (AF2): AF-Multimer has known failure modes for some homodimers (e.g., flavivirus NS4B) and large assemblies.
  5. Dynamics: Static snapshot — not a substitute for MD simulations or NMR for understanding motion.
  6. AF3 access: Initially restricted weights — ongoing debate about open vs. closed AI in science.
  7. Template-based cases: Traditional homology modeling can still outperform AF3 for some targets with very close experimental templates (e.g., insect odorant receptors).

7. Competing & Complementary Tools

ToolNotes
RoseTTAFold (Baker Lab, UW)Open-source alternative; RoseTTAFold All-Atom (2024) rivals AF3
ESMFold (Meta AI)Language model-based (no MSA needed); fast but lower accuracy
OpenFoldOpen reimplementation of AF2 for research
ColabFoldAF2 with faster MSA via MMseqs2 — democratized access
Chai-12024 startup model for biomolecular complexes

8. The Nobel Prize Context (2024)

The 2024 Nobel Prize in Chemistry was split:
  • ½ to David Baker (University of Washington) — computational protein design
  • ½ to Demis Hassabis & John Jumper (Google DeepMind) — AlphaFold
This is significant because it explicitly validated AI as a chemistry tool, not merely a computational shortcut.

9. Quick Stats for Impact

  • AF2 paper (Jumper et al., Nature 2021) — one of the most cited biology papers of the decade.
  • AF3 paper (Abramson et al., Nature 2024) — protein–ligand docking accuracy comparable to physics-based tools.
  • AFDB covers structures for organisms including humans, E. coli, A. thaliana, and essentially every major model organism.
  • Structural biology output that took the entire PDB 50 years to accumulate was matched in scale within 18 months of AFDB launch.

10. Likely Conference Questions & Talking Points

  • "Is the protein folding problem solved?" → Largely for single-chain static structures, yes. But folding dynamics, disordered proteins, and context-dependent conformations remain open.
  • "What's the difference between AF2 and AF3?" → AF2 = Evoformer + proteins only; AF3 = diffusion model + multi-molecular complexes.
  • "Can you trust the structures?" → Use pLDDT and PAE as guides. High-confidence regions are highly reliable; low-confidence regions need experimental validation.
  • "How does it affect wet lab work?" → Doesn't replace experiments for dynamics/interactions, but massively reduces the need for X-ray crystallography/cryo-EM as a first step.

Key papers to cite:
  • Jumper et al., Nature 2021 — AF2 original paper
  • Abramson et al., Nature 2024 — AF3 original paper (DOI: 10.1038/s41586-024-07487-w)
  • Varadi et al., Nucleic Acids Res 2024 — AFDB 2024 update [PMID: 37933859]
  • Krokidis et al., Int J Mol Sci 2025 — AF3 applications review [PMID: 40332289]

how do i simply explain about how alphafold work in my conference topics

Here's how to explain AlphaFold simply and clearly at a conference — structured from big idea → analogy → mechanism → output, so any audience follows:

How to Simply Explain AlphaFold


Step 1 — Start with the Problem (30 seconds)

"Every protein in your body is a string of amino acids — like beads on a necklace. But that string folds into a very specific 3D shape, and that shape determines what the protein does. If we know the shape, we can understand disease, design drugs, and engineer biology. The problem? Figuring out that 3D shape experimentally takes months and costs tens of thousands of dollars. And we have millions of proteins we've never solved."

Step 2 — The Core Idea (1 minute)

"AlphaFold asks: can we predict the 3D shape just from the sequence of amino acids — using AI?"
Use this analogy:
"Think of it like autocomplete on your phone. Your phone has seen millions of sentences and learned the patterns. AlphaFold has seen millions of protein structures and learned the folding patterns. You give it a new sequence — it predicts the shape."

Step 3 — How It Actually Works (2–3 minutes, the core explanation)

Break it into 3 simple steps:

🔷 Step A — Collect Evolutionary Clues

"AlphaFold doesn't just look at your protein. It searches databases for thousands of related proteins from other species — proteins that evolved from the same ancestor. This is called a Multiple Sequence Alignment (MSA)."
"The key insight: if two amino acids in a protein always change together across evolution — when one mutates, the other mutates too — they're probably physically touching in 3D space. Evolution is telling us about the structure."

🔷 Step B — Run It Through the AI (Evoformer)

"All this evolutionary information is fed into AlphaFold's neural network — called the Evoformer. It's a type of attention-based model (similar to what powers ChatGPT) that reasons about: which amino acids are close to each other? Which are far? What angles do they form?"
Simple analogy:
"Imagine you have 300 people standing in a room and you're trying to figure out who knows who. The Evoformer is continuously asking every person 'who are you most connected to?' and updating everyone's understanding of the whole network — simultaneously, many times over."

🔷 Step C — Build the 3D Structure

"Once AlphaFold has a confident map of which residues interact with which, it assembles the 3D coordinates — placing every atom in space. It even tells you how confident it is at each position using a score called pLDDT (0–100). High score = reliable. Low score = that region is probably floppy or disordered."

Step 4 — What Changed with AlphaFold 3 (30 seconds)

"The latest version, AlphaFold 3, uses a diffusion model — the same type of AI that generates images like DALL-E. Instead of just folding proteins, it can now model proteins bound to DNA, RNA, and small drug molecules all at once. This is a big deal for drug discovery."

Step 5 — The Punchline (30 seconds)

"In 2021, AlphaFold predicted accurate structures for over 200 million proteins in a matter of months — more than the entire 50-year history of experimental biology combined. It won the 2024 Nobel Prize in Chemistry. The protein folding problem, which stumped science for half a century, was essentially solved by a neural network."

One-Slide Visual Flow (for your slides)

Amino acid sequence
        ↓
Search for evolutionary relatives (MSA)
        ↓
Evoformer AI: "Which residues are close? Which interact?"
        ↓
Structure Module: Place every atom in 3D space
        ↓
Output: 3D structure + confidence score (pLDDT)

Audience-Specific Tweaks

AudienceEmphasis
General / non-scientistUse the autocomplete/jigsaw puzzle analogy. Focus on impact (Nobel Prize, drug discovery).
Biology/medicalEmphasize pLDDT, AFDB, disease mutations, drug targets.
CS/AI audienceGo deeper on the transformer architecture, attention mechanism, diffusion model in AF3.
Pharma/industryLead with protein–ligand docking, virtual screening, cost reduction.

The One-Liner to Remember

"AlphaFold reads a protein's evolutionary history like a blueprint, runs it through a transformer AI, and produces a 3D structure in minutes — for free — that used to take years and cost a fortune."

give me details script

Here is a full, detailed conference presentation script you can read, adapt, or memorize:

Full Conference Script — How AlphaFold Works

Estimated delivery time: 10–12 minutes

OPENING — Hook the Audience

"Let me start with a question.
How many of you have heard of the protein folding problem?
(pause for show of hands)
For those who haven't — this was one of the greatest unsolved problems in all of science. It sat unanswered for over 50 years. Thousands of researchers dedicated their entire careers to it. And then in 2020, a team of AI engineers at Google DeepMind — not biologists, not chemists — solved it.
Their tool is called AlphaFold. And today I want to walk you through exactly how it works, why it matters, and why the scientific world called it — and I quote — 'a solution to a 50-year-old grand challenge in biology.'"

SECTION 1 — Setting the Stage: What is a Protein?

"Before we talk about AlphaFold, we need to understand what it's actually predicting. So let me take 60 seconds to explain proteins.
Every living cell — in your body, in a bacterium, in a plant — runs on proteins. Proteins are the machines of life. They carry oxygen in your blood, fight infections, digest your food, send signals between your neurons, and copy your DNA.
Now, a protein starts as a simple chain. A long string of smaller molecules called amino acids — there are 20 different types — linked together like beads on a necklace. A typical protein might have 300 to 1,000 of these beads in a specific order.
But here is the critical thing: that string doesn't stay flat. It folds. It twists and coils and bends into a very precise 3-dimensional shape. And that shape is everything. The shape determines the function. Change the shape — you change or destroy the function. This is why mutations cause disease. A single wrong amino acid can cause the protein to misfold, and that misfolded protein can cause cancer, Alzheimer's, cystic fibrosis.
So if we can look at a protein's sequence and know its shape — we can understand diseases, find drug targets, design new medicines. That is the prize."

SECTION 2 — The Problem: Why Was This So Hard?

"So why did this take 50 years?
The challenge is this: we can easily read a protein's sequence using DNA sequencing — it's fast and cheap. But determining the 3D shape experimentally? That requires techniques like X-ray crystallography, cryo-electron microscopy, or NMR spectroscopy. These methods take months to years per protein. They require specialized equipment. They cost tens of thousands of dollars per structure. And some proteins simply refuse to cooperate with these methods.
As a result, by 2020 — after 50 years of effort — the global Protein Data Bank held about 170,000 experimentally solved protein structures. One hundred and seventy thousand. That sounds like a lot, until you realize there are an estimated 200 to 400 million unique protein sequences in nature.
We had solved less than 0.1 percent of the problem.
The gap between what we know at the sequence level and what we know at the structural level — that gap was enormous. And it was blocking biology, blocking drug discovery, blocking our understanding of life itself.
That gap is what AlphaFold was built to close."

SECTION 3 — The AlphaFold Approach: The Big Idea

"So how does AlphaFold approach this?
The core idea is elegant. And it starts with a profound insight from evolutionary biology.
Here it is: evolution is a record of what works.
When a protein is critical to life, it gets preserved across millions of years of evolution. You and a yeast cell share proteins that are 40% identical — because that protein is so important that evolution couldn't afford to change it much. But it does change a little. Mutations happen. Some mutations are tolerated — the protein still folds and works. Others are lethal — the protein misfolds, the organism dies.
Now here's the genius part. If you look across thousands of species and compare the same protein — you'll notice something. Certain pairs of amino acids always change together. When position 47 mutates from one amino acid to another, position 83 almost always mutates at the same time. Why? Because positions 47 and 83 are physically touching each other in the 3D structure. If you change one without changing the other, the protein breaks. Evolution has been quietly telling us about the 3D structure all along — we just needed a way to listen.
AlphaFold listens."

SECTION 4 — Step-by-Step: How AlphaFold Works

"Let me now walk you through the actual pipeline — step by step.

Step 1 — Input: Give AlphaFold a Sequence

"You start by giving AlphaFold a protein sequence. Just a string of letters — each letter representing one of the 20 amino acids. That's it. That's your only required input.
For example: MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVKVKALPDAQFEVVHSLAKWKRQTLGQHDFSAGEGLYTHMKALRPDEDRLSPLHSVYVDQWDWERVMGDGERQFSTLKSTVEAIWAGIKATEAAVSEEFGLAPFLPDQIHFVHSQELLSRYPDLDAKGRERAIAKDLGAVFLVGIGGKLSDGHRHDVRAPDYDDWSTPSELGHAGLNGDILVWNPRLYANRFNKSGAFKTSQKGLQHGLPVSTDLDAWFKLK
That string of letters is all you give it. What comes out is a 3-dimensional molecular structure."

Step 2 — MSA: Search for Evolutionary Relatives

"AlphaFold's first job is to search massive protein databases — UniRef, UniClust, BFD — and find every protein from every species that is related to your query protein. This search produces what's called a Multiple Sequence Alignment, or MSA.
Think of the MSA as a table. Each row is a different organism's version of your protein. Each column is a position in the sequence. Now you can look down each column and ask: which positions vary together? Which positions are correlated?
This correlation pattern is the evolutionary fingerprint of the 3D structure. AlphaFold turns this into a numerical representation — essentially a two-dimensional map of all pairwise relationships between amino acids."

Step 3 — The Evoformer: The AI Brain

"Now comes the most sophisticated part — the neural network at the heart of AlphaFold 2, called the Evoformer.
The Evoformer is a type of transformer — the same fundamental architecture behind large language models like GPT. If you've used ChatGPT, you've interacted with a transformer. But instead of processing words and sentences, the Evoformer processes amino acids and their relationships.
It takes two inputs simultaneously:
  • The MSA representation — rows of related sequences (the evolutionary context)
  • The pair representation — a matrix capturing how every amino acid relates to every other amino acid
These two inputs talk to each other repeatedly — the Evoformer passes information back and forth between them, updating and refining its understanding in 48 consecutive layers. Each layer is asking: given everything I know, which amino acids are close in space? Which are far? What's the geometry?
By the end of the Evoformer, AlphaFold has built a very detailed internal model of the protein's spatial relationships — even before it's placed a single atom in 3D space.
A simple analogy: imagine you're trying to figure out the layout of a building, but you can't go inside. Instead, you interview thousands of people who've been in similar buildings. The Evoformer is the interview process — gathering clues, cross-referencing, refining — until you have a confident mental map of the interior."

Step 4 — Structure Module: Building the 3D Shape

"Once the Evoformer has its refined representation, it passes everything to the Structure Module.
The Structure Module places every atom in 3D space. It uses a technique called Invariant Point Attention — which means it builds the structure in a way that doesn't depend on arbitrary orientation. Rotate the protein, flip it, mirror it — the physics don't change, and AlphaFold's answer doesn't change either.
It builds the backbone first — the main chain of the protein — and then adds the side chains of each amino acid, placing every carbon, nitrogen, oxygen, and sulfur atom.
This step runs multiple times — the structure feeds back into the representation, the representation refines the structure — three times over, in what AlphaFold calls recycling. Each cycle, the model corrects itself. Like an artist sketching a portrait, then stepping back, then refining, then stepping back again.
The final output is a PDB file — a list of 3D coordinates for every atom in the protein — identical in format to what you'd get from X-ray crystallography."

Step 5 — Confidence Scores

"Critically, AlphaFold also tells you how much to trust each part of its prediction.
Every residue in the structure gets a pLDDT score — which stands for predicted Local Distance Difference Test — on a scale of 0 to 100.
  • Above 90: Very high confidence. You can treat this like an experimental structure.
  • 70 to 90: Good confidence. Generally reliable.
  • 50 to 70: Low confidence. Use with caution — validate experimentally.
  • Below 50: This region is likely intrinsically disordered — it probably doesn't have a fixed shape in real life.
This is visualized in color — blue for high confidence, red for low. When you look at an AlphaFold structure and see a floppy red tail, AlphaFold is telling you: 'I'm not certain here, and that might be biologically meaningful — this region may not have a fixed structure.'
There's also a second confidence metric called PAE — Predicted Aligned Error — which tells you the uncertainty in the relative position between any two residues. This is especially useful when you're looking at multi-domain proteins — it tells you whether two domains have a confident relative orientation, or whether they're flexibly connected."

SECTION 5 — AlphaFold 3: The Next Evolution

"In May 2024, Google DeepMind published AlphaFold 3. And it represents a fundamental architectural shift.
AlphaFold 2 was built for single proteins. AlphaFold 3 was built for molecular complexes — proteins interacting with other proteins, with DNA, with RNA, with small molecule drugs, with post-translational modifications like sugars and phosphate groups.
The technical change is significant: AlphaFold 3 replaces the Structure Module with a diffusion model — the same class of AI that powers image generators like DALL-E and Stable Diffusion.
Here's the intuition: a diffusion model starts with pure noise — random atomic positions — and then gradually denoises, step by step, guided by the model's learned understanding of molecular physics, until a coherent structure emerges.
Why is this powerful? Because it handles chemical diversity. Small molecules, nucleic acids, ions, modified residues — these are all fundamentally different chemistry. The diffusion approach can handle all of them in a unified framework, where the Evoformer-based approach struggled.
For drug discovery, this is transformative. You can now predict how a drug molecule docks inside a protein's binding pocket — without needing to crystallize the complex."

SECTION 6 — The Impact

"Let me put the impact in perspective.
AlphaFold DB — the public database of AlphaFold-predicted structures — launched in 2021 with 350,000 structures. By 2022, it had 200 million. Today it covers over 214 million protein sequences — essentially the entire known protein universe.
Fifty years of experimental structural biology produced 170,000 structures. AlphaFold produced 200 million in 18 months. For free. Accessible to anyone on the planet with an internet connection.
Researchers are now using AlphaFold to:
  • Identify drug targets for neglected tropical diseases where no structural data existed before
  • Understand how cancer mutations destabilize tumor suppressor proteins
  • Design novel enzymes that don't exist in nature
  • Predict antibody-antigen interactions for vaccine design
  • Reannotate entire genomes of organisms we barely understand
In October 2024, the Nobel Committee recognized this by awarding the Nobel Prize in Chemistry — half to Demis Hassabis and John Jumper for AlphaFold, and half to David Baker for computational protein design. It was an explicit Nobel Prize for artificial intelligence applied to fundamental science."

SECTION 7 — Honest Limitations

"I want to be balanced here, because AlphaFold is not magic.
It predicts static structures — a single snapshot. Real proteins are dynamic. They flex, breathe, change shape when they bind a partner, transition between active and inactive forms. AlphaFold gives you the ground-state minimum energy structure. It doesn't give you the movie — just one frame.
Intrinsically disordered proteins — which make up perhaps 30% of the human proteome and are heavily involved in cancer and neurodegeneration — by definition don't have a fixed structure. AlphaFold's predictions for these regions are low confidence, and rightly so. But this means a huge swath of biology is still structurally inaccessible computationally.
Proteins with few evolutionary relatives — novel proteins, synthetic proteins, proteins from poorly sequenced organisms — give AlphaFold less evolutionary signal to work with, and accuracy drops.
And AlphaFold is not a replacement for experiment. It's a starting point. A hypothesis. The pLDDT score tells you how much to trust it, but critical conclusions still need experimental validation.
The tool is extraordinary. But it is a tool, not an oracle."

CLOSING — The One Takeaway

"So let me leave you with this.
For 50 years, the question was: can we read a protein's sequence and know its shape?
AlphaFold answered: yes. By listening to the language of evolution, processing it through a deep transformer AI, and assembling atoms in 3D space — it produces structures of near-experimental quality, in minutes, for any protein on Earth.
It didn't just accelerate structural biology. It democratized it. A researcher in a university with no crystallography lab, no cryo-EM, no million-dollar equipment budget — can now query the structure of any protein in the world in seconds, for free.
That is the significance of AlphaFold. Not just what it solved — but what it opened up.
Thank you."

Quick Reference — Script Timing

SectionContentTime
OpeningHook + question~1 min
Section 1What is a protein?~1.5 min
Section 2Why was this hard?~1.5 min
Section 3The big idea (evolution)~1.5 min
Section 4Step-by-step mechanism~4 min
Section 5AlphaFold 3~1 min
Section 6Impact~1 min
Section 7Limitations~1 min
ClosingTakeaway~30 sec
Total~12–13 min

Tip: For a shorter slot (5–7 min), cut Sections 2 and 7, and condense Section 4 to just Steps 2, 3, and 5.

Generate a PDF summary you can print as speaker notes

Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/alphafold-conference

Writing File

~/alphafold-conference/generate_speaker_notes.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY

OUTPUT = "/home/daytona/workspace/alphafold-conference/AlphaFold_Speaker_Notes.pdf"

# ── Page setup ──────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2*cm, bottomMargin=2*cm,
    title="AlphaFold – Conference Speaker Notes",
    author="Orris AI"
)

W, H = A4

# ── Colour palette ──────────────────────────────────────────────────────────
DEEP_BLUE   = colors.HexColor("#0D3B66")
MID_BLUE    = colors.HexColor("#1565C0")
ACCENT      = colors.HexColor("#1E88E5")
LIGHT_BG    = colors.HexColor("#E3F2FD")
RULE_COLOR  = colors.HexColor("#90CAF9")
WARN_BG     = colors.HexColor("#FFF8E1")
WARN_BORDER = colors.HexColor("#F9A825")
TIP_BG      = colors.HexColor("#E8F5E9")
TIP_BORDER  = colors.HexColor("#2E7D32")
WHITE       = colors.white
DARK_TEXT   = colors.HexColor("#1A1A2E")
MID_TEXT    = colors.HexColor("#37474F")

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

cover_title = ParagraphStyle("CoverTitle",
    fontSize=28, leading=34, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_CENTER, spaceAfter=6)

cover_sub = ParagraphStyle("CoverSub",
    fontSize=13, leading=18, textColor=colors.HexColor("#BBDEFB"),
    fontName="Helvetica", alignment=TA_CENTER, spaceAfter=4)

sec_heading = ParagraphStyle("SecHeading",
    fontSize=13, leading=16, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=0, spaceAfter=0)

sub_heading = ParagraphStyle("SubHeading",
    fontSize=10.5, leading=14, textColor=MID_BLUE,
    fontName="Helvetica-Bold", spaceBefore=8, spaceAfter=3)

script_style = ParagraphStyle("Script",
    fontSize=9.5, leading=14, textColor=DARK_TEXT,
    fontName="Helvetica", alignment=TA_JUSTIFY,
    spaceBefore=2, spaceAfter=4,
    leftIndent=10, rightIndent=4)

bullet_style = ParagraphStyle("Bullet",
    fontSize=9.5, leading=14, textColor=MID_TEXT,
    fontName="Helvetica", bulletIndent=6,
    leftIndent=18, spaceBefore=2, spaceAfter=2)

tip_style = ParagraphStyle("Tip",
    fontSize=9, leading=13, textColor=colors.HexColor("#1B5E20"),
    fontName="Helvetica-Oblique", leftIndent=6, rightIndent=6,
    spaceBefore=2, spaceAfter=2)

warn_style = ParagraphStyle("Warn",
    fontSize=9, leading=13, textColor=colors.HexColor("#E65100"),
    fontName="Helvetica-Oblique", leftIndent=6, rightIndent=6,
    spaceBefore=2, spaceAfter=2)

normal = ParagraphStyle("N",
    fontSize=9.5, leading=14, textColor=DARK_TEXT,
    fontName="Helvetica", spaceBefore=2, spaceAfter=2)

small_center = ParagraphStyle("SmallCenter",
    fontSize=8, leading=11, textColor=MID_TEXT,
    fontName="Helvetica", alignment=TA_CENTER)

footer_style = ParagraphStyle("Footer",
    fontSize=7.5, textColor=colors.HexColor("#90A4AE"),
    fontName="Helvetica", alignment=TA_CENTER)

# ── Helper builders ──────────────────────────────────────────────────────────
def section_header(number, title, subtitle=""):
    """Blue banner header for each section."""
    label = f"SECTION {number}  |  {title.upper()}"
    inner = [Paragraph(label, sec_heading)]
    if subtitle:
        inner.append(Paragraph(subtitle, ParagraphStyle("SH2",
            fontSize=8, textColor=colors.HexColor("#BBDEFB"),
            fontName="Helvetica", alignment=TA_LEFT)))
    tbl = Table([[inner]], colWidths=[16.6*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DEEP_BLUE),
        ("ROUNDEDCORNERS", [4]),
        ("TOPPADDING",    (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return tbl

def tip_box(text):
    tbl = Table([[Paragraph("💡  " + text, tip_style)]], colWidths=[16.6*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), TIP_BG),
        ("LINEAFTER",     (0,0), (0,-1), 3, TIP_BORDER),
        ("LINEBEFORE",    (0,0), (0,-1), 3, TIP_BORDER),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ]))
    return tbl

def warn_box(text):
    tbl = Table([[Paragraph("⚠  " + text, warn_style)]], colWidths=[16.6*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), WARN_BG),
        ("LINEBEFORE",    (0,0), (0,-1), 3, WARN_BORDER),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ]))
    return tbl

def quote_box(text):
    q = ParagraphStyle("Q", fontSize=9.5, leading=14,
        textColor=DEEP_BLUE, fontName="Helvetica-Oblique",
        leftIndent=8, rightIndent=8, spaceBefore=2, spaceAfter=2)
    tbl = Table([[Paragraph('" ' + text + ' "', q)]], colWidths=[16.6*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), LIGHT_BG),
        ("LINEBEFORE",    (0,0), (0,-1), 4, ACCENT),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
    ]))
    return tbl

def bullets(items):
    out = []
    for item in items:
        out.append(Paragraph("•  " + item, bullet_style))
    return out

def hr():
    return HRFlowable(width="100%", thickness=0.5,
                      color=RULE_COLOR, spaceAfter=6, spaceBefore=6)

def sp(h=6):
    return Spacer(1, h)

# ────────────────────────────────────────────────────────────────────────────
# BUILD STORY
# ────────────────────────────────────────────────────────────────────────────
story = []

# ═══════════════════════════════════════════════════════════════════════════
# COVER PAGE
# ═══════════════════════════════════════════════════════════════════════════
cover_data = [[
    Paragraph("AlphaFold", cover_title),
    Paragraph("Conference Speaker Notes", cover_sub),
    Paragraph("How AlphaFold Works — Full Presentation Script", cover_sub),
    sp(10),
    Paragraph("Estimated Delivery: 10–12 minutes", cover_sub),
    Paragraph("Prepared by Orris AI  •  May 2026", small_center),
]]
cover_tbl = Table([cover_data[0]], colWidths=[16.6*cm])
cover_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), DEEP_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 40),
    ("BOTTOMPADDING", (0,0), (-1,-1), 40),
    ("LEFTPADDING",   (0,0), (-1,-1), 20),
    ("RIGHTPADDING",  (0,0), (-1,-1), 20),
    ("ROUNDEDCORNERS", [8]),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(sp(30))
story.append(cover_tbl)
story.append(sp(20))

# Timing table on cover
timing_data = [
    [Paragraph("<b>Section</b>", normal), Paragraph("<b>Content</b>", normal), Paragraph("<b>Time</b>", normal)],
    ["Opening",     "Hook + question to audience",          "~1 min"],
    ["Section 1",   "What is a protein?",                   "~1.5 min"],
    ["Section 2",   "Why was this hard?",                   "~1.5 min"],
    ["Section 3",   "The big idea (evolution)",             "~1.5 min"],
    ["Section 4",   "Step-by-step mechanism (5 steps)",     "~4 min"],
    ["Section 5",   "AlphaFold 3",                          "~1 min"],
    ["Section 6",   "Impact & Nobel Prize",                 "~1 min"],
    ["Section 7",   "Limitations",                          "~1 min"],
    ["Closing",     "The one takeaway",                     "~30 sec"],
    [Paragraph("<b>Total</b>", normal), "", Paragraph("<b>~12–13 min</b>", normal)],
]
t = Table(timing_data, colWidths=[3.5*cm, 9.5*cm, 3.6*cm])
t.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), MID_BLUE),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1), (-1,-2), [colors.white, LIGHT_BG]),
    ("BACKGROUND",    (0,-1), (-1,-1), colors.HexColor("#CFD8DC")),
    ("FONTNAME",      (0,-1), (-1,-1), "Helvetica-Bold"),
    ("GRID",          (0,0), (-1,-1), 0.4, RULE_COLOR),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("ALIGN",         (2,0), (2,-1), "CENTER"),
]))
story.append(Paragraph("Presentation Timing Guide", sub_heading))
story.append(t)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# OPENING
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("OPEN", "Opening Hook", "~1 minute"))
story.append(sp(6))
story.append(tip_box("Ask the audience to raise their hands. Pause. Make eye contact. Set the tone."))
story.append(sp(4))
story.append(quote_box(
    "Let me start with a question. How many of you have heard of the protein folding problem? "
    "[pause for hands] For those who haven't — this was one of the greatest unsolved problems in all of "
    "science. It sat unanswered for over 50 years. Thousands of researchers dedicated their entire careers "
    "to it. And then in 2020, a team of AI engineers at Google DeepMind — not biologists, not chemists — "
    "solved it. Their tool is called AlphaFold. Today I want to walk you through exactly how it works, "
    "why it matters, and why the scientific world called it 'a solution to a 50-year-old grand challenge in biology.'"
))
story.append(sp(8))

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 1
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("1", "What is a Protein?", "~1.5 minutes"))
story.append(sp(6))
story.append(tip_box("Keep this simple. Non-scientists must feel confident before the AI explanation."))
story.append(sp(4))
story.append(quote_box(
    "Every living cell runs on proteins. Proteins are the machines of life — they carry oxygen in your blood, "
    "fight infections, digest your food, send signals between neurons, and copy your DNA. "
    "A protein starts as a chain of amino acids — 20 different types — linked like beads on a necklace. "
    "A typical protein has 300 to 1,000 beads in a specific order. "
    "But that string doesn't stay flat. It folds into a precise 3-dimensional shape. And that shape is everything. "
    "The shape determines the function. A single wrong amino acid can cause misfolding — leading to cancer, "
    "Alzheimer's, cystic fibrosis. So if we know the shape, we can understand disease, find drug targets, "
    "and design new medicines. That is the prize."
))
story.append(sp(4))
story.append(Paragraph("Key facts to remember:", sub_heading))
story.append(*[bullets([
    "20 types of amino acids — combined in sequences of hundreds to thousands",
    "3D shape = function. Wrong shape = disease.",
    "Sequence is easy to read (DNA sequencing). Structure is hard to determine.",
])])
story.append(sp(8))

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 2
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("2", "Why Was This So Hard?", "~1.5 minutes"))
story.append(sp(6))
story.append(quote_box(
    "Determining a 3D protein shape experimentally requires X-ray crystallography, cryo-EM, or NMR. "
    "These take months to years per protein, cost tens of thousands of dollars, and some proteins simply "
    "refuse to cooperate. After 50 years of effort, the Protein Data Bank held about 170,000 structures. "
    "That sounds like a lot — until you realize there are 200 to 400 million unique protein sequences in nature. "
    "We had solved less than 0.1 percent of the problem. That gap was blocking biology, drug discovery, "
    "and our understanding of life itself. That gap is what AlphaFold was built to close."
))
story.append(sp(4))
story.append(warn_box("Stat to know: PDB = ~170,000 structures (50 years). AlphaFold DB = 214 million structures (18 months)."))
story.append(sp(8))

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 3
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("3", "The Big Idea — Evolution as a Blueprint", "~1.5 minutes"))
story.append(sp(6))
story.append(tip_box("This is the conceptual heart. Slow down here. Let the evolution insight land."))
story.append(sp(4))
story.append(quote_box(
    "The core idea is elegant. It starts with a profound insight from evolutionary biology: "
    "evolution is a record of what works. If two amino acids always change together across millions of years "
    "of evolution — when position 47 mutates, position 83 almost always mutates at the same time — "
    "why? Because they are physically touching in 3D space. If you change one without changing the other, "
    "the protein breaks and the organism dies. Evolution has been quietly telling us about the 3D structure "
    "all along. We just needed a way to listen. AlphaFold listens."
))
story.append(sp(8))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 4
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("4", "How AlphaFold Works — Step by Step", "~4 minutes  |  The core of your talk"))
story.append(sp(6))

# Flow diagram
flow_data = [
    ["1. Amino acid sequence (input)"],
    ["2. Search databases → Multiple Sequence Alignment (MSA)"],
    ["3. Evoformer AI → pairwise residue relationships"],
    ["4. Structure Module → place every atom in 3D"],
    ["5. Output: PDB file + pLDDT confidence score"],
]
flow_styles = [
    colors.HexColor("#0D3B66"),
    colors.HexColor("#1565C0"),
    colors.HexColor("#1976D2"),
    colors.HexColor("#1E88E5"),
    colors.HexColor("#42A5F5"),
]
flow_rows = []
for i, (row, bg) in enumerate(zip(flow_data, flow_styles)):
    p = ParagraphStyle("FL", fontSize=9, fontName="Helvetica-Bold",
        textColor=WHITE, alignment=TA_CENTER)
    flow_rows.append([Paragraph(f"STEP {i+1}   |   " + row[0], p)])
ft = Table(flow_rows, colWidths=[16.6*cm])
ft_style = TableStyle([
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 12),
])
for i, bg in enumerate(flow_styles):
    ft_style.add("BACKGROUND", (0,i), (-1,i), bg)
ft.setStyle(ft_style)
story.append(ft)
story.append(sp(8))

# Step 1
story.append(Paragraph("Step 1 — Input: Give AlphaFold a Sequence", sub_heading))
story.append(quote_box(
    "You give AlphaFold a protein sequence — just a string of letters, each representing one of the "
    "20 amino acids. That is your only required input. What comes out is a complete 3-dimensional molecular structure."
))
story.append(sp(6))

# Step 2
story.append(Paragraph("Step 2 — Collect Evolutionary Clues (MSA)", sub_heading))
story.append(quote_box(
    "AlphaFold searches massive protein databases — UniRef, BFD — and finds every related protein "
    "from every species. This produces a Multiple Sequence Alignment, or MSA. Think of it as a table: "
    "each row is a different organism's version of your protein. Positions that vary together across "
    "evolution are physically touching in 3D. That co-evolution signal is the fingerprint of the structure."
))
story.append(sp(6))

# Step 3
story.append(Paragraph("Step 3 — The Evoformer AI", sub_heading))
story.append(quote_box(
    "This is fed into AlphaFold's neural network — the Evoformer. It's a transformer, the same "
    "architecture behind ChatGPT. But instead of words, it processes amino acid relationships. "
    "It holds two things simultaneously: the MSA (evolutionary context) and a pair matrix (every "
    "amino acid against every other). These two talk to each other across 48 layers, asking: which "
    "residues are close? What angles do they form? Imagine 300 people in a room — the Evoformer "
    "continuously asks everyone 'who are you connected to?' and updates the whole network simultaneously, "
    "until it has a confident spatial map of the entire protein."
))
story.append(sp(4))
story.append(tip_box("Analogy for AI audience: Evoformer = cross-attention between MSA rows and pair matrix. 48 layers deep."))
story.append(sp(6))

# Step 4
story.append(Paragraph("Step 4 — Build the 3D Structure (Structure Module)", sub_heading))
story.append(quote_box(
    "The Structure Module places every atom in 3D space using Invariant Point Attention — "
    "which means the answer doesn't change no matter how you rotate or orient the protein. "
    "It builds the backbone first, then adds side chains. The whole thing runs three times — "
    "each cycle the structure feeds back and refines itself. Like an artist sketching, stepping back, "
    "then refining. Final output: a PDB file identical in format to experimental X-ray crystallography data."
))
story.append(sp(6))

# Step 5
story.append(Paragraph("Step 5 — Confidence Scores (pLDDT and PAE)", sub_heading))
story.append(sp(4))

conf_data = [
    [Paragraph("<b>pLDDT Score</b>", normal), Paragraph("<b>Meaning</b>", normal), Paragraph("<b>Color</b>", normal)],
    ["> 90",   "Very high — treat like experimental structure",  "Dark blue"],
    ["70–90",  "Confident — generally reliable",                "Light blue"],
    ["50–70",  "Low confidence — use with caution",             "Yellow"],
    ["< 50",   "Likely disordered — no fixed shape in reality", "Orange/Red"],
]
ct = Table(conf_data, colWidths=[2.8*cm, 10.2*cm, 3.6*cm])
ct.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), MID_BLUE),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, LIGHT_BG]),
    ("GRID",          (0,0), (-1,-1), 0.4, RULE_COLOR),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
]))
story.append(ct)
story.append(sp(4))
story.append(quote_box(
    "Every residue gets a pLDDT score from 0 to 100. High = trust it. Low = that region is likely "
    "floppy or disordered — and that's biologically meaningful, not a failure. There's also PAE — "
    "Predicted Aligned Error — which tells you how confident AlphaFold is about the relative position "
    "of two residues. Critical for multi-domain proteins."
))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 5
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("5", "AlphaFold 3 — The Next Evolution", "~1 minute"))
story.append(sp(6))

af_compare = [
    [Paragraph("<b>Feature</b>", normal), Paragraph("<b>AlphaFold 2</b>", normal), Paragraph("<b>AlphaFold 3</b>", normal)],
    ["Architecture",      "Evoformer + Structure Module",          "Evoformer + Diffusion Model"],
    ["Molecules handled", "Proteins only",                         "Proteins, DNA, RNA, ligands, PTMs"],
    ["Drug docking",      "Limited (AF-Multimer)",                 "Native protein-ligand prediction"],
    ["Published",         "Nature 2021 (Jumper et al.)",           "Nature May 2024 (Abramson et al.)"],
    ["Access",            "Open source weights",                   "Restricted weights (non-commercial)"],
]
at = Table(af_compare, colWidths=[3.8*cm, 6.4*cm, 6.4*cm])
at.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DEEP_BLUE),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, LIGHT_BG]),
    ("GRID",          (0,0), (-1,-1), 0.4, RULE_COLOR),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
]))
story.append(at)
story.append(sp(6))
story.append(quote_box(
    "AlphaFold 3 uses a diffusion model — the same class of AI that generates images like DALL-E. "
    "It starts with random atomic noise and denoises, step by step, until a coherent structure emerges. "
    "This handles chemical diversity: proteins, DNA, RNA, small molecule drugs — all in one unified framework. "
    "For drug discovery, this is transformative. You can now predict how a drug docks inside a binding pocket "
    "without needing to crystallize the complex."
))
story.append(sp(8))

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 6
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("6", "The Impact", "~1 minute"))
story.append(sp(6))
story.append(quote_box(
    "AlphaFold DB launched in 2021 with 350,000 structures. By 2022 — 200 million. Today: 214 million "
    "protein sequences covered. Fifty years of experimental biology produced 170,000 structures. "
    "AlphaFold produced 200 million in 18 months. For free. Accessible to anyone on Earth. "
    "In October 2024, the Nobel Prize in Chemistry went to Demis Hassabis and John Jumper for AlphaFold, "
    "and to David Baker for computational protein design. An explicit Nobel Prize for artificial intelligence "
    "applied to fundamental science."
))
story.append(sp(4))
story.append(Paragraph("Applications:", sub_heading))
for b in bullets([
    "Drug discovery: structure-based virtual screening without crystallography",
    "Disease research: how mutations destabilize proteins (cancer, Alzheimer's, etc.)",
    "Synthetic biology: designing novel enzymes and binders that don't exist in nature",
    "Vaccine design: predicting antibody-antigen interactions",
    "Genome annotation: understanding proteins from poorly studied organisms",
]):
    story.append(b)
story.append(sp(8))

# ═══════════════════════════════════════════════════════════════════════════
# SECTION 7
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("7", "Honest Limitations", "~1 minute"))
story.append(sp(6))
story.append(tip_box("This shows intellectual honesty. Audiences trust speakers who acknowledge limits."))
story.append(sp(4))
story.append(quote_box(
    "AlphaFold is not magic. It predicts static structures — one snapshot. Real proteins are dynamic. "
    "They flex, change shape when binding partners, transition between active and inactive states. "
    "AlphaFold gives you one frame — not the movie. Intrinsically disordered proteins — 30% of the human "
    "proteome — don't have fixed shapes. AlphaFold's low pLDDT correctly flags these, but cannot resolve them. "
    "Proteins with few evolutionary relatives have less MSA signal and lower accuracy. "
    "And AlphaFold is not a replacement for experiment. It is a hypothesis generator. High-confidence "
    "regions are highly reliable. Critical conclusions still need experimental validation."
))
story.append(sp(4))

lim_data = [
    [Paragraph("<b>Limitation</b>", normal), Paragraph("<b>Why it matters</b>", normal)],
    ["Static structure only",       "Cannot capture conformational dynamics or allosteric changes"],
    ["Disordered proteins (IDRs)",  "~30% of human proteome lacks fixed shape — pLDDT flags this"],
    ["Rare/novel proteins",         "Small MSA = less evolutionary signal = lower accuracy"],
    ["AF-Multimer failures",        "Some homodimers and large assemblies are predicted incorrectly"],
    ["AF3 access restrictions",     "Weights non-commercial only — open science debate ongoing"],
]
lt = Table(lim_data, colWidths=[5*cm, 11.6*cm])
lt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#B71C1C")),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, WARN_BG]),
    ("GRID",          (0,0), (-1,-1), 0.4, RULE_COLOR),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
]))
story.append(lt)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# CLOSING
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("CLOSE", "Closing — The One Takeaway", "~30 seconds"))
story.append(sp(8))
story.append(quote_box(
    "For 50 years, the question was: can we read a protein's sequence and know its shape? "
    "AlphaFold answered: yes. By listening to the language of evolution, processing it through a deep "
    "transformer AI, and assembling atoms in 3D space — it produces structures of near-experimental quality, "
    "in minutes, for any protein on Earth. "
    "It didn't just accelerate structural biology. It democratized it. A researcher in a university with "
    "no crystallography lab, no cryo-EM, no million-dollar equipment — can now query the structure of any "
    "protein in the world in seconds, for free. "
    "That is the significance of AlphaFold. Not just what it solved — but what it opened up. Thank you."
))
story.append(sp(16))

# BIG ONE-LINER BOX
oneliner_p = ParagraphStyle("OL",
    fontSize=12, leading=18, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_CENTER)
ol_tbl = Table([[Paragraph(
    '"AlphaFold reads a protein\'s evolutionary history like a blueprint, runs it through a transformer AI, '
    'and produces a 3D structure in minutes — for free — that used to take years and cost a fortune."',
    oneliner_p)]], colWidths=[16.6*cm])
ol_tbl.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), DEEP_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 18),
    ("BOTTOMPADDING", (0,0), (-1,-1), 18),
    ("LEFTPADDING",   (0,0), (-1,-1), 16),
    ("RIGHTPADDING",  (0,0), (-1,-1), 16),
    ("ROUNDEDCORNERS", [6]),
]))
story.append(Paragraph("The One-Liner to Remember:", sub_heading))
story.append(ol_tbl)
story.append(sp(10))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# Q&A PREP PAGE
# ═══════════════════════════════════════════════════════════════════════════
qa_header_style = ParagraphStyle("QAH",
    fontSize=11, fontName="Helvetica-Bold", textColor=DEEP_BLUE, spaceBefore=10, spaceAfter=4)
qa_a_style = ParagraphStyle("QAA",
    fontSize=9.5, leading=14, fontName="Helvetica", textColor=DARK_TEXT,
    leftIndent=12, spaceBefore=2, spaceAfter=6)
qa_q_style = ParagraphStyle("QAQ",
    fontSize=10, leading=14, fontName="Helvetica-Bold", textColor=MID_BLUE,
    spaceBefore=8, spaceAfter=2)

story.append(section_header("Q&A", "Likely Conference Questions — Prepared Answers", ""))
story.append(sp(8))

qas = [
    ("Is the protein folding problem fully solved?",
     "For single-chain static structures — largely yes. But conformational dynamics, intrinsically "
     "disordered proteins, and context-dependent folding remain open. The 'problem' has many dimensions. "
     "AlphaFold solved the core prediction challenge with remarkable accuracy."),

    ("What's the difference between AlphaFold 2 and 3?",
     "AF2 uses an Evoformer + Structure Module; works on proteins only. AF3 replaces the structure module "
     "with a diffusion model and handles proteins, DNA, RNA, small molecules, and post-translational "
     "modifications — making it far more relevant for drug discovery."),

    ("Can you trust AlphaFold structures?",
     "Use pLDDT and PAE as guides. Regions above 90 pLDDT are highly reliable — comparable to experimental "
     "structures. Below 70, treat with caution. Below 50, the region is likely disordered. Always validate "
     "critical conclusions experimentally."),

    ("Does AlphaFold replace wet lab experiments?",
     "No — it complements them. It provides a rapid, free structural hypothesis that guides experimental "
     "design. It dramatically reduces the need for crystallography as a first step, but doesn't replace "
     "experiments for dynamics, interactions in cellular context, or novel fold verification."),

    ("Why did it win the Nobel Prize and not just a regular award?",
     "The Nobel Committee explicitly recognized that this was a solution to a 50-year grand scientific challenge. "
     "The scale of impact — 214 million structures, democratized access, drug discovery acceleration — "
     "made it a transformational scientific contribution, not just a software improvement."),

    ("What is RoseTTAFold / ESMFold — are they competitors?",
     "RoseTTAFold (David Baker's lab) is an open-source alternative with similar accuracy. RoseTTAFold All-Atom "
     "(2024) rivals AF3 for complexes. ESMFold (Meta) uses a protein language model without MSA — much faster "
     "but less accurate. These tools are complementary — researchers often use all of them."),
]

for q, a in qas:
    story.append(KeepTogether([
        Paragraph("Q: " + q, qa_q_style),
        Paragraph("A: " + a, qa_a_style),
        hr(),
    ]))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# KEY REFERENCES
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("REF", "Key References to Cite", ""))
story.append(sp(8))

refs = [
    ("AlphaFold 2 — Original Paper",
     "Jumper J et al. Highly accurate protein structure prediction with AlphaFold. "
     "Nature 596, 583–589 (2021). doi: 10.1038/s41586-021-03819-2"),
    ("AlphaFold 3 — Original Paper",
     "Abramson J et al. Accurate structure prediction of biomolecular interactions with AlphaFold 3. "
     "Nature 630, 493–500 (2024). doi: 10.1038/s41586-024-07487-w"),
    ("AlphaFold DB — 2024 Update",
     "Varadi M et al. AlphaFold Protein Structure Database in 2024: providing structure coverage for "
     "over 214 million protein sequences. Nucleic Acids Res 52(D1):D368–D375 (2024). PMID: 37933859"),
    ("AlphaFold 3 Applications Review",
     "Krokidis MG et al. AlphaFold3: An Overview of Applications and Performance Insights. "
     "Int J Mol Sci 26(8):3671 (2025). PMID: 40332289"),
    ("AlphaFold DB — 2025 Update",
     "Fleming J et al. AlphaFold Protein Structure Database 2025: a redesigned interface and updated "
     "structural coverage. J Mol Biol 437(15):168967 (2025). PMID: 41273079"),
]

ref_data = [[Paragraph("<b>#</b>", normal), Paragraph("<b>Citation</b>", normal)]]
for i, (title, citation) in enumerate(refs, 1):
    ref_data.append([
        Paragraph(f"[{i}]", normal),
        [Paragraph(title, ParagraphStyle("RT", fontSize=9.5, fontName="Helvetica-Bold",
                                          textColor=DEEP_BLUE, spaceBefore=0, spaceAfter=1)),
         Paragraph(citation, ParagraphStyle("RC", fontSize=8.5, fontName="Helvetica",
                                             textColor=MID_TEXT, leading=12))],
    ])
rt = Table(ref_data, colWidths=[1.2*cm, 15.4*cm])
rt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DEEP_BLUE),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,-1), 9),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, LIGHT_BG]),
    ("GRID",          (0,0), (-1,-1), 0.4, RULE_COLOR),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
]))
story.append(rt)
story.append(sp(16))
story.append(hr())
story.append(sp(4))
story.append(Paragraph(
    "AlphaFold Speaker Notes  •  Orris AI  •  May 2026  •  Prepared for conference use",
    footer_style))

# ═══════════════════════════════════════════════════════════════════════════
# BUILD
# ═══════════════════════════════════════════════════════════════════════════
doc.build(story)
print(f"PDF saved: {OUTPUT}")
Running Command

cd /home/daytona/workspace/alphafold-conference && python generate_speaker_notes.py

Editing File

~/alphafold-conference/generate_speaker_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_speaker_notes.py'
Editing File

~/alphafold-conference/generate_speaker_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_speaker_notes.py'
Editing File

~/alphafold-conference/generate_speaker_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_speaker_notes.py'
Editing File

~/alphafold-conference/generate_speaker_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_speaker_notes.py'
Editing File

~/alphafold-conference/generate_speaker_notes.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_speaker_notes.py'
Running Command

cd /home/daytona/workspace/alphafold-conference && python generate_speaker_notes.py

Your PDF is ready:

AlphaFold Speaker Notes

PDF Document · PDF


Here's what's included across the pages:
PageContent
1 — CoverTitle page + full timing guide table (all sections with durations)
2 — Sections 1–3Script for Opening, What is a Protein, Why Was This Hard, The Big Idea
3 — Section 4Step-by-step flow diagram + full script for all 5 steps including pLDDT confidence table
4 — Sections 5–7AF2 vs AF3 comparison table, Impact stats, Limitations table
5 — ClosingFull closing script + the one-liner box in bold blue
6 — Q&A Prep6 likely audience questions with prepared answers
7 — References5 key papers to cite with full citations and PMIDs
Print it double-sided and you have a compact speaker notes packet you can hold at the podium.

Create a matching PowerPoint presentation with visuals for each section

Reading File
Reading File
Reading File
Writing File

~/alphafold-conference/generate_presentation.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "AlphaFold – How It Works";
pres.author = "Conference Presentation";
pres.subject = "AlphaFold Protein Structure Prediction";

// ── COLOUR PALETTE ──────────────────────────────────────────────────────────
const C = {
  navy:      "0D2B4E",  // dominant dark bg
  deepblue:  "0D3B66",  // section banners
  midblue:   "1565C0",  // accents
  skyblue:   "1E88E5",  // lighter accent
  lightblue: "90CAF9",  // subtle highlights
  paleblue:  "E3F2FD",  // card bg
  white:     "FFFFFF",
  offwhite:  "F0F6FF",
  gold:      "FFB300",  // Nobel Prize accent
  orange:    "E65100",  // warnings/limitations
  green:     "2E7D32",  // tips / positive
  lightgold: "FFF8E1",
  darktext:  "1A1A2E",
  midgrey:   "546E7A",
};

// ── HELPERS ──────────────────────────────────────────────────────────────────

/** Full-slide dark gradient background using overlapping shapes */
function darkBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: C.navy }, line: { color: C.navy },
  });
}

/** Full-slide light background */
function lightBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: C.offwhite }, line: { color: C.offwhite },
  });
}

/** Slim accent bar at top of slide */
function topBar(slide, color = C.skyblue, h = 0.06) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h,
    fill: { color }, line: { color },
  });
}

/** Slide number + footer */
function footer(slide, num, total, label = "") {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.35, w: 10, h: 0.275,
    fill: { color: C.deepblue }, line: { color: C.deepblue },
  });
  if (label) {
    slide.addText(label.toUpperCase(), {
      x: 0.25, y: 5.36, w: 7, h: 0.25,
      fontSize: 7, color: C.lightblue, bold: true,
      charSpacing: 2, valign: "middle",
    });
  }
  slide.addText(`${num} / ${total}`, {
    x: 8.8, y: 5.36, w: 0.95, h: 0.25,
    fontSize: 8, color: C.lightblue, align: "right", valign: "middle",
  });
}

/** Blue section label pill */
function sectionPill(slide, text, x = 0.35, y = 0.2) {
  const w = text.length * 0.09 + 0.4;
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w, h: 0.28,
    fill: { color: C.skyblue }, line: { color: C.skyblue }, rectRadius: 0.04,
  });
  slide.addText(text.toUpperCase(), {
    x, y, w, h: 0.28,
    fontSize: 7.5, color: C.white, bold: true, align: "center",
    valign: "middle", charSpacing: 1.5, margin: 0,
  });
}

/** Slide title on dark bg */
function darkTitle(slide, title, sub = "", y = 0.55) {
  slide.addText(title, {
    x: 0.45, y, w: 9.1, h: 0.7,
    fontSize: 28, color: C.white, bold: true,
    fontFace: "Calibri", margin: 0,
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.45, y: y + 0.72, w: 9.1, h: 0.38,
      fontSize: 14, color: C.lightblue,
      fontFace: "Calibri", margin: 0,
    });
  }
}

/** Slide title on light bg */
function lightTitle(slide, title, sub = "") {
  topBar(slide, C.midblue, 0.07);
  slide.addText(title, {
    x: 0.45, y: 0.2, w: 9.1, h: 0.65,
    fontSize: 26, color: C.deepblue, bold: true,
    fontFace: "Calibri", margin: 0,
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.45, y: 0.82, w: 9.1, h: 0.32,
      fontSize: 12, color: C.midgrey, fontFace: "Calibri", margin: 0,
    });
  }
}

/** Divider rule */
function rule(slide, y, color = C.lightblue, x = 0.45, w = 9.1) {
  slide.addShape(pres.shapes.LINE, {
    x, y, w, h: 0,
    line: { color, width: 0.8 },
  });
}

/** Card box */
function card(slide, x, y, w, h, fill = C.white, radius = 0.08) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w, h,
    fill: { color: fill },
    line: { color: C.lightblue, width: 0.5 },
    rectRadius: radius,
    shadow: { type: "outer", color: "000000", blur: 8, offset: 2, angle: 135, opacity: 0.08 },
  });
}

/** Step box – numbered circle + right content */
function stepBox(slide, num, title, body, x, y, w, h, accent = C.skyblue) {
  card(slide, x, y, w, h, C.white);
  // circle
  slide.addShape(pres.shapes.ELLIPSE, {
    x: x + 0.15, y: y + 0.15, w: 0.52, h: 0.52,
    fill: { color: accent }, line: { color: accent },
  });
  slide.addText(String(num), {
    x: x + 0.15, y: y + 0.15, w: 0.52, h: 0.52,
    fontSize: 16, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
  });
  // title
  slide.addText(title, {
    x: x + 0.78, y: y + 0.12, w: w - 0.9, h: 0.3,
    fontSize: 11, color: C.deepblue, bold: true, margin: 0,
  });
  // body
  slide.addText(body, {
    x: x + 0.78, y: y + 0.42, w: w - 0.9, h: h - 0.55,
    fontSize: 9, color: C.darktext, margin: 0,
  });
}

/** Stat big number card */
function statCard(slide, num, label, x, y, w = 2.8, h = 1.1, bg = C.deepblue) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w, h, fill: { color: bg }, line: { color: bg }, rectRadius: 0.08,
  });
  slide.addText(num, {
    x, y: y + 0.05, w, h: 0.6,
    fontSize: 28, color: C.gold, bold: true, align: "center", valign: "middle", margin: 0,
  });
  slide.addText(label, {
    x: x + 0.1, y: y + 0.6, w: w - 0.2, h: 0.44,
    fontSize: 9.5, color: C.lightblue, align: "center", margin: 0,
  });
}

const TOTAL = 18;

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 — COVER
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);

  // Decorative circles
  s.addShape(pres.shapes.ELLIPSE, { x: 7.2, y: -0.8, w: 4.5, h: 4.5,
    fill: { color: C.midblue, transparency: 82 }, line: { color: C.midblue, transparency: 82 } });
  s.addShape(pres.shapes.ELLIPSE, { x: 8.1, y: 2.8, w: 2.8, h: 2.8,
    fill: { color: C.skyblue, transparency: 88 }, line: { color: C.skyblue, transparency: 88 } });
  s.addShape(pres.shapes.ELLIPSE, { x: -0.5, y: 3.5, w: 3, h: 3,
    fill: { color: C.midblue, transparency: 88 }, line: { color: C.midblue, transparency: 88 } });

  // Left accent bar
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 1.0, w: 0.06, h: 2.4,
    fill: { color: C.gold }, line: { color: C.gold },
  });

  s.addText("AlphaFold", {
    x: 0.6, y: 0.9, w: 8, h: 1.0,
    fontSize: 52, color: C.white, bold: true, fontFace: "Calibri", margin: 0,
  });
  s.addText("How It Works — Conference Presentation", {
    x: 0.6, y: 1.85, w: 8.2, h: 0.45,
    fontSize: 17, color: C.lightblue, fontFace: "Calibri", margin: 0,
  });
  s.addText("Protein Structure Prediction · AI Architecture · Applications · Limitations", {
    x: 0.6, y: 2.3, w: 8.2, h: 0.35,
    fontSize: 11, color: C.midgrey, fontFace: "Calibri", margin: 0,
  });

  rule(s, 2.85, C.midblue);

  s.addText([
    { text: "2024 Nobel Prize in Chemistry", options: { bold: true, color: C.gold } },
    { text: "  ·  DeepMind & Isomorphic Labs  ·  May 2026", options: { color: C.lightblue } },
  ], { x: 0.6, y: 2.95, w: 8.5, h: 0.4, fontSize: 11, margin: 0 });

  // Bottom timing row
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 5.0, w: 10, h: 0.35,
    fill: { color: C.deepblue, transparency: 30 }, line: { color: C.deepblue, transparency: 30 },
  });
  s.addText("Estimated Delivery: 10–12 minutes  ·  18 slides", {
    x: 0.4, y: 5.02, w: 9.2, h: 0.3,
    fontSize: 9, color: C.lightblue, align: "center", valign: "middle",
  });
  footer(s, 1, TOTAL);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 — AGENDA
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  darkTitle(s, "Agenda", "What we'll cover in the next 12 minutes");
  rule(s, 1.45, C.skyblue);

  const items = [
    ["1", "The Problem", "Why protein structures matter and why solving them was so hard"],
    ["2", "The Big Idea", "How evolutionary biology provides the structural blueprint"],
    ["3", "How It Works", "AlphaFold's 5-step pipeline: MSA → Evoformer → 3D structure"],
    ["4", "AlphaFold 3", "Diffusion model, multi-molecular complexes, drug docking"],
    ["5", "Impact", "214 million structures, Nobel Prize, drug discovery revolution"],
    ["6", "Limitations", "What AlphaFold cannot do — and why that matters"],
  ];

  items.forEach(([num, title, desc], i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.55 + row * 1.25;
    const w = 4.6;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w, h: 1.1,
      fill: { color: C.deepblue, transparency: 30 },
      line: { color: C.midblue, width: 0.5 },
      rectRadius: 0.07,
    });
    s.addShape(pres.shapes.ELLIPSE, {
      x: x + 0.14, y: y + 0.28, w: 0.52, h: 0.52,
      fill: { color: C.skyblue }, line: { color: C.skyblue },
    });
    s.addText(num, {
      x: x + 0.14, y: y + 0.28, w: 0.52, h: 0.52,
      fontSize: 16, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
    });
    s.addText(title, {
      x: x + 0.78, y: y + 0.1, w: w - 0.9, h: 0.36,
      fontSize: 13, color: C.white, bold: true, margin: 0,
    });
    s.addText(desc, {
      x: x + 0.78, y: y + 0.46, w: w - 0.9, h: 0.56,
      fontSize: 9, color: C.lightblue, margin: 0,
    });
  });

  footer(s, 2, TOTAL, "Agenda");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 — WHAT IS A PROTEIN?
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 1 · The Problem");
  lightTitle(s, "What is a Protein?", "The machines of life");

  // Left: visual amino acid chain diagram
  const colors_aa = [C.skyblue, C.midblue, C.gold, C.deepblue, C.skyblue, C.midblue, C.gold];
  const labels = ["M","K","T","A","Y","I","A"];
  for (let i = 0; i < 7; i++) {
    const cx = 0.5 + i * 0.75;
    s.addShape(pres.shapes.ELLIPSE, {
      x: cx, y: 1.3, w: 0.55, h: 0.55,
      fill: { color: colors_aa[i] }, line: { color: colors_aa[i] },
    });
    s.addText(labels[i], {
      x: cx, y: 1.3, w: 0.55, h: 0.55,
      fontSize: 12, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
    });
    if (i < 6) {
      s.addShape(pres.shapes.LINE, {
        x: cx + 0.55, y: 1.575, w: 0.2, h: 0,
        line: { color: C.midgrey, width: 1.5 },
      });
    }
  }
  s.addText("…and hundreds more", {
    x: 5.4, y: 1.38, w: 2.2, h: 0.4,
    fontSize: 9, color: C.midgrey, italic: true, margin: 0,
  });

  // Arrow down
  s.addShape(pres.shapes.LINE, {
    x: 3.7, y: 2.05, w: 0, h: 0.45,
    line: { color: C.skyblue, width: 2 },
  });
  s.addText("↓ folds into", {
    x: 2.7, y: 2.45, w: 2, h: 0.3,
    fontSize: 10, color: C.skyblue, bold: true, align: "center", margin: 0,
  });

  // 3D shape representation
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 1.2, y: 2.85, w: 5, h: 1.05,
    fill: { color: C.paleblue }, line: { color: C.skyblue, width: 1 }, rectRadius: 0.12,
  });
  s.addText("3D STRUCTURE = FUNCTION", {
    x: 1.2, y: 2.85, w: 5, h: 1.05,
    fontSize: 18, color: C.deepblue, bold: true, align: "center", valign: "middle", margin: 0,
  });

  // Right column — key facts
  const facts = [
    ["20", "types of amino acids"],
    ["300–1,000+", "amino acids per protein"],
    ["Shape → Function", "wrong shape = disease"],
  ];
  facts.forEach(([big, small], i) => {
    const y = 1.25 + i * 1.2;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: 7.0, y, w: 2.7, h: 1.05,
      fill: { color: C.deepblue }, line: { color: C.deepblue }, rectRadius: 0.08,
    });
    s.addText(big, {
      x: 7.0, y: y + 0.05, w: 2.7, h: 0.52,
      fontSize: 20, color: C.gold, bold: true, align: "center", margin: 0,
    });
    s.addText(small, {
      x: 7.1, y: y + 0.56, w: 2.5, h: 0.4,
      fontSize: 9, color: C.lightblue, align: "center", margin: 0,
    });
  });

  footer(s, 3, TOTAL, "Section 1 · The Problem");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 — THE STRUCTURAL BIOLOGY GAP
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 1 · The Problem");
  darkTitle(s, "The Structural Biology Gap", "Why solving protein structures experimentally was never enough");
  rule(s, 1.48, C.skyblue);

  // Methods on left
  s.addText("Experimental Methods", {
    x: 0.4, y: 1.56, w: 4.5, h: 0.35,
    fontSize: 13, color: C.gold, bold: true, margin: 0,
  });
  const methods = [
    ["X-ray Crystallography", "Months · High cost · Needs crystal"],
    ["Cryo-Electron Microscopy", "Months · $M equipment needed"],
    ["NMR Spectroscopy", "Size-limited · Months per structure"],
  ];
  methods.forEach(([m, d], i) => {
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: 0.4, y: 2.0 + i * 0.88, w: 4.4, h: 0.75,
      fill: { color: C.deepblue, transparency: 20 }, line: { color: C.midblue, width: 0.5 }, rectRadius: 0.06,
    });
    s.addText(m, { x: 0.6, y: 2.02 + i * 0.88, w: 4, h: 0.32, fontSize: 11, color: C.white, bold: true, margin: 0 });
    s.addText(d, { x: 0.6, y: 2.32 + i * 0.88, w: 4, h: 0.26, fontSize: 9, color: C.lightblue, margin: 0 });
  });

  // Stats on right
  const stats = [
    ["~170K", "Experimental structures\nin PDB (50 years)"],
    ["200–400M", "Estimated unique protein\nsequences in nature"],
    ["< 0.1%", "Sequences with known\n3D structure"],
  ];
  stats.forEach(([num, label], i) => {
    const x = i === 0 ? 5.2 : i === 1 ? 7.65 : 5.2;
    const y = i < 2 ? 1.55 : 3.15;
    const w = i === 0 ? 2.2 : i === 1 ? 2.2 : 4.65;
    statCard(s, num, label, x, y, w, 1.35);
  });

  // Closing punch
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 5.2, y: 4.62, w: 4.65, h: 0.52,
    fill: { color: C.orange }, line: { color: C.orange }, rectRadius: 0.06,
  });
  s.addText("The gap was blocking all of biology & drug discovery", {
    x: 5.2, y: 4.62, w: 4.65, h: 0.52,
    fontSize: 10.5, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
  });

  footer(s, 4, TOTAL, "Section 1 · The Problem");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 — THE BIG IDEA: EVOLUTION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 2 · The Big Idea");
  darkTitle(s, "Evolution is a Blueprint", "Proteins that co-evolve are physically touching");
  rule(s, 1.48, C.gold);

  // Two-column layout
  // LEFT — MSA table visual
  s.addText("Multiple Sequence Alignment (MSA)", {
    x: 0.4, y: 1.58, w: 4.5, h: 0.32,
    fontSize: 11, color: C.gold, bold: true, margin: 0,
  });

  const species = ["Human   ", "Mouse   ", "Yeast   ", "E. coli "];
  const seqs    = [
    ["M","K","T","A","Y","I","A"],
    ["M","K","T","V","Y","V","A"],
    ["M","R","S","A","F","I","G"],
    ["M","K","A","A","Y","I","S"],
  ];
  const cellColors = [
    [C.skyblue, C.midblue, C.midblue, C.midgrey, C.gold, C.midgrey, C.midgrey],
    [C.skyblue, C.midblue, C.midblue, C.midgrey, C.gold, C.midgrey, C.midgrey],
    [C.skyblue, C.midgrey, C.midgrey, C.midgrey, C.gold, C.midgrey, C.midgrey],
    [C.skyblue, C.midblue, C.midgrey, C.midgrey, C.gold, C.midgrey, C.midgrey],
  ];
  species.forEach((sp, r) => {
    s.addText(sp, { x: 0.4, y: 1.97 + r * 0.55, w: 0.9, h: 0.46, fontSize: 8.5, color: C.lightblue, valign: "middle", margin: 0 });
    seqs[r].forEach((aa, c) => {
      s.addShape(pres.shapes.RECTANGLE, {
        x: 1.35 + c * 0.44, y: 1.97 + r * 0.55, w: 0.42, h: 0.44,
        fill: { color: cellColors[r][c] }, line: { color: C.navy },
      });
      s.addText(aa, {
        x: 1.35 + c * 0.44, y: 1.97 + r * 0.55, w: 0.42, h: 0.44,
        fontSize: 11, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
      });
    });
  });

  // Column labels
  for (let c = 0; c < 7; c++) {
    s.addText(`P${c+1}`, {
      x: 1.35 + c * 0.44, y: 1.72, w: 0.42, h: 0.25,
      fontSize: 7.5, color: C.lightblue, align: "center", bold: true, margin: 0,
    });
  }

  // Co-evolution annotation
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.4, y: 4.18, w: 4.5, h: 0.75,
    fill: { color: C.midblue, transparency: 60 }, line: { color: C.skyblue, width: 0.8 }, rectRadius: 0.06,
  });
  s.addText([
    { text: "P1 & P5 co-evolve together", options: { bold: true, color: C.gold } },
    { text: " → they are physically touching\nin the 3D structure", options: { color: C.white } },
  ], { x: 0.55, y: 4.22, w: 4.2, h: 0.65, fontSize: 10, margin: 0 });

  // RIGHT — insight callout
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 5.3, y: 1.55, w: 4.35, h: 3.5,
    fill: { color: C.deepblue, transparency: 15 }, line: { color: C.gold, width: 1.2 }, rectRadius: 0.1,
  });
  s.addText("The Key Insight", {
    x: 5.5, y: 1.68, w: 3.95, h: 0.38,
    fontSize: 15, color: C.gold, bold: true, margin: 0,
  });
  rule(s, 2.12, C.gold, 5.5, 3.95);
  s.addText(
    "If two amino acids mutate together across millions of years of evolution — "
    + "when one changes, the other changes too — they are almost certainly "
    + "physically touching in 3D space.\n\n"
    + "AlphaFold mines this co-evolution signal across thousands of species "
    + "to reconstruct the 3D shape of the protein.",
    {
      x: 5.5, y: 2.2, w: 3.95, h: 2.7,
      fontSize: 11, color: C.white, fontFace: "Calibri", margin: 0,
    }
  );

  footer(s, 5, TOTAL, "Section 2 · The Big Idea");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 — ALPHAFOLD PIPELINE OVERVIEW
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 3 · How It Works");
  lightTitle(s, "The AlphaFold Pipeline", "5 steps from sequence to 3D structure");

  const steps = [
    { num: 1, label: "Input", sub: "Amino acid sequence", color: "0D3B66" },
    { num: 2, label: "MSA Search", sub: "Evolutionary relatives", color: "1565C0" },
    { num: 3, label: "Evoformer", sub: "AI transformer", color: "1976D2" },
    { num: 4, label: "Structure\nModule", sub: "3D assembly", color: "1E88E5" },
    { num: 5, label: "Output", sub: "PDB + pLDDT scores", color: "42A5F5" },
  ];

  steps.forEach((st, i) => {
    const x = 0.2 + i * 1.93;
    // Box
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y: 1.22, w: 1.7, h: 2.5,
      fill: { color: st.color }, line: { color: st.color }, rectRadius: 0.1,
    });
    // Number circle
    s.addShape(pres.shapes.ELLIPSE, {
      x: x + 0.6, y: 1.35, w: 0.5, h: 0.5,
      fill: { color: C.white, transparency: 85 }, line: { color: C.white },
    });
    s.addText(String(st.num), {
      x: x + 0.6, y: 1.35, w: 0.5, h: 0.5,
      fontSize: 16, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
    });
    s.addText(st.label, {
      x: x + 0.08, y: 2.0, w: 1.55, h: 0.55,
      fontSize: 12, color: C.white, bold: true, align: "center", margin: 0,
    });
    s.addText(st.sub, {
      x: x + 0.08, y: 2.6, w: 1.55, h: 0.55,
      fontSize: 9, color: C.lightblue, align: "center", margin: 0,
    });
    // Arrow (not after last)
    if (i < 4) {
      s.addShape(pres.shapes.LINE, {
        x: x + 1.7, y: 2.47, w: 0.22, h: 0,
        line: { color: C.midblue, width: 1.5 },
      });
      s.addText("▶", {
        x: x + 1.85, y: 2.35, w: 0.25, h: 0.25,
        fontSize: 10, color: C.midblue, align: "center", valign: "middle", margin: 0,
      });
    }
  });

  // Bottom description row
  const descs = [
    "String of letters\n(20 amino acids)",
    "Search UniRef,\nBFD databases",
    "48 attention layers\nMSA + pair matrix",
    "Invariant Point\nAttention, 3 recycles",
    "PDB file +\npLDDT confidence",
  ];
  descs.forEach((d, i) => {
    s.addText(d, {
      x: 0.2 + i * 1.93, y: 3.85, w: 1.7, h: 0.88,
      fontSize: 8.5, color: C.midgrey, align: "center", margin: 0,
    });
  });

  // Output badge
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 2.7, y: 4.82, w: 4.6, h: 0.52,
    fill: { color: C.deepblue }, line: { color: C.deepblue }, rectRadius: 0.06,
  });
  s.addText("Near-experimental accuracy · Minutes to run · Free to use", {
    x: 2.7, y: 4.82, w: 4.6, h: 0.52,
    fontSize: 10.5, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
  });

  footer(s, 6, TOTAL, "Section 3 · How It Works");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 — STEP 1 & 2: SEQUENCE + MSA
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 3 · Step 1 & 2");
  lightTitle(s, "Steps 1 & 2 — Input & Evolutionary Search", "Gathering the raw material");

  // Step 1 card
  stepBox(s, 1, "Give AlphaFold a Sequence",
    "Just a string of amino acid letters (e.g. MKTAYIAKQR…). This is your only required input. No 3D data needed.",
    0.35, 1.2, 4.45, 1.2, C.deepblue);

  // Step 2 card
  stepBox(s, 2, "Search for Evolutionary Relatives (MSA)",
    "AlphaFold searches UniRef90, UniClust30 and BFD — billions of sequences across all species — to find related proteins.",
    0.35, 2.55, 4.45, 1.85, C.midblue);

  // Right side — insight
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 5.2, y: 1.2, w: 4.5, h: 3.2,
    fill: { color: C.paleblue }, line: { color: C.lightblue, width: 0.8 }, rectRadius: 0.1,
  });
  s.addText("Why Evolution Matters", {
    x: 5.4, y: 1.35, w: 4.1, h: 0.38,
    fontSize: 14, color: C.deepblue, bold: true, margin: 0,
  });
  rule(s, 1.8, C.lightblue, 5.4, 4.1);

  const points = [
    "More MSA sequences = more structural signal",
    "Co-evolution reveals physical contacts",
    "Proteins with few homologs = less accurate",
    "Output: pairwise residue correlation matrix",
  ];
  points.forEach((p, i) => {
    s.addShape(pres.shapes.ELLIPSE, {
      x: 5.38, y: 1.98 + i * 0.56, w: 0.2, h: 0.2,
      fill: { color: C.skyblue }, line: { color: C.skyblue },
    });
    s.addText(p, {
      x: 5.65, y: 1.95 + i * 0.56, w: 3.85, h: 0.38,
      fontSize: 10, color: C.darktext, margin: 0,
    });
  });

  // Analogy box
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 4.5, w: 9.35, h: 0.78,
    fill: { color: C.deepblue }, line: { color: C.deepblue }, rectRadius: 0.07,
  });
  s.addText([
    { text: "Analogy: ", options: { bold: true, color: C.gold } },
    { text: "It's like reading thousands of diary entries from different people about the same building — each one gives you a clue about its interior layout.", options: { color: C.white } },
  ], { x: 0.5, y: 4.54, w: 9.1, h: 0.66, fontSize: 10, margin: 0 });

  footer(s, 7, TOTAL, "Section 3 · Steps 1 & 2");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 — STEP 3: EVOFORMER
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 3 · Step 3");
  darkTitle(s, "Step 3 — The Evoformer", "AlphaFold's AI brain: a 48-layer transformer");
  rule(s, 1.48, C.skyblue);

  // Evoformer diagram
  // MSA track
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 1.6, w: 4.0, h: 0.75,
    fill: { color: C.midblue }, line: { color: C.midblue }, rectRadius: 0.07,
  });
  s.addText("MSA Representation", {
    x: 0.35, y: 1.6, w: 4.0, h: 0.75,
    fontSize: 13, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
  });

  // Pair track
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 2.6, w: 4.0, h: 0.75,
    fill: { color: C.deepblue }, line: { color: C.skyblue, width: 0.8 }, rectRadius: 0.07,
  });
  s.addText("Pair Representation (N×N matrix)", {
    x: 0.35, y: 2.6, w: 4.0, h: 0.75,
    fontSize: 13, color: C.white, bold: true, align: "center", valign: "middle", margin: 0,
  });

  // Bidirectional arrows
  s.addShape(pres.shapes.LINE, { x: 1.5, y: 2.37, w: 0, h: 0.21, line: { color: C.gold, width: 1.5 } });
  s.addShape(pres.shapes.LINE, { x: 2.1, y: 2.37, w: 0, h: 0.21, line: { color: C.gold, width: 1.5 } });
  s.addText("↑↓  Cross-talk (48 layers)", {
    x: 0.35, y: 2.35, w: 4.0, h: 0.28,
    fontSize: 9, color: C.gold, align: "center", bold: true, margin: 0,
  });

  // Big arrow right
  s.addShape(pres.shapes.LINE, { x: 4.38, y: 2.5, w: 0.35, h: 0, line: { color: C.skyblue, width: 2 } });
  s.addText("→", { x: 4.55, y: 2.38, w: 0.3, h: 0.3, fontSize: 14, color: C.skyblue, align: "center", margin: 0 });

  // Output box
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 4.95, y: 1.6, w: 4.7, h: 1.75,
    fill: { color: C.deepblue, transparency: 20 }, line: { color: C.skyblue, width: 1 }, rectRadius: 0.08,
  });
  s.addText("Refined structural understanding", {
    x: 5.05, y: 1.68, w: 4.5, h: 0.4,
    fontSize: 13, color: C.white, bold: true, margin: 0,
  });
  const outputs = ["Which residues are close in 3D space", "What angles and distances exist", "Confidence in each prediction"];
  outputs.forEach((o, i) => {
    s.addShape(pres.shapes.ELLIPSE, { x: 5.05, y: 2.15 + i * 0.38, w: 0.18, h: 0.18, fill: { color: C.gold }, line: { color: C.gold } });
    s.addText(o, { x: 5.3, y: 2.12 + i * 0.38, w: 4.1, h: 0.3, fontSize: 10, color: C.lightblue, margin: 0 });
  });

  // Bottom key points
  const kps = [
    ["Transformer Architecture", "Same fundamental design as GPT/ChatGPT — processes relationships, not just sequences"],
    ["Attention Mechanism", "Every amino acid 'attends' to every other — learns who is important to whom"],
    ["48 Layers Deep", "Each layer refines the structural map — like progressive sketching"],
  ];
  kps.forEach(([title, body], i) => {
    const x = 0.35 + i * 3.22;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y: 3.6, w: 3.0, h: 1.55,
      fill: { color: C.deepblue, transparency: 30 }, line: { color: C.midblue, width: 0.5 }, rectRadius: 0.07,
    });
    s.addText(title, { x: x + 0.1, y: 3.68, w: 2.8, h: 0.38, fontSize: 11, color: C.gold, bold: true, margin: 0 });
    s.addText(body, { x: x + 0.1, y: 4.06, w: 2.8, h: 1.0, fontSize: 9, color: C.white, margin: 0 });
  });

  footer(s, 8, TOTAL, "Section 3 · Step 3: Evoformer");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 — STEP 4 & 5: STRUCTURE MODULE + pLDDT
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 3 · Steps 4 & 5");
  lightTitle(s, "Steps 4 & 5 — Building the Structure & Confidence", "From abstract representation to 3D atoms");

  stepBox(s, 4, "Structure Module — Place Every Atom in 3D",
    "Uses Invariant Point Attention to build the backbone, then side chains. Runs 3 recycling loops — each pass refines the structure based on the previous one. Output: a PDB file (same format as X-ray crystallography).",
    0.35, 1.18, 9.3, 1.45, C.deepblue);

  // pLDDT table
  s.addText("Step 5 — Confidence Score: pLDDT", {
    x: 0.35, y: 2.72, w: 9.3, h: 0.38,
    fontSize: 13, color: C.deepblue, bold: true, margin: 0,
  });

  const plddt = [
    ["> 90",  "Very High",  "Treat like an experimental structure",  "1565C0"],
    ["70–90", "Confident",  "Generally reliable for analysis",       "1E88E5"],
    ["50–70", "Low",        "Use with caution — validate",           "F9A825"],
    ["< 50",  "Disordered", "Region likely has no fixed shape",      "E65100"],
  ];
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.35, y: 3.12, w: 9.3, h: 0.38,
    fill: { color: C.deepblue }, line: { color: C.deepblue },
  });
  ["pLDDT Score", "Confidence", "What it means", "Color"].forEach((h, i) => {
    const ws = [1.3, 1.6, 5.2, 1.2];
    const xs = [0.35, 1.65, 3.25, 8.45];
    s.addText(h, { x: xs[i], y: 3.12, w: ws[i], h: 0.38, fontSize: 10, color: C.white, bold: true, valign: "middle", margin: 0, leftMargin: 6 });
  });

  plddt.forEach(([score, conf, meaning, color], i) => {
    const bg = i % 2 === 0 ? C.white : C.paleblue;
    s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 3.5 + i * 0.42, w: 9.3, h: 0.42, fill: { color: bg }, line: { color: C.lightblue, width: 0.3 } });
    s.addText(score,   { x: 0.42, y: 3.52+i*0.42, w: 1.2, h: 0.38, fontSize: 10.5, color: C.deepblue, bold: true, valign: "middle", margin: 0 });
    s.addText(conf,    { x: 1.65, y: 3.52+i*0.42, w: 1.5, h: 0.38, fontSize: 10,   color: C.deepblue, valign: "middle", margin: 0 });
    s.addText(meaning, { x: 3.25, y: 3.52+i*0.42, w: 5.1, h: 0.38, fontSize: 9.5,  color: C.darktext, valign: "middle", margin: 0 });
    s.addShape(pres.shapes.RECTANGLE, { x: 8.45, y: 3.52+i*0.42, w: 1.18, h: 0.38, fill: { color }, line: { color } });
  });

  footer(s, 9, TOTAL, "Section 3 · Steps 4 & 5");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 — PAE EXPLAINER
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 3 · Confidence Scores");
  darkTitle(s, "Reading AlphaFold Confidence", "pLDDT + PAE — your guide to trusting the structure");
  rule(s, 1.48, C.skyblue);

  // pLDDT side
  s.addText("pLDDT — Per-residue Confidence", { x: 0.4, y: 1.58, w: 4.5, h: 0.36, fontSize: 12, color: C.gold, bold: true, margin: 0 });

  const segments = [
    { color: "0D3B66", label: ">90", desc: "Very High" },
    { color: "1565C0", label: "70-90", desc: "Good" },
    { color: "F9A825", label: "50-70", desc: "Low" },
    { color: "E65100", label: "<50", desc: "Disorder" },
  ];
  segments.forEach((seg, i) => {
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: 0.4 + i * 1.1, y: 2.05, w: 0.9, h: 0.65,
      fill: { color: seg.color }, line: { color: seg.color }, rectRadius: 0.05,
    });
    s.addText(seg.label, { x: 0.4+i*1.1, y: 2.08, w: 0.9, h: 0.35, fontSize: 11, color: C.white, bold: true, align: "center", margin: 0 });
    s.addText(seg.desc, { x: 0.4+i*1.1, y: 2.44, w: 0.9, h: 0.26, fontSize: 8, color: C.white, align: "center", margin: 0 });
  });
  s.addShape(pres.shapes.LINE, { x: 0.4, y: 2.9, w: 4.4, h: 0, line: { color: C.midblue, width: 0.6 } });
  s.addText("Colors visualized directly on the 3D structure", { x: 0.4, y: 2.95, w: 4.4, h: 0.3, fontSize: 9, color: C.lightblue, italic: true, margin: 0 });

  // PAE side
  s.addText("PAE — Predicted Aligned Error", { x: 5.3, y: 1.58, w: 4.4, h: 0.36, fontSize: 12, color: C.gold, bold: true, margin: 0 });
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 5.3, y: 1.98, w: 4.4, h: 1.55,
    fill: { color: C.deepblue, transparency: 20 }, line: { color: C.midblue, width: 0.5 }, rectRadius: 0.07,
  });
  s.addText(
    "Measures positional error between any two residues.\n\n"
    + "Low PAE = confident relative orientation (domains are rigidly positioned)\n\n"
    + "High PAE between domains = they may be flexibly linked",
    { x: 5.45, y: 2.08, w: 4.1, h: 1.35, fontSize: 10, color: C.white, margin: 0 }
  );

  // Protein chain visual (simple)
  s.addShape(pres.shapes.LINE, { x: 0.5, y: 3.55, w: 4.3, h: 0, line: { color: C.midgrey, width: 1 } });
  const chainSegs = [
    { x: 0.5, color: C.midblue, label: "Structured\n(blue)" },
    { x: 2.0, color: "F9A825", label: "Linker\n(yellow)" },
    { x: 2.9, color: C.skyblue, label: "Domain 2\n(blue)" },
    { x: 4.0, color: C.orange, label: "Disordered\ntail (red)" },
  ];
  chainSegs.forEach((seg, i) => {
    const w = i < 3 ? 0.9 : 0.8;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: seg.x, y: 3.42, w, h: 0.3,
      fill: { color: seg.color }, line: { color: seg.color }, rectRadius: 0.04,
    });
    s.addText(seg.label, { x: seg.x, y: 3.74, w, h: 0.45, fontSize: 7.5, color: C.lightblue, align: "center", margin: 0 });
  });

  // Key message
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.4, y: 4.6, w: 9.25, h: 0.72,
    fill: { color: C.midblue, transparency: 50 }, line: { color: C.skyblue, width: 0.8 }, rectRadius: 0.07,
  });
  s.addText([
    { text: "Rule of thumb: ", options: { bold: true, color: C.gold } },
    { text: "Blue = trust it. Yellow = check it. Red = that region is probably genuinely disordered — and that is biologically important information, not a failure.", options: { color: C.white } },
  ], { x: 0.55, y: 4.64, w: 9.0, h: 0.62, fontSize: 10.5, margin: 0 });

  footer(s, 10, TOTAL, "Section 3 · Confidence");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 — AF2 vs AF3 COMPARISON
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 4 · AlphaFold 3");
  lightTitle(s, "AlphaFold 2 vs AlphaFold 3", "A fundamental architectural upgrade");

  const rows = [
    ["Feature",           "AlphaFold 2  (2021)",               "AlphaFold 3  (2024)"],
    ["Architecture",      "Evoformer + Structure Module",       "Evoformer + Diffusion Model"],
    ["Molecules",         "Proteins only",                      "Proteins, DNA, RNA, ligands, PTMs"],
    ["Drug docking",      "Not natively supported",             "Native protein–ligand prediction"],
    ["Output format",     "Single static structure",            "Sampled ensemble of structures"],
    ["Access",            "Open source weights (Apache 2.0)",   "Non-commercial weights only"],
    ["Published in",      "Nature, July 2021",                  "Nature, May 2024"],
  ];

  const colW = [2.8, 3.25, 3.25];
  const colX = [0.35, 3.15, 6.4];

  rows.forEach((row, ri) => {
    const y = 1.22 + ri * 0.55;
    const isHeader = ri === 0;
    row.forEach((cell, ci) => {
      const bg = isHeader ? (ci === 0 ? C.deepblue : ci === 1 ? C.midblue : C.skyblue)
                           : (ri % 2 === 0 ? C.paleblue : C.white);
      s.addShape(pres.shapes.RECTANGLE, {
        x: colX[ci], y, w: colW[ci], h: 0.52,
        fill: { color: bg }, line: { color: C.lightblue, width: 0.4 },
      });
      s.addText(cell, {
        x: colX[ci] + 0.08, y: y + 0.02, w: colW[ci] - 0.12, h: 0.48,
        fontSize: isHeader ? 11 : 9.5,
        color: isHeader ? C.white : C.darktext,
        bold: isHeader,
        valign: "middle", margin: 0,
      });
    });
  });

  // AF3 key highlight
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 5.0, w: 9.3, h: 0.42,
    fill: { color: C.deepblue }, line: { color: C.deepblue }, rectRadius: 0.06,
  });
  s.addText([
    { text: "AF3 key advance: ", options: { bold: true, color: C.gold } },
    { text: "Diffusion model handles any chemistry — proteins, DNA, drugs, sugars — in one unified framework.", options: { color: C.white } },
  ], { x: 0.5, y: 5.02, w: 9.1, h: 0.38, fontSize: 10, valign: "middle", margin: 0 });

  footer(s, 11, TOTAL, "Section 4 · AlphaFold 3");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 — DIFFUSION MODEL EXPLAINED
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 4 · AlphaFold 3");
  darkTitle(s, "How AF3's Diffusion Model Works", "From random noise to biomolecular structure");
  rule(s, 1.48, C.skyblue);

  // Diffusion steps visual
  const dsteps = [
    { label: "Pure\nNoise", sublabel: "Random\natom positions", bg: C.midgrey },
    { label: "Partial\nStructure", sublabel: "Gradual\ndenoising", bg: C.midblue },
    { label: "Refined\nShape", sublabel: "Conditioned on\ninputs", bg: "1976D2" },
    { label: "Final\nStructure", sublabel: "Full complex\npredicted", bg: C.skyblue },
  ];
  dsteps.forEach((ds, i) => {
    const x = 0.4 + i * 2.3;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y: 1.58, w: 1.9, h: 1.75,
      fill: { color: ds.bg }, line: { color: ds.bg }, rectRadius: 0.08,
    });
    s.addText(ds.label, { x, y: 1.78, w: 1.9, h: 0.7, fontSize: 13, color: C.white, bold: true, align: "center", margin: 0 });
    s.addText(ds.sublabel, { x, y: 2.5, w: 1.9, h: 0.6, fontSize: 9, color: C.lightblue, align: "center", margin: 0 });
    if (i < 3) {
      s.addText("→", { x: x + 1.88, y: 2.0, w: 0.42, h: 0.6, fontSize: 18, color: C.skyblue, align: "center", valign: "middle", margin: 0 });
    }
  });

  // What it handles
  s.addText("What AF3 Can Predict:", { x: 0.4, y: 3.52, w: 9.2, h: 0.35, fontSize: 12, color: C.gold, bold: true, margin: 0 });
  const handles = [
    ["Proteins", "Single chain &\nmulti-chain"],
    ["Nucleic Acids", "DNA & RNA\ncomplexes"],
    ["Small Molecules", "Drug ligands &\ncofactors"],
    ["PTMs", "Glycosylation,\nphosphorylation"],
  ];
  handles.forEach(([title, sub], i) => {
    const x = 0.4 + i * 2.35;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y: 3.94, w: 2.12, h: 1.18,
      fill: { color: C.deepblue, transparency: 20 }, line: { color: C.skyblue, width: 0.7 }, rectRadius: 0.07,
    });
    s.addText(title, { x, y: 3.98, w: 2.12, h: 0.38, fontSize: 11, color: C.white, bold: true, align: "center", margin: 0 });
    s.addText(sub, { x: x+0.1, y: 4.36, w: 1.92, h: 0.68, fontSize: 9, color: C.lightblue, align: "center", margin: 0 });
  });

  footer(s, 12, TOTAL, "Section 4 · Diffusion Model");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 13 — IMPACT: THE NUMBERS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 5 · Impact");
  darkTitle(s, "The Impact of AlphaFold", "Numbers that changed biology forever");
  rule(s, 1.48, C.gold);

  // Big stat cards
  const bigStats = [
    ["214M+",  "protein structures\nin AlphaFold DB (2024)"],
    ["170K",   "structures from\n50 years of wet lab work"],
    ["18 mo.", "time for AlphaFold to\nmatch 50 years of PDB"],
    ["Free",   "open access for every\nresearcher on Earth"],
  ];
  bigStats.forEach(([num, label], i) => {
    statCard(s, num, label, 0.35 + i * 2.42, 1.55, 2.2, 1.3);
  });

  // Nobel Prize banner
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 2.98, w: 9.3, h: 0.92,
    fill: { color: "B8860B", transparency: 20 }, line: { color: C.gold, width: 1.5 }, rectRadius: 0.08,
  });
  s.addText("🏆  2024 Nobel Prize in Chemistry", { x: 0.55, y: 3.02, w: 9.0, h: 0.38, fontSize: 16, color: C.gold, bold: true, margin: 0 });
  s.addText("Demis Hassabis & John Jumper (DeepMind) for AlphaFold  ·  David Baker (UW) for protein design", {
    x: 0.55, y: 3.4, w: 9.0, h: 0.44, fontSize: 10, color: C.white, margin: 0,
  });

  // Applications grid
  s.addText("Applications:", { x: 0.35, y: 3.98, w: 9.3, h: 0.32, fontSize: 11, color: C.gold, bold: true, margin: 0 });
  const apps = [
    ["Drug Discovery", "Structure-based virtual screening without crystallography"],
    ["Disease Research", "Mutation impact prediction — cancer, Alzheimer's, rare diseases"],
    ["Synthetic Biology", "De novo enzyme design and novel protein engineering"],
    ["Vaccine Design", "Antibody-antigen interaction prediction at scale"],
  ];
  apps.forEach(([t, d], i) => {
    const x = 0.35 + (i % 2) * 4.8;
    const y = 4.32 + Math.floor(i / 2) * 0.55;
    s.addShape(pres.shapes.ELLIPSE, { x, y: y+0.08, w: 0.2, h: 0.2, fill: { color: C.skyblue }, line: { color: C.skyblue } });
    s.addText([
      { text: t + ": ", options: { bold: true, color: C.white } },
      { text: d, options: { color: C.lightblue } },
    ], { x: x + 0.28, y, w: 4.3, h: 0.42, fontSize: 9.5, margin: 0 });
  });

  footer(s, 13, TOTAL, "Section 5 · Impact");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 14 — COMPETING TOOLS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Section 5 · Ecosystem");
  lightTitle(s, "The AlphaFold Ecosystem", "Competing and complementary tools");

  const tools = [
    { name: "RoseTTAFold", org: "Baker Lab, UW", notes: "Open-source; All-Atom (2024) rivals AF3 for complexes", tag: "Open Source", tc: C.green },
    { name: "ESMFold", org: "Meta AI", notes: "Language model — no MSA needed. Fast but lower accuracy", tag: "Fast / No MSA", tc: C.midblue },
    { name: "ColabFold", org: "Community", notes: "AF2 with MMseqs2 MSA — democratized web access, faster runs", tag: "Accessible", tc: C.skyblue },
    { name: "OpenFold", org: "OpenFold Consortium", notes: "Open reimplementation of AF2 — fully reproducible training", tag: "Research", tc: C.deepblue },
    { name: "Chai-1", org: "Chai Discovery", notes: "2024 startup model for biomolecular complexes, no MSA needed", tag: "New (2024)", tc: C.gold },
    { name: "Foldseek", org: "Steinegger Lab", notes: "Fast structural search enabled by AF structures — like BLAST for 3D", tag: "Search Tool", tc: C.midgrey },
  ];

  tools.forEach((t, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.2 + row * 1.3;
    const w = 4.6;

    card(s, x, y, w, 1.15, C.white);

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: x + 0.1, y: y + 0.08, w: 1.1, h: 0.26,
      fill: { color: t.tc }, line: { color: t.tc }, rectRadius: 0.04,
    });
    s.addText(t.tag, { x: x + 0.1, y: y + 0.08, w: 1.1, h: 0.26, fontSize: 7, color: C.white, bold: true, align: "center", valign: "middle", margin: 0 });

    s.addText(t.name, { x: x + 1.28, y: y + 0.06, w: 3.1, h: 0.32, fontSize: 13, color: C.deepblue, bold: true, margin: 0 });
    s.addText(t.org, { x: x + 1.28, y: y + 0.36, w: 3.1, h: 0.24, fontSize: 8.5, color: C.midgrey, margin: 0 });
    s.addText(t.notes, { x: x + 0.12, y: y + 0.62, w: w - 0.22, h: 0.46, fontSize: 9, color: C.darktext, margin: 0 });
  });

  footer(s, 14, TOTAL, "Section 5 · Ecosystem");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 15 — LIMITATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "Section 6 · Limitations");
  darkTitle(s, "What AlphaFold Cannot Do", "Honest limitations every user must know");
  rule(s, 1.48, C.orange);

  const lims = [
    { icon: "⏸", title: "Static Snapshot Only", body: "Predicts one conformation — the energy minimum. Cannot capture protein dynamics, allosteric changes, or active/inactive state transitions." },
    { icon: "〰", title: "Intrinsically Disordered Regions", body: "~30% of the human proteome lacks a fixed structure. AlphaFold's low pLDDT correctly flags these, but cannot resolve them. IDRs are heavily involved in cancer and neurodegeneration." },
    { icon: "🔍", title: "Novel / Rare Proteins", body: "Proteins with few evolutionary homologs have small MSAs and less co-evolution signal. Accuracy drops significantly for truly novel folds." },
    { icon: "🔗", title: "Complex Assembly Failures", body: "AF-Multimer has known failure modes for some homodimers and large assemblies (e.g. flavivirus NS4B). Always validate with experimental data." },
    { icon: "🔒", title: "AF3 Access Restrictions", body: "AF3 weights are non-commercial only — an active open science debate. RoseTTAFold All-Atom provides open-source equivalent." },
  ];

  lims.forEach((l, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i < 3 ? i : i - 3;
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.55 + row * 1.2;
    const w = 4.55;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w, h: 1.08,
      fill: { color: "1A0A0A", transparency: 30 },
      line: { color: C.orange, width: 0.7 },
      rectRadius: 0.07,
    });
    s.addText(l.icon + "  " + l.title, { x: x + 0.12, y: y + 0.08, w: w - 0.2, h: 0.32, fontSize: 11, color: C.gold, bold: true, margin: 0 });
    s.addText(l.body, { x: x + 0.12, y: y + 0.4, w: w - 0.2, h: 0.6, fontSize: 9, color: C.white, margin: 0 });
  });

  // Bottom message
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.35, y: 5.0, w: 9.3, h: 0.45,
    fill: { color: C.deepblue, transparency: 30 }, line: { color: C.skyblue, width: 0.5 }, rectRadius: 0.06,
  });
  s.addText("AlphaFold is a hypothesis generator, not an oracle. High pLDDT = trust it. Critical results still need experimental validation.", {
    x: 0.5, y: 5.02, w: 9.0, h: 0.41, fontSize: 10, color: C.lightblue, italic: true, align: "center", valign: "middle", margin: 0,
  });

  footer(s, 15, TOTAL, "Section 6 · Limitations");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 16 — Q&A PREP
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  lightBg(s);
  sectionPill(s, "Q&A Preparation");
  lightTitle(s, "Likely Conference Questions", "Prepared talking points");

  const qs = [
    ["Is the protein folding problem solved?", "Largely for static single-chain structures — yes. Dynamics, IDRs, and context-dependent folding remain open."],
    ["AF2 vs AF3 — key difference?", "AF2: Evoformer + proteins only. AF3: diffusion model + proteins, DNA, RNA, drugs in one framework."],
    ["Can you trust AlphaFold structures?", "Use pLDDT. Above 90 = experimental quality. Below 70 = validate. Below 50 = likely disordered."],
    ["Does it replace wet lab work?", "No — it provides a rapid structural hypothesis. Still need experiments for dynamics and functional validation."],
    ["Why did it win the Nobel Prize?", "Solved a 50-year grand challenge. Transformed structural biology from scarce to abundant — at global scale."],
    ["What is RoseTTAFold / ESMFold?", "Open-source alternatives. RoseTTAFold All-Atom rivals AF3. ESMFold uses no MSA — fast but less accurate."],
  ];

  qs.forEach((q, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.2 + row * 1.32;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w: 4.55, h: 1.2,
      fill: { color: C.white },
      line: { color: C.lightblue, width: 0.5 },
      rectRadius: 0.07,
      shadow: { type: "outer", color: "000000", blur: 6, offset: 1, angle: 135, opacity: 0.07 },
    });
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: x + 0.1, y: y + 0.08, w: 0.22, h: 0.22,
      fill: { color: C.deepblue }, line: { color: C.deepblue }, rectRadius: 0.04,
    });
    s.addText("Q", { x: x + 0.1, y: y + 0.08, w: 0.22, h: 0.22, fontSize: 9, color: C.white, bold: true, align: "center", valign: "middle", margin: 0 });
    s.addText(q[0], { x: x + 0.38, y: y + 0.06, w: 4.08, h: 0.34, fontSize: 10.5, color: C.deepblue, bold: true, margin: 0 });
    s.addText(q[1], { x: x + 0.14, y: y + 0.46, w: 4.28, h: 0.65, fontSize: 9, color: C.darktext, margin: 0 });
  });

  footer(s, 16, TOTAL, "Q&A Preparation");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 17 — KEY REFERENCES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);
  sectionPill(s, "References");
  darkTitle(s, "Key Papers to Cite", "Essential references for your presentation");
  rule(s, 1.48, C.skyblue);

  const refs = [
    { num: "1", title: "AlphaFold 2 — Original Paper", citation: "Jumper J et al. Nature 596, 583–589 (2021)  ·  doi: 10.1038/s41586-021-03819-2" },
    { num: "2", title: "AlphaFold 3 — Original Paper", citation: "Abramson J et al. Nature 630, 493–500 (2024)  ·  doi: 10.1038/s41586-024-07487-w" },
    { num: "3", title: "AlphaFold DB — 2024 Update", citation: "Varadi M et al. Nucleic Acids Res 52(D1):D368 (2024)  ·  PMID: 37933859" },
    { num: "4", title: "AlphaFold 3 Applications Review", citation: "Krokidis MG et al. Int J Mol Sci 26(8):3671 (2025)  ·  PMID: 40332289" },
    { num: "5", title: "AlphaFold DB — 2025 Update", citation: "Fleming J et al. J Mol Biol 437(15):168967 (2025)  ·  PMID: 41273079" },
  ];

  refs.forEach((r, i) => {
    const y = 1.55 + i * 0.73;
    s.addShape(pres.shapes.ELLIPSE, {
      x: 0.35, y: y + 0.05, w: 0.42, h: 0.42,
      fill: { color: C.skyblue }, line: { color: C.skyblue },
    });
    s.addText(`[${r.num}]`, { x: 0.35, y: y + 0.05, w: 0.42, h: 0.42, fontSize: 12, color: C.white, bold: true, align: "center", valign: "middle", margin: 0 });
    s.addText(r.title, { x: 0.9, y: y + 0.04, w: 8.75, h: 0.28, fontSize: 11, color: C.white, bold: true, margin: 0 });
    s.addText(r.citation, { x: 0.9, y: y + 0.32, w: 8.75, h: 0.28, fontSize: 9, color: C.lightblue, margin: 0 });
  });

  footer(s, 17, TOTAL, "References");
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 18 — CLOSING / ONE-LINER
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkBg(s);

  // Decorative circles
  s.addShape(pres.shapes.ELLIPSE, { x: 7.5, y: -0.5, w: 4, h: 4, fill: { color: C.midblue, transparency: 85 }, line: { color: C.midblue, transparency: 85 } });
  s.addShape(pres.shapes.ELLIPSE, { x: -0.8, y: 3.2, w: 3, h: 3, fill: { color: C.skyblue, transparency: 88 }, line: { color: C.skyblue, transparency: 88 } });

  // Gold accent bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 0.9, w: 0.06, h: 3.0, fill: { color: C.gold }, line: { color: C.gold } });

  s.addText("The One-Liner to Remember", { x: 0.6, y: 0.85, w: 8.5, h: 0.42, fontSize: 13, color: C.gold, bold: true, margin: 0 });

  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 0.6, y: 1.35, w: 8.6, h: 1.8,
    fill: { color: C.deepblue, transparency: 25 }, line: { color: C.gold, width: 1.5 }, rectRadius: 0.1,
  });
  s.addText(
    '"AlphaFold reads a protein\'s evolutionary history like a blueprint,\n'
    + 'runs it through a transformer AI, and produces a 3D structure\n'
    + 'in minutes — for free — that used to take years and cost a fortune."',
    { x: 0.75, y: 1.42, w: 8.3, h: 1.65, fontSize: 16, color: C.white, italic: true, fontFace: "Calibri", align: "center", valign: "middle", margin: 0 }
  );

  rule(s, 3.3, C.midblue);

  s.addText("AlphaFold did not just accelerate structural biology — it democratized it.", {
    x: 0.6, y: 3.38, w: 8.5, h: 0.42, fontSize: 13, color: C.lightblue, margin: 0,
  });
  s.addText(
    "A researcher anywhere in the world — with no crystallography lab, no cryo-EM, no million-dollar equipment — "
    + "can now query the structure of any protein in seconds, for free.",
    { x: 0.6, y: 3.82, w: 8.5, h: 0.62, fontSize: 11, color: C.white, fontFace: "Calibri", margin: 0 }
  );

  s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x: 2.5, y: 4.55, w: 5.0, h: 0.7,
    fill: { color: C.gold, transparency: 15 }, line: { color: C.gold, width: 1 }, rectRadius: 0.08,
  });
  s.addText("Thank You", { x: 2.5, y: 4.55, w: 5.0, h: 0.7, fontSize: 22, color: C.white, bold: true, align: "center", valign: "middle", margin: 0 });

  footer(s, 18, TOTAL);
}

// ═══════════════════════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/alphafold-conference/AlphaFold_Presentation.pptx" })
  .then(() => console.log("PPTX saved: /home/daytona/workspace/alphafold-conference/AlphaFold_Presentation.pptx"))
  .catch(e => { console.error("Error:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/alphafold-conference && node generate_presentation.js

Running Command

grep -n "shapes.LINE" /home/daytona/workspace/alphafold-conference/generate_presentation.js | head -30

Running Command

cd /home/daytona/workspace/alphafold-conference && sed -i \ 's/pres\.shapes\.LINE/pres.ShapeType ? pres.shapes.LINE : "line"/g' \ generate_presentation.js # That won't work cleanly. Let me just do a python replace python3 -c " import re with open('generate_presentation.js','r') as f: code = f.read() # Replace horizontal lines (h:0) with thin rectangles # Pattern: addShape(pres.shapes.LINE, { x:..., y:..., w:..., h: 0, line: {...} }); def fix_hline(m): inner = m.group(1) # extract values xm = re.search(r'x:\s*([\d.]+)', inner) ym = re.search(r'y:\s*([\d.]+)', inner) wm = re.search(r'w:\s*([\d.]+)', inner) cm = re.search(r'color:\s*([A-Z.a-z_\[\"\']+)', inner) x = xm.group(1) if xm else '0' y = ym.group(1) if ym else '0' w = wm.group(1) if wm else '1' c = cm.group(1) if cm else 'C.midblue' return f'addShape(pres.shapes.RECTANGLE, {{ x: {x}, y: {y}, w: {w}, h: 0.02, fill: {{ color: {c} }}, line: {{ color: {c} }} }})' code = re.sub(r'addShape\(pres\.shapes\.LINE,\s*\{([^}]+h:\s*0[^}]*)\}\)', fix_hline, code) # Replace vertical lines (w:0) similarly def fix_vline(m): inner = m.group(1) xm = re.search(r'x:\s*([\d.]+)', inner) ym = re.search(r'y:\s*([\d.]+)', inner) hm = re.search(r'h:\s*([\d.]+)', inner) cm = re.search(r'color:\s*([A-Z.a-z_\[\"\']+)', inner) x = xm.group(1) if xm else '0' y = ym.group(1) if ym else '0' h = hm.group(1) if hm else '1' c = cm.group(1) if cm else 'C.midblue' return f'addShape(pres.shapes.RECTANGLE, {{ x: {x}, y: {y}, w: 0.02, h: {h}, fill: {{ color: {c} }}, line: {{ color: {c} }} }})' code = re.sub(r'addShape\(pres\.shapes\.LINE,\s*\{([^}]+w:\s*0[^}]*)\}\)', fix_vline, code) with open('generate_presentation.js','w') as f: f.write(code) print('Done') "

Running Command

cd /home/daytona/workspace/alphafold-conference && python3 -c " with open('generate_presentation.js','r') as f: code = f.read() # Fix the rule() helper which uses shapes.LINE with h:0 pattern old_rule = '''function rule(slide, y, color = C.lightblue, x = 0.45, w = 9.1) { return HRFlowable(width=\"100%\", thickness=0.5, color=RULE_COLOR, spaceAfter=6, spaceBefore=6); }''' # Actually just find and replace the rule function import re code = re.sub( r'function rule\(slide, y, color = C\.lightblue, x = 0\.45, w = 9\.1\) \{[^}]+\}', 'function rule(slide, y, color = C.lightblue, x = 0.45, w = 9.1) {\n slide.addShape(pres.shapes.RECTANGLE, {\n x, y, w, h: 0.02,\n fill: { color }, line: { color },\n });\n}', code ) # Also fix any remaining shapes.LINE calls that still have non-zero w and h (diagonal lines) # These should stay as-is since they have both w and h non-zero # Check what remains import re remaining = re.findall(r'shapes\.LINE.*', code) print('Remaining LINE shapes:', remaining) with open('generate_presentation.js','w') as f: f.write(code) "

Running Command

cd /home/daytona/workspace/alphafold-conference && python3 -c " with open('generate_presentation.js','r') as f: code = f.read() # Replace all remaining shapes.LINE with w:0 or h:0 individually replacements = [ ( 's.addShape(pres.shapes.LINE, { x: 1.5, y: 2.37, w: 0, h: 0.21, line: { color: C.gold, width: 1.5 } });', 's.addShape(pres.shapes.RECTANGLE, { x: 1.5, y: 2.37, w: 0.02, h: 0.21, fill: { color: C.gold }, line: { color: C.gold } });' ), ( 's.addShape(pres.shapes.LINE, { x: 2.1, y: 2.37, w: 0, h: 0.21, line: { color: C.gold, width: 1.5 } });', 's.addShape(pres.shapes.RECTANGLE, { x: 2.1, y: 2.37, w: 0.02, h: 0.21, fill: { color: C.gold }, line: { color: C.gold } });' ), ( 's.addShape(pres.shapes.LINE, { x: 4.38, y: 2.5, w: 0.35, h: 0, line: { color: C.skyblue, width: 2 } });', 's.addShape(pres.shapes.RECTANGLE, { x: 4.38, y: 2.5, w: 0.35, h: 0.02, fill: { color: C.skyblue }, line: { color: C.skyblue } });' ), ( 's.addShape(pres.shapes.LINE, { x: 0.4, y: 2.9, w: 4.4, h: 0, line: { color: C.midblue, width: 0.6 } });', 's.addShape(pres.shapes.RECTANGLE, { x: 0.4, y: 2.9, w: 4.4, h: 0.02, fill: { color: C.midblue }, line: { color: C.midblue } });' ), ( 's.addShape(pres.shapes.LINE, { x: 0.5, y: 3.55, w: 4.3, h: 0, line: { color: C.midgrey, width: 1 } });', 's.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.55, w: 4.3, h: 0.02, fill: { color: C.midgrey }, line: { color: C.midgrey } });' ), ] for old, new in replacements: code = code.replace(old, new) # Also fix multi-line LINE shapes that still remain (the 3 from grep) import re # Replace any remaining shapes.LINE with RECTANGLE def fix_any_line(m): inner = m.group(1) xm = re.search(r'x:\s*([\d.]+)', inner) ym = re.search(r'y:\s*([\d.]+)', inner) wm = re.search(r'w:\s*([\d.]+)', inner) hm = re.search(r'h:\s*([\d.]+)', inner) cm = re.search(r'color[: ]+([A-Za-z_.\"\']+)', inner) x = xm.group(1) if xm else '0' y = ym.group(1) if ym else '0' w = wm.group(1) if wm else '1' h = hm.group(1) if hm else '0.02' c = cm.group(1) if cm else 'C.midblue' if float(w) == 0: w = '0.02' if float(h) == 0: h = '0.02' return f'addShape(pres.shapes.RECTANGLE, {{ x: {x}, y: {y}, w: {w}, h: {h}, fill: {{ color: {c} }}, line: {{ color: {c} }} }})' code = re.sub(r'addShape\(pres\.shapes\.LINE,\s*\{([\s\S]*?)\}\)', fix_any_line, code) remaining = [l for l in code.split('\n') if 'shapes.LINE' in l] print('Still remaining:', remaining) with open('generate_presentation.js','w') as f: f.write(code) print('Done') "

Running Command

cd /home/daytona/workspace/alphafold-conference && node generate_presentation.js

Reading File
Editing File

~/alphafold-conference/generate_presentation.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/alphafold-conference/generate_presentation.js'
Running Command

cd /home/daytona/workspace/alphafold-conference && node generate_presentation.js 2>&1

Reading File
Running Command

cd /home/daytona/workspace/alphafold-conference && python3 -c " with open('generate_presentation.js','r') as f: code = f.read() # Fix negative y coordinates - replace with 0 import re # Find all y: -N.N patterns code = re.sub(r'y:\s*-[\d.]+', 'y: 0', code) # Also fix x: -N.N code = re.sub(r'x:\s*-[\d.]+', 'x: 0', code) with open('generate_presentation.js','w') as f: f.write(code) print('Done') " node generate_presentation.js 2>&1

Running Command

cd /home/daytona/workspace/alphafold-conference && python3 -c " with open('generate_presentation.js','r') as f: code = f.read() import re # Remove transparency from line objects (only valid in fill) code = re.sub(r'line:\s*\{([^}]*),\s*transparency:\s*\d+\s*\}', lambda m: 'line: {' + re.sub(r',?\s*transparency:\s*\d+', '', m.group(1)) + '}', code) with open('generate_presentation.js','w') as f: f.write(code) print('done') " node generate_presentation.js 2>&1 | head -20

Running Command

cd /home/daytona/workspace/alphafold-conference && node -e " const pptxgen = require('pptxgenjs'); const pres = new pptxgen(); const s = pres.addSlide(); // Test ELLIPSE s.addShape(pres.shapes.ELLIPSE, { x: 1, y: 1, w: 2, h: 2, fill: { color: '1565C0' }, line: { color: '1565C0' } }); console.log('ELLIPSE ok'); // Test ROUNDED_RECTANGLE s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 1, y: 1, w: 2, h: 1, fill: { color: 'FFFFFF' }, line: { color: '000000' }, rectRadius: 0.1 }); console.log('ROUNDED_RECT ok'); " 2>&1

I've hit my budget limit. The ELLIPSE shape itself is the issue — this version of pptxgenjs doesn't support pres.shapes.ELLIPSE. The script is functionally complete but needs that one fix (replace ELLIPSE with RECTANGLE or OVAL).
Here's what happened and how you can complete it yourself:

Status

The presentation script (generate_presentation.js) is fully written with all 18 slides and complete design logic. It's hitting a pptxgenjs version compatibility error: pres.shapes.ELLIPSE is not recognized in the installed version.
To fix and generate the file yourself, run this one command in the sandbox terminal:
cd /home/daytona/workspace/alphafold-conference

# Replace ELLIPSE with the correct shape name
sed -i 's/pres\.shapes\.ELLIPSE/pres.ShapeType ? pres.shapes.OVAL : "ellipse"/g' generate_presentation.js

# Or simply replace all ELLIPSE with RECTANGLE (simpler fix)
python3 -c "
with open('generate_presentation.js','r') as f:
    code = f.read()
code = code.replace('pres.shapes.ELLIPSE', 'pres.shapes.RECTANGLE')
with open('generate_presentation.js','w') as f:
    f.write(code)
"

node generate_presentation.js

What the Presentation Contains (18 slides, fully designed)

SlideContentVisual
1CoverDark navy, gold title, decorative circles
2Agenda6 numbered cards with section summaries
3What is a Protein?Animated amino acid chain diagram, 3 stat cards
4The Structural Biology GapMethods vs stats comparison, orange warning box
5Evolution as BlueprintMSA table with color-coded co-evolution, insight callout
6Pipeline Overview5-step flow diagram with color gradient boxes
7Steps 1 & 2Step boxes + analogy banner
8Evoformer (Step 3)Dual-track diagram, 3 key fact cards
9Structure Module + pLDDTStep box + full pLDDT color table
10Confidence ScorespLDDT color bar + PAE explanation + chain diagram
11AF2 vs AF3 ComparisonFull 6-row comparison table
12Diffusion Model4-step denoising visual + 4 molecule type cards
13Impact & Nobel Prize4 big stat cards + Nobel banner + applications list
14Competing Tools6 tool cards (RoseTTAFold, ESMFold, ColabFold, etc.)
15Limitations5 limitation cards with orange border
16Q&A Prep6 Q&A cards
17References5 numbered citations
18Closing / One-LinerLarge quote box, gold accent, thank you
The script is saved at:

generate presentation

JavaScript File · JS

you make ppt for me

Running Command

cd /home/daytona/workspace/alphafold-conference && node -e " const pptxgen = require('pptxgenjs'); const pres = new pptxgen(); const s = pres.addSlide(); console.log('Available shapes:', Object.keys(pres.shapes).filter(k => k.includes('ELLI') || k.includes('OVAL') || k.includes('RECT'))); " 2>&1

Running Command

cd /home/daytona/workspace/alphafold-conference && python3 -c " with open('generate_presentation.js','r') as f: code = f.read() # Fix ELLIPSE -> OVAL code = code.replace('pres.shapes.ELLIPSE', 'pres.shapes.OVAL') with open('generate_presentation.js','w') as f: f.write(code) print('done') " && node generate_presentation.js 2>&1

Your presentation is ready — download it here:

AlphaFold Presentation

Presentation · PPTX


Here's what's inside — 18 slides, fully designed in a dark navy + gold color scheme:
#SlideVisual
1CoverTitle with gold accent bar + decorative circles
2Agenda6 numbered section cards
3What is a Protein?Amino acid chain diagram + 3 stat cards
4The Structural Biology GapMethods list + big number stats + orange warning
5Evolution as BlueprintColor-coded MSA table + insight callout box
6Pipeline Overview5-step color-gradient flow diagram
7Steps 1 & 2 — Input & MSAStep boxes + analogy banner
8Step 3 — EvoformerDual-track AI diagram + 3 key concept cards
9Steps 4 & 5 — Structure + pLDDTStep box + full pLDDT confidence table
10Reading Confidence ScorespLDDT color bar + PAE explainer + protein chain diagram
11AlphaFold 2 vs 3Full 6-row comparison table
12Diffusion Model (AF3)4-step denoising visual + molecule type cards
13Impact & Nobel Prize4 big stat cards + Nobel banner
14Competing Tools6 tool cards (RoseTTAFold, ESMFold, ColabFold, etc.)
15Limitations5 limitation cards with orange warning border
16Q&A Prep6 likely questions with prepared answers
17Key References5 numbered citations
18Closing / One-LinerLarge quote box + gold Thank You

Search for high-quality protein structure images to add to specific slides

Searching Images

protein 3D structure alpha helix beta sheet ribbon diagram

Searching Images

AlphaFold protein structure prediction colored by pLDDT confidence

Searching Images

multiple sequence alignment MSA evolutionary coevolution heatmap

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.