Synpens in PPT presentation

Asking for Preferences
Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Searching Images

synapse structure neurotransmitter release diagram

Reading File
Finding Sources
Searching Images

neuromuscular junction action potential calcium vesicle exocytosis

Finding Sources
Finding Sources
Searching Images

types of neurotransmitter receptors ionotropic metabotropic GPCR

Reading File
Running Command

mkdir -p /home/daytona/workspace/synapses-ppt && ls /home/daytona/workspace/

Writing File

~/synapses-ppt/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ── Color palette (deep neural blue theme) ──────────────────────────────────
const C = {
  bg:       "0D1B2A",   // very dark navy
  bgAlt:    "112233",   // slightly lighter navy
  card:     "162944",   // card bg
  accent1:  "00C9FF",   // cyan/electric blue
  accent2:  "5EF08B",   // neon green
  accent3:  "FF6B6B",   // coral red
  accent4:  "FFD166",   // golden yellow
  white:    "FFFFFF",
  dim:      "A8B8CC",   // muted text
  divider:  "1E3A5F",
};

// ── Helper: fetch images as base64 ──────────────────────────────────────────
function fetchImages(urls) {
  const result = JSON.parse(
    execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js ${urls.map(u => `"${u}"`).join(" ")}`,
      { timeout: 60000 }
    ).toString()
  );
  return result;
}

// ── Fetch all images ─────────────────────────────────────────────────────────
console.log("Fetching images...");
const imageUrls = [
  // Chemical synapse diagram (Guyton)
  "https://cdn.orris.care/cdss_images/02d51cd5433e3d8ef65b099b45f61dc0fbc1b873b22c8d59c3b62134a395c5c1.png",
  // Electrical synapse diagram (Guyton)
  "https://cdn.orris.care/cdss_images/3cba5399f99a83a39d5b46fe2f71d1a1d5748b93b5dd1886b25f8b55a5dbfcca.png",
  // Neuromuscular junction / SNARE proteins (Harrison's)
  "https://cdn.orris.care/cdss_images/HARRISON_1763032040735_59abb461-0774-4953-b337-f7f815e726ff.png",
  // Synaptic architecture / ASD-related proteins (Harrison's)
  "https://cdn.orris.care/cdss_images/HARRISON_1763034773880_73b13bc1-052b-4f42-b604-ad937a5d8ded.png",
  // EPSP/IPSP postsynaptic potentials graph
  "https://cdn.orris.care/cdss_images/b9e4202b7690833ce6183b1d3b86e140bfae03bd11b5003bd664304bfe7bca01.png",
];

let imgs = [];
try {
  imgs = fetchImages(imageUrls);
  console.log("Images fetched:", imgs.map((i,idx) => `[${idx}] ${i.error ? "ERROR: "+i.error : "OK"}`).join(", "));
} catch(e) {
  console.error("Image fetch failed:", e.message);
  imgs = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

function imgData(idx) {
  return imgs[idx] && !imgs[idx].error ? imgs[idx].base64 : null;
}

// ── Initialize presentation ──────────────────────────────────────────────────
let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Synapses – Advanced Medical Neuroscience";
pres.author = "Medical Neuroscience Lecture";
pres.subject = "Synapse Structure, Function & Clinical Relevance";

// ── Utility: add slide background ───────────────────────────────────────────
function addBg(slide, color) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: color || C.bg },
    line: { type: "none" }
  });
}

function addAccentBar(slide, y, color, h) {
  slide.addShape(pres.ShapeType.rect, {
    x: 0, y: y, w: 10, h: h || 0.06,
    fill: { color: color || C.accent1 },
    line: { type: "none" }
  });
}

function addSlideBadge(slide, label, x, y, color) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w: 1.5, h: 0.3,
    fill: { color: color || C.accent1 },
    line: { type: "none" },
    rectRadius: 0.08
  });
  slide.addText(label.toUpperCase(), {
    x, y, w: 1.5, h: 0.3,
    fontSize: 7, bold: true, color: C.bg,
    align: "center", valign: "middle", margin: 0
  });
}

function sectionTag(slide, text, color) {
  addSlideBadge(slide, text, 8.2, 0.18, color || C.accent1);
}

// ── SLIDE 1: Title ───────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  // Top accent band
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 10, h: 1.1,
    fill: { color: C.accent1 },
    line: { type: "none" }
  });
  // Subtle grid lines for decoration
  for (let i = 0; i < 6; i++) {
    s.addShape(pres.ShapeType.line, {
      x: i * 1.8, y: 0, w: 0, h: 1.1,
      line: { color: C.bgAlt, width: 0.5 }
    });
  }
  // Title
  s.addText("SYNAPSES", {
    x: 0.5, y: 1.3, w: 9, h: 1.5,
    fontSize: 60, bold: true, color: C.white,
    align: "center", fontFace: "Calibri"
  });
  s.addText("Structure • Physiology • Pharmacology • Clinical Relevance", {
    x: 0.5, y: 2.9, w: 9, h: 0.55,
    fontSize: 16, color: C.accent1,
    align: "center", fontFace: "Calibri", italic: true
  });
  addAccentBar(s, 3.55, C.divider, 0.03);
  s.addText("Advanced Neuroscience  |  Medical & Nursing Students", {
    x: 0.5, y: 3.75, w: 9, h: 0.4,
    fontSize: 13, color: C.dim,
    align: "center", fontFace: "Calibri"
  });
  // Brain icon text
  s.addText("🧠", { x: 4.6, y: 4.3, w: 0.8, h: 0.6, fontSize: 32, align: "center" });
}

// ── SLIDE 2: Agenda ──────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent1, 0.08);
  s.addText("CONTENTS", {
    x: 0.5, y: 0.2, w: 9, h: 0.6,
    fontSize: 26, bold: true, color: C.accent1, fontFace: "Calibri"
  });
  addAccentBar(s, 0.88, C.divider, 0.03);

  const topics = [
    ["01", "Definition & Overview of Synapses", C.accent1],
    ["02", "Types of Synapses: Chemical vs Electrical", C.accent2],
    ["03", "Structure of the Chemical Synapse", C.accent4],
    ["04", "Synaptic Transmission – Step by Step", C.accent1],
    ["05", "SNARE Proteins & Vesicle Exocytosis", C.accent3],
    ["06", "Postsynaptic Potentials: EPSP & IPSP", C.accent2],
    ["07", "Neurotransmitters & Receptors", C.accent4],
    ["08", "Synaptic Plasticity (LTP & LTD)", C.accent1],
    ["09", "Clinical Relevance & Pharmacology", C.accent3],
  ];

  const col1 = topics.slice(0, 5);
  const col2 = topics.slice(5);

  col1.forEach(([num, title, col], i) => {
    const y = 1.1 + i * 0.76;
    s.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 0.45, h: 0.45, fill: { color: col }, line: { type: "none" } });
    s.addText(num, { x: 0.3, y, w: 0.45, h: 0.45, fontSize: 14, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addText(title, { x: 0.85, y: y + 0.02, w: 4.0, h: 0.42, fontSize: 13, color: C.white, valign: "middle", fontFace: "Calibri" });
  });

  col2.forEach(([num, title, col], i) => {
    const y = 1.1 + i * 0.76;
    s.addShape(pres.ShapeType.rect, { x: 5.2, y, w: 0.45, h: 0.45, fill: { color: col }, line: { type: "none" } });
    s.addText(num, { x: 5.2, y, w: 0.45, h: 0.45, fontSize: 14, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });
    s.addText(title, { x: 5.75, y: y + 0.02, w: 3.9, h: 0.42, fontSize: 13, color: C.white, valign: "middle", fontFace: "Calibri" });
  });
}

// ── SLIDE 3: Definition ──────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent1, 0.08);
  sectionTag(s, "Overview", C.accent1);

  s.addText("What is a Synapse?", {
    x: 0.5, y: 0.2, w: 7.5, h: 0.65,
    fontSize: 28, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Definition card
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.4, y: 1.05, w: 9.2, h: 1.25,
    fill: { color: C.card }, line: { color: C.accent1, width: 1.5 }, rectRadius: 0.12
  });
  s.addText([
    { text: "Definition: ", options: { bold: true, color: C.accent1 } },
    { text: "A synapse is a specialized junctional contact through which one neuron communicates with another neuron, or with an effector cell (muscle or gland). It has two sides — the ", options: { color: C.white } },
    { text: "presynaptic", options: { bold: true, color: C.accent2 } },
    { text: " terminal and the ", options: { color: C.white } },
    { text: "postsynaptic", options: { bold: true, color: C.accent3 } },
    { text: " membrane — separated by the synaptic cleft (~200–300 Å wide).", options: { color: C.white } },
  ], { x: 0.6, y: 1.1, w: 8.8, h: 1.15, fontSize: 14, valign: "middle", fontFace: "Calibri" });

  // Key facts in cards
  const facts = [
    ["10,000–200,000", "presynaptic terminals per motor neuron"],
    ["0.5 ms", "synaptic delay (AP to postsynaptic response)"],
    ["200–300 Å", "width of the synaptic cleft"],
    ["One-way", "information flow in chemical synapses"],
  ];
  facts.forEach(([val, label], i) => {
    const x = 0.3 + i * 2.38;
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 2.55, w: 2.2, h: 1.5,
      fill: { color: C.card }, line: { color: C.divider, width: 1 }, rectRadius: 0.1
    });
    s.addText(val, { x, y: 2.65, w: 2.2, h: 0.65, fontSize: 19, bold: true, color: C.accent1, align: "center", fontFace: "Calibri" });
    s.addText(label, { x, y: 3.3, w: 2.2, h: 0.6, fontSize: 11, color: C.dim, align: "center", fontFace: "Calibri" });
  });

  s.addText("Source: Guyton & Hall Textbook of Medical Physiology; Neuroscience: Exploring the Brain, 5th Ed.", {
    x: 0.5, y: 5.2, w: 9, h: 0.3, fontSize: 8, color: C.dim, fontFace: "Calibri", italic: true
  });
}

// ── SLIDE 4: Types of Synapses ───────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent2, 0.08);
  sectionTag(s, "Types", C.accent2);

  s.addText("Chemical vs. Electrical Synapses", {
    x: 0.5, y: 0.2, w: 7.5, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Two panels
  const panels = [
    {
      title: "Chemical Synapse",
      color: C.accent1,
      imgIdx: 0,
      points: [
        "Presynaptic terminal + synaptic cleft + postsynaptic membrane",
        "Neurotransmitter stored in synaptic vesicles",
        "Unidirectional signal transmission",
        "Synaptic delay ~0.5 ms",
        "Most synapses in the brain are chemical",
        "Target: ionotropic or metabotropic receptors",
      ]
    },
    {
      title: "Electrical Synapse",
      color: C.accent2,
      imgIdx: 1,
      points: [
        "Connected by gap junctions (connexin proteins)",
        "Bidirectional signal transmission",
        "No synaptic delay — nearly instantaneous",
        "Allows synchronous firing of neuron groups",
        "Important in hypothalamic hormone-secreting neurons",
        "Less amenable to pharmacological modulation",
      ]
    }
  ];

  panels.forEach((p, pi) => {
    const x = pi === 0 ? 0.25 : 5.15;
    const w = 4.6;
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 1.0, w, h: 4.45,
      fill: { color: C.card }, line: { color: p.color, width: 1.5 }, rectRadius: 0.1
    });
    // Header
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 1.0, w, h: 0.45,
      fill: { color: p.color }, line: { type: "none" }, rectRadius: 0.05
    });
    s.addText(p.title, {
      x, y: 1.0, w, h: 0.45,
      fontSize: 14, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri"
    });
    // Image
    const imgD = imgData(p.imgIdx);
    if (imgD) {
      s.addImage({ data: imgD, x: x + 0.2, y: 1.52, w: w - 0.4, h: 1.3, sizing: { type: "contain", w: w - 0.4, h: 1.3 } });
    }
    // Bullets
    p.points.forEach((pt, bi) => {
      s.addText([
        { text: "▸ ", options: { color: p.color, bold: true } },
        { text: pt, options: { color: C.white } }
      ], { x: x + 0.15, y: 2.9 + bi * 0.41, w: w - 0.3, h: 0.38, fontSize: 11, fontFace: "Calibri" });
    });
  });
}

// ── SLIDE 5: Chemical Synapse Structure ──────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent4, 0.08);
  sectionTag(s, "Structure", C.accent4);

  s.addText("Anatomy of the Chemical Synapse", {
    x: 0.5, y: 0.2, w: 7.5, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Left: diagram
  const imgD = imgData(0);
  if (imgD) {
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.25, y: 1.0, w: 4.7, h: 4.4,
      fill: { color: C.card }, line: { color: C.accent4, width: 1 }, rectRadius: 0.1
    });
    s.addImage({ data: imgD, x: 0.4, y: 1.1, w: 4.4, h: 3.3, sizing: { type: "contain", w: 4.4, h: 3.3 } });
    s.addText("Fig. Chemical synapse anatomy — Guyton & Hall", {
      x: 0.4, y: 4.35, w: 4.4, h: 0.3, fontSize: 8, color: C.dim, align: "center", fontFace: "Calibri", italic: true
    });
  }

  // Right: labelled components
  const components = [
    ["Presynaptic Terminal", "Axon bouton containing vesicles & mitochondria", C.accent1],
    ["Synaptic Vesicles", "Storage organelles for neurotransmitter molecules", C.accent4],
    ["Mitochondria", "Provide ATP for NT synthesis & active transport", C.accent2],
    ["Synaptic Cleft", "Gap of 200–300 Å between membranes", C.accent3],
    ["Postsynaptic Membrane", "Contains ionotropic or metabotropic receptors", C.accent1],
    ["Active Zones", "Docking sites on presynaptic membrane with Ca²⁺ channels", C.accent2],
  ];
  components.forEach(([name, desc, col], i) => {
    const y = 1.0 + i * 0.74;
    s.addShape(pres.ShapeType.rect, {
      x: 5.15, y, w: 0.08, h: 0.5,
      fill: { color: col }, line: { type: "none" }
    });
    s.addText(name, { x: 5.3, y, w: 4.4, h: 0.28, fontSize: 12, bold: true, color: col, fontFace: "Calibri" });
    s.addText(desc, { x: 5.3, y: y + 0.28, w: 4.4, h: 0.35, fontSize: 10, color: C.dim, fontFace: "Calibri" });
  });
}

// ── SLIDE 6: Synaptic Transmission Steps ─────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent1, 0.08);
  sectionTag(s, "Transmission", C.accent1);

  s.addText("Synaptic Transmission — Step by Step", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  const steps = [
    ["1", "Action Potential Arrival", "AP travels down the presynaptic axon and reaches the terminal bouton", C.accent1],
    ["2", "Voltage-Gated Ca²⁺ Channels Open", "Depolarization opens Ca²⁺ channels in active zones of presynaptic membrane", C.accent4],
    ["3", "Ca²⁺ Influx Triggers Exocytosis", "Ca²⁺ binds synaptotagmin → trans-SNARE complex forms → vesicle fusion", C.accent2],
    ["4", "Neurotransmitter Release", "NT molecules flood the synaptic cleft (~200–300 Å gap)", C.accent3],
    ["5", "Receptor Binding", "NT binds postsynaptic receptors → ion channel gating or 2nd messenger activation", C.accent1],
    ["6", "Termination", "NT removed by: reuptake, enzymatic degradation (e.g. AChE), or diffusion", C.accent4],
  ];

  steps.forEach(([num, title, desc, col], i) => {
    const col2 = i < 3 ? 0.3 : 5.2;
    const row = i < 3 ? i : i - 3;
    const y = 1.0 + row * 1.45;
    const w = 4.5;

    s.addShape(pres.ShapeType.roundRect, {
      x: col2, y, w, h: 1.3,
      fill: { color: C.card }, line: { color: col, width: 1.2 }, rectRadius: 0.1
    });
    // Number badge
    s.addShape(pres.ShapeType.ellipse, {
      x: col2 + 0.15, y: y + 0.35, w: 0.55, h: 0.55,
      fill: { color: col }, line: { type: "none" }
    });
    s.addText(num, {
      x: col2 + 0.15, y: y + 0.35, w: 0.55, h: 0.55,
      fontSize: 15, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri"
    });
    s.addText(title, { x: col2 + 0.82, y: y + 0.12, w: w - 1.0, h: 0.4, fontSize: 12, bold: true, color: col, fontFace: "Calibri" });
    s.addText(desc, { x: col2 + 0.82, y: y + 0.52, w: w - 1.0, h: 0.65, fontSize: 10.5, color: C.dim, fontFace: "Calibri" });
  });
}

// ── SLIDE 7: SNARE Proteins ──────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent3, 0.08);
  sectionTag(s, "SNARE / Vesicles", C.accent3);

  s.addText("SNARE Proteins & Vesicle Exocytosis", {
    x: 0.5, y: 0.2, w: 7.5, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Image
  const imgD = imgData(2);
  if (imgD) {
    s.addShape(pres.ShapeType.roundRect, {
      x: 5.2, y: 0.98, w: 4.55, h: 4.4,
      fill: { color: C.card }, line: { color: C.accent3, width: 1 }, rectRadius: 0.1
    });
    s.addImage({ data: imgD, x: 5.35, y: 1.1, w: 4.25, h: 3.3, sizing: { type: "contain", w: 4.25, h: 3.3 } });
    s.addText("SNARE-mediated vesicle fusion at NMJ — Harrison's Internal Medicine", {
      x: 5.3, y: 4.35, w: 4.4, h: 0.3, fontSize: 7.5, color: C.dim, align: "center", fontFace: "Calibri", italic: true
    });
  }

  // SNARE proteins detail
  const snares = [
    ["Synaptobrevin (v-SNARE)", "Vesicle-bound; binds t-SNAREs on terminal membrane", C.accent1],
    ["Syntaxin (t-SNARE)", "Target membrane protein; anchors vesicle to active zone", C.accent4],
    ["SNAP-25 (t-SNARE)", "Second target-SNARE; completes the trans-SNARE complex", C.accent2],
    ["Synaptotagmin", "Ca²⁺ sensor protein; triggers fusion upon Ca²⁺ binding", C.accent3],
  ];

  s.addText("The SNARE Complex", { x: 0.3, y: 1.0, w: 4.7, h: 0.4, fontSize: 14, bold: true, color: C.accent3, fontFace: "Calibri" });

  snares.forEach(([name, desc, col], i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y: 1.5 + i * 0.82, w: 4.65, h: 0.7,
      fill: { color: C.card }, line: { color: col, width: 1 }, rectRadius: 0.08
    });
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.5 + i * 0.82, w: 0.08, h: 0.7, fill: { color: col }, line: { type: "none" } });
    s.addText(name, { x: 0.5, y: 1.52 + i * 0.82, w: 4.3, h: 0.28, fontSize: 11.5, bold: true, color: col, fontFace: "Calibri" });
    s.addText(desc, { x: 0.5, y: 1.8 + i * 0.82, w: 4.3, h: 0.3, fontSize: 10, color: C.dim, fontFace: "Calibri" });
  });

  // Clinical note: botulinum toxin
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.3, y: 4.78, w: 4.65, h: 0.65,
    fill: { color: "2A0A0A" }, line: { color: C.accent3, width: 1.5 }, rectRadius: 0.08
  });
  s.addText([
    { text: "⚠ Clinical Pearl: ", options: { bold: true, color: C.accent3 } },
    { text: "Botulinum toxin cleaves SNARE proteins (SNAP-25, synaptobrevin, syntaxin), blocking NT release at the NMJ → flaccid paralysis.", options: { color: C.white } }
  ], { x: 0.45, y: 4.82, w: 4.35, h: 0.56, fontSize: 10.5, fontFace: "Calibri" });
}

// ── SLIDE 8: EPSP & IPSP ─────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent2, 0.08);
  sectionTag(s, "Potentials", C.accent2);

  s.addText("Postsynaptic Potentials: EPSP & IPSP", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Graph image
  const imgD = imgData(4);
  if (imgD) {
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y: 0.98, w: 4.6, h: 4.45,
      fill: { color: C.card }, line: { color: C.accent2, width: 1 }, rectRadius: 0.1
    });
    s.addImage({ data: imgD, x: 0.45, y: 1.1, w: 4.3, h: 3.2, sizing: { type: "contain", w: 4.3, h: 3.2 } });
    s.addText("EPSP/IPSP generation & summation — Katzung's Pharmacology 16e", {
      x: 0.4, y: 4.35, w: 4.5, h: 0.3, fontSize: 7.5, color: C.dim, align: "center", fontFace: "Calibri", italic: true
    });
  }

  // Right: explanation
  const items = [
    {
      title: "EPSP (Excitatory Postsynaptic Potential)",
      color: C.accent1,
      points: [
        "Caused by influx of Na⁺ (or Ca²⁺) → membrane depolarization",
        "Ionotropic receptors: direct channel opening",
        "Spatial summation: multiple EPSPs add up",
        "Temporal summation: rapid successive EPSPs sum",
        "If membrane reaches threshold → Action Potential fires"
      ]
    },
    {
      title: "IPSP (Inhibitory Postsynaptic Potential)",
      color: C.accent3,
      points: [
        "Caused by K⁺ efflux or Cl⁻ influx → hyperpolarization",
        "Mediated by GABA (via Cl⁻ channels) or glycine",
        "Moves membrane potential away from threshold",
        "Prevents action potential generation",
        "IPSP can counteract a suprathreshold excitatory stimulus"
      ]
    }
  ];

  let ry = 1.0;
  items.forEach(item => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 5.15, y: ry, w: 4.6, h: 0.38,
      fill: { color: item.color }, line: { type: "none" }, rectRadius: 0.06
    });
    s.addText(item.title, {
      x: 5.15, y: ry, w: 4.6, h: 0.38,
      fontSize: 11, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri"
    });
    ry += 0.42;
    item.points.forEach(pt => {
      s.addText([
        { text: "• ", options: { color: item.color, bold: true } },
        { text: pt, options: { color: C.white } }
      ], { x: 5.3, y: ry, w: 4.3, h: 0.36, fontSize: 10.5, fontFace: "Calibri" });
      ry += 0.38;
    });
    ry += 0.1;
  });
}

// ── SLIDE 9: Neurotransmitters & Receptors ───────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent4, 0.08);
  sectionTag(s, "NT & Receptors", C.accent4);

  s.addText("Neurotransmitters & Receptor Types", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Receptor type comparison: ionotropic vs metabotropic
  const receptorCols = [
    {
      label: "Ionotropic Receptors",
      subtitle: "(Ligand-Gated Ion Channels)",
      color: C.accent1,
      items: [
        "Direct ion channel opening on ligand binding",
        "Fast response (ms timescale)",
        "Examples: AMPA, NMDA, GABA_A, nAChR, GlyR",
        "Ion flux: Na⁺, K⁺, Ca²⁺, or Cl⁻",
        "Involved in: EPSP (cations) and IPSP (Cl⁻)",
        "Pharmacology: benzodiazepines (GABA_A allosteric modulator)"
      ]
    },
    {
      label: "Metabotropic Receptors",
      subtitle: "(G-Protein Coupled Receptors)",
      color: C.accent4,
      items: [
        "Indirect — activate G proteins & 2nd messengers",
        "Slow response (seconds to minutes)",
        "Examples: mGluR, GABA_B, mAChR, dopamine, serotonin",
        "2nd messengers: cAMP, IP3/DAG, Ca²⁺",
        "Modulate neuronal excitability & gene expression",
        "Pharmacology: opioids, antipsychotics, antidepressants"
      ]
    }
  ];

  receptorCols.forEach((rc, i) => {
    const x = i === 0 ? 0.25 : 5.15;
    const w = 4.6;
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 1.0, w, h: 4.45,
      fill: { color: C.card }, line: { color: rc.color, width: 1.5 }, rectRadius: 0.1
    });
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.0, w, h: 0.7, fill: { color: rc.color }, line: { type: "none" }, rectRadius: 0.05 });
    s.addText(rc.label, { x, y: 1.02, w, h: 0.38, fontSize: 13, bold: true, color: C.bg, align: "center", fontFace: "Calibri" });
    s.addText(rc.subtitle, { x, y: 1.38, w, h: 0.28, fontSize: 10, color: C.bg, align: "center", fontFace: "Calibri", italic: true });
    rc.items.forEach((item, bi) => {
      s.addText([
        { text: "▸ ", options: { color: rc.color, bold: true } },
        { text: item, options: { color: C.white } }
      ], { x: x + 0.15, y: 1.76 + bi * 0.44, w: w - 0.3, h: 0.42, fontSize: 11, fontFace: "Calibri" });
    });
  });

  // Key NTs table at bottom
  s.addText("Key Neurotransmitters: Glutamate (excitatory, most common CNS) • GABA (inhibitory, most common CNS) • Acetylcholine (NMJ, autonomic) • Dopamine • Serotonin • Norepinephrine", {
    x: 0.3, y: 5.15, w: 9.4, h: 0.35, fontSize: 9.5, color: C.dim, fontFace: "Calibri", italic: true
  });
}

// ── SLIDE 10: Synaptic Plasticity ────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent1, 0.08);
  sectionTag(s, "Plasticity", C.accent1);

  s.addText("Synaptic Plasticity: LTP & LTD", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // LTP card
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.3, y: 1.0, w: 4.6, h: 4.45,
    fill: { color: C.card }, line: { color: C.accent2, width: 1.5 }, rectRadius: 0.1
  });
  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.0, w: 4.6, h: 0.42, fill: { color: C.accent2 }, line: { type: "none" }, rectRadius: 0.05 });
  s.addText("Long-Term Potentiation (LTP)", { x: 0.3, y: 1.0, w: 4.6, h: 0.42, fontSize: 13, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });

  const ltpPoints = [
    "Sustained increase in synaptic strength",
    "Induced by high-frequency stimulation of glutamate synapses",
    "Requires NMDA receptor activation (coincidence detector)",
    "NMDA receptor needs: glutamate binding + Mg²⁺ block removal (depolarization)",
    "Ca²⁺ entry via NMDA → activates CaMKII → AMPA receptor phosphorylation",
    "Additional AMPA receptors inserted into postsynaptic membrane",
    "Basis of memory formation and learning (Hebb's rule)",
  ];
  ltpPoints.forEach((pt, i) => {
    s.addText([
      { text: "● ", options: { color: C.accent2, bold: true } },
      { text: pt, options: { color: C.white } }
    ], { x: 0.45, y: 1.5 + i * 0.42, w: 4.3, h: 0.4, fontSize: 10.5, fontFace: "Calibri" });
  });

  // LTD card
  s.addShape(pres.ShapeType.roundRect, {
    x: 5.1, y: 1.0, w: 4.6, h: 4.45,
    fill: { color: C.card }, line: { color: C.accent3, width: 1.5 }, rectRadius: 0.1
  });
  s.addShape(pres.ShapeType.roundRect, { x: 5.1, y: 1.0, w: 4.6, h: 0.42, fill: { color: C.accent3 }, line: { type: "none" }, rectRadius: 0.05 });
  s.addText("Long-Term Depression (LTD)", { x: 5.1, y: 1.0, w: 4.6, h: 0.42, fontSize: 13, bold: true, color: C.bg, align: "center", valign: "middle", margin: 0, fontFace: "Calibri" });

  const ltdPoints = [
    "Sustained decrease in synaptic efficacy",
    "Induced by low-frequency prolonged stimulation",
    "Requires NMDA receptor activation (moderate Ca²⁺ rise)",
    "Activates phosphatases (PP1, calcineurin) → AMPA receptor dephosphorylation",
    "AMPA receptors endocytosed from postsynaptic membrane",
    "Counterbalances LTP → prevents saturation of synapses",
    "Involved in motor learning (cerebellum) and fear extinction",
  ];
  ltdPoints.forEach((pt, i) => {
    s.addText([
      { text: "● ", options: { color: C.accent3, bold: true } },
      { text: pt, options: { color: C.white } }
    ], { x: 5.25, y: 1.5 + i * 0.42, w: 4.3, h: 0.4, fontSize: 10.5, fontFace: "Calibri" });
  });
}

// ── SLIDE 11: Clinical Relevance ─────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent3, 0.08);
  sectionTag(s, "Clinical", C.accent3);

  s.addText("Clinical Relevance & Pharmacology", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  const clinicalItems = [
    {
      condition: "Myasthenia Gravis",
      mechanism: "Autoantibodies against nAChR at NMJ → reduced EPSP amplitude → fatigable weakness",
      drug: "Pyridostigmine (AChE inhibitor) — extends ACh dwell time in cleft",
      color: C.accent3,
    },
    {
      condition: "Alzheimer's Disease",
      mechanism: "Loss of cholinergic synapses in hippocampus & cortex; Aβ plaques disrupt synaptic function",
      drug: "Donepezil, rivastigmine (AChE inhibitors); memantine (NMDA antagonist)",
      color: C.accent1,
    },
    {
      condition: "Parkinson's Disease",
      mechanism: "Loss of dopaminergic neurons in substantia nigra → reduced DA at striatal synapses",
      drug: "Levodopa/carbidopa; dopamine agonists (pramipexole); MAO-B inhibitors",
      color: C.accent4,
    },
    {
      condition: "Epilepsy",
      mechanism: "Imbalance of excitatory (glutamate) vs inhibitory (GABA) synaptic activity",
      drug: "Benzodiazepines & barbiturates (GABA_A potentiation); phenytoin (Na⁺ channel block)",
      color: C.accent2,
    },
    {
      condition: "Depression / Anxiety",
      mechanism: "Reduced serotonergic & noradrenergic synaptic transmission",
      drug: "SSRIs (block serotonin reuptake); SNRIs; TCAs; MAOIs",
      color: C.accent4,
    },
    {
      condition: "Botulism / Tetanus",
      mechanism: "Botulinum toxin cleaves SNAREs → blocks ACh release. Tetanospasmin blocks GABA/glycine release",
      drug: "Antitoxin; supportive care; mechanical ventilation",
      color: C.accent3,
    },
  ];

  const colW = 4.55;
  clinicalItems.forEach((item, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = col === 0 ? 0.25 : 5.1;
    const y = 1.02 + row * 1.5;

    s.addShape(pres.ShapeType.roundRect, {
      x, y, w: colW, h: 1.38,
      fill: { color: C.card }, line: { color: item.color, width: 1.2 }, rectRadius: 0.08
    });
    s.addShape(pres.ShapeType.rect, { x, y, w: 0.08, h: 1.38, fill: { color: item.color }, line: { type: "none" } });
    s.addText(item.condition, { x: x + 0.18, y: y + 0.05, w: colW - 0.25, h: 0.3, fontSize: 12.5, bold: true, color: item.color, fontFace: "Calibri" });
    s.addText(item.mechanism, { x: x + 0.18, y: y + 0.35, w: colW - 0.25, h: 0.5, fontSize: 9.5, color: C.dim, fontFace: "Calibri" });
    s.addText([
      { text: "Rx: ", options: { bold: true, color: C.accent2 } },
      { text: item.drug, options: { color: C.white } }
    ], { x: x + 0.18, y: y + 0.88, w: colW - 0.25, h: 0.42, fontSize: 9.5, fontFace: "Calibri" });
  });
}

// ── SLIDE 12: Synaptic Architecture & ASD ────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent4, 0.08);
  sectionTag(s, "Molecular", C.accent4);

  s.addText("Molecular Architecture of the Synapse", {
    x: 0.5, y: 0.2, w: 8, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  // Big image
  const imgD = imgData(3);
  if (imgD) {
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y: 0.98, w: 5.5, h: 4.45,
      fill: { color: C.card }, line: { color: C.accent4, width: 1 }, rectRadius: 0.1
    });
    s.addImage({ data: imgD, x: 0.45, y: 1.1, w: 5.2, h: 3.3, sizing: { type: "contain", w: 5.2, h: 3.3 } });
    s.addText("Synaptic protein architecture linked to neurodevelopmental disorders — Harrison's Internal Medicine", {
      x: 0.4, y: 4.35, w: 5.4, h: 0.3, fontSize: 7.5, color: C.dim, align: "center", fontFace: "Calibri", italic: true
    });
  }

  // Right: key proteins
  s.addText("Key Synaptic Proteins", { x: 6.1, y: 1.0, w: 3.6, h: 0.38, fontSize: 14, bold: true, color: C.accent4, fontFace: "Calibri" });

  const proteins = [
    ["Neuroligin / Neurexin", "Trans-synaptic cell adhesion molecules; mutations linked to autism & schizophrenia", C.accent1],
    ["PSD-95", "Major scaffolding protein of the post-synaptic density; anchors NMDA receptors", C.accent4],
    ["Shank / Homer", "Scaffolding proteins linking mGluR to PSD-95; SHANK3 mutations → Phelan-McDermid syndrome", C.accent2],
    ["VGLUT / VGAT", "Vesicular glutamate / GABA transporters; fill vesicles with NT prior to release", C.accent3],
    ["NRXN1 / CNTNAP2", "Neurexin superfamily; critical for synapse development; ASD risk genes", C.accent1],
  ];
  proteins.forEach(([name, desc, col], i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 6.05, y: 1.48 + i * 0.75, w: 3.7, h: 0.68,
      fill: { color: C.card }, line: { color: col, width: 1 }, rectRadius: 0.07
    });
    s.addShape(pres.ShapeType.rect, { x: 6.05, y: 1.48 + i * 0.75, w: 0.07, h: 0.68, fill: { color: col }, line: { type: "none" } });
    s.addText(name, { x: 6.18, y: 1.5 + i * 0.75, w: 3.5, h: 0.26, fontSize: 11, bold: true, color: col, fontFace: "Calibri" });
    s.addText(desc, { x: 6.18, y: 1.76 + i * 0.75, w: 3.5, h: 0.35, fontSize: 9, color: C.dim, fontFace: "Calibri" });
  });
}

// ── SLIDE 13: Summary ────────────────────────────────────────────────────────
{
  let s = pres.addSlide();
  addBg(s);
  addAccentBar(s, 0, C.accent1, 0.08);

  s.addText("Key Takeaways", {
    x: 0.5, y: 0.2, w: 9, h: 0.65,
    fontSize: 28, bold: true, color: C.accent1, align: "center", fontFace: "Calibri"
  });
  addAccentBar(s, 0.9, C.divider, 0.03);

  const takeaways = [
    ["Synapses", "Specialized junctions enabling directed, one-way (chemical) or bidirectional (electrical) neurotransmission", C.accent1],
    ["Chemical Transmission", "Electrical → Chemical → Electrical: AP triggers Ca²⁺ influx → SNARE-mediated vesicle fusion → NT release → postsynaptic receptor activation", C.accent4],
    ["EPSP vs IPSP", "EPSPs (Na⁺/Ca²⁺ influx, depolarization) and IPSPs (Cl⁻ influx or K⁺ efflux, hyperpolarization) sum spatially and temporally to determine whether an action potential fires", C.accent2],
    ["Receptor Types", "Ionotropic (fast, direct ion gating) vs metabotropic (slow, G-protein/2nd messenger) — critical pharmacology targets", C.accent4],
    ["LTP/LTD", "NMDA receptor-dependent plasticity underlies learning, memory, and addiction; LTP = potentiation, LTD = depression of synaptic strength", C.accent1],
    ["Clinical Relevance", "Synaptic dysfunction underlies MG, AD, PD, epilepsy, depression & other disorders — most CNS drugs target synaptic components", C.accent3],
  ];

  takeaways.forEach(([title, body, col], i) => {
    const x = i < 3 ? 0.3 : 5.15;
    const y = 1.05 + (i % 3) * 1.45;
    s.addShape(pres.ShapeType.roundRect, {
      x, y, w: 4.6, h: 1.35,
      fill: { color: C.card }, line: { color: col, width: 1.2 }, rectRadius: 0.1
    });
    s.addText(title, { x: x + 0.15, y: y + 0.06, w: 4.3, h: 0.35, fontSize: 12.5, bold: true, color: col, fontFace: "Calibri" });
    s.addText(body, { x: x + 0.15, y: y + 0.42, w: 4.3, h: 0.85, fontSize: 10, color: C.white, fontFace: "Calibri" });
  });
}

// ── Write file ───────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/synapses-ppt/Synapses_Medical_Presentation.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("SUCCESS: " + outPath);
}).catch(err => {
  console.error("FAILED:", err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/synapses-ppt && node build.js 2>&1

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.