lfj-code / Report /PPT /create_ppt.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 for Single-Cell Perturbation Prediction";
// === COLOR PALETTE: Deep Teal + Amber (biology meets computation) ===
const C = {
dark: "0F172A",
light: "F8FAFC",
teal: "0891B2",
tealDk: "164E63",
tealLt: "ECFEFF",
white: "FFFFFF",
text: "1E293B",
textS: "475569",
textM: "94A3B8",
red: "EF4444",
green: "10B981",
amber: "F59E0B",
purple: "8B5CF6",
blue: "3B82F6",
border: "E2E8F0",
};
const shadow = () => ({ type: "outer", color: "000000", blur: 6, offset: 2, angle: 135, opacity: 0.1 });
// Slide number helper (bottom-right)
let slideNum = 0;
function addSlideNum(sl, dark) {
slideNum++;
sl.addText(String(slideNum), {
x: 9.2, y: 5.15, w: 0.5, h: 0.3,
fontSize: 10, fontFace: "Calibri", color: dark ? C.textM : C.textS, align: "right", margin: 0,
});
}
function card(sl, x, y, w, h, opts = {}) {
sl.addShape(pres.shapes.RECTANGLE, {
x, y, w, h, fill: { color: opts.fill || C.white }, shadow: shadow(),
});
if (opts.accent) {
sl.addShape(pres.shapes.RECTANGLE, { x, y, w: 0.06, h, fill: { color: opts.accent } });
}
}
function titleBar(sl, title) {
sl.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.9, fill: { color: C.tealDk } });
sl.addText(title, {
x: 0.6, y: 0.15, w: 8.8, h: 0.6,
fontSize: 24, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
});
}
// ============================
// SLIDE 1: TITLE
// ============================
let s = pres.addSlide();
s.background = { color: C.dark };
// Left teal block as visual motif
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.15, h: 5.625, fill: { color: C.teal } });
s.addText("GRN-Guided Cascaded\nFlow Matching", {
x: 0.8, y: 1.1, w: 8.4, h: 1.8,
fontSize: 42, fontFace: "Georgia", color: C.white, bold: true, lineSpacingMultiple: 1.15,
});
s.addText("for Single-Cell Perturbation Prediction", {
x: 0.8, y: 2.95, w: 8.4, h: 0.5,
fontSize: 20, fontFace: "Calibri", color: "22D3EE",
});
s.addText("组会汇报", {
x: 0.8, y: 4.2, w: 3, h: 0.4,
fontSize: 14, fontFace: "Calibri", color: C.textM,
});
addSlideNum(s, true);
// ============================
// SLIDE 2: TASK
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "Task:单细胞扰动预测");
// Virtual Cell card
card(s, 0.5, 1.15, 4.3, 2.1, { accent: C.teal });
s.addText("虚拟细胞 (Virtual Cell)", {
x: 0.75, y: 1.25, w: 3.8, h: 0.4,
fontSize: 16, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText("构建能模拟真实细胞行为的 AI 模型:给定任意输入条件(基因型、环境、扰动),预测细胞的分子状态变化。单细胞扰动预测是实现虚拟细胞最关键的子任务。", {
x: 0.75, y: 1.7, w: 3.85, h: 1.4,
fontSize: 12.5, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.35,
});
// Perturbation types card
card(s, 5.2, 1.15, 4.3, 2.1, { accent: C.amber });
s.addText("扰动类型", {
x: 5.45, y: 1.25, w: 3.8, h: 0.4,
fontSize: 16, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText([
{ text: "药物扰动", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: " 小分子化合物 → 转录组变化", options: { breakLine: true, fontSize: 11, color: C.textS } },
{ text: "细胞因子扰动", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: " IL-6, TNF-α 等 → 信号通路响应", options: { breakLine: true, fontSize: 11, color: C.textS } },
{ text: "基因扰动(本工作聚焦)", options: { bold: true, breakLine: true, fontSize: 12, color: C.teal } },
{ text: " CRISPR KO / OE / KD → 全基因组变化", options: { fontSize: 11, color: C.textS } },
], { x: 5.45, y: 1.7, w: 3.85, h: 1.5, margin: 0, lineSpacingMultiple: 1.2 });
// Task formalization
card(s, 0.5, 3.5, 9.0, 1.6, { accent: C.purple });
s.addText("任务形式化", {
x: 0.75, y: 3.6, w: 2, h: 0.35,
fontSize: 14, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText([
{ text: "已知: ", options: { bold: true, fontSize: 13 } },
{ text: "x_ctrl (control 基因表达, G ~ 5000 HVG) + p (扰动基因)", options: { fontSize: 13, breakLine: true } },
{ text: "预测: ", options: { bold: true, fontSize: 13 } },
{ text: "x_pert (扰动后基因表达谱)", options: { fontSize: 13 } },
], { x: 0.75, y: 4.0, w: 8.5, h: 0.9, fontFace: "Consolas", color: C.text, margin: 0, lineSpacingMultiple: 1.5 });
addSlideNum(s);
// ============================
// SLIDE 3: WHY IMPORTANT + DATA
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "为什么重要 & 数据特点");
// Three importance cards
const imp = [
{ icon: "$$$", title: "药物筛选加速", desc: "Perturb-seq 成本极高\n计算预测大幅缩小候选范围", c: C.teal },
{ icon: "N\u00B2", title: "组合扰动爆炸", desc: "N 基因两两组合 = N(N-1)/2\n不可能穷举,必须靠预测", c: C.amber },
{ icon: "\u2697", title: "理解疾病机制", desc: "预测哪些基因扰动\n产生特定疾病表型", c: C.purple },
];
imp.forEach((it, i) => {
const x = 0.5 + i * 3.1;
card(s, x, 1.15, 2.8, 2.0, { accent: it.c });
s.addText(it.icon, {
x: x + 0.2, y: 1.25, w: 2.4, h: 0.55,
fontSize: 28, fontFace: "Georgia", color: it.c, bold: true, margin: 0,
});
s.addText(it.title, {
x: x + 0.2, y: 1.8, w: 2.4, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText(it.desc, {
x: x + 0.2, y: 2.15, w: 2.4, h: 0.85,
fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, lineSpacingMultiple: 1.3,
});
});
// Data card
card(s, 0.5, 3.5, 9.0, 1.65, { accent: C.tealDk });
s.addText("Norman 数据集", {
x: 0.75, y: 3.6, w: 3, h: 0.35,
fontSize: 16, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
const stats = [
{ val: "~9K", label: "细胞数" },
{ val: "5000", label: "高变基因" },
{ val: "105", label: "扰动条件" },
{ val: "KO+OE", label: "扰动类型" },
];
stats.forEach((st, i) => {
const x = 0.75 + i * 2.15;
s.addText(st.val, {
x, y: 4.05, w: 1.9, h: 0.5,
fontSize: 26, fontFace: "Georgia", color: C.teal, bold: true, margin: 0,
});
s.addText(st.label, {
x, y: 4.5, w: 1.9, h: 0.25,
fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0,
});
});
s.addText("关键挑战:细胞配对不可得 — 扰动是破坏性的,一个细胞只能测一次", {
x: 0.75, y: 4.85, w: 8.5, h: 0.2,
fontSize: 11, fontFace: "Calibri", color: C.red, italic: true, margin: 0,
});
// ============================
addSlideNum(s);
// SLIDE 4: EXISTING METHODS (1)
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "现有方法:简单基线与预训练大模型");
// Additive Shift
card(s, 0.5, 1.15, 4.3, 1.85, { accent: C.textM });
s.addText("Additive Shift(均值偏移)", {
x: 0.75, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText("x\u0302_pert = x_ctrl + mean(x_pert - x_ctrl)", {
x: 0.75, y: 1.6, w: 3.8, h: 0.25,
fontSize: 11, fontFace: "Consolas", color: C.tealDk, margin: 0,
});
s.addText([
{ text: "假设扰动效应对所有细胞是常数平移", options: { breakLine: true } },
{ text: "忽略细胞异质性", options: { breakLine: true } },
{ text: "但出奇地难以超越", options: { color: C.red, bold: true } },
], { x: 0.75, y: 1.95, w: 3.8, h: 0.85, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// scGPT
card(s, 5.2, 1.15, 4.3, 1.85, { accent: C.blue });
s.addText("scGPT (Nature Methods 2024)", {
x: 5.45, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "自回归 Transformer 大规模预训练", options: { breakLine: true } },
{ text: "扰动基因 mask → 模型补全", options: { breakLine: true } },
{ text: "本质是自回归补全,非扰动预测目标", options: { breakLine: true, color: C.red } },
{ text: "编码绝对状态,不建模状态变化", options: { color: C.red } },
], { x: 5.45, y: 1.7, w: 3.8, h: 1.1, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Geneformer
card(s, 0.5, 3.25, 4.3, 1.85, { accent: C.green });
s.addText("Geneformer (Nature 2024)", {
x: 0.75, y: 3.35, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Rank-value encoding + Transformer", options: { breakLine: true } },
{ text: "In-silico perturbation: 删除基因 token", options: { breakLine: true } },
{ text: "启发式方法,没学习扰动动力学", options: { breakLine: true, color: C.red } },
{ text: "Rank encoding 丢失表达量信息", options: { color: C.red } },
], { x: 0.75, y: 3.7, w: 3.8, h: 1.1, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// CPA
card(s, 5.2, 3.25, 4.3, 1.85, { accent: C.amber });
s.addText("CPA (Mol Sys Bio 2023)", {
x: 5.45, y: 3.35, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Basal + perturbation + covariate 可加分解", options: { breakLine: true } },
{ text: "Latent space 线性组合", options: { breakLine: true } },
{ text: "线性可加假设过强", options: { breakLine: true, color: C.red } },
{ text: "不建模基因间调控关系", options: { color: C.red } },
], { x: 5.45, y: 3.7, w: 3.8, h: 1.1, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// ============================
addSlideNum(s);
// SLIDE 5: EXISTING METHODS (2)
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "现有方法:专用扰动预测模型");
// GEARS
card(s, 0.5, 1.15, 4.3, 1.7, { accent: C.purple });
s.addText("GEARS (Nat Biotech 2023)", {
x: 0.75, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "GO 图 + GNN 编码基因关系", options: { breakLine: true } },
{ text: "GO 是静态先验,不随细胞状态变", options: { breakLine: true, color: C.red } },
{ text: "确定性预测,不能给出分布", options: { color: C.red } },
], { x: 0.75, y: 1.65, w: 3.8, h: 0.95, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// STATE
card(s, 5.2, 1.15, 4.3, 1.7, { accent: C.teal });
s.addText("STATE (ICLR 2025)", {
x: 5.45, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Stacked Attention for Expression Transform", options: { breakLine: true } },
{ text: "确定性预测", options: { breakLine: true, color: C.red } },
{ text: "没有从 GRN 变化角度建模", options: { color: C.red } },
], { x: 5.45, y: 1.65, w: 3.8, h: 0.95, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// CellFlow
card(s, 0.5, 3.1, 4.3, 1.7, { accent: C.blue });
s.addText("CellFlow (preprint 2025)", {
x: 0.75, y: 3.2, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Flow matching + 预训练 embedding 条件", options: { breakLine: true } },
{ text: "预训练 embedding 编码绝对状态", options: { breakLine: true, color: C.red } },
{ text: "没有显式建模调控网络改变", options: { color: C.red } },
], { x: 0.75, y: 3.6, w: 3.8, h: 0.95, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// scDFM
card(s, 5.2, 3.1, 4.3, 1.7, { accent: C.teal });
s.addText("scDFM (ICLR 2026)", {
x: 5.45, y: 3.2, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Conditional FM + DiffPerceiverBlock", options: { breakLine: true } },
{ text: "生成式模型,训练稳定", options: { breakLine: true, color: C.green } },
{ text: "信息来源单一,不理解 GRN", options: { breakLine: true, color: C.red } },
{ text: "d_model=128,表达能力有限", options: { color: C.red } },
], { x: 5.45, y: 3.6, w: 3.8, h: 1.0, fontSize: 11, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// ============================
addSlideNum(s);
// SLIDE 6: BLIND SPOT (section divider)
// ============================
s = pres.addSlide();
s.background = { color: C.tealDk };
s.addText("所有现有方法的共同盲区", {
x: 0.8, y: 0.6, w: 8.4, h: 0.7,
fontSize: 30, fontFace: "Georgia", color: C.white, bold: true, margin: 0,
});
// Current: black box
card(s, 0.8, 1.6, 8.4, 1.4, { fill: "1B4A5A" });
s.addText("现有方法", {
x: 1.0, y: 1.65, w: 2, h: 0.3,
fontSize: 12, fontFace: "Calibri", color: "CBD5E1", margin: 0,
});
s.addText([
{ text: "扰动", options: { bold: true, fontSize: 20 } },
{ text: " \u2192 ", options: { fontSize: 20, color: C.textM } },
{ text: "[ \u9ED1\u7BB1\u6A21\u578B ]", options: { bold: true, fontSize: 20, color: C.red } },
{ text: " \u2192 ", options: { fontSize: 20, color: C.textM } },
{ text: "表达变化", options: { bold: true, fontSize: 20 } },
], { x: 1.0, y: 2.05, w: 8.0, h: 0.7, fontFace: "Calibri", color: C.white, align: "center", margin: 0 });
// Ours: explicit GRN
card(s, 0.8, 3.3, 8.4, 1.6, { fill: "0C3547" });
s.addText("我们的方法", {
x: 1.0, y: 3.35, w: 2, h: 0.3,
fontSize: 12, fontFace: "Calibri", color: "22D3EE", margin: 0,
});
s.addText([
{ text: "扰动", options: { bold: true, fontSize: 20 } },
{ text: " \u2192 ", options: { fontSize: 20, color: C.textM } },
{ text: "GRN 变化", options: { bold: true, fontSize: 20, color: C.teal } },
{ text: " \u2192 ", options: { fontSize: 20, color: C.textM } },
{ text: "表达变化", options: { bold: true, fontSize: 20 } },
], { x: 1.0, y: 3.75, w: 8.0, h: 0.7, fontFace: "Calibri", color: C.white, align: "center", margin: 0 });
s.addText("\u2191 显式建模生物学机制", {
x: 3.0, y: 4.4, w: 4, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: "22D3EE", align: "center", margin: 0,
});
// ============================
addSlideNum(s, true);
// SLIDE 7: MOTIVATION 1 - FLOW MATCHING
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "Motivation 1:Flow Matching 解决配对问题");
// Problem
card(s, 0.5, 1.15, 4.3, 2.0, { accent: C.red });
s.addText("核心困难:无 Paired Data", {
x: 0.75, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "一个细胞扰动后就变了,无法回到扰动前", options: { breakLine: true } },
{ text: "无法得到 (x_ctrl_i, x_pert_i) 逐细胞配对", options: { breakLine: true } },
{ text: "传统方法:群体均值匹配(丢失异质性)", options: { breakLine: true } },
{ text: "或 Autoencoder(受限于重建质量)", options: {} },
], { x: 0.75, y: 1.65, w: 3.8, h: 1.3, fontSize: 12, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Solution
card(s, 5.2, 1.15, 4.3, 2.0, { accent: C.green });
s.addText("Flow Matching 的优势", {
x: 5.45, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "学习分布间的概率传输映射", options: { breakLine: true } },
{ text: "不需逐细胞配对,只需群体分布", options: { breakLine: true } },
{ text: "Conditional OT 构造高效训练对", options: { breakLine: true } },
{ text: "生成式输出 \u2192 不确定性估计", options: {} },
], { x: 5.45, y: 1.65, w: 3.8, h: 1.3, fontSize: 12, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Flow diagram
card(s, 0.5, 3.5, 9.0, 1.6);
s.addText("p(x_ctrl)", {
x: 0.8, y: 3.8, w: 2.2, h: 0.6,
fontSize: 18, fontFace: "Consolas", color: C.tealDk, bold: true, align: "center", margin: 0,
});
s.addShape(pres.shapes.RECTANGLE, {
x: 3.2, y: 4.0, w: 3.6, h: 0.28, fill: { color: C.teal, transparency: 30 },
});
s.addText("\u2500\u2500 \u5B66\u4E60 ODE \u8DEF\u5F84 \u2500\u2500\u25B6", {
x: 3.2, y: 3.95, w: 3.6, h: 0.35,
fontSize: 13, fontFace: "Calibri", color: C.white, align: "center", margin: 0,
});
s.addText("p(x_pert | pert)", {
x: 7.0, y: 3.8, w: 2.5, h: 0.6,
fontSize: 18, fontFace: "Consolas", color: C.tealDk, bold: true, align: "center", margin: 0,
});
s.addText("天然适合 unpaired data \u2014 只需两组细胞的群体分布即可训练", {
x: 0.8, y: 4.55, w: 8.4, h: 0.35,
fontSize: 12, fontFace: "Calibri", color: C.teal, italic: true, margin: 0, align: "center",
});
// ============================
addSlideNum(s);
// SLIDE 8: MOTIVATION 2&3 - GRN + ATTENTION
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "Motivation 2 & 3:GRN + scGPT Attention");
// Left: GRN cascade
card(s, 0.5, 1.15, 4.3, 4.0, { accent: C.amber });
s.addText("扰动通过 GRN 级联传播", {
x: 0.75, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "CRISPR KO 基因 A", options: { bold: true, breakLine: true, fontSize: 12, color: C.tealDk } },
{ text: " \u2193", options: { breakLine: true, fontSize: 11, color: C.textM } },
{ text: "A 的表达降为 0", options: { breakLine: true, fontSize: 12 } },
{ text: " \u2193", options: { breakLine: true, fontSize: 11, color: C.textM } },
{ text: "一级效应:A \u2192 B, C, D 改变", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: " \u2193", options: { breakLine: true, fontSize: 11, color: C.textM } },
{ text: "级联效应:B\u2192E,F C\u2192G,H ...", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: " \u2193", options: { breakLine: true, fontSize: 11, color: C.textM } },
{ text: "最终数千个基因表达变化", options: { bold: true, fontSize: 12, color: C.red } },
], { x: 0.75, y: 1.7, w: 3.8, h: 2.8, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.15 });
s.addText("核心:先理解 GRN 变化 \u2192 再预测表达", {
x: 0.75, y: 4.55, w: 3.8, h: 0.35,
fontSize: 12, fontFace: "Calibri", color: C.teal, bold: true, italic: true, margin: 0,
});
// Right: scGPT Attention
card(s, 5.2, 1.15, 4.3, 4.0, { accent: C.teal });
s.addText("scGPT Attention \u2248 数据驱动 GRN", {
x: 5.45, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText("attn[i][j] 高 \u2192 基因 j 对基因 i 有强调控", {
x: 5.45, y: 1.7, w: 3.8, h: 0.3,
fontSize: 11, fontFace: "Consolas", color: C.tealDk, margin: 0,
});
s.addText([
{ text: "上下文相关的 GRN", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: "随细胞状态变化,比静态 GO 图更灵活", options: { breakLine: true, fontSize: 11, color: C.textS } },
{ text: "", options: { breakLine: true, fontSize: 4 } },
{ text: "提取扰动引起的 GRN 变化", options: { bold: true, breakLine: true, fontSize: 12 } },
{ text: "分别输入 ctrl / pert 表达", options: { breakLine: true, fontSize: 11, color: C.textS } },
{ text: "得到两个 attention matrix", options: { breakLine: true, fontSize: 11, color: C.textS } },
{ text: "差值 = 扰动引起的 GRN 变化", options: { breakLine: true, fontSize: 11, color: C.textS } },
], { x: 5.45, y: 2.1, w: 3.8, h: 2.1, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.25 });
// Formula highlight
s.addShape(pres.shapes.RECTANGLE, {
x: 5.45, y: 4.3, w: 3.8, h: 0.45, fill: { color: C.tealLt },
});
s.addText("\u0394_attn = Attn(pert) - Attn(ctrl)", {
x: 5.45, y: 4.32, w: 3.8, h: 0.4,
fontSize: 14, fontFace: "Consolas", color: C.tealDk, bold: true, align: "center", margin: 0,
});
// ============================
addSlideNum(s);
// SLIDE 9: METHOD OVERVIEW
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "方法总览:Cascaded Flow Matching");
s.addText("在 scDFM 的 flow matching 框架上,引入 GRN-aware latent flow", {
x: 0.6, y: 1.05, w: 8.8, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.textS, italic: true, margin: 0,
});
// Stage 1
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 1.55, w: 4.3, h: 2.3,
fill: { color: C.amber, transparency: 92 }, line: { color: C.amber, width: 2 },
});
s.addText("Stage 1: GRN Latent Flow", {
x: 0.7, y: 1.65, w: 3.9, h: 0.4,
fontSize: 17, fontFace: "Georgia", color: C.amber, bold: true, margin: 0,
});
s.addText([
{ text: "noise \u2192 GRN 变化特征", options: { bold: true, breakLine: true, fontSize: 14 } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "理解调控网络如何改变", options: { breakLine: true, fontSize: 13, color: C.textS } },
{ text: "推理时先完成", options: { fontSize: 13, color: C.amber, bold: true } },
], { x: 0.7, y: 2.15, w: 3.9, h: 1.5, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.2 });
// Arrow
s.addText("\u2192", {
x: 4.5, y: 2.2, w: 1, h: 0.8,
fontSize: 40, fontFace: "Calibri", color: C.tealDk, align: "center", valign: "middle", margin: 0,
});
// Stage 2
s.addShape(pres.shapes.RECTANGLE, {
x: 5.2, y: 1.55, w: 4.3, h: 2.3,
fill: { color: C.teal, transparency: 92 }, line: { color: C.teal, width: 2 },
});
s.addText("Stage 2: Expression Flow", {
x: 5.4, y: 1.65, w: 3.9, h: 0.4,
fontSize: 17, fontFace: "Georgia", color: C.teal, bold: true, margin: 0,
});
s.addText([
{ text: "noise \u2192 基因表达预测", options: { bold: true, breakLine: true, fontSize: 14 } },
{ text: "", options: { breakLine: true, fontSize: 6 } },
{ text: "基于 GRN 变化预测表达", options: { breakLine: true, fontSize: 13, color: C.textS } },
{ text: "推理时后完成", options: { fontSize: 13, color: C.teal, bold: true } },
], { x: 5.4, y: 2.15, w: 3.9, h: 1.5, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.2 });
// Intuition banner
card(s, 0.5, 4.2, 9.0, 1.05, { accent: C.tealDk });
s.addText("生物学直觉", {
x: 0.75, y: 4.3, w: 2, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText("模型先\u201C想清楚\u201D扰动改变了哪些基因调控关系,再基于这些理解去预测表达变化", {
x: 0.75, y: 4.6, w: 8.5, h: 0.4,
fontSize: 13, fontFace: "Calibri", color: C.text, margin: 0,
});
// ============================
addSlideNum(s);
// SLIDE 10: ARCHITECTURE
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "模型架构");
// Left architecture diagram
// Condition inputs
card(s, 0.3, 1.15, 3.0, 1.35);
s.addText("条件信息(推理时可用)", {
x: 0.45, y: 1.2, w: 2.7, h: 0.25,
fontSize: 11, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText([
{ text: "x_ctrl (control 表达)", options: { breakLine: true } },
{ text: "pert_id (扰动基因)", options: { breakLine: true } },
{ text: "t\u2081, t\u2082 (时间步)", options: {} },
], { x: 0.45, y: 1.5, w: 2.7, h: 0.85, fontSize: 10.5, fontFace: "Consolas", color: C.text, margin: 0, bullet: true, paraSpaceAfter: 3 });
// GRN target
card(s, 3.6, 1.15, 3.1, 1.35, { fill: "FFF7ED" });
s.addText("辅助目标(从噪声生成)", {
x: 3.75, y: 1.2, w: 2.8, h: 0.25,
fontSize: 11, fontFace: "Calibri", color: C.amber, bold: true, margin: 0,
});
s.addText([
{ text: "z = \u0394_attn @ gene_emb", options: { breakLine: true, fontFace: "Consolas" } },
{ text: "GRN 变化特征 (512d/gene)", options: { breakLine: true } },
{ text: "来自 frozen scGPT", options: {} },
], { x: 3.75, y: 1.5, w: 2.8, h: 0.85, fontSize: 10.5, fontFace: "Calibri", color: C.text, margin: 0, bullet: true, paraSpaceAfter: 3 });
// Expression stream
s.addShape(pres.shapes.RECTANGLE, {
x: 0.3, y: 2.75, w: 3.0, h: 0.5, fill: { color: C.teal, transparency: 85 }, line: { color: C.teal, width: 1 },
});
s.addText("Expression Stream \u2192 expr_tokens", {
x: 0.4, y: 2.78, w: 2.8, h: 0.45,
fontSize: 11, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0, valign: "middle",
});
// Latent stream
s.addShape(pres.shapes.RECTANGLE, {
x: 3.6, y: 2.75, w: 3.1, h: 0.5, fill: { color: C.amber, transparency: 85 }, line: { color: C.amber, width: 1 },
});
s.addText("Latent Stream \u2192 lat_tokens", {
x: 3.7, y: 2.78, w: 2.9, h: 0.45,
fontSize: 11, fontFace: "Calibri", color: C.amber, bold: true, margin: 0, valign: "middle",
});
// Merge
s.addText("\u2295 加法融合", {
x: 1.5, y: 3.32, w: 3.5, h: 0.3,
fontSize: 12, fontFace: "Calibri", color: C.text, align: "center", margin: 0,
});
// Shared backbone
s.addShape(pres.shapes.RECTANGLE, {
x: 0.3, y: 3.7, w: 6.4, h: 0.6, fill: { color: C.tealDk },
});
s.addText("Shared Backbone: DiffPerceiverBlock \u00D7 4 + GeneadaLN", {
x: 0.5, y: 3.73, w: 6.0, h: 0.55,
fontSize: 12.5, fontFace: "Calibri", color: C.white, bold: true, margin: 0, valign: "middle",
});
// Two heads
s.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 4.5, w: 3.0, h: 0.45, fill: { color: C.teal } });
s.addText("ExprHead \u2192 v_expr (B,G)", {
x: 0.4, y: 4.52, w: 2.8, h: 0.4,
fontSize: 11, fontFace: "Calibri", color: C.white, bold: true, margin: 0, valign: "middle",
});
s.addShape(pres.shapes.RECTANGLE, { x: 3.6, y: 4.5, w: 3.1, h: 0.45, fill: { color: C.amber } });
s.addText("LatentHead \u2192 v_latent (B,G,512)", {
x: 3.7, y: 4.52, w: 2.9, h: 0.4,
fontSize: 11, fontFace: "Calibri", color: C.white, bold: true, margin: 0, valign: "middle",
});
// Right: key design points
card(s, 7.0, 1.15, 2.7, 3.8);
s.addText("设计要点", {
x: 7.15, y: 1.25, w: 2.4, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText([
{ text: "双流输入", options: { bold: true, breakLine: true, fontSize: 11 } },
{ text: "表达 + GRN latent 各自编码后加法融合", options: { breakLine: true, fontSize: 10, color: C.textS } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "共享骨干", options: { bold: true, breakLine: true, fontSize: 11 } },
{ text: "4 层 DiffPerceiverBlock 联合处理", options: { breakLine: true, fontSize: 10, color: C.textS } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "双头输出", options: { bold: true, breakLine: true, fontSize: 11 } },
{ text: "分别预测表达和 latent 速度场", options: { breakLine: true, fontSize: 10, color: C.textS } },
{ text: "", options: { breakLine: true, fontSize: 5 } },
{ text: "条件注入", options: { bold: true, breakLine: true, fontSize: 11 } },
{ text: "c = t\u2081 + t\u2082 + pert_emb", options: { breakLine: true, fontSize: 10, color: C.textS } },
{ text: "通过 adaLN 注入", options: { fontSize: 10, color: C.textS } },
], { x: 7.15, y: 1.6, w: 2.4, h: 3.2, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.15 });
// ============================
addSlideNum(s);
// SLIDE 11: TRAINING & INFERENCE
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "Cascaded 训练与推理");
// Training (left)
card(s, 0.5, 1.15, 4.3, 4.0, { accent: C.purple });
s.addText("训练:概率切换", {
x: 0.75, y: 1.25, w: 3.8, h: 0.35,
fontSize: 16, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText("不同时优化两个 flow,随机 coin flip:", {
x: 0.75, y: 1.65, w: 3.8, h: 0.25,
fontSize: 12, fontFace: "Calibri", color: C.textS, margin: 0,
});
// 40% latent
s.addShape(pres.shapes.RECTANGLE, {
x: 0.75, y: 2.1, w: 3.8, h: 0.9,
fill: { color: C.amber, transparency: 90 }, line: { color: C.amber, width: 1 },
});
s.addText("40%", {
x: 0.85, y: 2.15, w: 0.8, h: 0.35,
fontSize: 22, fontFace: "Georgia", color: C.amber, bold: true, margin: 0,
});
s.addText([
{ text: "训练 Latent Flow", options: { bold: true, breakLine: true } },
{ text: "t\u2082 随机, t\u2081=0, 只算 loss_latent", options: {} },
], { x: 1.7, y: 2.15, w: 2.7, h: 0.75, fontSize: 11, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.5 });
// 60% expression
s.addShape(pres.shapes.RECTANGLE, {
x: 0.75, y: 3.2, w: 3.8, h: 0.9,
fill: { color: C.teal, transparency: 90 }, line: { color: C.teal, width: 1 },
});
s.addText("60%", {
x: 0.85, y: 3.25, w: 0.8, h: 0.35,
fontSize: 22, fontFace: "Georgia", color: C.teal, bold: true, margin: 0,
});
s.addText([
{ text: "训练 Expression Flow", options: { bold: true, breakLine: true } },
{ text: "t\u2081 随机, t\u2082\u22481, 只算 loss_expr", options: {} },
], { x: 1.7, y: 3.25, w: 2.7, h: 0.75, fontSize: 11, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.5 });
// Inference (right)
card(s, 5.2, 1.15, 4.3, 4.0, { accent: C.teal });
s.addText("推理:两阶段串行", {
x: 5.45, y: 1.25, w: 3.8, h: 0.35,
fontSize: 16, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
// Stage 1
s.addShape(pres.shapes.RECTANGLE, {
x: 5.45, y: 1.8, w: 3.8, h: 1.2,
fill: { color: C.amber, transparency: 90 }, line: { color: C.amber, width: 1 },
});
s.addText("Stage 1: GRN Latent", {
x: 5.55, y: 1.85, w: 3.6, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.amber, bold: true, margin: 0,
});
s.addText([
{ text: "z_noise ==(ODE)==> z_clean", options: { breakLine: true, fontFace: "Consolas", fontSize: 11 } },
{ text: "先理解 GRN 如何变化 (t\u2082: 0\u21921)", options: { fontSize: 11 } },
], { x: 5.55, y: 2.2, w: 3.6, h: 0.65, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.4 });
// Arrow
s.addText("\u2193", {
x: 5.45, y: 3.05, w: 3.8, h: 0.35,
fontSize: 22, fontFace: "Calibri", color: C.tealDk, align: "center", margin: 0,
});
// Stage 2
s.addShape(pres.shapes.RECTANGLE, {
x: 5.45, y: 3.45, w: 3.8, h: 1.2,
fill: { color: C.teal, transparency: 90 }, line: { color: C.teal, width: 1 },
});
s.addText("Stage 2: Expression", {
x: 5.55, y: 3.5, w: 3.6, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.teal, bold: true, margin: 0,
});
s.addText([
{ text: "x_noise ==(ODE)==> x_pred", options: { breakLine: true, fontFace: "Consolas", fontSize: 11 } },
{ text: "基于 z_clean 预测表达 (t\u2081: 0\u21921)", options: { fontSize: 11 } },
], { x: 5.55, y: 3.85, w: 3.6, h: 0.65, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.4 });
// ============================
addSlideNum(s);
// SLIDE 12: CHALLENGES
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "当前挑战与解决方向");
// Challenge 1
card(s, 0.5, 1.15, 4.3, 4.0, { accent: C.red });
s.addText("挑战 1:GRN 信号噪声大", {
x: 0.75, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "Attention: 5000\u00D75000 = 25M 非零值", options: { breakLine: true } },
{ text: "真实 GRN: 每基因仅 ~20-50 靶标", options: { breakLine: true } },
{ text: "99%+ attention 值是噪声", options: { breakLine: true, color: C.red, bold: true } },
{ text: "latent loss \u2248 1.12 >> expr loss \u2248 0.019", options: { color: C.red } },
], { x: 0.75, y: 1.65, w: 3.8, h: 1.15, fontSize: 12, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Solution 1
s.addShape(pres.shapes.RECTANGLE, {
x: 0.75, y: 3.05, w: 3.8, h: 1.8,
fill: { color: C.green, transparency: 90 }, line: { color: C.green, width: 1 },
});
s.addText("解决:稀疏化 Top-K", {
x: 0.85, y: 3.1, w: 3.6, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.green, bold: true, margin: 0,
});
s.addText([
{ text: "每个基因只保留 |\u0394| 最大的 K=30 个", options: { breakLine: true } },
{ text: "过滤 99.4% 噪声", options: { breakLine: true, bold: true } },
{ text: "sparse_topk_emb 模式", options: { fontFace: "Consolas" } },
], { x: 0.85, y: 3.45, w: 3.6, h: 1.0, fontSize: 11.5, fontFace: "Calibri", color: C.text, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Challenge 2
card(s, 5.2, 1.15, 4.3, 4.0, { accent: C.red });
s.addText("挑战 2:512 维 Latent 太难预测", {
x: 5.45, y: 1.25, w: 3.8, h: 0.3,
fontSize: 14, fontFace: "Calibri", color: C.text, bold: true, margin: 0,
});
s.addText([
{ text: "每基因 512 维 = 250 万维速度场", options: { breakLine: true } },
{ text: "模型每步需预测如此大的向量", options: { breakLine: true } },
{ text: "消融: 512\u21921 维, loss 从 ~1.1 降到 ~0.5", options: { breakLine: true, color: C.red, bold: true } },
{ text: "维度是难度的重要来源", options: { color: C.red } },
], { x: 5.45, y: 1.65, w: 3.8, h: 1.15, fontSize: 12, fontFace: "Calibri", color: C.textS, margin: 0, bullet: true, paraSpaceAfter: 4 });
// Solution 2
s.addShape(pres.shapes.RECTANGLE, {
x: 5.45, y: 3.05, w: 3.8, h: 1.8,
fill: { color: C.green, transparency: 90 }, line: { color: C.green, width: 1 },
});
s.addText("解决:PCA 降维", {
x: 5.55, y: 3.1, w: 3.6, h: 0.3,
fontSize: 13, fontFace: "Calibri", color: C.green, bold: true, margin: 0,
});
s.addText([
{ text: "512-d gene_emb \u2192 PCA 投影到 64 维", options: { breakLine: true } },
{ text: "去掉冗余维度,保留主变化方向", options: { breakLine: true, bold: true } },
{ text: "sparse_pca 模式", options: { fontFace: "Consolas" } },
], { x: 5.55, y: 3.45, w: 3.6, h: 1.0, fontSize: 11.5, fontFace: "Calibri", color: C.text, margin: 0, bullet: true, paraSpaceAfter: 4 });
// ============================
addSlideNum(s);
// SLIDE 13: SUMMARY & FUTURE
// ============================
s = pres.addSlide();
s.background = { color: C.light };
titleBar(s, "总结与展望");
// Core contribution
card(s, 0.5, 1.15, 9.0, 1.4, { accent: C.teal });
s.addText("核心贡献", {
x: 0.75, y: 1.25, w: 2, h: 0.3,
fontSize: 16, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
s.addText("不是架构改进,而是从生物学机制出发重新建模:用 Cascaded Flow Matching 实现\u201C先理解调控变化,再预测表达变化\u201D", {
x: 0.75, y: 1.6, w: 8.5, h: 0.75,
fontSize: 14, fontFace: "Calibri", color: C.text, margin: 0, lineSpacingMultiple: 1.35,
});
// Future experiment
s.addText("后续关键实验:验证因果假设", {
x: 0.5, y: 2.8, w: 5, h: 0.35,
fontSize: 16, fontFace: "Calibri", color: C.tealDk, bold: true, margin: 0,
});
const tbl = [
[
{ text: "推理方式", options: { bold: true, color: "FFFFFF", fill: { color: C.tealDk } } },
{ text: "含义", options: { bold: true, color: "FFFFFF", fill: { color: C.tealDk } } },
{ text: "预期", options: { bold: true, color: "FFFFFF", fill: { color: C.tealDk } } },
],
[
{ text: "先 GRN \u2192 后 Expression", options: { bold: true, fill: { color: C.tealLt } } },
{ text: "先理解调控变化,再预测表达", options: { fill: { color: C.tealLt } } },
{ text: "最优", options: { bold: true, color: C.teal, fill: { color: C.tealLt } } },
],
["先 Expression \u2192 后 GRN", "先预测表达,再理解调控", "次优"],
["同时 random", "无显式顺序", "最差"],
];
s.addTable(tbl, {
x: 0.5, y: 3.25, w: 9.0,
fontSize: 12, fontFace: "Calibri",
border: { pt: 0.5, color: C.border },
colW: [3.0, 3.5, 2.5],
rowH: [0.38, 0.38, 0.38, 0.38],
autoPage: false,
});
s.addText("如果\u201C先 GRN 后 Expression\u201D显著优于其他 \u2192 验证 GRN 理解是预测表达变化的前提", {
x: 0.5, y: 4.85, w: 9.0, h: 0.35,
fontSize: 12, fontFace: "Calibri", color: C.teal, italic: true, bold: true, margin: 0,
});
// ============================
addSlideNum(s);
// SLIDE 14: CONCLUSION
// ============================
s = pres.addSlide();
s.background = { color: C.dark };
s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.15, h: 5.625, fill: { color: C.teal } });
s.addText("核心结论", {
x: 0.8, y: 1.2, w: 3, h: 0.4,
fontSize: 16, fontFace: "Calibri", color: "CBD5E1", margin: 0,
});
s.addText("用 scGPT 的 attention delta 显式提取扰动引起的基因调控网络变化,通过 cascaded flow matching 强制模型\u201C先理解 GRN 如何改变,再预测表达如何变化\u201D,从而将生物学先验融入生成式模型的推理过程。", {
x: 0.8, y: 1.8, w: 8.4, h: 2.2,
fontSize: 22, fontFace: "Georgia", color: C.white, lineSpacingMultiple: 1.45, margin: 0,
});
s.addText("GRN-Guided Cascaded Flow Matching", {
x: 0.8, y: 4.6, w: 5, h: 0.35,
fontSize: 14, fontFace: "Calibri", color: "22D3EE", margin: 0,
});
addSlideNum(s, true);
// === SAVE ===
const outPath = "/home/hp250092/ku50001222/qian/aivc/lfj/Report/PPT/GRN_CCFM_presentation.pptx";
pres.writeFile({ fileName: outPath })
.then(() => console.log("Saved: " + outPath))
.catch(err => console.error("Error:", err));