File size: 33,359 Bytes
e2409ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9"; // 10" x 5.625"
pres.author = "Qian";
pres.title = "GRN-Guided Cascaded Flow Matching for Single-Cell Perturbation Prediction";

// ─── COLOR PALETTE ───
const NAVY    = "1B2A4A";
const BLUE    = "2E6B9E";
const LT_BLUE = "B8D4E8";
const BG_GRAY = "F0F2F5";
const CARD_BG = "F7F8FA";
const TXT     = "2C3E50";
const TXT_MID = "4A5568";
const TXT_LT  = "6B7B8D";
const WHITE   = "FFFFFF";
const RED     = "C0392B";
const GREEN   = "27AE60";
const ORANGE  = "D35400";

const HF = "Cambria";
const BF = "Calibri";
const CF = "Consolas";

// ─── HELPERS ───
function slideNum(slide, n) {
  slide.addText(String(n), {
    x: 9.2, y: 5.2, w: 0.5, h: 0.3,
    fontSize: 10, color: TXT_LT, fontFace: BF, align: "right"
  });
}

function headerBar(slide, title) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.85,
    fill: { color: NAVY }
  });
  slide.addText(title, {
    x: 0.6, y: 0.12, w: 8.8, h: 0.6,
    fontSize: 24, fontFace: HF, color: WHITE, bold: true, margin: 0
  });
}

function sectionLabel(slide, text, x, y, w) {
  slide.addText(text, {
    x: x || 0.6, y: y || 1.1, w: w || 8.8, h: 0.4,
    fontSize: 17, fontFace: HF, color: NAVY, bold: true, margin: 0
  });
}

function card(slide, x, y, w, h, accentColor) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h, fill: { color: CARD_BG }
  });
  if (accentColor) {
    slide.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 0.06, h, fill: { color: accentColor }
    });
  }
}

// ════════════════════════════════════════════════════════════
// SLIDE 1: TITLE
// ════════════════════════════════════════════════════════════
let s1 = pres.addSlide();
s1.background = { color: NAVY };
s1.addShape(pres.shapes.RECTANGLE, {
  x: 0, y: 0, w: 10, h: 0.06, fill: { color: BLUE }
});
s1.addText([
  { text: "GRN-Guided Cascaded Flow Matching", options: { breakLine: true, fontSize: 34 } },
  { text: "for Single-Cell Perturbation Prediction", options: { fontSize: 28 } }
], {
  x: 0.8, y: 1.0, w: 8.4, h: 2.2,
  fontFace: HF, color: WHITE, bold: true,
  align: "center", valign: "middle", paraSpaceAfter: 8
});
s1.addShape(pres.shapes.RECTANGLE, {
  x: 3.8, y: 3.4, w: 2.4, h: 0.035, fill: { color: BLUE }
});
s1.addText("Group Meeting Report", {
  x: 1, y: 3.65, w: 8, h: 0.45,
  fontSize: 18, fontFace: BF, color: LT_BLUE, align: "center"
});
s1.addText("March 2026", {
  x: 1, y: 4.2, w: 8, h: 0.35,
  fontSize: 14, fontFace: BF, color: TXT_LT, align: "center"
});

// ════════════════════════════════════════════════════════════
// SLIDE 2: TASK DEFINITION
// ════════════════════════════════════════════════════════════
let s2 = pres.addSlide();
headerBar(s2, "Task: Single-Cell Perturbation Prediction");
slideNum(s2, 2);

// Left column
sectionLabel(s2, "Virtual Cell Vision", 0.6, 1.05);
s2.addText([
  { text: "AI model simulating cell behavior", options: { bullet: true, breakLine: true } },
  { text: "Predict molecular state under perturbation", options: { bullet: true, breakLine: true } },
  { text: "Focus: CRISPR genetic perturbation", options: { bullet: true } }
], {
  x: 0.6, y: 1.5, w: 4.2, h: 1.2,
  fontSize: 13, fontFace: BF, color: TXT, paraSpaceAfter: 4
});

sectionLabel(s2, "Perturbation Types", 0.6, 2.8);
s2.addText([
  { text: "Drug (small molecule compounds)", options: { bullet: true, breakLine: true } },
  { text: "Cytokine (immune signaling)", options: { bullet: true, breakLine: true } },
  { text: "Genetic (CRISPR KO / OE / KD)", options: { bullet: true, bold: true } }
], {
  x: 0.6, y: 3.25, w: 4.2, h: 1.2,
  fontSize: 13, fontFace: BF, color: TXT, paraSpaceAfter: 4
});

// Right column - task formulation card
card(s2, 5.3, 1.05, 4.2, 3.7, BLUE);
s2.addText("Task Formulation", {
  x: 5.6, y: 1.15, w: 3.7, h: 0.35,
  fontSize: 15, fontFace: HF, color: NAVY, bold: true, margin: 0
});
s2.addText([
  { text: "Input:", options: { bold: true, breakLine: true } },
  { text: "  x_ctrl (control expression, G dims)", options: { breakLine: true } },
  { text: "  p (perturbed gene ID)", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Output:", options: { bold: true, breakLine: true } },
  { text: "  x_pert (perturbed expression, G dims)", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "G = 5,000 highly variable genes", options: { italic: true, color: TXT_MID } }
], {
  x: 5.6, y: 1.6, w: 3.7, h: 2.8,
  fontSize: 12, fontFace: CF, color: TXT
});

// ════════════════════════════════════════════════════════════
// SLIDE 3: SIGNIFICANCE & DATASET
// ════════════════════════════════════════════════════════════
let s3 = pres.addSlide();
headerBar(s3, "Significance & Dataset");
slideNum(s3, 3);

// Three importance cards
const importCards = [
  { num: "$$$", title: "Drug Screening", body: "Wet-lab Perturb-seq is expensive;\nvirtual screening saves resources" },
  { num: "N\u00B2", title: "Combinatorial Explosion", body: "N genes \u2192 N(N-1)/2 combinations;\nimpossible to enumerate all" },
  { num: "DNA", title: "Disease Mechanism", body: "Predict which gene perturbation\ncauses disease phenotype" }
];
importCards.forEach((c, i) => {
  const cx = 0.6 + i * 3.1;
  card(s3, cx, 1.05, 2.8, 2.0, BLUE);
  s3.addText(c.num, {
    x: cx + 0.15, y: 1.15, w: 1.0, h: 0.45,
    fontSize: 20, fontFace: HF, color: BLUE, bold: true, margin: 0
  });
  s3.addText(c.title, {
    x: cx + 0.15, y: 1.6, w: 2.5, h: 0.3,
    fontSize: 14, fontFace: HF, color: NAVY, bold: true, margin: 0
  });
  s3.addText(c.body, {
    x: cx + 0.15, y: 1.95, w: 2.5, h: 0.9,
    fontSize: 11, fontFace: BF, color: TXT_MID
  });
});

// Dataset info
sectionLabel(s3, "Dataset: Norman et al.", 0.6, 3.3);
s3.addText([
  { text: "~9,000 cells \u00D7 5,000 HVG", options: { bullet: true, breakLine: true, bold: true } },
  { text: "105 single/double CRISPR perturbations (KO + OE)", options: { bullet: true, breakLine: true } },
  { text: "No cell-level pairing (destructive measurement)", options: { bullet: true, breakLine: true, bold: true, color: RED } },
  { text: "Metrics: DE gene overlap, direction, MSE, Pearson r", options: { bullet: true } }
], {
  x: 0.6, y: 3.75, w: 8.8, h: 1.3,
  fontSize: 13, fontFace: BF, color: TXT, paraSpaceAfter: 4
});

// ════════════════════════════════════════════════════════════
// SLIDE 4: EXISTING METHODS
// ════════════════════════════════════════════════════════════
let s4 = pres.addSlide();
headerBar(s4, "Existing Methods & Limitations");
slideNum(s4, 4);

const hdrOpts = (txt) => ({ text: txt, options: { bold: true, color: WHITE, fill: { color: NAVY }, fontSize: 12, fontFace: BF, align: "center" } });
const cellOpts = (txt, opts) => ({ text: txt, options: { fontSize: 11, fontFace: BF, ...opts } });
const altBg = { fill: { color: "F8F9FA" } };

s4.addTable([
  [ hdrOpts("Method"), hdrOpts("Type"), hdrOpts("Key Limitation") ],
  [ cellOpts("Additive Shift", altBg), cellOpts("Baseline", { ...altBg, align: "center" }), cellOpts("Ignores cell heterogeneity; constant shift assumption", altBg) ],
  [ cellOpts("scGPT"), cellOpts("Pretrained LM", { align: "center" }), cellOpts("Autoregressive completion; not designed for perturbation") ],
  [ cellOpts("Geneformer", altBg), cellOpts("Pretrained LM", { ...altBg, align: "center" }), cellOpts("Heuristic in-silico perturbation; loses expression info", altBg) ],
  [ cellOpts("CPA"), cellOpts("Specialized", { align: "center" }), cellOpts("Linear additivity assumption in latent space") ],
  [ cellOpts("GEARS", altBg), cellOpts("Specialized", { ...altBg, align: "center" }), cellOpts("Static GO graph prior; deterministic prediction only", altBg) ],
  [ cellOpts("scDFM", { bold: true }), cellOpts("Flow Matching", { align: "center" }), cellOpts("No GRN modeling; limited model capacity (d=128)") ]
], {
  x: 0.6, y: 1.1, w: 8.8,
  colW: [1.8, 1.5, 5.5],
  border: { pt: 0.5, color: "DDE1E6" },
  rowH: [0.45, 0.42, 0.42, 0.42, 0.42, 0.42, 0.42]
});

s4.addText("scDFM (ICLR 2026) is closest to our work \u2014 we build upon its flow matching framework.", {
  x: 0.6, y: 4.5, w: 8.8, h: 0.3,
  fontSize: 11, fontFace: BF, color: TXT_MID, italic: true
});

// ════════════════════════════════════════════════════════════
// SLIDE 5: THE MISSING PIECE
// ════════════════════════════════════════════════════════════
let s5 = pres.addSlide();
headerBar(s5, "The Common Blind Spot");
slideNum(s5, 5);

sectionLabel(s5, "All existing methods share the same gap:");

// Existing approach block
card(s5, 0.6, 1.8, 8.8, 1.3, RED);
s5.addText("Existing Approach", {
  x: 0.85, y: 1.9, w: 3.0, h: 0.3,
  fontSize: 14, fontFace: HF, color: RED, bold: true, margin: 0
});
s5.addText("Perturbation   \u2192   [ Black-Box Model ]   \u2192   Expression Change", {
  x: 0.85, y: 2.3, w: 8.2, h: 0.4,
  fontSize: 16, fontFace: CF, color: TXT, margin: 0
});
s5.addText("No explicit modeling of gene regulatory network changes", {
  x: 0.85, y: 2.7, w: 8.0, h: 0.3,
  fontSize: 12, fontFace: BF, color: TXT_MID, italic: true, margin: 0
});

// Our approach block
card(s5, 0.6, 3.5, 8.8, 1.3, GREEN);
s5.addText("Our Approach", {
  x: 0.85, y: 3.6, w: 3.0, h: 0.3,
  fontSize: 14, fontFace: HF, color: GREEN, bold: true, margin: 0
});
s5.addText("Perturbation   \u2192   GRN Rewiring   \u2192   Expression Change", {
  x: 0.85, y: 4.0, w: 8.2, h: 0.4,
  fontSize: 16, fontFace: CF, color: TXT, margin: 0
});
s5.addText("Explicitly model how perturbation alters the gene regulatory network", {
  x: 0.85, y: 4.4, w: 8.0, h: 0.3,
  fontSize: 12, fontFace: BF, color: TXT_MID, italic: true, margin: 0
});

// ════════════════════════════════════════════════════════════
// SLIDE 6: THREE KEY MOTIVATIONS
// ════════════════════════════════════════════════════════════
let s6 = pres.addSlide();
headerBar(s6, "Three Key Motivations");
slideNum(s6, 6);

const motivations = [
  {
    num: "1", title: "Flow Matching for Unpaired Data",
    bullets: [
      "Learns probability transport: p(ctrl) \u2192 p(pert)",
      "No cell-level pairing required",
      "Generative output with uncertainty estimation"
    ]
  },
  {
    num: "2", title: "GRN Cascade Drives Expression Change",
    bullets: [
      "KO gene A \u2192 direct targets B,C,D change",
      "Cascade propagates through regulatory network",
      "Understanding GRN change = better prediction"
    ]
  },
  {
    num: "3", title: "scGPT Attention \u2248 Data-Driven GRN",
    bullets: [
      "Pretrained attention encodes gene-gene regulation",
      "Context-dependent: varies with cell state",
      "\u0394_attn captures GRN change from perturbation"
    ]
  }
];

motivations.forEach((m, i) => {
  const cy = 1.05 + i * 1.4;
  card(s6, 0.6, cy, 8.8, 1.2, BLUE);
  s6.addShape(pres.shapes.OVAL, {
    x: 0.85, y: cy + 0.15, w: 0.5, h: 0.5,
    fill: { color: NAVY }
  });
  s6.addText(m.num, {
    x: 0.85, y: cy + 0.15, w: 0.5, h: 0.5,
    fontSize: 18, fontFace: HF, color: WHITE, bold: true,
    align: "center", valign: "middle", margin: 0
  });
  s6.addText(m.title, {
    x: 1.55, y: cy + 0.1, w: 7.5, h: 0.35,
    fontSize: 15, fontFace: HF, color: NAVY, bold: true, margin: 0
  });
  s6.addText(m.bullets.map((b, bi) => ({
    text: b,
    options: { bullet: true, breakLine: bi < m.bullets.length - 1 }
  })), {
    x: 1.55, y: cy + 0.5, w: 7.5, h: 0.65,
    fontSize: 12, fontFace: BF, color: TXT_MID, paraSpaceAfter: 2
  });
});

// ════════════════════════════════════════════════════════════
// SLIDE 7: METHOD OVERVIEW
// ════════════════════════════════════════════════════════════
let s7 = pres.addSlide();
headerBar(s7, "Method: Cascaded Flow Matching");
slideNum(s7, 7);

sectionLabel(s7, "Two-Stage Generation: \"Think First, Then Predict\"");

// Stage 1 box
card(s7, 0.6, 1.7, 4.1, 2.8, ORANGE);
s7.addText("Stage 1: GRN Latent Flow", {
  x: 0.85, y: 1.8, w: 3.6, h: 0.35,
  fontSize: 15, fontFace: HF, color: ORANGE, bold: true, margin: 0
});
s7.addText([
  { text: "noise \u2192 GRN change features", options: { breakLine: true, bold: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Understand how perturbation", options: { breakLine: true } },
  { text: "rewires the regulatory network", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Conditioned on:", options: { bold: true, breakLine: true } },
  { text: "  \u2022 control expression", options: { breakLine: true } },
  { text: "  \u2022 perturbed gene ID", options: {} }
], {
  x: 0.85, y: 2.25, w: 3.6, h: 2.0,
  fontSize: 12, fontFace: BF, color: TXT
});

// Arrow
s7.addText("\u2192", {
  x: 4.7, y: 2.7, w: 0.6, h: 0.5,
  fontSize: 30, fontFace: BF, color: NAVY, align: "center", valign: "middle", bold: true
});

// Stage 2 box
card(s7, 5.3, 1.7, 4.1, 2.8, GREEN);
s7.addText("Stage 2: Expression Flow", {
  x: 5.55, y: 1.8, w: 3.6, h: 0.35,
  fontSize: 15, fontFace: HF, color: GREEN, bold: true, margin: 0
});
s7.addText([
  { text: "noise \u2192 gene expression", options: { breakLine: true, bold: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Predict expression changes", options: { breakLine: true } },
  { text: "based on GRN understanding", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Conditioned on:", options: { bold: true, breakLine: true } },
  { text: "  \u2022 Stage 1 GRN features", options: { breakLine: true } },
  { text: "  \u2022 control expression + pert ID", options: {} }
], {
  x: 5.55, y: 2.25, w: 3.6, h: 2.0,
  fontSize: 12, fontFace: BF, color: TXT
});

// Bottom insight bar
s7.addShape(pres.shapes.RECTANGLE, {
  x: 0.6, y: 4.7, w: 8.8, h: 0.5,
  fill: { color: LT_BLUE }
});
s7.addText("Biological intuition: first understand GRN rewiring, then predict expression change", {
  x: 0.8, y: 4.7, w: 8.4, h: 0.5,
  fontSize: 13, fontFace: BF, color: NAVY, italic: true, valign: "middle"
});

// ════════════════════════════════════════════════════════════
// SLIDE 8: GRN FEATURE EXTRACTION
// ════════════════════════════════════════════════════════════
let s8 = pres.addSlide();
headerBar(s8, "GRN Feature: Attention-Delta Extraction");
slideNum(s8, 8);

sectionLabel(s8, "Using Frozen scGPT to Extract GRN Change Signal");

// Steps
const steps = [
  "Feed control & perturbed expression\ninto frozen scGPT separately",
  "Extract attention matrices:\nAttn(ctrl) and Attn(pert)",
  "Compute delta:\n\u0394_attn = Attn(pert) \u2212 Attn(ctrl)",
  "Project to features:\nz = \u0394_attn \u00D7 gene_embeddings"
];
steps.forEach((desc, i) => {
  const sy = 1.65 + i * 0.9;
  s8.addShape(pres.shapes.OVAL, {
    x: 0.7, y: sy + 0.05, w: 0.45, h: 0.45,
    fill: { color: BLUE }
  });
  s8.addText(String(i + 1), {
    x: 0.7, y: sy + 0.05, w: 0.45, h: 0.45,
    fontSize: 16, fontFace: HF, color: WHITE, bold: true,
    align: "center", valign: "middle", margin: 0
  });
  s8.addText(desc, {
    x: 1.4, y: sy, w: 3.8, h: 0.6,
    fontSize: 12, fontFace: BF, color: TXT, valign: "middle", margin: 0
  });
  if (i < steps.length - 1) {
    s8.addShape(pres.shapes.LINE, {
      x: 0.92, y: sy + 0.52, w: 0, h: 0.35,
      line: { color: BLUE, width: 1.5, dashType: "dash" }
    });
  }
});

// Output card on right
card(s8, 5.6, 1.65, 3.8, 3.2, NAVY);
s8.addText("Output", {
  x: 5.85, y: 1.75, w: 3.3, h: 0.3,
  fontSize: 15, fontFace: HF, color: NAVY, bold: true, margin: 0
});
s8.addText([
  { text: "Per-gene GRN change vector", options: { breakLine: true, bold: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Shape: (B, G, 512)", options: { breakLine: true, fontFace: CF } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Each gene gets a 512-d vector\nencoding: \"how did upstream\nregulatory relationships change\nfor this gene?\"", options: { color: TXT_MID } }
], {
  x: 5.85, y: 2.15, w: 3.3, h: 2.2,
  fontSize: 12, fontFace: BF, color: TXT
});

// ════════════════════════════════════════════════════════════
// SLIDE 9: MODEL ARCHITECTURE
// ════════════════════════════════════════════════════════════
let s9 = pres.addSlide();
headerBar(s9, "Model Architecture");
slideNum(s9, 9);

// Expression Stream
card(s9, 0.6, 1.1, 4.1, 1.1, BLUE);
s9.addText("Expression Stream", {
  x: 0.85, y: 1.15, w: 3.6, h: 0.3,
  fontSize: 14, fontFace: HF, color: BLUE, bold: true, margin: 0
});
s9.addText("GeneEncoder + ValueEnc \u2192 expr_tokens (B,G,d)", {
  x: 0.85, y: 1.5, w: 3.6, h: 0.4,
  fontSize: 11, fontFace: CF, color: TXT, margin: 0
});

// Latent Stream
card(s9, 5.3, 1.1, 4.1, 1.1, ORANGE);
s9.addText("Latent Stream", {
  x: 5.55, y: 1.15, w: 3.6, h: 0.3,
  fontSize: 14, fontFace: HF, color: ORANGE, bold: true, margin: 0
});
s9.addText("LatentEmbedder \u2192 lat_tokens (B,G,d)", {
  x: 5.55, y: 1.5, w: 3.6, h: 0.4,
  fontSize: 11, fontFace: CF, color: TXT, margin: 0
});

// Merge
s9.addText("\u2295  Additive Fusion", {
  x: 3.0, y: 2.35, w: 4.0, h: 0.35,
  fontSize: 13, fontFace: BF, color: NAVY, bold: true, align: "center", margin: 0
});

// Down arrows
s9.addShape(pres.shapes.LINE, {
  x: 2.5, y: 2.2, w: 0, h: 0.15,
  line: { color: NAVY, width: 1.5 }
});
s9.addShape(pres.shapes.LINE, {
  x: 7.5, y: 2.2, w: 0, h: 0.15,
  line: { color: NAVY, width: 1.5 }
});

// Conditioning
card(s9, 2.0, 2.85, 6.0, 0.5, NAVY);
s9.addText("Conditioning:  c = t_expr + t_latent + pert_embedding", {
  x: 2.25, y: 2.9, w: 5.5, h: 0.4,
  fontSize: 11, fontFace: CF, color: TXT, valign: "middle", margin: 0
});

// Down arrow to backbone
s9.addShape(pres.shapes.LINE, {
  x: 5.0, y: 3.35, w: 0, h: 0.2,
  line: { color: NAVY, width: 1.5 }
});

// Shared Backbone
s9.addShape(pres.shapes.RECTANGLE, {
  x: 2.0, y: 3.6, w: 6.0, h: 0.65,
  fill: { color: NAVY }
});
s9.addText("Shared Backbone:  DiffPerceiverBlock \u00D7 4  (with Gene-AdaLN)", {
  x: 2.0, y: 3.6, w: 6.0, h: 0.65,
  fontSize: 13, fontFace: BF, color: WHITE, bold: true,
  align: "center", valign: "middle"
});

// Down arrows to heads
s9.addShape(pres.shapes.LINE, {
  x: 3.4, y: 4.25, w: 0, h: 0.2,
  line: { color: NAVY, width: 1.5 }
});
s9.addShape(pres.shapes.LINE, {
  x: 6.6, y: 4.25, w: 0, h: 0.2,
  line: { color: NAVY, width: 1.5 }
});

// Dual heads
card(s9, 2.0, 4.5, 2.8, 0.65, BLUE);
s9.addText("Expression Head \u2192 v_expr (B,G)", {
  x: 2.2, y: 4.55, w: 2.4, h: 0.45,
  fontSize: 11, fontFace: CF, color: TXT, valign: "middle", margin: 0
});
card(s9, 5.2, 4.5, 2.8, 0.65, ORANGE);
s9.addText("Latent Head \u2192 v_latent (B,G,512)", {
  x: 5.4, y: 4.55, w: 2.4, h: 0.45,
  fontSize: 11, fontFace: CF, color: TXT, valign: "middle", margin: 0
});

// ════════════════════════════════════════════════════════════
// SLIDE 10: TRAINING & INFERENCE
// ════════════════════════════════════════════════════════════
let s10 = pres.addSlide();
headerBar(s10, "Cascaded Training & Inference");
slideNum(s10, 10);

// Left: Training
sectionLabel(s10, "Training: Probabilistic Switching", 0.6, 1.1, 4.2);
card(s10, 0.6, 1.55, 4.2, 1.4, BLUE);
s10.addText([
  { text: "40%", options: { bold: true, fontSize: 20, color: ORANGE } },
  { text: "  Train Latent Flow only", options: { fontSize: 13 } }
], {
  x: 0.85, y: 1.65, w: 3.7, h: 0.45, fontFace: BF, color: TXT, valign: "middle", margin: 0
});
s10.addText("t\u2082 random, t\u2081 = 0, only loss_latent", {
  x: 0.85, y: 2.05, w: 3.7, h: 0.25,
  fontSize: 10, fontFace: CF, color: TXT_MID, margin: 0
});
s10.addText([
  { text: "60%", options: { bold: true, fontSize: 20, color: GREEN } },
  { text: "  Train Expression Flow only", options: { fontSize: 13 } }
], {
  x: 0.85, y: 2.4, w: 3.7, h: 0.45, fontFace: BF, color: TXT, valign: "middle", margin: 0
});
s10.addText("t\u2081 random, t\u2082 \u2248 1, only loss_expr", {
  x: 0.85, y: 2.7, w: 3.7, h: 0.25,
  fontSize: 10, fontFace: CF, color: TXT_MID, margin: 0
});

// Right: Inference
sectionLabel(s10, "Inference: Sequential Two-Stage", 5.3, 1.1, 4.2);
card(s10, 5.3, 1.55, 4.2, 1.4, NAVY);
s10.addText([
  { text: "Stage 1:", options: { bold: true, color: ORANGE, breakLine: true } },
  { text: "z_noise \u2550\u2550(ODE)\u2550\u2550> z_clean  (t\u2082: 0\u21921)", options: { fontFace: CF, fontSize: 11, breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 4 } },
  { text: "Stage 2:", options: { bold: true, color: GREEN, breakLine: true } },
  { text: "x_noise \u2550\u2550(ODE)\u2550\u2550> x_pred   (t\u2081: 0\u21921)", options: { fontFace: CF, fontSize: 11 } }
], {
  x: 5.55, y: 1.65, w: 3.7, h: 1.2,
  fontSize: 12, fontFace: BF, color: TXT, margin: 0
});

// Biological analogy
sectionLabel(s10, "Biological Cascade Analogy", 0.6, 3.2, 8.8);
s10.addShape(pres.shapes.RECTANGLE, {
  x: 0.6, y: 3.6, w: 8.8, h: 1.6,
  fill: { color: LT_BLUE }
});
s10.addText([
  { text: "CRISPR knock-out gene A", options: { bold: true, breakLine: true } },
  { text: "  \u2193  Gene A expression \u2192 0", options: { breakLine: true } },
  { text: "  \u2193  Direct targets B, C, D change (1st-order)", options: { breakLine: true } },
  { text: "  \u2193  B\u2019s targets E, F and C\u2019s targets G, H change (cascade)", options: { breakLine: true } },
  { text: "  \u2193  Thousands of genes altered across the transcriptome", options: {} }
], {
  x: 0.8, y: 3.65, w: 8.4, h: 1.5,
  fontSize: 12, fontFace: CF, color: TXT
});

// ════════════════════════════════════════════════════════════
// SLIDE 11: CHALLENGE 1 - NOISY GRN SIGNAL
// ════════════════════════════════════════════════════════════
let s11 = pres.addSlide();
headerBar(s11, "Challenge 1: Noisy GRN Signal");
slideNum(s11, 11);

// Problem
sectionLabel(s11, "Problem: Noise Drowns True Signal", 0.6, 1.1, 4.2);
card(s11, 0.6, 1.55, 4.2, 1.8, RED);
s11.addText([
  { text: "Attention matrix: 5000\u00D75000", options: { bold: true, breakLine: true } },
  { text: "= 25,000,000 non-zero values", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Real GRN: ~20\u201350 targets per gene", options: { breakLine: true } },
  { text: "\u2192 99%+ attention values are noise", options: { bold: true, color: RED } }
], {
  x: 0.85, y: 1.65, w: 3.7, h: 1.4,
  fontSize: 12, fontFace: BF, color: TXT
});
s11.addText("Evidence: latent loss \u2248 1.12 >> expr loss \u2248 0.019", {
  x: 0.6, y: 3.5, w: 4.2, h: 0.25,
  fontSize: 11, fontFace: BF, color: TXT_MID, italic: true
});

// Solution
sectionLabel(s11, "Solution: Sparse Top-K Filtering", 5.3, 1.1, 4.2);
card(s11, 5.3, 1.55, 4.2, 1.8, GREEN);
s11.addText([
  { text: "Keep only top K=30 per gene", options: { bold: true, breakLine: true } },
  { text: "(ranked by |\u0394_attn| magnitude)", options: { breakLine: true, color: TXT_MID } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "\u2192 Filters 99.4% noise", options: { bold: true, color: GREEN, breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "features = sparse_\u0394_topk \u00D7 gene_emb", options: { fontFace: CF, fontSize: 11 } }
], {
  x: 5.55, y: 1.65, w: 3.7, h: 1.4,
  fontSize: 12, fontFace: BF, color: TXT
});
s11.addText("Status: implemented (sparse_topk_emb mode)", {
  x: 5.3, y: 3.5, w: 4.2, h: 0.25,
  fontSize: 11, fontFace: BF, color: GREEN, italic: true
});

// Before/after comparison bar
s11.addShape(pres.shapes.RECTANGLE, {
  x: 0.6, y: 4.0, w: 8.8, h: 1.2,
  fill: { color: BG_GRAY }
});
s11.addText([
  { text: "Before: ", options: { bold: true } },
  { text: "\u0394_attn (G\u00D7G) \u2192 25M values \u2192 noise dominates \u2192 loss ~1.12", options: { color: RED } }
], {
  x: 0.8, y: 4.1, w: 8.4, h: 0.35,
  fontSize: 12, fontFace: BF, color: TXT
});
s11.addText([
  { text: "After:  ", options: { bold: true } },
  { text: "sparse_\u0394_topk (G\u00D7K) \u2192 150K values \u2192 signal preserved \u2192 loss expected \u2193", options: { color: GREEN } }
], {
  x: 0.8, y: 4.55, w: 8.4, h: 0.35,
  fontSize: 12, fontFace: BF, color: TXT
});

// ════════════════════════════════════════════════════════════
// SLIDE 12: CHALLENGE 2 - HIGH-DIM LATENT
// ════════════════════════════════════════════════════════════
let s12 = pres.addSlide();
headerBar(s12, "Challenge 2: High-Dimensional Latent");
slideNum(s12, 12);

// Problem
sectionLabel(s12, "Problem: High-Dim Latent Prediction", 0.6, 1.1, 4.2);
card(s12, 0.6, 1.55, 4.2, 1.8, RED);
s12.addText([
  { text: "Each gene: 512-d GRN feature vector", options: { breakLine: true, bold: true } },
  { text: "Total: G\u00D7512 = 2.5M-dim velocity field", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "Ablation experiment:", options: { bold: true, breakLine: true } },
  { text: "512-d \u2192 1-d: loss drops 1.1 \u2192 0.5", options: { bold: true, color: RED } }
], {
  x: 0.85, y: 1.65, w: 3.7, h: 1.5,
  fontSize: 12, fontFace: BF, color: TXT
});
s12.addText("Dimensionality is a major difficulty source", {
  x: 0.6, y: 3.5, w: 4.2, h: 0.25,
  fontSize: 11, fontFace: BF, color: TXT_MID, italic: true
});

// Solution
sectionLabel(s12, "Solution: PCA Compression", 5.3, 1.1, 4.2);
card(s12, 5.3, 1.55, 4.2, 1.8, GREEN);
s12.addText([
  { text: "PCA on gene embeddings:", options: { bold: true, breakLine: true } },
  { text: "512-d \u2192 64-d principal components", options: { breakLine: true } },
  { text: "", options: { breakLine: true, fontSize: 6 } },
  { text: "features = sparse_\u0394 \u00D7 pca_basis", options: { fontFace: CF, fontSize: 11, breakLine: true } },
  { text: "Output: (B, G, 64)", options: { fontFace: CF, fontSize: 11 } }
], {
  x: 5.55, y: 1.65, w: 3.7, h: 1.5,
  fontSize: 12, fontFace: BF, color: TXT
});
s12.addText("Status: implemented (sparse_pca mode)", {
  x: 5.3, y: 3.5, w: 4.2, h: 0.25,
  fontSize: 11, fontFace: BF, color: GREEN, italic: true
});

// Combined pipeline
s12.addShape(pres.shapes.RECTANGLE, {
  x: 0.6, y: 4.0, w: 8.8, h: 1.2,
  fill: { color: LT_BLUE }
});
s12.addText("Combined Pipeline", {
  x: 0.8, y: 4.05, w: 8.4, h: 0.3,
  fontSize: 14, fontFace: HF, color: NAVY, bold: true, margin: 0
});
s12.addText("\u0394_attn  \u2192  Sparse Top-K (noise filter)  \u2192  PCA 512\u219264 (dim reduction)  \u2192  GRN features (B, G, 64)", {
  x: 0.8, y: 4.45, w: 8.4, h: 0.5,
  fontSize: 13, fontFace: CF, color: TXT, valign: "middle"
});

// ════════════════════════════════════════════════════════════
// SLIDE 13: SUMMARY & FUTURE WORK
// ════════════════════════════════════════════════════════════
let s13 = pres.addSlide();
headerBar(s13, "Summary & Future Work");
slideNum(s13, 13);

// Core Contribution
sectionLabel(s13, "Core Contribution", 0.6, 1.1);
s13.addText([
  { text: "First explicit GRN modeling in perturbation prediction", options: { bullet: true, breakLine: true, bold: true } },
  { text: "Cascaded flow matching: GRN first, expression second", options: { bullet: true, breakLine: true } },
  { text: "Biologically grounded: perturbation cascades through GRN", options: { bullet: true } }
], {
  x: 0.6, y: 1.5, w: 8.8, h: 1.0,
  fontSize: 13, fontFace: BF, color: TXT, paraSpaceAfter: 4
});

// Future experiment
sectionLabel(s13, "Key Future Experiment: Validate Causal Hypothesis", 0.6, 2.7);

const fHdr = (t) => ({ text: t, options: { bold: true, color: WHITE, fill: { color: NAVY }, fontSize: 11, fontFace: BF, align: "center" } });
const fCell = (t, opts) => ({ text: t, options: { fontSize: 11, fontFace: BF, ...opts } });
const fAlt = { fill: { color: "F8F9FA" } };

s13.addTable([
  [ fHdr("Inference Order"), fHdr("Meaning"), fHdr("Expected") ],
  [ fCell("GRN \u2192 Expression", { ...fAlt, bold: true }), fCell("Understand first, then predict", fAlt), fCell("Best", { ...fAlt, bold: true, color: GREEN, align: "center" }) ],
  [ fCell("Expression \u2192 GRN"), fCell("Predict first, understand later"), fCell("Suboptimal", { color: ORANGE, align: "center" }) ],
  [ fCell("Simultaneous", fAlt), fCell("No explicit order", fAlt), fCell("Worst", { ...fAlt, color: RED, align: "center" }) ]
], {
  x: 0.6, y: 3.15, w: 8.8,
  colW: [2.5, 3.8, 2.5],
  border: { pt: 0.5, color: "DDE1E6" },
  rowH: [0.4, 0.4, 0.4, 0.4]
});

s13.addText("If \"GRN \u2192 Expression\" wins: GRN understanding is a prerequisite, not a byproduct.", {
  x: 0.6, y: 4.8, w: 8.8, h: 0.4,
  fontSize: 12, fontFace: BF, color: NAVY, bold: true, italic: true
});

// ════════════════════════════════════════════════════════════
// SLIDE 14: TAKE-HOME MESSAGE
// ════════════════════════════════════════════════════════════
let s14 = pres.addSlide();
s14.background = { color: NAVY };
s14.addShape(pres.shapes.RECTANGLE, {
  x: 0, y: 0, w: 10, h: 0.06, fill: { color: BLUE }
});
s14.addText("Take-Home Message", {
  x: 1, y: 1.0, w: 8, h: 0.6,
  fontSize: 24, fontFace: HF, color: LT_BLUE, align: "center"
});
s14.addText([
  { text: "We embed biological prior \u2014 perturbation cascades through GRN \u2014", options: { breakLine: true } },
  { text: "into generative modeling via cascaded flow matching,", options: { breakLine: true } },
  { text: "forcing the model to ", options: {} },
  { text: "\"understand regulatory rewiring", options: { bold: true } },
  { text: "", options: { breakLine: true } },
  { text: "before predicting expression changes.\"", options: { bold: true } }
], {
  x: 1.0, y: 2.0, w: 8.0, h: 2.0,
  fontSize: 18, fontFace: BF, color: WHITE, align: "center", valign: "middle",
  paraSpaceAfter: 6
});
s14.addShape(pres.shapes.RECTANGLE, {
  x: 3.8, y: 4.3, w: 2.4, h: 0.035, fill: { color: BLUE }
});
s14.addText("Thank You", {
  x: 1, y: 4.5, w: 8, h: 0.5,
  fontSize: 20, fontFace: HF, color: TXT_LT, align: "center"
});

// ─── WRITE ───
pres.writeFile({ fileName: "/home/hp250092/ku50001222/qian/aivc/lfj/Report/PPT2/GRN_CCFM_presentation.pptx" })
  .then(() => console.log("SUCCESS: Presentation saved."))
  .catch(err => console.error("ERROR:", err));