lfj-code / Report /build_pptx.js
ethan1115's picture
Upload folder using huggingface_hub
e2409ff verified
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "Qian";
pres.title = "GRN-Guided Cascaded Flow Matching";
// === Color Palette ===
const C = {
navy: "0B1D3A",
deepBlue: "0E3B5C",
teal: "0D7377",
seafoam: "14B8A6",
mint: "99F6E4", // brightened for dark bg readability
gold: "F59E0B",
orange: "F97316",
coral: "EF4444",
white: "FFFFFF",
offWhite: "F0F4F8",
lightGray: "E2E8F0",
midGray: "94A3B8",
darkGray: "334155",
textDark: "1E293B",
textMid: "475569",
accent1: "3B82F6", // blue for expression
accent2: "F59E0B", // gold for GRN/latent
accent3: "10B981", // green for bio
subtitleOnDark: "A7F3D0", // bright mint-green for subtitles on navy
};
const cardShadow = () => ({ type: "outer", blur: 4, offset: 2, angle: 135, color: "000000", opacity: 0.10 });
// Slide number — placed safely out of content area
function addSlideNum(slide, num) {
slide.addText(String(num), {
x: 9.3, y: 5.2, w: 0.5, h: 0.3,
fontSize: 8, color: C.midGray, align: "right", fontFace: "Calibri",
});
}
// Section divider — centered vertically, improved contrast
function addDividerSlide(title, subtitle, num) {
const s = pres.addSlide();
s.background = { color: C.navy };
s.addShape(pres.shapes.RECTANGLE, { x: 0.7, y: 2.0, w: 0.8, h: 0.06, fill: { color: C.seafoam } });
s.addText(title, {
x: 0.7, y: 2.2, w: 8.6, h: 1.0,
fontSize: 36, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
});
if (subtitle) {
s.addText(subtitle, {
x: 0.7, y: 3.3, w: 8.6, h: 0.6,
fontSize: 16, fontFace: "Calibri", color: C.subtitleOnDark, margin: 0,
});
}
addSlideNum(s, num);
return s;
}
// Content slide — title with teal top bar
function addContentSlide(title, num) {
const s = pres.addSlide();
s.background = { color: C.offWhite };
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.06, fill: { color: C.teal } });
s.addText(title, {
x: 0.6, y: 0.15, w: 8.8, h: 0.55,
fontSize: 22, fontFace: "Georgia", color: C.textDark, bold: true, margin: 0,
});
addSlideNum(s, num);
return s;
}
let slideNum = 0;
// ============================================================
// SLIDE 1: Title
// ============================================================
slideNum++;
{
const s = pres.addSlide();
s.background = { color: C.navy };
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: C.seafoam } });
s.addShape(pres.shapes.RECTANGLE, { x: 0.7, y: 1.2, w: 1.2, h: 0.06, fill: { color: C.gold } });
s.addText("GRN-Guided\nCascaded Flow Matching\nfor Single-Cell Perturbation Prediction", {
x: 0.7, y: 1.4, w: 8.6, h: 2.2,
fontSize: 30, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
lineSpacingMultiple: 1.35,
});
s.addText("Gene Regulatory Network meets Flow Matching", {
x: 0.7, y: 3.75, w: 8.6, h: 0.4,
fontSize: 14, fontFace: "Calibri", color: C.subtitleOnDark, italic: true, margin: 0,
});
s.addShape(pres.shapes.RECTANGLE, { x: 0.7, y: 4.35, w: 2.5, h: 0.02, fill: { color: C.midGray } });
s.addText("Group Meeting | 2026.03", {
x: 0.7, y: 4.5, w: 8.6, h: 0.4,
fontSize: 12, fontFace: "Calibri", color: C.lightGray, margin: 0,
});
addSlideNum(s, slideNum);
}
// ============================================================
// SLIDE 2: Section — Task
// ============================================================
slideNum++;
addDividerSlide("1. Task", "Single-Cell Perturbation Prediction", slideNum);
// ============================================================
// SLIDE 3: Virtual Cell + Perturbation Types
// ============================================================
slideNum++;
{
const s = addContentSlide("Virtual Cell & Perturbation Types", slideNum);
// Virtual Cell callout
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 4.2, h: 1.15, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 0.07, h: 1.15, fill: { color: C.teal } });
s.addText([
{ text: "Virtual Cell", options: { bold: true, fontSize: 13, color: C.teal, breakLine: true } },
{ text: "AI model simulating real cell behavior: given genotype, environment, perturbation \u2192 predict molecular state changes. Perturbation prediction is its most critical subtask.", options: { fontSize: 10.5, color: C.textMid } },
], { x: 0.75, y: 0.95, w: 3.8, h: 1.05, valign: "top", fontFace: "Calibri", margin: 0 });
// Three perturbation type cards (right)
const types = [
{ title: "Drug Perturbation", desc: "Small molecules / drugs (L1000/LINCS)", color: C.accent1 },
{ title: "Cytokine Perturbation", desc: "Cytokines (IL-6, TNF-a, IFN-g) signaling", color: C.accent3 },
{ title: "Genetic Perturbation", desc: "CRISPR KO / CRISPRa OE / RNAi KD", color: C.accent2 },
];
const cardX = 5.0, cardW = 4.5, cardH = 0.7;
types.forEach((t, i) => {
const yy = 0.9 + i * (cardH + 0.12);
s.addShape(pres.shapes.RECTANGLE, { x: cardX, y: yy, w: cardW, h: cardH, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: cardX, y: yy, w: 0.07, h: cardH, fill: { color: t.color } });
s.addText(t.title, {
x: cardX + 0.2, y: yy + 0.05, w: 4.0, h: 0.28,
fontSize: 11.5, fontFace: "Calibri", bold: true, color: C.textDark, margin: 0,
});
s.addText(t.desc, {
x: cardX + 0.2, y: yy + 0.35, w: 4.0, h: 0.3,
fontSize: 9.5, fontFace: "Calibri", color: C.textMid, margin: 0,
});
});
// Focus banner
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.4, w: 9.0, h: 0.5, fill: { color: C.navy } });
s.addText("This work: genetic perturbation (Perturb-seq) = CRISPR perturbation + scRNA-seq readout", {
x: 0.7, y: 3.42, w: 8.6, h: 0.46,
fontSize: 11.5, fontFace: "Calibri", color: C.white, bold: true, margin: 0, valign: "middle",
});
// Task formalization
s.addText([
{ text: "Task: ", options: { bold: true, color: C.teal, fontSize: 13 } },
{ text: "x_ctrl + perturbation ID \u2192 predict x_pert (x \u2208 R^G, G \u2248 5000 HVG)", options: { color: C.textDark, fontSize: 12, fontFace: "Consolas" } },
], { x: 0.5, y: 4.05, w: 9.0, h: 0.35, fontFace: "Calibri", margin: 0 });
// Key challenges
s.addText([
{ text: "Drug screening acceleration | Combinatorial explosion: N genes \u2192 N(N-1)/2 combos | ", options: { fontSize: 10, color: C.textMid, breakLine: false } },
{ text: "No paired data (destructive measurement)", options: { fontSize: 10, color: C.coral, bold: true } },
], { x: 0.5, y: 4.45, w: 9.0, h: 0.35, fontFace: "Calibri", margin: 0 });
}
// ============================================================
// SLIDE 4: Section — Existing Methods
// ============================================================
slideNum++;
addDividerSlide("2. Existing Methods", "And their common blind spot", slideNum);
// ============================================================
// SLIDE 5: Methods Overview Table
// ============================================================
slideNum++;
{
const s = addContentSlide("Existing Methods: Overview", slideNum);
const methods = [
{ name: "Additive Shift", cat: "Baseline", approach: "Mean shift: x = x_ctrl + delta_mean", issue: "Ignores cell heterogeneity" },
{ name: "scGPT", cat: "Foundation Model", approach: "Masked token completion (fine-tune)", issue: "Encodes absolute state, not change" },
{ name: "Geneformer", cat: "Foundation Model", approach: "In-silico: delete gene token", issue: "Heuristic, no learned dynamics" },
{ name: "CPA", cat: "Dedicated Model", approach: "VAE: basal + perturbation (additive)", issue: "Linear additivity too strong" },
{ name: "GEARS", cat: "Dedicated Model", approach: "GNN on GO graph + cross-attention", issue: "Static prior graph, deterministic" },
{ name: "STATE", cat: "Dedicated Model", approach: "Stacked attention on expression", issue: "Deterministic, no GRN modeling" },
{ name: "CellFlow", cat: "Flow Matching", approach: "FM + pretrained embedding cond.", issue: "Embedding = absolute state" },
{ name: "scDFM", cat: "Flow Matching", approach: "Conditional FM + DiffPerceiver", issue: "No GRN understanding" },
];
const hY = 0.85;
const cols = [
{ x: 0.5, w: 1.5, label: "Method" },
{ x: 2.0, w: 1.5, label: "Category" },
{ x: 3.5, w: 3.2, label: "Approach" },
{ x: 6.7, w: 2.8, label: "Key Limitation" },
];
// Header
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: hY, w: 9.0, h: 0.35, fill: { color: C.teal } });
cols.forEach(c => {
s.addText(c.label, {
x: c.x + 0.08, y: hY, w: c.w - 0.08, h: 0.35,
fontSize: 10, fontFace: "Calibri", bold: true, color: C.white, valign: "middle", margin: 0,
});
});
// Data rows
const rowH = 0.37;
methods.forEach((m, i) => {
const ry = hY + 0.35 + i * rowH;
const bgColor = i % 2 === 0 ? C.white : "F8FAFC";
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: ry, w: 9.0, h: rowH, fill: { color: bgColor } });
s.addText(m.name, {
x: cols[0].x + 0.08, y: ry, w: cols[0].w - 0.08, h: rowH,
fontSize: 9.5, fontFace: "Calibri", bold: true, color: C.textDark, valign: "middle", margin: 0,
});
s.addText(m.cat, {
x: cols[1].x + 0.08, y: ry, w: cols[1].w - 0.08, h: rowH,
fontSize: 9, fontFace: "Calibri", color: C.textMid, valign: "middle", margin: 0,
});
s.addText(m.approach, {
x: cols[2].x + 0.08, y: ry, w: cols[2].w - 0.08, h: rowH,
fontSize: 9, fontFace: "Calibri", color: C.textDark, valign: "middle", margin: 0,
});
s.addText(m.issue, {
x: cols[3].x + 0.08, y: ry, w: cols[3].w - 0.08, h: rowH,
fontSize: 9, fontFace: "Calibri", color: C.coral, bold: true, valign: "middle", margin: 0,
});
});
// Common blind spot callout
const bY = hY + 0.35 + methods.length * rowH + 0.3;
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: bY, w: 9.0, h: 0.7, fill: { color: C.navy } });
s.addText([
{ text: "Common blind spot: ", options: { bold: true, color: C.gold, fontSize: 13 } },
{ text: "Perturbation \u2192 [black box] \u2192 Expression change", options: { color: C.white, fontSize: 13, breakLine: true } },
{ text: "No method explicitly models: Perturbation \u2192 GRN rewiring \u2192 Expression change", options: { color: C.subtitleOnDark, fontSize: 11 } },
], { x: 0.7, y: bY + 0.03, w: 8.6, h: 0.65, fontFace: "Calibri", valign: "middle", margin: 0 });
}
// ============================================================
// SLIDE 6: Section — Motivation
// ============================================================
slideNum++;
addDividerSlide("3. Motivation", "Why GRN + Flow Matching?", slideNum);
// ============================================================
// SLIDE 7: Motivation 1 — Flow Matching
// ============================================================
slideNum++;
{
const s = addContentSlide("Motivation 1: Flow Matching for Unpaired Data", slideNum);
// Problem card (left)
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 4.2, h: 1.8, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 0.07, h: 1.8, fill: { color: C.coral } });
s.addText([
{ text: "The Pairing Problem", options: { bold: true, fontSize: 13, color: C.coral, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "Perturbation is destructive:", options: { fontSize: 11, color: C.textDark, breakLine: true } },
{ text: "One cell measured ONCE only", options: { fontSize: 11, color: C.textDark, breakLine: true } },
{ text: "No (x_ctrl, x_pert) pairs available", options: { fontSize: 11, color: C.coral, bold: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "Mean matching \u2192 loses heterogeneity", options: { bullet: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Autoencoder \u2192 limited reconstruction", options: { bullet: true, fontSize: 10, color: C.textMid } },
], { x: 0.75, y: 0.95, w: 3.8, h: 1.7, fontFace: "Calibri", valign: "top", margin: 0 });
// Solution card (right)
s.addShape(pres.shapes.RECTANGLE, { x: 5.0, y: 0.9, w: 4.5, h: 1.8, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 5.0, y: 0.9, w: 0.07, h: 1.8, fill: { color: C.accent3 } });
s.addText([
{ text: "Flow Matching Solution", options: { bold: true, fontSize: 13, color: C.accent3, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "Learn probabilistic transport mapping\nbetween distributions (not individual cells)", options: { fontSize: 11, color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "Only needs population-level distributions", options: { bullet: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Conditional OT for efficient pairing", options: { bullet: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Generative output = uncertainty estimation", options: { bullet: true, fontSize: 10, color: C.textMid } },
], { x: 5.25, y: 0.95, w: 4.1, h: 1.7, fontFace: "Calibri", valign: "top", margin: 0 });
// Flow diagram
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.0, w: 9.0, h: 1.6, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.OVAL, { x: 1.2, y: 3.25, w: 1.8, h: 1.1, fill: { color: "FEE2E2" } });
s.addText("noise x\u2080", { x: 1.2, y: 3.25, w: 1.8, h: 1.1, fontSize: 12, fontFace: "Calibri", color: C.coral, align: "center", valign: "middle", bold: true, margin: 0 });
s.addText("v\u03B8( x, t, ctrl, pert )", {
x: 3.2, y: 3.45, w: 3.6, h: 0.5,
fontSize: 14, fontFace: "Consolas", color: C.teal, align: "center", valign: "middle", bold: true, margin: 0,
});
s.addShape(pres.shapes.RECTANGLE, { x: 3.5, y: 3.95, w: 3.0, h: 0.04, fill: { color: C.teal } });
s.addText("learned velocity field (ODE)", {
x: 3.2, y: 4.0, w: 3.6, h: 0.3,
fontSize: 9, fontFace: "Calibri", color: C.textMid, align: "center", margin: 0,
});
s.addShape(pres.shapes.OVAL, { x: 7.0, y: 3.25, w: 1.8, h: 1.1, fill: { color: "D1FAE5" } });
s.addText("predicted\nx_pert", { x: 7.0, y: 3.25, w: 1.8, h: 1.1, fontSize: 12, fontFace: "Calibri", color: C.accent3, align: "center", valign: "middle", bold: true, margin: 0 });
}
// ============================================================
// SLIDE 8: Motivation 2 — GRN Cascade
// ============================================================
slideNum++;
{
const s = addContentSlide("Motivation 2: Perturbation Propagates via GRN", slideNum);
// Cascade diagram (left)
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 5.5, h: 2.8, fill: { color: C.white }, shadow: cardShadow() });
const steps = [
{ text: "CRISPR knock-out Gene A", color: C.coral, bold: true },
{ text: "Gene A expression --> 0", color: C.coral, bold: false },
{ text: "Direct targets B, C, D change (1st order)", color: C.accent2, bold: false },
{ text: "B->E,F C->G,H D->I ... (cascade)", color: C.accent2, bold: false },
{ text: "Thousands of genes ultimately affected", color: C.teal, bold: true },
];
steps.forEach((st, i) => {
const yy = 1.05 + i * 0.45;
s.addText((i > 0 ? " | " : " ") + st.text, {
x: 0.8, y: yy, w: 5.0, h: 0.38,
fontSize: 11, fontFace: "Calibri", color: st.color, bold: st.bold, margin: 0,
});
});
s.addText("This cascade path = Gene Regulatory Network (GRN)", {
x: 0.8, y: 3.3, w: 5.0, h: 0.3,
fontSize: 11, fontFace: "Calibri", color: C.navy, bold: true, italic: true, margin: 0,
});
// Comparison cards (right)
s.addShape(pres.shapes.RECTANGLE, { x: 6.3, y: 0.9, w: 3.2, h: 1.2, fill: { color: "FEF3C7" }, shadow: cardShadow() });
s.addText([
{ text: "Existing Methods", options: { bold: true, fontSize: 12, color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Pert -> [black box] -> Expr", options: { fontSize: 11, fontFace: "Consolas", color: C.coral, breakLine: true } },
{ text: "End-to-end, no GRN understanding", options: { fontSize: 10, color: C.textMid } },
], { x: 6.5, y: 0.95, w: 2.9, h: 1.1, fontFace: "Calibri", valign: "top", margin: 0 });
s.addShape(pres.shapes.RECTANGLE, { x: 6.3, y: 2.3, w: 3.2, h: 1.4, fill: { color: "D1FAE5" }, shadow: cardShadow() });
s.addText([
{ text: "Our Approach", options: { bold: true, fontSize: 12, color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Pert -> GRN change -> Expr", options: { fontSize: 11, fontFace: "Consolas", color: C.accent3, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Explicitly model how perturbation rewires the regulatory network, then predict expression", options: { fontSize: 10, color: C.textDark } },
], { x: 6.5, y: 2.35, w: 2.9, h: 1.3, fontFace: "Calibri", valign: "top", margin: 0 });
// Bottom insight
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 4.1, w: 9.0, h: 0.5, fill: { color: C.navy } });
s.addText("Understanding GRN changes is a prerequisite for accurate expression prediction", {
x: 0.7, y: 4.12, w: 8.6, h: 0.46,
fontSize: 12, fontFace: "Calibri", color: C.gold, bold: true, margin: 0, valign: "middle",
});
}
// ============================================================
// SLIDE 9: Motivation 3 — scGPT Attention = GRN
// ============================================================
slideNum++;
{
const s = addContentSlide("Motivation 3: scGPT Attention = Data-Driven GRN", slideNum);
// Left: explanation
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 4.5, h: 2.1, fill: { color: C.white }, shadow: cardShadow() });
s.addText([
{ text: "scGPT Transformer Attention", options: { bold: true, fontSize: 13, color: C.teal, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "attn[i][j] high -> gene j influences gene i", options: { fontSize: 11, fontFace: "Consolas", color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "= Context-dependent, data-driven GRN", options: { fontSize: 12, color: C.navy, bold: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "vs static GO graph:", options: { bold: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Changes with cell state (context-aware)", options: { bullet: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Learned from massive scRNA-seq data", options: { bullet: true, fontSize: 10, color: C.textMid, breakLine: true } },
{ text: "Captures non-linear regulatory logic", options: { bullet: true, fontSize: 10, color: C.textMid } },
], { x: 0.7, y: 0.95, w: 4.1, h: 2.0, fontFace: "Calibri", valign: "top", margin: 0 });
// Right: Attention-Delta
s.addShape(pres.shapes.RECTANGLE, { x: 5.3, y: 0.9, w: 4.2, h: 2.1, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 5.3, y: 0.9, w: 0.07, h: 2.1, fill: { color: C.gold } });
s.addText([
{ text: "Attention-Delta", options: { bold: true, fontSize: 13, color: C.accent2, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "Same frozen scGPT, two inputs:", options: { fontSize: 11, color: C.textDark, breakLine: true } },
{ text: "attn_ctrl = scGPT(x_ctrl)", options: { fontSize: 10.5, fontFace: "Consolas", color: C.accent1, breakLine: true } },
{ text: "attn_pert = scGPT(x_pert)", options: { fontSize: 10.5, fontFace: "Consolas", color: C.coral, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "delta_attn = attn_pert - attn_ctrl", options: { fontSize: 11, fontFace: "Consolas", color: C.navy, bold: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Directly captures how perturbation\nrewires gene regulatory relationships", options: { fontSize: 10, color: C.textDark } },
], { x: 5.55, y: 0.95, w: 3.8, h: 2.0, fontFace: "Calibri", valign: "top", margin: 0 });
// Bottom: GRN features formula
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.3, w: 9.0, h: 1.25, fill: { color: C.navy } });
s.addText([
{ text: "GRN Change Features:", options: { bold: true, fontSize: 14, color: C.gold, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "z = delta_attn x gene_embeddings", options: { fontSize: 17, fontFace: "Consolas", color: C.white, breakLine: true } },
{ text: " (G x G) (G x 512) --> (G x 512)", options: { fontSize: 11, fontFace: "Consolas", color: C.subtitleOnDark } },
], { x: 0.7, y: 3.35, w: 8.6, h: 1.15, fontFace: "Calibri", valign: "top", margin: 0 });
}
// ============================================================
// SLIDE 10: Section — Our Method
// ============================================================
slideNum++;
addDividerSlide("4. Our Method", "GRN-Guided Cascaded Flow Matching", slideNum);
// ============================================================
// SLIDE 11: Two-Stage Cascaded FM
// ============================================================
slideNum++;
{
const s = addContentSlide("Two-Stage Cascaded Flow Matching", slideNum);
// Stage 1 card
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 4.0, h: 2.0, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 0.07, h: 2.0, fill: { color: C.gold } });
s.addText([
{ text: "Stage 1: GRN Latent Flow", options: { bold: true, fontSize: 13, color: C.accent2, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "noise ==(ODE)==> GRN features", options: { fontSize: 12, fontFace: "Consolas", color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "\"Understand how gene regulation\n changes under perturbation\"", options: { fontSize: 11, color: C.accent2, italic: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "t_latent: 0 -> 1", options: { fontSize: 10, fontFace: "Consolas", color: C.textMid, breakLine: true } },
{ text: "t_expr = 0 (expression frozen)", options: { fontSize: 10, fontFace: "Consolas", color: C.textMid } },
], { x: 0.75, y: 0.95, w: 3.6, h: 1.9, fontFace: "Calibri", valign: "top", margin: 0 });
// Arrow
s.addShape(pres.shapes.RECTANGLE, { x: 4.6, y: 1.75, w: 0.7, h: 0.04, fill: { color: C.teal } });
s.addText(">", { x: 5.0, y: 1.55, w: 0.5, h: 0.5, fontSize: 24, color: C.teal, align: "center", valign: "middle", fontFace: "Calibri", bold: true, margin: 0 });
// Stage 2 card
s.addShape(pres.shapes.RECTANGLE, { x: 5.5, y: 0.9, w: 4.0, h: 2.0, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 5.5, y: 0.9, w: 0.07, h: 2.0, fill: { color: C.accent1 } });
s.addText([
{ text: "Stage 2: Expression Flow", options: { bold: true, fontSize: 13, color: C.accent1, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "noise ==(ODE)==> expression", options: { fontSize: 12, fontFace: "Consolas", color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "\"Based on GRN understanding,\n predict gene expression changes\"", options: { fontSize: 11, color: C.accent1, italic: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "t_expr: 0 -> 1", options: { fontSize: 10, fontFace: "Consolas", color: C.textMid, breakLine: true } },
{ text: "t_latent = 1 (GRN complete)", options: { fontSize: 10, fontFace: "Consolas", color: C.textMid } },
], { x: 5.75, y: 0.95, w: 3.6, h: 1.9, fontFace: "Calibri", valign: "top", margin: 0 });
// Bio intuition banner
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.15, w: 9.0, h: 0.55, fill: { color: C.navy } });
s.addText("Bio intuition: First understand HOW regulation changes, THEN predict WHAT expression changes", {
x: 0.7, y: 3.18, w: 8.6, h: 0.5,
fontSize: 12, fontFace: "Calibri", color: C.gold, bold: true, margin: 0, valign: "middle",
});
// Training note card
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.95, w: 9.0, h: 0.85, fill: { color: C.white }, shadow: cardShadow() });
s.addText([
{ text: "Cascaded Training: ", options: { bold: true, fontSize: 12, color: C.teal } },
{ text: "Probabilistic switching (not simultaneous)", options: { fontSize: 12, color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "40% Train Latent Flow: t_latent random, t_expr=0, loss_latent only", options: { fontSize: 10, fontFace: "Consolas", color: C.accent2, breakLine: true } },
{ text: "60% Train Expr Flow: t_expr random, t_latent~1, loss_expr only", options: { fontSize: 10, fontFace: "Consolas", color: C.accent1 } },
], { x: 0.7, y: 4.0, w: 8.6, h: 0.75, fontFace: "Calibri", valign: "top", margin: 0 });
}
// ============================================================
// SLIDE 12: Model Architecture
// ============================================================
slideNum++;
{
const s = addContentSlide("Model Architecture", slideNum);
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.85, w: 9.0, h: 4.2, fill: { color: C.white }, shadow: cardShadow() });
// --- Top: Two input streams ---
s.addShape(pres.shapes.RECTANGLE, { x: 0.8, y: 1.0, w: 3.5, h: 0.6, fill: { color: "DBEAFE" } });
s.addText([
{ text: "Expression Stream", options: { bold: true, fontSize: 11, color: C.accent1, breakLine: true } },
{ text: "GeneEnc(id) + ValueEnc(x_t, x_ctrl) -> tokens", options: { fontSize: 8.5, fontFace: "Consolas", color: C.textMid } },
], { x: 0.9, y: 1.03, w: 3.3, h: 0.55, fontFace: "Calibri", valign: "middle", margin: 0 });
s.addShape(pres.shapes.RECTANGLE, { x: 5.7, y: 1.0, w: 3.5, h: 0.6, fill: { color: "FEF3C7" } });
s.addText([
{ text: "Latent Stream (GRN)", options: { bold: true, fontSize: 11, color: C.accent2, breakLine: true } },
{ text: "LatentEmbedder(z_t) -> tokens", options: { fontSize: 8.5, fontFace: "Consolas", color: C.textMid } },
], { x: 5.8, y: 1.03, w: 3.3, h: 0.55, fontFace: "Calibri", valign: "middle", margin: 0 });
// Plus
s.addShape(pres.shapes.OVAL, { x: 4.5, y: 1.05, w: 0.5, h: 0.5, fill: { color: C.teal } });
s.addText("+", { x: 4.5, y: 1.05, w: 0.5, h: 0.5, fontSize: 20, color: C.white, align: "center", valign: "middle", bold: true, margin: 0 });
// Down arrow
s.addText("|", { x: 4.5, y: 1.6, w: 0.5, h: 0.3, fontSize: 14, color: C.teal, align: "center", valign: "middle", margin: 0 });
s.addText("V", { x: 4.5, y: 1.8, w: 0.5, h: 0.2, fontSize: 10, color: C.teal, align: "center", valign: "middle", margin: 0 });
// --- Shared Backbone ---
s.addShape(pres.shapes.RECTANGLE, { x: 1.5, y: 2.1, w: 3.8, h: 1.5, fill: { color: C.teal } });
s.addText([
{ text: "Shared Backbone", options: { bold: true, fontSize: 13, color: C.white, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 3 } },
{ text: "DiffPerceiverBlock x 4", options: { fontSize: 11, color: C.mint, breakLine: true } },
{ text: "(GeneadaLN + Adapter + DiffAttn)", options: { fontSize: 9, color: C.mint, breakLine: true } },
{ text: "d_model = 512", options: { fontSize: 10, fontFace: "Consolas", color: C.white } },
], { x: 1.6, y: 2.15, w: 3.6, h: 1.4, fontFace: "Calibri", valign: "middle", align: "center", margin: 0 });
// --- Conditioning box ---
s.addShape(pres.shapes.RECTANGLE, { x: 6.0, y: 2.1, w: 3.2, h: 0.55, fill: { color: "E0E7FF" } });
s.addText("c = t_expr + t_latent + pert_emb", {
x: 6.05, y: 2.1, w: 3.1, h: 0.55,
fontSize: 9, fontFace: "Consolas", color: C.accent1, valign: "middle", align: "center", margin: 0,
});
s.addText("Cond.", {
x: 5.35, y: 2.15, w: 0.6, h: 0.45,
fontSize: 8, fontFace: "Calibri", color: C.textMid, valign: "middle", align: "center", margin: 0,
});
// --- Frozen scGPT box ---
s.addShape(pres.shapes.RECTANGLE, { x: 6.0, y: 2.9, w: 3.2, h: 1.65, fill: { color: "F1F5F9" }, line: { color: C.midGray, width: 1, dashType: "dash" } });
s.addText([
{ text: "Frozen scGPT", options: { bold: true, fontSize: 11, color: C.darkGray, breakLine: true } },
{ text: "(no gradient)", options: { fontSize: 8, color: C.midGray, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 3 } },
{ text: "x_ctrl, x_pert", options: { fontSize: 9, fontFace: "Consolas", color: C.accent1, breakLine: true } },
{ text: " -> attention layer 11", options: { fontSize: 9, fontFace: "Consolas", color: C.midGray, breakLine: true } },
{ text: "delta_attn x gene_emb", options: { fontSize: 9, fontFace: "Consolas", color: C.accent2, breakLine: true } },
{ text: " -> z_target (B,G,512)", options: { fontSize: 9, fontFace: "Consolas", color: C.accent2 } },
], { x: 6.1, y: 2.95, w: 3.0, h: 1.55, fontFace: "Calibri", valign: "top", margin: 0 });
// --- Two decoder heads ---
s.addShape(pres.shapes.RECTANGLE, { x: 1.5, y: 3.9, w: 1.7, h: 0.6, fill: { color: "DBEAFE" } });
s.addText([
{ text: "Expr Head", options: { bold: true, fontSize: 10, color: C.accent1, breakLine: true } },
{ text: "v_expr (B,G)", options: { fontSize: 9, fontFace: "Consolas", color: C.textMid } },
], { x: 1.5, y: 3.93, w: 1.7, h: 0.55, fontFace: "Calibri", valign: "middle", align: "center", margin: 0 });
s.addShape(pres.shapes.RECTANGLE, { x: 3.6, y: 3.9, w: 1.7, h: 0.6, fill: { color: "FEF3C7" } });
s.addText([
{ text: "Latent Head", options: { bold: true, fontSize: 10, color: C.accent2, breakLine: true } },
{ text: "v_latent (B,G,512)", options: { fontSize: 9, fontFace: "Consolas", color: C.textMid } },
], { x: 3.6, y: 3.93, w: 1.7, h: 0.55, fontFace: "Calibri", valign: "middle", align: "center", margin: 0 });
}
// ============================================================
// SLIDE 13: Section — Challenges
// ============================================================
slideNum++;
addDividerSlide("5. Current Challenges", "And proposed solutions", slideNum);
// ============================================================
// SLIDE 14: Challenges + Solutions
// ============================================================
slideNum++;
{
const s = addContentSlide("Challenges & Solutions", slideNum);
// Challenge 1 (top-left)
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 4.3, h: 2.0, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.9, w: 0.07, h: 2.0, fill: { color: C.coral } });
s.addText([
{ text: "Challenge 1: Noise in Attention", options: { bold: true, fontSize: 12, color: C.coral, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Attention: 5000x5000 = 25M non-zero values", options: { fontSize: 10, color: C.textDark, breakLine: true } },
{ text: "Real GRN: ~20-50 regulators per gene", options: { fontSize: 10, color: C.textDark, breakLine: true } },
{ text: "99%+ values are noise!", options: { fontSize: 11, color: C.coral, bold: true, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Evidence: latent loss ~ 1.12", options: { fontSize: 10, color: C.textMid, breakLine: true } },
{ text: " >> expr loss ~ 0.019", options: { fontSize: 10, color: C.textMid } },
], { x: 0.75, y: 0.95, w: 3.9, h: 1.9, fontFace: "Calibri", valign: "top", margin: 0 });
// Solution 1 (top-right)
s.addShape(pres.shapes.RECTANGLE, { x: 5.2, y: 0.9, w: 4.3, h: 2.0, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 5.2, y: 0.9, w: 0.07, h: 2.0, fill: { color: C.accent3 } });
s.addText([
{ text: "Solution: Sparse Top-K", options: { bold: true, fontSize: 12, color: C.accent3, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Per gene: keep only K=30 largest |delta|", options: { fontSize: 10, color: C.textDark, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "delta_attn (GxG) 25M values", options: { fontSize: 9.5, fontFace: "Consolas", color: C.coral, breakLine: true } },
{ text: " -> top-K sparsification", options: { fontSize: 9.5, fontFace: "Consolas", color: C.textMid, breakLine: true } },
{ text: "sparse_delta (Gx30) filter 99.4%", options: { fontSize: 9.5, fontFace: "Consolas", color: C.accent3, breakLine: true } },
{ text: " -> x gene_emb = (G,512)", options: { fontSize: 9.5, fontFace: "Consolas", color: C.accent3 } },
], { x: 5.45, y: 0.95, w: 3.9, h: 1.9, fontFace: "Calibri", valign: "top", margin: 0 });
// Challenge 2 (bottom-left)
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.2, w: 4.3, h: 1.2, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.2, w: 0.07, h: 1.2, fill: { color: C.coral } });
s.addText([
{ text: "Challenge 2: 512-d Latent Too Hard", options: { bold: true, fontSize: 12, color: C.coral, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "(G,512) = 2.5M-dim velocity field per step", options: { fontSize: 10, color: C.textDark, breakLine: true } },
{ text: "Ablation: dim 512->1: loss 1.1 -> 0.5-0.7", options: { fontSize: 10, fontFace: "Consolas", color: C.textDark } },
], { x: 0.75, y: 3.25, w: 3.9, h: 1.1, fontFace: "Calibri", valign: "top", margin: 0 });
// Solution 2 (bottom-right)
s.addShape(pres.shapes.RECTANGLE, { x: 5.2, y: 3.2, w: 4.3, h: 1.2, fill: { color: C.white }, shadow: cardShadow() });
s.addShape(pres.shapes.RECTANGLE, { x: 5.2, y: 3.2, w: 0.07, h: 1.2, fill: { color: C.accent3 } });
s.addText([
{ text: "Solution: PCA Reduction", options: { bold: true, fontSize: 12, color: C.accent3, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "sparse_delta x pca_basis -> (G, 64)", options: { fontSize: 10, fontFace: "Consolas", color: C.textDark, breakLine: true } },
{ text: "Keep principal directions, 8x reduction", options: { fontSize: 10, color: C.textMid } },
], { x: 5.45, y: 3.25, w: 3.9, h: 1.1, fontFace: "Calibri", valign: "top", margin: 0 });
}
// ============================================================
// SLIDE 15: Section — Summary
// ============================================================
slideNum++;
addDividerSlide("6. Summary & Future Work", "Validating the biological hypothesis", slideNum);
// ============================================================
// SLIDE 16: Summary + Future Experiment
// ============================================================
slideNum++;
{
const s = addContentSlide("Summary & Key Future Experiment", slideNum);
// Core contribution
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.85, w: 9.0, h: 0.9, fill: { color: C.navy } });
s.addText([
{ text: "Core contribution: ", options: { bold: true, color: C.gold, fontSize: 12 } },
{ text: "Not architectural improvement -- biological mechanism-driven modeling", options: { color: C.white, fontSize: 12, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 3 } },
{ text: "Existing: Pert -> [black box] -> Expr ", options: { fontSize: 10, fontFace: "Consolas", color: C.midGray } },
{ text: "Ours: Pert -> GRN rewiring -> Expr", options: { fontSize: 10, fontFace: "Consolas", color: C.subtitleOnDark } },
], { x: 0.7, y: 0.88, w: 8.6, h: 0.85, fontFace: "Calibri", valign: "middle", margin: 0 });
// Future experiment
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 2.0, w: 9.0, h: 2.3, fill: { color: C.white }, shadow: cardShadow() });
s.addText([
{ text: "Key Future Experiment: Does inference order matter?", options: { bold: true, fontSize: 14, color: C.teal, breakLine: true } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "Train with random t1, t2 (no cascade). Compare inference orders:", options: { fontSize: 11, color: C.textDark } },
], { x: 0.7, y: 2.05, w: 8.6, h: 0.7, fontFace: "Calibri", valign: "top", margin: 0 });
const rows = [
{ order: "GRN first -> Expr", meaning: "Understand regulation, then predict", expected: "Best", bg: "D1FAE5", color: C.accent3 },
{ order: "Expr first -> GRN", meaning: "Predict first, understand after", expected: "Suboptimal", bg: "FEF3C7", color: C.accent2 },
{ order: "Simultaneous", meaning: "No explicit order", expected: "Worst", bg: "FEE2E2", color: C.coral },
];
rows.forEach((r, i) => {
const ry = 2.85 + i * 0.45;
s.addShape(pres.shapes.RECTANGLE, { x: 0.8, y: ry, w: 8.4, h: 0.38, fill: { color: r.bg } });
s.addText(r.order, {
x: 0.9, y: ry, w: 2.8, h: 0.38,
fontSize: 11, fontFace: "Consolas", color: C.textDark, bold: true, valign: "middle", margin: 0,
});
s.addText(r.meaning, {
x: 3.8, y: ry, w: 3.2, h: 0.38,
fontSize: 10, fontFace: "Calibri", color: C.textMid, valign: "middle", margin: 0,
});
s.addText(r.expected, {
x: 7.2, y: ry, w: 1.8, h: 0.38,
fontSize: 12, fontFace: "Calibri", color: r.color, bold: true, valign: "middle", align: "center", margin: 0,
});
});
// Hypothesis
s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 4.55, w: 9.0, h: 0.5, fill: { color: C.navy } });
s.addText([
{ text: "Hypothesis: ", options: { bold: true, color: C.gold, fontSize: 12 } },
{ text: "Understanding GRN changes is a prerequisite for expression prediction, not a byproduct.", options: { color: C.white, fontSize: 12 } },
], { x: 0.7, y: 4.57, w: 8.6, h: 0.46, fontFace: "Calibri", valign: "middle", margin: 0 });
}
// ============================================================
// SLIDE 17: Closing
// ============================================================
slideNum++;
{
const s = pres.addSlide();
s.background = { color: C.navy };
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: C.seafoam } });
s.addShape(pres.shapes.RECTANGLE, { x: 0.7, y: 1.5, w: 1.0, h: 0.06, fill: { color: C.gold } });
s.addText("Takeaway", {
x: 0.7, y: 1.7, w: 8.6, h: 0.5,
fontSize: 18, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
});
s.addText("Use scGPT attention-delta to explicitly extract perturbation-induced GRN changes, and through cascaded flow matching, force the model to \"first understand how GRN changes, then predict how expression changes\" -- embedding the biological prior that perturbation propagates through GRN into the generative model's inference process.", {
x: 0.7, y: 2.4, w: 8.6, h: 2.0,
fontSize: 16, fontFace: "Georgia", color: C.white, lineSpacingMultiple: 1.5, margin: 0,
});
s.addShape(pres.shapes.RECTANGLE, { x: 0.7, y: 4.6, w: 2.5, h: 0.02, fill: { color: C.midGray } });
s.addText("Thank you!", {
x: 0.7, y: 4.75, w: 8.6, h: 0.45,
fontSize: 16, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
});
addSlideNum(s, slideNum);
}
// === Save ===
const outPath = "/home/hp250092/ku50001222/qian/aivc/lfj/Report/GRN_CCFM_group_meeting.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
console.log("Saved to: " + outPath);
}).catch(err => {
console.error("Error:", err);
});