lfj-code / Report /week10 /gen_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 Perturbation Prediction";
// ── Design Tokens ──────────────────────────────────────────────────
const C = {
primary: "990011", // cherry red
primaryLt: "B8001A", // lighter red
accent: "2F3C7E", // navy accent
dark: "1A1A2E", // near-black for title slides
white: "FFFFFF",
offWhite: "FCF6F5",
lightGray: "F5F0EE",
midGray: "AAAAAA",
darkText: "2D2D2D",
bodyText: "3A3A3A",
tableHead: "990011",
tableAlt: "FDF2F2",
green: "2E7D32",
red: "C62828",
};
const FONT_H = "Georgia";
const FONT_B = "Calibri";
// ── Helper: section divider bar (top) ──────────────────────────────
function addTopBar(slide) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 10, h: 0.06,
fill: { color: C.primary },
});
}
// ── Helper: slide number ───────────────────────────────────────────
function addSlideNum(slide, num) {
slide.addText(String(num), {
x: 9.2, y: 5.15, w: 0.6, h: 0.35,
fontSize: 10, fontFace: FONT_B, color: C.midGray, align: "right",
});
}
// ── Helper: content slide title ────────────────────────────────────
function addTitle(slide, title, num) {
addTopBar(slide);
slide.addText(title, {
x: 0.6, y: 0.25, w: 8.8, h: 0.55,
fontSize: 28, fontFace: FONT_H, color: C.primary, bold: true, margin: 0,
});
// thin separator
slide.addShape(pres.shapes.LINE, {
x: 0.6, y: 0.85, w: 8.8, h: 0,
line: { color: C.primary, width: 1.2 },
});
addSlideNum(slide, num);
}
// ── Helper: bullet list ────────────────────────────────────────────
function bullets(items, opts = {}) {
return items.map((t, i) => ({
text: typeof t === "string" ? t : t.text,
options: {
bullet: { code: "2022" },
breakLine: i < items.length - 1,
fontSize: opts.fontSize || 14,
fontFace: FONT_B,
color: opts.color || C.bodyText,
bold: (typeof t === "object" && t.bold) || false,
indentLevel: (typeof t === "object" && t.indent) || 0,
paraSpaceAfter: 6,
},
}));
}
// ── Helper: table with standard styling ────────────────────────────
function styledTable(headerRow, dataRows, opts = {}) {
const hdrCells = headerRow.map((h) => ({
text: h, options: {
bold: true, color: C.white, fill: { color: C.tableHead },
fontSize: 11, fontFace: FONT_B, align: "center", valign: "middle",
},
}));
const bodyRows = dataRows.map((row, ri) =>
row.map((cell) => {
const isObj = typeof cell === "object" && cell !== null;
return {
text: isObj ? cell.text : String(cell),
options: {
fontSize: 11, fontFace: FONT_B, color: C.darkText,
fill: { color: ri % 2 === 0 ? C.white : C.tableAlt },
align: isObj && cell.align ? cell.align : "center",
valign: "middle",
bold: isObj && cell.bold ? true : false,
},
};
})
);
return { rows: [hdrCells, ...bodyRows], opts };
}
// ====================================================================
// SLIDE 1 β€” Title
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.dark };
// accent bar left
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.primary },
});
s.addText("GRN-Guided Perturbation Prediction", {
x: 0.7, y: 1.2, w: 8.6, h: 1.2,
fontSize: 36, fontFace: FONT_H, color: C.white, bold: true, margin: 0,
});
s.addText("From Cascaded Flow Matching to RegFM", {
x: 0.7, y: 2.4, w: 8.6, h: 0.6,
fontSize: 20, fontFace: FONT_B, color: C.primaryLt, margin: 0,
});
s.addShape(pres.shapes.LINE, {
x: 0.7, y: 3.2, w: 3, h: 0,
line: { color: C.primary, width: 2 },
});
s.addText("Weekly Research Progress Report | 2026-03-29", {
x: 0.7, y: 3.5, w: 8.6, h: 0.4,
fontSize: 14, fontFace: FONT_B, color: "CCCCCC", margin: 0,
});
}
// ====================================================================
// SLIDE 2 β€” Task Overview
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Task: Single-Cell Perturbation Prediction", 2);
// Left column β€” description
s.addText(bullets([
"Input: control expression + perturbed gene(s)",
"Output: post-perturbation expression",
"No cell-level pairing (destructive assay)",
"Eval: DE overlap, Pearson, MSE, etc.",
]), { x: 0.6, y: 1.15, w: 4.5, h: 2.2 });
// Right column β€” dataset card
s.addShape(pres.shapes.RECTANGLE, {
x: 5.5, y: 1.15, w: 4.0, h: 2.3,
fill: { color: C.lightGray },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 5.5, y: 1.15, w: 4.0, h: 0.4,
fill: { color: C.primary },
});
s.addText("Norman Dataset", {
x: 5.5, y: 1.15, w: 4.0, h: 0.4,
fontSize: 13, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
s.addText(bullets([
"~9,000 cells x 5,000 HVG",
"105 CRISPR perturbations (KO + OE)",
"39 held-out test perturbations",
"Fold-1 split (additive)",
], { fontSize: 12 }), { x: 5.7, y: 1.65, w: 3.6, h: 1.7 });
// Formalization box
s.addShape(pres.shapes.RECTANGLE, {
x: 0.6, y: 3.7, w: 8.8, h: 1.4,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.6, y: 3.7, w: 0.08, h: 1.4,
fill: { color: C.primary },
});
s.addText([
{ text: "Formal Definition", options: { bold: true, fontSize: 14, fontFace: FONT_H, color: C.primary, breakLine: true, paraSpaceAfter: 4 } },
{ text: "Given: x_ctrl in R^G (control expression), p in {gene_1, gene_2} (perturbation)", options: { fontSize: 12, fontFace: FONT_B, color: C.bodyText, breakLine: true, paraSpaceAfter: 2 } },
{ text: "Predict: x_pert in R^G (post-perturbation expression)", options: { fontSize: 12, fontFace: FONT_B, color: C.bodyText } },
], { x: 0.9, y: 3.8, w: 8.3, h: 1.2 });
}
// ====================================================================
// SLIDE 3 β€” Baseline: scDFM
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Baseline: scDFM (Flow Matching)", 3);
s.addText(bullets([
"Learns velocity field v(x, t) via flow matching",
"Transports control distribution to perturbed",
"DiffPerceiverBlock backbone (d=128, 4 layers)",
"ODE solver: RK4, 20 steps",
]), { x: 0.6, y: 1.15, w: 5.0, h: 2.0 });
// Metrics callout cards
const metrics = [
{ label: "Pearson Delta", value: "0.866" },
{ label: "MSE", value: "0.0032" },
{ label: "DE Direction", value: "93.7%" },
{ label: "Discrimination", value: "0.980" },
];
metrics.forEach((m, i) => {
const mx = 0.6 + i * 2.3;
s.addShape(pres.shapes.RECTANGLE, {
x: mx, y: 2.9, w: 2.1, h: 1.5,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: mx, y: 2.9, w: 2.1, h: 0.06,
fill: { color: C.primary },
});
s.addText(m.value, {
x: mx, y: 3.1, w: 2.1, h: 0.6,
fontSize: 26, fontFace: FONT_H, color: C.primary, bold: true, align: "center", margin: 0,
});
s.addText(m.label, {
x: mx, y: 3.7, w: 2.1, h: 0.4,
fontSize: 12, fontFace: FONT_B, color: "777777", align: "center", margin: 0,
});
});
// Limitation note
s.addText([
{ text: "Limitation: ", options: { bold: true, fontSize: 13, color: C.red } },
{ text: "Genes treated as unstructured vector; no GRN modeling", options: { fontSize: 13, color: C.bodyText } },
], { x: 0.6, y: 4.7, w: 8.8, h: 0.3, fontFace: FONT_B });
}
// ====================================================================
// SLIDE 4 β€” GRN-CCFM: Cascaded Approach
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "GRN-CCFM: Cascaded Approach", 4);
// Core idea
s.addText([
{ text: "Core Idea", options: { bold: true, fontSize: 16, fontFace: FONT_H, color: C.primary, breakLine: true, paraSpaceAfter: 6 } },
{ text: "Extract Attention-Delta from scGPT to capture GRN change, then use LatentForcing cascade to jointly generate GRN features and gene expression.", options: { fontSize: 13, fontFace: FONT_B, color: C.bodyText } },
], { x: 0.6, y: 1.15, w: 8.8, h: 1.0 });
// Three pillars
const pillars = [
{ title: "Attention-Delta", items: ["delta_attn = attn_tgt - attn_ctrl", "Captures regulatory change", "Sparse G x G matrix (~0.6%)"] },
{ title: "Cascaded Training", items: ["40% steps: latent flow only", "60% steps: expression flow only", "Two-stage ODE at inference"] },
{ title: "Architecture Fix", items: ["d_model: 128 -> 512", "Missing gene mask (7 sites)", "scGPT vocab alignment"] },
];
pillars.forEach((p, i) => {
const px = 0.6 + i * 3.1;
s.addShape(pres.shapes.RECTANGLE, {
x: px, y: 2.4, w: 2.8, h: 2.8,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: px, y: 2.4, w: 2.8, h: 0.45,
fill: { color: C.primary },
});
s.addText(p.title, {
x: px, y: 2.4, w: 2.8, h: 0.45,
fontSize: 13, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
s.addText(bullets(p.items, { fontSize: 11 }), {
x: px + 0.15, y: 3.0, w: 2.5, h: 2.0,
});
});
}
// ====================================================================
// SLIDE 5 β€” Cascaded Variants Overview
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Cascaded Variants: Design Space", 5);
const tbl = styledTable(
["Variant", "Latent Dim", "Agg. Method", "delta_topk", "Key Idea"],
[
["grn_att_only", "128 (bilinear)", "Bilinear head", "30", "Attention only, no SVD"],
["grn_svd", "128", "SVD dictionary", "30", "Fixed SVD basis"],
["grn_svd_cross", "128", "SVD + cross-attn", "30", "Learnable SVD queries"],
["grn_dense4", "4", "Multi-stats", "30", "Low-dim dense features"],
["grn_scalar", "1", "signed_L2 + norm", "100", "Scalar latent per gene"],
["dim1_ablation", "1", "Slice scGPT[0]", "30", "Ablation: 512d -> 1d"],
]
);
s.addTable(tbl.rows, {
x: 0.5, y: 1.15, w: 9.0,
border: { pt: 0.5, color: "DDDDDD" },
colW: [1.5, 1.3, 1.5, 1.0, 3.7],
rowH: [0.38, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35],
autoPage: false,
});
// Shared config note
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 3.85, w: 9.0, h: 1.3,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 3.85, w: 0.08, h: 1.3,
fill: { color: C.accent },
});
s.addText([
{ text: "Shared Config", options: { bold: true, fontSize: 13, fontFace: FONT_H, color: C.accent, breakLine: true, paraSpaceAfter: 4 } },
], { x: 0.8, y: 3.95, w: 8.5, h: 0.3 });
s.addText(bullets([
"d_model=128, nlayers=4, nhead=8, lr=5e-5, EMA=0.9999",
"Cascaded: choose_latent_p=0.4, latent_weight=1.0",
"Inference: RK4 ODE, 20 steps each stage",
], { fontSize: 11 }), { x: 0.8, y: 4.25, w: 8.5, h: 0.8 });
}
// ====================================================================
// SLIDE 6 β€” Cascaded Results
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Cascaded Results: Evaluation Metrics", 6);
const tbl = styledTable(
["Model", "Pearson Delta", "MSE", "DE Direction", "Discrim."],
[
[{ text: "scDFM Baseline", bold: true }, { text: "0.866", bold: true }, { text: "0.0032", bold: true }, { text: "0.937", bold: true }, { text: "0.980", bold: true }],
[{ text: "dim1_ablation", bold: true }, { text: "0.752", bold: true }, "0.0059", "0.878", "0.914"],
["grn_dense4", "0.122", "0.020", "0.780", "0.521"],
["grn_scalar (dtk100)", "0.087", "0.021", "0.793", "0.534"],
["grn_scalar (bs48)", "0.068", "0.026", "0.771", "0.533"],
["grn_att_only", "-0.097", "0.602", "0.747", "0.552"],
["grn_svd / svd_cross", "-0.096", "0.575", "0.746", "0.492"],
]
);
s.addTable(tbl.rows, {
x: 0.5, y: 1.15, w: 9.0,
border: { pt: 0.5, color: "DDDDDD" },
colW: [2.2, 1.7, 1.3, 1.6, 1.4],
rowH: [0.4, 0.36, 0.36, 0.36, 0.36, 0.36, 0.36, 0.36],
autoPage: false,
});
// Insight box
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.2, w: 9.0, h: 1.05,
fill: { color: "FFF5F5" },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.2, w: 0.08, h: 1.05,
fill: { color: C.red },
});
s.addText(bullets([
{ text: "Only dim1 (d=1) approaches baseline; all high-dim cascaded variants fail", bold: true },
"High-dim latent generation is the fundamental bottleneck",
"grn_att_only / grn_svd: negative Pearson, MSE > 0.5",
], { fontSize: 12 }), { x: 0.8, y: 4.25, w: 8.5, h: 0.95 });
}
// ====================================================================
// SLIDE 7 β€” Failure Analysis
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Failure Analysis: Why Cascaded Fails", 7);
// Left: problem
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 1.15, w: 4.3, h: 3.5,
fill: { color: "FFF5F5" },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 1.15, w: 4.3, h: 0.45,
fill: { color: C.red },
});
s.addText("Root Cause", {
x: 0.5, y: 1.15, w: 4.3, h: 0.45,
fontSize: 14, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
s.addText(bullets([
"Latent loss stuck at ~1.0-2.0",
"Target: sparse G x G matrix (~0.6% non-zero)",
"Generating GRN is itself a hard problem",
"Decoupled training prevents joint optimization",
"Expression flow never benefits from GRN",
], { fontSize: 12 }), { x: 0.7, y: 1.8, w: 3.9, h: 2.5 });
// Right: evidence
s.addShape(pres.shapes.RECTANGLE, {
x: 5.2, y: 1.15, w: 4.3, h: 3.5,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 5.2, y: 1.15, w: 4.3, h: 0.45,
fill: { color: C.green },
});
s.addText("Evidence from dim1 Ablation", {
x: 5.2, y: 1.15, w: 4.3, h: 0.45,
fontSize: 14, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
s.addText(bullets([
"scgpt_dim: 512 -> 1",
"Latent loss converges normally",
"Pearson delta: 0.752 (vs baseline 0.866)",
"Confirms: high-dim target is the bottleneck",
"But dim=1 loses most GRN information",
], { fontSize: 12 }), { x: 5.4, y: 1.8, w: 3.9, h: 2.5 });
// Bottom conclusion
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.85, w: 9.0, h: 0.5,
fill: { color: C.dark },
});
s.addText("Conclusion: Cascaded generation of GRN features is a dead end. Need a new paradigm.", {
x: 0.5, y: 4.85, w: 9.0, h: 0.5,
fontSize: 13, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
}
// ====================================================================
// SLIDE 8 β€” Paradigm Shift
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.dark };
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.primary },
});
s.addText("Paradigm Shift", {
x: 0.7, y: 0.8, w: 8.6, h: 0.6,
fontSize: 32, fontFace: FONT_H, color: C.white, bold: true, margin: 0,
});
s.addText("From GRN Generation to Structural Supervision", {
x: 0.7, y: 1.4, w: 8.6, h: 0.5,
fontSize: 18, fontFace: FONT_B, color: C.primaryLt, margin: 0,
});
// Key insight box
s.addShape(pres.shapes.RECTANGLE, {
x: 0.7, y: 2.3, w: 8.6, h: 1.2,
fill: { color: C.primary },
});
s.addText([
{ text: "Key Insight: ", options: { bold: true, fontSize: 15, color: C.white } },
{ text: "Delta-attention is ", options: { fontSize: 15, color: C.white } },
{ text: "privileged information", options: { bold: true, italic: true, fontSize: 15, color: C.white } },
{ text: " -- available at training (from source + target), absent at inference (only source).", options: { fontSize: 15, color: C.white } },
], { x: 1.0, y: 2.5, w: 8.0, h: 0.8, fontFace: FONT_B });
// Old vs New
s.addShape(pres.shapes.RECTANGLE, {
x: 0.7, y: 3.8, w: 4.0, h: 1.2,
fill: { color: "2A2A42" },
});
s.addText([
{ text: "OLD: Cascaded", options: { bold: true, fontSize: 14, color: C.red, breakLine: true, paraSpaceAfter: 4 } },
{ text: "Generate GRN features (latent flow)", options: { fontSize: 13, color: "E8E8E8", breakLine: true, paraSpaceAfter: 2 } },
{ text: "-> Use for expression (expr flow)", options: { fontSize: 13, color: "E8E8E8" } },
], { x: 0.9, y: 3.9, w: 3.6, h: 1.0, fontFace: FONT_B });
s.addShape(pres.shapes.RECTANGLE, {
x: 5.3, y: 3.8, w: 4.0, h: 1.2,
fill: { color: "2A2A42" },
});
s.addText([
{ text: "NEW: RegFM", options: { bold: true, fontSize: 14, color: "66BB6A", breakLine: true, paraSpaceAfter: 4 } },
{ text: "Embed GRN as structural bias", options: { fontSize: 13, color: "E8E8E8", breakLine: true, paraSpaceAfter: 2 } },
{ text: "-> Soft-supervise with delta_attn at train", options: { fontSize: 13, color: "E8E8E8" } },
], { x: 5.5, y: 3.9, w: 3.6, h: 1.0, fontFace: FONT_B });
addSlideNum(s, 8);
}
// ====================================================================
// SLIDE 9 β€” RegFM Architecture
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "RegFM: Architecture", 9);
// Equation box
s.addShape(pres.shapes.RECTANGLE, {
x: 0.6, y: 1.15, w: 8.8, h: 0.7,
fill: { color: C.offWhite },
});
s.addText([
{ text: "v(x, t) = \u03B1 \u00B7 v", options: { fontFace: "Calibri", fontSize: 22, color: C.primary, bold: true } },
{ text: "reg", options: { fontFace: "Calibri", fontSize: 15, color: C.primary, bold: true } },
{ text: " + (1 \u2013 \u03B1) \u00B7 v", options: { fontFace: "Calibri", fontSize: 22, color: C.primary, bold: true } },
{ text: "int", options: { fontFace: "Calibri", fontSize: 15, color: C.primary, bold: true } },
], {
x: 0.6, y: 1.15, w: 8.8, h: 0.7,
align: "center", valign: "middle",
});
// Three component cards
const comps = [
{
title: "v_reg (Regulatory)",
color: C.primary,
items: [
"RegulatoryHead module",
"Q, K, V from backbone h",
"R = tanh(QK^T / sqrt(d_r))",
"v_reg = Linear(R @ V)",
"d_r = 32, params = 12K",
],
},
{
title: "v_int (Intrinsic)",
color: C.accent,
items: [
"Original ExprDecoder",
"3-layer MLP",
"Per-gene autonomous dynamics",
"No inter-gene interaction",
"Reused from scDFM baseline",
],
},
{
title: "Gate (alpha)",
color: C.green,
items: [
"VelocityGate module",
"Input: h + pert_emb + t_emb",
"MLP(384 -> 128 -> 1)",
"Init: bias=-3, alpha~0.05",
"Safe fallback to v_int",
],
},
];
comps.forEach((c, i) => {
const cx = 0.5 + i * 3.15;
s.addShape(pres.shapes.RECTANGLE, {
x: cx, y: 2.15, w: 2.95, h: 3.0,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: cx, y: 2.15, w: 2.95, h: 0.42,
fill: { color: c.color },
});
s.addText(c.title, {
x: cx, y: 2.15, w: 2.95, h: 0.42,
fontSize: 12, fontFace: FONT_B, color: C.white, bold: true, align: "center", valign: "middle",
});
s.addText(bullets(c.items, { fontSize: 10.5 }), {
x: cx + 0.1, y: 2.7, w: 2.75, h: 2.3,
});
});
}
// ====================================================================
// SLIDE 10 β€” RegFM Training & Loss
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "RegFM: Training & Loss Design", 10);
// Loss equation
s.addShape(pres.shapes.RECTANGLE, {
x: 0.6, y: 1.15, w: 8.8, h: 0.6,
fill: { color: C.offWhite },
});
s.addText([
{ text: "L = L", options: { fontFace: "Calibri", fontSize: 20, color: C.primary, bold: true } },
{ text: "vel", options: { fontFace: "Calibri", fontSize: 14, color: C.primary, bold: true } },
{ text: " + \u03BB \u00B7 L", options: { fontFace: "Calibri", fontSize: 20, color: C.primary, bold: true } },
{ text: "reg", options: { fontFace: "Calibri", fontSize: 14, color: C.primary, bold: true } },
{ text: " + \u03B3 \u00B7 L", options: { fontFace: "Calibri", fontSize: 20, color: C.primary, bold: true } },
{ text: "mmd", options: { fontFace: "Calibri", fontSize: 14, color: C.primary, bold: true } },
], {
x: 0.6, y: 1.15, w: 8.8, h: 0.6,
align: "center", valign: "middle",
});
// Loss details table
const tbl = styledTable(
["Loss Term", "Target", "Weight", "Description"],
[
["L_vel", "v_target = x1 - eps", "1.0", "Standard flow matching MSE"],
["L_reg", "delta_attention", "0.1", "R_theta aligned with GRN ground truth"],
["L_mmd", "Distribution matching", "0.5", "Sliced Wasserstein / MMD"],
]
);
s.addTable(tbl.rows, {
x: 0.6, y: 2.0, w: 8.8,
border: { pt: 0.5, color: "DDDDDD" },
colW: [1.2, 2.5, 1.0, 4.1],
rowH: [0.38, 0.35, 0.35, 0.35],
autoPage: false,
});
// Training status
s.addText([
{ text: "Training Status (RegFM + MMD)", options: { bold: true, fontSize: 14, fontFace: FONT_H, color: C.primary, breakLine: true, paraSpaceAfter: 6 } },
], { x: 0.6, y: 3.4, w: 4.5, h: 0.35 });
const statusTbl = styledTable(
["Step", "L_vel", "L_reg", "L_mmd", "Total"],
[
["5k", "0.169", "0.318", "0.025", "0.226"],
["20k", "0.126", "0.254", "0.017", "0.168"],
["32k", "0.112", "0.236", "0.016", "0.152"],
]
);
s.addTable(statusTbl.rows, {
x: 0.6, y: 3.8, w: 5.5,
border: { pt: 0.5, color: "DDDDDD" },
colW: [0.8, 1.0, 1.0, 1.0, 1.0],
rowH: [0.35, 0.3, 0.3, 0.3],
autoPage: false,
});
// Key design notes
s.addShape(pres.shapes.RECTANGLE, {
x: 6.5, y: 3.4, w: 3.0, h: 1.8,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 6.5, y: 3.4, w: 0.07, h: 1.8,
fill: { color: C.accent },
});
s.addText([
{ text: "Design Notes", options: { bold: true, fontSize: 12, fontFace: FONT_H, color: C.accent, breakLine: true, paraSpaceAfter: 4 } },
], { x: 6.75, y: 3.5, w: 2.6, h: 0.3 });
s.addText(bullets([
"Gate init: alpha ~ 0.05",
"Diagonal removed from R",
"Tanh bounds R to [-1, 1]",
"Backbone: d_model=128",
], { fontSize: 10.5 }), { x: 6.75, y: 3.85, w: 2.6, h: 1.2 });
}
// ====================================================================
// SLIDE 11 β€” Schrodinger Bridge: Approach
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Schrodinger Bridge: Approach", 11);
// Motivation
s.addText(bullets([
"FM: noise -> target (unpaired, indirect)",
"SB: source -> target (optimal transport coupling)",
"Natural fit for perturbation prediction",
], { fontSize: 13 }), { x: 0.6, y: 1.15, w: 9.0, h: 1.2 });
// Variants table
const tbl = styledTable(
["Variant", "Transport", "Score Head", "Anchoring", "Key Feature"],
[
["A1 (baseline)", "SB-ODE", "None", "None", "Basic SB formulation"],
["A5 (full SDE)", "SB-SDE", "Full ASB", "None", "Score + velocity joint"],
["A6 (DSM aniso)", "SB-SDE", "Anisotropic", "None", "Per-gene noise scale"],
["SA1 (src-ODE)", "SB-ODE", "None", "Source cell", "Anchor at x_ctrl"],
["SA6 (src-SDE)", "SB-SDE", "Anisotropic", "Source cell", "Anchor + aniso score"],
]
);
s.addTable(tbl.rows, {
x: 0.4, y: 2.55, w: 9.2,
border: { pt: 0.5, color: "DDDDDD" },
colW: [1.7, 1.2, 1.4, 1.3, 3.6],
rowH: [0.38, 0.32, 0.32, 0.32, 0.32, 0.32],
autoPage: false,
});
// Source-anchored note
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.35, w: 9.0, h: 0.75,
fill: { color: C.offWhite },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.35, w: 0.08, h: 0.75,
fill: { color: C.accent },
});
s.addText([
{ text: "Source-Anchored: ", options: { bold: true, fontSize: 12, color: C.accent } },
{ text: "ODE starts from x_ctrl (not noise). Loss_v drops to ~0.0004 (vs ~0.3 for standard SB).", options: { fontSize: 12, color: C.bodyText } },
], { x: 0.8, y: 4.4, w: 8.5, h: 0.6, fontFace: FONT_B });
}
// ====================================================================
// SLIDE 12 β€” Schrodinger Bridge: Results
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Schrodinger Bridge: Results", 12);
// Top table β€” use explicit large font cells
const hdr12 = ["Model", "Pearson", "MSE", "DE Dir.", "Discrim."].map(h => ({
text: h, options: { bold: true, color: C.white, fill: { color: C.tableHead }, fontSize: 13, fontFace: FONT_B, align: "center", valign: "middle" },
}));
const data12 = [
[{ text: "scDFM Baseline", bold: true }, { text: "0.866", bold: true }, "0.0032", "0.937", "0.980"],
[{ text: "SB A1 (baseline)", bold: true }, { text: "0.858", bold: true }, "0.0072", "0.902", "0.957"],
["SB A6 (aniso DSM)", "0.849", "0.0074", "0.901", "0.956"],
["SA1 / SA6", "Training...", "@ 195k", "-", "-"],
].map((row, ri) => row.map(cell => {
const isObj = typeof cell === "object" && cell !== null;
return { text: isObj ? cell.text : String(cell), options: { fontSize: 13, fontFace: FONT_B, color: C.darkText, fill: { color: ri % 2 === 0 ? C.white : C.tableAlt }, align: "center", valign: "middle", bold: isObj && cell.bold ? true : false } };
}));
s.addTable([hdr12, ...data12], {
x: 0.5, y: 1.15, w: 9.0,
border: { pt: 0.5, color: "DDDDDD" },
colW: [2.4, 1.6, 1.4, 1.6, 1.6],
rowH: [0.42, 0.4, 0.4, 0.4, 0.4],
autoPage: false,
});
// Training loss comparison
s.addText([
{ text: "Training Loss Comparison", options: { bold: true, fontSize: 14, fontFace: FONT_H, color: C.primary, breakLine: true, paraSpaceAfter: 6 } },
], { x: 0.6, y: 3.25, w: 8.8, h: 0.35 });
const hdrL = ["Variant", "Loss_v", "Loss_s", "Notes"].map(h => ({
text: h, options: { bold: true, color: C.white, fill: { color: C.tableHead }, fontSize: 12, fontFace: FONT_B, align: "center", valign: "middle" },
}));
const dataL = [
["A1 Baseline", "0.26 - 0.40", "N/A", "Stable"],
["A6 DSM Aniso", "0.30 - 0.37", "0.76 - 0.80", "Better score"],
["SA1 Src-ODE", "~0.0005", "N/A", "Very low (anchored)"],
["SA6 Src-SDE", "~0.001", "~0.057", "Anchored + aniso"],
].map((row, ri) => row.map(cell => ({
text: cell, options: { fontSize: 12, fontFace: FONT_B, color: C.darkText, fill: { color: ri % 2 === 0 ? C.white : C.tableAlt }, align: "center", valign: "middle" },
})));
s.addTable([hdrL, ...dataL], {
x: 0.5, y: 3.65, w: 9.0,
border: { pt: 0.5, color: "DDDDDD" },
colW: [2.2, 2.0, 1.8, 3.0],
rowH: [0.38, 0.35, 0.35, 0.35, 0.35],
autoPage: false,
});
}
// ====================================================================
// SLIDE 13 β€” Comprehensive Comparison
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Comprehensive Comparison", 13);
const tbl = styledTable(
["Method", "Approach", "Pearson", "MSE", "DE Dir.", "Discrim."],
[
[{ text: "scDFM Baseline", bold: true }, "Flow Matching", { text: "0.866", bold: true }, { text: "0.003", bold: true }, { text: "0.937", bold: true }, { text: "0.980", bold: true }],
[{ text: "SB A1", bold: true }, "Schrodinger Bridge", "0.858", "0.007", "0.902", "0.957"],
["SB A6", "SB + Aniso DSM", "0.849", "0.007", "0.901", "0.956"],
[{ text: "dim1 ablation", bold: true }, "Cascaded (d=1)", "0.752", "0.006", "0.878", "0.914"],
["grn_dense4", "Cascaded (d=4)", "0.122", "0.020", "0.780", "0.521"],
["grn_scalar", "Cascaded (d=1, L2)", "0.087", "0.021", "0.793", "0.534"],
["grn_att_only", "Cascaded (bilinear)", "-0.097", "0.602", "0.747", "0.552"],
["grn_svd_cross", "Cascaded (SVD)", "-0.096", "0.575", "0.746", "0.492"],
["RegFM (20k)", "Structural Bias", "0.040", "0.128", "0.748", "0.505"],
]
);
s.addTable(tbl.rows, {
x: 0.3, y: 1.1, w: 9.4,
border: { pt: 0.5, color: "DDDDDD" },
colW: [1.6, 1.7, 1.1, 1.0, 1.0, 1.0],
rowH: [0.38, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35],
autoPage: false,
});
// Color legend
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.85, w: 9.0, h: 0.5,
fill: { color: C.offWhite },
});
s.addText([
{ text: "Top tier: ", options: { bold: true, fontSize: 11, color: C.green } },
{ text: "Baseline (0.866), SB A1 (0.858) ", options: { fontSize: 11, color: C.bodyText } },
{ text: "Mid tier: ", options: { bold: true, fontSize: 11, color: C.accent } },
{ text: "dim1 (0.752) ", options: { fontSize: 11, color: C.bodyText } },
{ text: "Failed: ", options: { bold: true, fontSize: 11, color: C.red } },
{ text: "All high-dim cascaded variants", options: { fontSize: 11, color: C.bodyText } },
], { x: 0.7, y: 4.85, w: 8.6, h: 0.5, fontFace: FONT_B, valign: "middle" });
}
// ====================================================================
// SLIDE 14 β€” Key Takeaways
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.white };
addTitle(s, "Key Takeaways", 14);
const takeaways = [
{ num: "1", title: "Cascaded GRN Generation Fails", desc: "High-dim latent target (G x G sparse) is fundamentally too hard to generate via flow matching." },
{ num: "2", title: "SB Competitive with FM Baseline", desc: "Schrodinger Bridge (A1: 0.858) nearly matches scDFM (0.866); source-anchored variants training." },
{ num: "3", title: "RegFM: New Paradigm", desc: "Treat delta_attn as privileged info; embed GRN as structural bias, not generation target." },
{ num: "4", title: "dim1 Confirms the Diagnosis", desc: "Only 1d latent converges; validates that task difficulty scales with latent dimensionality." },
];
takeaways.forEach((t, i) => {
const ty = 1.15 + i * 1.05;
// Number circle
s.addShape(pres.shapes.OVAL, {
x: 0.6, y: ty + 0.05, w: 0.45, h: 0.45,
fill: { color: C.primary },
});
s.addText(t.num, {
x: 0.6, y: ty + 0.05, w: 0.45, h: 0.45,
fontSize: 16, fontFace: FONT_H, color: C.white, bold: true, align: "center", valign: "middle",
});
// Title + description
s.addText(t.title, {
x: 1.25, y: ty, w: 8.2, h: 0.3,
fontSize: 15, fontFace: FONT_H, color: C.primary, bold: true, margin: 0,
});
s.addText(t.desc, {
x: 1.25, y: ty + 0.32, w: 8.2, h: 0.55,
fontSize: 12, fontFace: FONT_B, color: C.bodyText, margin: 0,
});
});
}
// ====================================================================
// SLIDE 15 β€” Next Steps
// ====================================================================
{
const s = pres.addSlide();
s.background = { color: C.dark };
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.primary },
});
s.addText("Next Steps", {
x: 0.7, y: 0.6, w: 8.6, h: 0.6,
fontSize: 32, fontFace: FONT_H, color: C.white, bold: true, margin: 0,
});
const steps = [
{ title: "RegFM Full Training", desc: "Continue to 100k+ steps; evaluate and compare with baseline at convergence" },
{ title: "SB Source-Anchored Eval", desc: "Evaluate SA1 / SA6 at 200k; compare ODE vs SDE transport" },
{ title: "RegFM vs SB vs Baseline", desc: "Head-to-head comparison on cell-eval + distributional metrics" },
{ title: "Distributional Evaluation", desc: "Apply new metrics (MMD, Energy Distance, C2ST, kNN) beyond conditional mean" },
{ title: "Interpretability Analysis", desc: "Visualize R_theta from RegFM; compare with known GRN structure" },
];
steps.forEach((st, i) => {
const sy = 1.5 + i * 0.78;
s.addShape(pres.shapes.RECTANGLE, {
x: 0.7, y: sy, w: 8.6, h: 0.65,
fill: { color: "2A2A42" },
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.7, y: sy, w: 0.07, h: 0.65,
fill: { color: C.primary },
});
s.addText(st.title, {
x: 1.0, y: sy + 0.03, w: 3.0, h: 0.3,
fontSize: 14, fontFace: FONT_B, color: C.white, bold: true, margin: 0,
});
s.addText(st.desc, {
x: 1.0, y: sy + 0.32, w: 8.1, h: 0.28,
fontSize: 12, fontFace: FONT_B, color: "CCCCCC", margin: 0,
});
});
addSlideNum(s, 15);
}
// ── Write file ─────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/hp250092/ku50001222/qian/aivc/lfj/Report/week10/GRN_Progress_Report.pptx" })
.then(() => console.log("PPTX saved successfully."))
.catch((err) => console.error("Error:", err));