Explain everything in detail cover all the points

Reading File
Running Command

ls -la /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/

The file has no extension. Let me check what type of file it is and try to read it.
Running Command

file /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/"DOC-20260711-WA0038." && xxd /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/"DOC-20260711-WA0038." | head -20

It's a PowerPoint file. Let me read the PPTX skill and then extract all content from it.
Reading File
Running Command

cp /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/"DOC-20260711-WA0038." /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/DOC-20260711-WA0038.pptx && python -m markitdown /home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/DOC-20260711-WA0038.pptx

Running Command

python3 -c " from pptx import Presentation prs = Presentation('/home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/DOC-20260711-WA0038.pptx') for i, slide in enumerate(prs.slides, 1): print(f'\\n===== SLIDE {i} =====') for shape in slide.shapes: if hasattr(shape, 'text') and shape.text.strip(): print(f'[{shape.shape_type}] {shape.name}: {shape.text}') if shape.has_table: print(f'TABLE in {shape.name}:') for row in shape.table.rows: for cell in row.cells: print(f' | {cell.text}', end='') print() "

Running Command

pip install --user python-pptx -q && python3 -c " from pptx import Presentation prs = Presentation('/home/daytona/workspace/attachments/40307a91-b508-4195-9d00-3afa72d74cc2/DOC-20260711-WA0038.pptx') print(f'Total slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): print(f'\\n===== SLIDE {i} =====') for shape in slide.shapes: if hasattr(shape, 'text') and shape.text.strip(): print(f'[{shape.name}]: {shape.text}') if hasattr(shape, 'has_table') and shape.has_table: print(f'TABLE in {shape.name}:') for row in shape.table.rows: row_text = ' | '.join(cell.text.strip() for cell in row.cells) print(f' {row_text}') "

Now I have all the content. This is a Lippincott's Biochemistry Chapter 19 presentation on "Amino Acids: Disposal of Nitrogen." Let me also check for any images in the slides and query the medical library for richer detail.
Finding Sources
Finding Sources
Reading File
I now have comprehensive content from both the presentation and the Lippincott textbook. Let me compile the full detailed explanation.

Amino Acids: Disposal of Nitrogen

Chapter 19 - Lippincott's Illustrated Reviews: Biochemistry


I. Overview of Amino Acid Catabolism

Unlike carbohydrates and fats, amino acids are not stored in the body. Any amino acids consumed in excess of the body's immediate needs are degraded rather than stored as protein reserves.
Amino acid catabolism proceeds in two phases:
  • Phase 1 - Nitrogen Removal: The α-amino group is removed, generating free ammonia (NH₃) and an α-keto acid. Ammonia is highly toxic, especially to the CNS, and must be quickly converted to a safe form - primarily urea - for excretion.
  • Phase 2 - Carbon Skeleton Fate: The remaining carbon skeletons (α-keto acids) enter central metabolic pathways and can be converted to CO₂ (via TCA), glucose (gluconeogenesis), lipids, or ketone bodies.

II. Nitrogen Metabolism & the Amino Acid Pool

A. The Amino Acid Pool

The body maintains a dynamic amino acid pool that is constantly turning over.
Pool is replenished by:
  • Digestion and absorption of dietary protein
  • Breakdown of endogenous (body) proteins
  • Synthesis of nonessential amino acids
Pool is depleted by:
  • Protein synthesis (structural, enzymatic, hormonal proteins)
  • Biosynthesis of nitrogen-containing compounds (purines, pyrimidines, heme, creatine, etc.)
  • Energy production - amino acids oxidized to CO₂, converted to glucose or fats
Nitrogen Balance: In healthy adults, nitrogen input equals nitrogen output (positive balance = growth/pregnancy; negative balance = starvation/illness).

B. Protein Turnover

The body degrades and resynthesizes approximately 300-400 g of protein daily. Turnover rates vary enormously:
  • Regulatory proteins (enzymes, transcription factors): short half-life (minutes to hours)
  • Structural proteins (collagen, muscle fibers): long half-life (days to years)

C. Protein Degradation Pathways

1. Ubiquitin-Proteasome System (ATP-dependent)
  • Proteins tagged with multiple ubiquitin molecules
  • Tagged protein fed into the proteasome barrel
  • Cleaved into amino acid fragments that are recycled
  • Highly selective - the N-terminal amino acid influences the half-life (N-end rule)
  • Proteins with PEST sequences (Pro, Glu, Ser, Thr-rich) are rapidly degraded
2. Lysosomal Degradation (ATP-independent)
  • Degrades extracellular and membrane proteins via acid hydrolases (cathepsins)
  • Autophagy channels cytoplasmic contents into lysosomes

III. Digestion of Dietary Proteins

Overview

  • ~70-100 g of protein are consumed daily
  • Proteins must be broken down to di-/tripeptides and free amino acids for absorption
  • Digestion involves coordinated action of stomach, pancreas, and small intestine enzymes

A. Gastric Digestion

  • HCl (secreted by parietal cells):
    • Denatures/unfolds proteins, exposing peptide bonds
    • Converts inactive pepsinogen → active pepsin (also autocatalytic at low pH)
  • Pepsin (secreted by chief cells):
    • Active only at low pH (~1-2)
    • An endopeptidase - cleaves internal peptide bonds, producing polypeptides and a few free amino acids
    • Preferentially cleaves next to aromatic/large hydrophobic residues

B. Pancreatic Digestion

In the small intestine, pancreatic juice delivers:
  • Endopeptidases: Trypsin, chymotrypsin, elastase (cleave internal bonds at specific residues)
  • Exopeptidases: Carboxypeptidases A and B (cleave from the C-terminus)
All pancreatic proteases are secreted as inactive zymogens to prevent autodigestion:
ZymogenActive EnzymeCleaves
TrypsinogenTrypsinAfter Arg, Lys
ChymotrypsinogenChymotrypsinAfter Phe, Tyr, Trp
ProelastaseElastaseAfter small neutral AAs
Zymogen Activation Cascade:
  1. Enteropeptidase (brush border enzyme of duodenum) cleaves trypsinogen → trypsin
  2. Trypsin then activates ALL other zymogens (amplification cascade)
  3. Hormonal control: Secretin stimulates bicarbonate release; CCK (cholecystokinin) triggers enzyme and bile release
Clinical Deficiencies:
  • Cystic Fibrosis / Pancreatitis: Impaired pancreatic secretion → incomplete digestion → steatorrhea and protein malnutrition
  • Celiac Disease: Gluten-induced immune damage to intestinal villi → malabsorption

C. Small Intestine Brush Border

  • Aminopeptidase (exopeptidase): cleaves amino acids from the N-terminus of oligopeptides, releasing free AAs and smaller peptides

D. Absorption

  • Free amino acids: Absorbed via Na⁺-coupled co-transport into enterocytes (secondary active transport)
  • Di- and tripeptides: Absorbed via H⁺-coupled transport (PepT1 transporter), then hydrolyzed by intracellular peptidases
  • Only free amino acids enter the portal circulation to reach the liver
  • Exception: Branched-chain amino acids (Val, Leu, Ile) largely bypass the liver and are taken up directly by muscle

IV. Transport of Amino Acids into Cells

  • Intracellular amino acid concentration is maintained higher than extracellular via active transport (ATP-dependent)
  • At least 7 transport systems exist with overlapping specificities
  • Shared transport systems are present in the small intestine AND renal proximal tubule
Genetic Disorders of Amino Acid Transport:
DisorderDefectConsequence
CystinuriaCOAL transport system (Cystine, Ornithine, Arginine, Lysine)These AAs lost in urine → kidney stones (cystine precipitates). Most common inherited AA transport disorder (1:7,000)
Hartnup DiseaseNeutral amino acid transport (especially tryptophan)Reduced tryptophan absorption → inadequate niacin synthesis → pellagra-like symptoms (dermatitis, diarrhea, dementia)

V. Removal of Nitrogen from Amino Acids

The α-amino group must be removed before the carbon skeleton can be oxidized. This is done in two sequential steps known as transdeamination (transamination + oxidative deamination).

A. Transamination - The Nitrogen Funnel

Mechanism:
  • Most amino acids donate their α-amino group to α-ketoglutarate
  • Products: Glutamate + corresponding α-keto acid
  • Catalyzed by aminotransferases (transaminases)
  • Glutamate becomes the central nitrogen collector of the body
Exceptions: Lysine and threonine do NOT undergo transamination.
Key Aminotransferases:
EnzymeReactionSignificance
ALT (Alanine aminotransferase)Alanine + α-KG ⇌ Pyruvate + GlutamateCollects nitrogen from alanine (Glucose-Alanine Cycle)
AST (Aspartate aminotransferase)Glutamate + OAA ⇌ Aspartate + α-KGAspartate supplies one nitrogen atom to the urea cycle

B. Mechanism of Aminotransferases

All aminotransferases require pyridoxal phosphate (PLP), derived from vitamin B6:
  • PLP is covalently bound to a lysine residue at the active site (Schiff base)
  • Step 1: Amino group transfers from amino acid → PLP → forms pyridoxamine phosphate (PMP) + α-keto acid
  • Step 2: PMP donates amino group to a new α-keto acid → new amino acid + regenerates PLP
The equilibrium constant is ~1, making the reaction fully reversible - it functions in both catabolism (post-meal) and synthesis (low dietary intake).
Clinical Significance of Plasma Aminotransferases:
  • Normally these enzymes are intracellular; only tiny amounts appear in blood from routine cell turnover
  • Elevated plasma ALT/AST = tissue damage/necrosis
ConditionElevates
Severe viral hepatitisBoth ALT and AST (ALT > AST typically)
Drug/toxin-induced liver injuryALT and AST
Circulatory collapse ("shock liver")Markedly elevated transaminases
Myocardial infarctionPrimarily AST (also troponin, CK-MB)
Muscle disorders (myopathies)AST and CK
Serial enzyme measurements help track the trajectory of liver damage.

VI. Oxidative Deamination

After transamination, glutamate carries most of the body's amino nitrogen. Glutamate dehydrogenase (GDH) releases this nitrogen as free ammonia.

Glutamate Dehydrogenase (GDH)

  • Location: Liver and kidney mitochondria
  • Reaction: Glutamate + NAD⁺ (or NADP⁺) → α-ketoglutarate + NH₃ + NADH (or NADPH)
  • Releases free NH₃ for urea synthesis
  • Provides α-ketoglutarate for TCA cycle entry
Dual coenzymes:
  • NAD⁺ → oxidative deamination (catabolism)
  • NADPH → reductive amination (anabolism)
Allosteric Regulation:
  • GTP inhibits (energy-rich state → suppress catabolism)
  • ADP activates (energy-poor state → increase amino acid degradation)

D-Amino Acid Oxidase (DAO)

  • FAD-dependent, located in peroxisomes
  • Metabolizes dietary D-amino acids (non-proteinogenic, mirror images of L-amino acids)
  • Products: α-keto acids + NH₃ + H₂O₂ (peroxide broken down by catalase)
  • Also degrades D-serine - linked to NMDA receptor modulation; altered DAO activity is implicated in schizophrenia risk

VII. Ammonia Transport to the Liver

Free NH₃ is neurotoxic at very low concentrations. Peripheral tissues package nitrogen into non-toxic carriers for transport to the liver.

1. Glutamine Transport (Most Tissues - brain, muscle, liver)

  • Glutamine synthetase (requires ATP): NH₃ + Glutamate → Glutamine (non-toxic, neutral)
  • Glutamine travels in the blood to the liver and kidneys
  • Glutaminase in the liver: Glutamine → Glutamate + NH₃ (released for urea synthesis)
  • In kidneys: NH₄⁺ is excreted to regulate acid-base balance

2. Alanine Transport - The Glucose-Alanine Cycle (Muscle-specific)

  • In muscle: Pyruvate + Glutamate → Alanine (via ALT) - packages nitrogen safely
  • Alanine is transported to the liver
  • In liver: Alanine → Pyruvate + Glutamate (via ALT, reversed)
  • Pyruvate → glucose via gluconeogenesis → returns to muscle
  • This cycle transfers nitrogen from muscle to liver while recycling carbon for energy

VIII. The Urea Cycle

Overview

  • Urea is the primary nitrogen disposal product in humans (~90% of urinary nitrogen)
  • Each urea molecule contains 2 nitrogen atoms:
    • 1 from free NH₃ (released by GDH from glutamate)
    • 1 from aspartate (donated via AST transamination)
  • Carbon and oxygen come from CO₂/HCO₃⁻
  • Site: Primarily in hepatocytes (both mitochondria and cytoplasm)
  • Excretion: Urea diffuses into blood → kidneys → urine

Steps of the Urea Cycle

Mitochondrial Reactions (Steps 1-2):
Step 1: Carbamoyl Phosphate Formation
  • Enzyme: Carbamoyl Phosphate Synthetase I (CPS I)
  • Substrates: NH₃ + CO₂/HCO₃⁻ + 2 ATP
  • Cofactor/Activator: N-acetylglutamate (NAG) - essential allosteric activator
  • Location: Mitochondrial matrix
  • This is the rate-limiting step of the urea cycle
Step 2: Citrulline Formation
  • Enzyme: Ornithine Transcarbamylase (OTC)
  • Carbamoyl phosphate + Ornithine → Citrulline + Pi
  • Citrulline exits the mitochondria via ornithine/citrulline antiporter
Cytosolic Reactions (Steps 3-5):
Step 3: Argininosuccinate Synthesis
  • Enzyme: Argininosuccinate Synthetase
  • Citrulline + Aspartate + ATP → Argininosuccinate + AMP + PPi
  • This step incorporates the second nitrogen (from aspartate)
  • Uses 1 ATP (but equivalent to 2 ATP because PPi is hydrolyzed)
Step 4: Argininosuccinate Cleavage
  • Enzyme: Argininosuccinate Lyase
  • Argininosuccinate → Arginine + Fumarate
  • Fumarate links the urea cycle to the TCA cycle (can be converted to malate → OAA → aspartate, regenerating the aspartate donor)
Step 5: Urea Formation - Regeneration of Ornithine
  • Enzyme: Arginase I (virtually exclusive to liver)
  • Arginine + H₂O → Urea + Ornithine
  • Ornithine re-enters the mitochondria to repeat the cycle
  • Arginase II in kidneys regulates arginine for nitric oxide synthesis (does NOT make urea)

Stoichiometry

Aspartate + NH₃ + CO₂ + 3 ATP + H₂O →
    Urea + Fumarate + 2 ADP + AMP + 2 Pi + PPi
  • 4 high-energy phosphate bonds consumed per urea molecule (3 ATP → 2 ADP + 1 AMP)
  • Reaction is irreversible (large negative ΔG)

Regulation of the Urea Cycle

  • Key enzyme: CPS I (rate-limiting)
  • N-acetylglutamate (NAG) is the essential allosteric activator of CPS I
    • NAG is synthesized by N-acetylglutamate synthase (NAGS) from Acetyl-CoA + Glutamate
    • Arginine activates NAGS → more NAG → more CPS I activity (positive feedback)
  • Cycle rate increases after a protein-rich meal (more substrate, more arginine, more NAG)
  • Long-term regulation: high-protein diet induces urea cycle enzyme synthesis

Fate of Urea

  • Diffuses from liver → bloodstream → kidneys → filtered and excreted in urine
  • ~25% diffuses into the intestine → gut bacteria urease converts urea → CO₂ + NH₃
  • NH₃ is partly lost in feces, partly reabsorbed into portal blood
  • In renal failure: elevated plasma urea drives more urea into gut → more bacterial NH₃ production → worsening hyperammonemia
  • Treatment: oral neomycin (antibiotic reduces gut bacteria → less NH₃ production)

IX. Metabolism of Ammonia

Sources of Ammonia

SourceMechanism
Amino acid catabolismTransdeamination (aminotransferase + GDH)
GlutamineGlutaminase in intestine/kidneys releases NH₃
Intestinal bacteriaUrease converts urea → NH₃
AminesMonoamine oxidase (MAO) deaminates biogenic amines
Purines/PyrimidinesDeamination during nucleotide catabolism

Normal Ammonia Levels

  • Normal plasma [NH₃]: 5-35 µmol/L
  • Ammonia at 1000 µmol/L = medical emergency
  • Predominantly transported as glutamine (non-toxic) and alanine

X. Hyperammonemia

CNS Effects of Ammonia Toxicity

NH₃ crosses the blood-brain barrier easily. Its toxicity is multi-factorial:
  • Depletes α-ketoglutarate (TCA cycle intermediate) → impairs brain energy production
  • Stimulates glutamine synthesis in astrocytes → astrocyte swelling → cerebral edema
  • Inhibits neuronal function
Symptoms (in order of severity): Tremors → Vomiting → Slurred speech → Asterixis (flapping tremor) → Confusion/Encephalopathy → Cerebral edema → Coma → Death

Types of Hyperammonemia

Acquired (most common, in adults):
  • Liver disease (hepatitis, cirrhosis): hepatocytes destroyed → impaired urea cycle
  • Portal-systemic shunting: blood bypasses liver → ammonia escapes urea cycle → accumulates in systemic circulation
Congenital (newborns):
  • Genetic deficiency of urea cycle enzymes
  • OTC (Ornithine Transcarbamylase) deficiency: Most common urea cycle disorder; X-linked; presents in male newborns in first weeks of life with hyperammonemia, vomiting, lethargy
  • All other urea cycle disorders follow autosomal recessive inheritance
  • Arginase deficiency: Milder than other urea cycle defects
  • Note: With urea cycle defects, arginine becomes an essential amino acid

Treatment of Hyperammonemia

StrategyDetails
Protein-restricted dietReduce nitrogen load; must provide adequate calories to prevent catabolism
Nitrogen scavengersPhenylbutyrate → converted to phenylacetate → conjugates with glutamine → phenylacetylglutamine excreted in urine (exports 2 N per molecule)
Sodium benzoateConjugates with glycine → hippurate excreted in urine (exports 1 N)
Oral antibiotics (neomycin)Reduce gut bacteria → less urease activity → less intestinal NH₃ production
LactuloseAcidifies colon → traps NH₄⁺, reduces absorption
Arginine/citrulline supplementationRestores urea cycle intermediate pool
Liver transplantDefinitive cure for genetic urea cycle disorders

Summary: Integration of Nitrogen Metabolism

Dietary Protein
    ↓ (digestion & absorption)
Amino Acid Pool
    ↓ (aminotransferases - PLP-dependent)
Glutamate (central nitrogen collector)
    ↓ (Glutamate Dehydrogenase)
NH₃ + α-KG
    ↓
Transport to liver (as Glutamine or Alanine)
    ↓
UREA CYCLE (liver mitochondria + cytoplasm)
    ↓
Urea → Kidney → Urine
Key EnzymeLocationCoenzymeClinical Relevance
Aminotransferases (ALT, AST)All tissuesPLP (Vit B6)Elevated in liver/muscle damage
Glutamate DehydrogenaseLiver/kidney mitoNAD⁺/NADP⁺Regulated by energy status (GTP/ADP)
CPS IMitochondriaNAG activatorRate-limiting step; congenital deficiency → hyperammonemia
OTCMitochondria-Most common urea cycle disorder (X-linked)
Arginase ILiver cytosol-Exclusively in liver; produces urea
Glutamine synthetaseMost tissuesATPNon-toxic ammonia transport

Make me to learn this in 15 mins cover all the points which you have given teach me everything without leaving any content

🧬 Amino Acids: Disposal of Nitrogen — 15-Minute Speed Learn

Read this like a story. Every concept flows into the next. No fluff, just the facts you need.

⏱️ MIN 1-2 — The Big Picture (The "Why")

One sentence to anchor everything:
The body cannot store excess amino acids, so it strips off the nitrogen (toxic as ammonia), converts it to urea, and burns the carbon skeletons for energy.
That's the whole chapter. Everything below is just the how.
Two-phase catabolism:
  • Phase 1 → Remove nitrogen → get NH₃ + α-keto acid
  • Phase 2 → Carbon skeleton → energy (TCA/glucose/ketones)
Nitrogen balance: In healthy adults, nitrogen IN = nitrogen OUT. Positive = growth. Negative = starvation/illness.

⏱️ MIN 2-3 — The Amino Acid Pool & Protein Turnover

Think of a pool that is constantly filled and drained:
Fills the poolDrains the pool
Dietary proteinProtein synthesis
Body protein breakdownN-containing compounds (purines, heme)
Synthesis of nonessential AAsEnergy production (oxidized)
Key fact: Body breaks down and rebuilds 300-400 g protein DAILY.
Why degrade proteins at all?
  • Regulatory proteins (enzymes, transcription factors) = short-lived (minutes-hours)
  • Structural proteins (collagen) = long-lived (days-years)
Two degradation systems:
SystemEnergyDegrades
Ubiquitin-ProteasomeATP-dependentIntracellular proteins; PEST sequences = fast degradation
LysosomalATP-independentExtracellular/membrane proteins via acid hydrolases
Memory hook: Ubiquitin = "you-be-quit-in" → protein gets tagged, then eliminated.

⏱️ MIN 3-5 — Protein Digestion (Stomach → Pancreas → Intestine)

Think of it as a 3-station production line:

Station 1 - Stomach

  • HCl (parietal cells): denatures protein + activates pepsinogen
  • Pepsin (chief cells): active at low pH; endopeptidase; cleaves large proteins into polypeptides

Station 2 - Pancreas (in small intestine)

All enzymes secreted as inactive ZYMOGENS (to prevent autodigestion):
ZymogenActive enzymeCleaves next to
TrypsinogenTrypsinArg, Lys
ChymotrypsinogenChymotrypsinPhe, Tyr, Trp
ProelastaseElastaseSmall neutral AAs
Activation cascade - the most important point here:
  1. Enteropeptidase (brush border enzyme) → activates trypsinogen → trypsin
  2. Trypsin activates ALL other zymogens
  3. Hormones: CCK triggers enzyme release; Secretin triggers bicarbonate
Clinical links:
  • CF / Pancreatitis → no zymogens → steatorrhea + protein loss
  • Celiac disease → gluten damages villi → malabsorption

Station 3 - Brush Border

  • Aminopeptidase (exopeptidase) → clips N-terminal amino acids off oligopeptides

Absorption

  • Free AAs → Na⁺-linked transport
  • Di/tripeptides → H⁺-linked (PepT1) → hydrolyzed inside enterocyte
  • All exit as free AAs into portal blood
  • Exception: Branched-chain AAs (Val, Leu, Ile) bypass liver → go to muscle

⏱️ MIN 5-6 — Amino Acid Transport into Cells + Genetic Disorders

  • Intracellular [AA] > extracellular [AA] → active transport required (7 systems)
  • Same transport systems in intestine AND renal tubule → defects = malabsorption + amino acid in urine (aminoaciduria)
Two must-know disorders:
DisorderDefectProblemResult
CystinuriaCOAL system (Cystine, Ornithine, Arginine, Lysine)Can't reabsorb these in kidneyKidney stones (cystine precipitates). Most common AA transport disorder 1:7,000
Hartnup DiseaseNeutral AA transport (esp. tryptophan)Can't absorb tryptophan → less niacinPellagra-like: dermatitis, diarrhea, dementia

⏱️ MIN 6-8 — Removing Nitrogen: Transamination + Oxidative Deamination

This is the core chemistry of the chapter. Two sequential reactions = transdeamination.

Step 1 - Transamination (Nitrogen funnel → Glutamate)

Most AAs dump their nitrogen onto α-ketoglutarate → making Glutamate
  • Enzyme: Aminotransferases (transaminases)
  • Coenzyme: PLP (pyridoxal phosphate) from Vitamin B6 - covalently bound to lysine at active site
  • Equilibrium ~1 → fully reversible (works in catabolism AND anabolism)
  • Exceptions: Lysine and Threonine do NOT transaminate
Two key aminotransferases:
EnzymeReactionWhy important
ALTAlanine + α-KG ⇌ Pyruvate + GlutamateGlucose-Alanine Cycle; liver marker
ASTGlutamate + OAA ⇌ Aspartate + α-KGAspartate feeds 2nd N into urea cycle
Clinical: Elevated ALT/AST = cell damage
  • Viral hepatitis, drug toxicity, cirrhosis → elevated ALT, AST
  • MI → elevated AST (+ troponin, CK-MB)
  • Serial measurements track liver damage progression

Step 2 - Oxidative Deamination (Free NH₃ released)

Glutamate → α-ketoglutarate + free NH₃
  • Enzyme: Glutamate Dehydrogenase (GDH) - liver/kidney mitochondria
  • NAD⁺ for deamination (catabolism); NADP⁺ for reductive amination (anabolism)
Allosteric regulation of GDH:
  • GTP → INHIBITS (energy full - stop degrading AAs)
  • ADP → ACTIVATES (energy low - degrade AAs for fuel)
Bonus enzyme - D-Amino Acid Oxidase (DAO):
  • FAD-dependent, in peroxisomes
  • Oxidizes dietary D-amino acids → α-keto acid + NH₃ + H₂O₂
  • Also degrades D-serine → linked to NMDA receptor modulation and schizophrenia

⏱️ MIN 8-9 — Transporting Ammonia to the Liver

Free NH₃ is toxic → must be packaged for safe transport.
Two carrier molecules:

1. Glutamine (Most tissues - brain, muscle, liver)

NH₃ + Glutamate → Glutamine  [Glutamine synthetase; uses ATP]
Glutamine → liver/kidney
Glutamine → Glutamate + NH₃  [Glutaminase; releases for urea/excretion]

2. Alanine - The Glucose-Alanine Cycle (Muscle only)

Muscle:  Pyruvate + Glutamate → Alanine  [ALT]
         Alanine travels to liver
Liver:   Alanine → Pyruvate + Glutamate  [ALT reversed]
         Pyruvate → Glucose [gluconeogenesis] → back to muscle
This cycle transfers nitrogen FROM muscle TO liver while recycling carbon for energy.

⏱️ MIN 9-12 — The Urea Cycle (The Heart of the Chapter)

One sentence: Liver takes 2 nitrogens (1 from NH₃, 1 from aspartate) + CO₂ → makes urea → kidneys excrete it.

5 Steps — Learn in order:

MITOCHONDRIA (Steps 1-2):
Step 1 - Carbamoyl Phosphate Formation
  • NH₃ + CO₂ + 2 ATP → Carbamoyl phosphate
  • Enzyme: CPS I (Carbamoyl Phosphate Synthetase I)
  • Activator: N-acetylglutamate (NAG) ← ESSENTIAL, rate-limiting step
  • ⭐ This is the RATE-LIMITING STEP of the urea cycle
Step 2 - Citrulline Formation
  • Carbamoyl phosphate + Ornithine → Citrulline + Pi
  • Enzyme: OTC (Ornithine Transcarbamylase)
  • Citrulline exits mitochondria into cytoplasm

CYTOPLASM (Steps 3-5):
Step 3 - Argininosuccinate Synthesis
  • Citrulline + Aspartate + ATP → Argininosuccinate + AMP + PPi
  • Enzyme: Argininosuccinate Synthetase
  • ⭐ This step brings in the SECOND nitrogen (from aspartate)
Step 4 - Argininosuccinate Cleavage
  • Argininosuccinate → Arginine + Fumarate
  • Enzyme: Argininosuccinate Lyase
  • Fumarate → TCA cycle or gluconeogenesis (links urea cycle to TCA)
Step 5 - Urea Formation + Ornithine Recycled
  • Arginine + H₂O → Urea + Ornithine
  • Enzyme: Arginase I (exclusively in liver)
  • Ornithine re-enters mitochondria → cycle repeats

Memory trick for the 5 steps:

"Can Citrulline Always Act Usefully?" Carbamoyl phosphate → Citrulline → Argininosuccinate → Arginine → Urea

Stoichiometry (must know):

Aspartate + NH₃ + CO₂ + 3 ATP + H₂O →
    Urea + Fumarate + 2 ADP + AMP + 2 Pi + PPi
  • 4 high-energy phosphate bonds used per urea (counts PPi hydrolysis)
  • Irreversible (large negative ΔG)

Regulation:

  • NAG activates CPS I (rate-limiting enzyme)
  • NAG made by NAGS from Acetyl-CoA + Glutamate
  • Arginine activates NAGS → more urea cycle activity after protein-rich meal

Fate of Urea:

  • Blood → kidneys → urine (main route)
  • ~25% → intestine → gut bacteria urease → NH₃ → reabsorbed
  • In renal failure: more urea enters gut → more NH₃ → worsens hyperammonemia
  • Rx: oral neomycin (kills gut bacteria → less NH₃)

⏱️ MIN 12-14 — Ammonia Metabolism & Hyperammonemia

Sources of NH₃:

SourceMechanism
Amino acidsTransdeamination (ATase + GDH)
GlutamineGlutaminase in intestine/kidney
Gut bacteriaUrease: urea → NH₃
AminesMAO (monoamine oxidase)
Purines/PyrimidinesDeamination

Normal levels: 5-35 µmol/L | Emergency: ~1000 µmol/L

Mechanism of CNS toxicity:

  1. NH₃ depletes α-KG → impairs TCA → brain energy crisis
  2. Excess glutamine synthesis in astrocytes → astrocyte swelling → cerebral edema
  3. Direct neuronal inhibition

Symptom progression:

Tremors → Vomiting → Slurred speech → Asterixis → Encephalopathy → Coma → Death

Types of Hyperammonemia:

TypeCauseKey Feature
AcquiredLiver disease (hepatitis, cirrhosis), portal shuntingAdults; treat underlying liver disease
CongenitalUrea cycle enzyme deficiencyNewborns; presents after protein feeding
Urea cycle enzyme deficiencies:
DeficiencyInheritanceNotes
OTC deficiencyX-linkedMost common; male newborns; severe
All othersAutosomal recessiveCPS I, ASS, ASL, Arginase
Arginase deficiencyAutosomal recessiveMildest presentation
Important: With any urea cycle defect → Arginine becomes essential (can't synthesize it)

⏱️ MIN 14-15 — Treatment of Hyperammonemia + Final Review

TreatmentMechanism
Protein restrictionReduce N load (must give enough calories to prevent catabolism)
Phenylbutyrate → phenylacetate → + Glutamine → phenylacetylglutamine (urine)Excretes 2 N per molecule via urine
Sodium benzoate → + Glycine → hippurate (urine)Excretes 1 N per molecule
Oral neomycin / lactuloseReduce gut NH₃ production
Arginine/citrulline supplementationReplenish cycle intermediates
Liver transplantDefinitive cure for genetic defects

🧠 Final 60-Second Master Summary

Dietary Protein
    ↓ HCl + Pepsin (stomach)
    ↓ Trypsin/Chymotrypsin (pancreas) — activated by enteropeptidase
    ↓ Aminopeptidase (brush border)
Free Amino Acids absorbed (Na⁺ cotransport)
    ↓
Amino Acid Pool (300-400g turned over daily)
    ↓ Aminotransferases (PLP/Vit B6) → funnel nitrogen to GLUTAMATE
    ↓ Glutamate Dehydrogenase (GDH) → releases free NH₃ [GTP inhibits, ADP activates]
    ↓
NH₃ transported as GLUTAMINE (all tissues) or ALANINE (muscle)
    ↓
LIVER: UREA CYCLE
  Mito: NH₃ + CO₂ → Carbamoyl-P [CPS I; NAG activates]
  Mito: + Ornithine → Citrulline [OTC]
  Cyto: + Aspartate → Argininosuccinate [ASS; 2nd N enters here]
  Cyto: → Arginine + Fumarate [ASL]
  Cyto: → UREA + Ornithine [Arginase I; liver only]
    ↓
UREA → Kidneys → Urine ✅

⚡ High-Yield One-Liners for Exams

  • ALT/AST elevated → cell damage; ALT more liver-specific
  • PLP (Vit B6) → coenzyme for ALL aminotransferases
  • Lysine and Threonine do NOT transaminate
  • CPS I is rate-limiting; activated by NAG; needs 2 ATP
  • OTC deficiency = most common urea cycle disorder; X-linked
  • Arginase = liver only; all other urea cycle enzymes in other tissues too
  • Cystinuria = COAL defect → kidney stones (most common AA transport disorder)
  • Hartnup = tryptophan transport defect → pellagra symptoms
  • 4 high-energy phosphates consumed per urea molecule
  • Both nitrogens of urea ultimately come from glutamate
  • Phenylbutyrate exports 2 nitrogens per molecule; benzoate exports 1

You now have everything in the chapter. Go over the urea cycle steps one more time (just the 5 enzymes in order), and you're done. ✅

Create a study guide PDF with diagrams of the urea cycle

Reading File
Running Command

mkdir -p /home/daytona/workspace/nitrogen-study-guide && python3 -c "import reportlab; print('reportlab ok')"

Now let me write the full PDF generation script:
Writing File

~/nitrogen-study-guide/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.platypus.flowables import Flowable
from reportlab.graphics.shapes import (
    Drawing, Rect, Circle, Ellipse, String, Arrow,
    Line, Polygon, Group
)
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Drawing, Rect, Ellipse, String, Line, Polygon, Circle
import math

# ── Color Palette ──────────────────────────────────────────────────────────────
DEEP_NAVY    = colors.HexColor("#0D1B2A")
ROYAL_BLUE   = colors.HexColor("#1B4F8A")
TEAL         = colors.HexColor("#0F7B8C")
ACCENT_GOLD  = colors.HexColor("#E8A020")
ACCENT_GREEN = colors.HexColor("#2EAA6E")
ACCENT_RED   = colors.HexColor("#C0392B")
ACCENT_PURP  = colors.HexColor("#7B2D8B")
LIGHT_BLUE   = colors.HexColor("#D6EAF8")
LIGHT_GREEN  = colors.HexColor("#D5F5E3")
LIGHT_GOLD   = colors.HexColor("#FEF9E7")
LIGHT_PURP   = colors.HexColor("#F5EEF8")
LIGHT_RED    = colors.HexColor("#FDEDEC")
WHITE        = colors.white
DARK_GRAY    = colors.HexColor("#2C3E50")
MID_GRAY     = colors.HexColor("#7F8C8D")
LIGHT_GRAY   = colors.HexColor("#ECF0F1")
MITO_COLOR   = colors.HexColor("#FFF3CD")
CYTO_COLOR   = colors.HexColor("#D1ECF1")
MITO_BORDER  = colors.HexColor("#E6A817")
CYTO_BORDER  = colors.HexColor("#17A2B8")

W, H = A4  # 595 x 842 pts

# ── Styles ─────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent='Normal', **kw):
    return ParagraphStyle(name, parent=styles[parent], **kw)

cover_title = make_style('CoverTitle', fontSize=32, textColor=WHITE,
                          leading=38, alignment=TA_CENTER, fontName='Helvetica-Bold')
cover_sub   = make_style('CoverSub',   fontSize=16, textColor=LIGHT_BLUE,
                          leading=22, alignment=TA_CENTER)
cover_auth  = make_style('CoverAuth',  fontSize=11, textColor=ACCENT_GOLD,
                          alignment=TA_CENTER)

section_h   = make_style('SectionH', fontSize=15, textColor=WHITE,
                          leading=20, fontName='Helvetica-Bold', alignment=TA_CENTER)
h2          = make_style('H2', fontSize=13, textColor=ROYAL_BLUE,
                          leading=18, fontName='Helvetica-Bold', spaceAfter=4)
h3          = make_style('H3', fontSize=11, textColor=TEAL,
                          leading=15, fontName='Helvetica-Bold', spaceAfter=3)
body        = make_style('Body', fontSize=9.5, textColor=DARK_GRAY,
                          leading=14, spaceAfter=3, alignment=TA_JUSTIFY)
bullet_s    = make_style('Bullet', fontSize=9.5, textColor=DARK_GRAY,
                          leading=13, leftIndent=14, firstLineIndent=-10, spaceAfter=2)
small       = make_style('Small', fontSize=8.5, textColor=MID_GRAY, leading=12)
caption     = make_style('Caption', fontSize=8, textColor=MID_GRAY,
                          alignment=TA_CENTER, fontName='Helvetica-Oblique')
highlight   = make_style('Highlight', fontSize=9.5, textColor=DARK_GRAY,
                          leading=13, backColor=LIGHT_GOLD, leftIndent=8,
                          rightIndent=8, borderPadding=4)
alert       = make_style('Alert', fontSize=9.5, textColor=ACCENT_RED,
                          leading=13, fontName='Helvetica-Bold')

def b(t): return f"<b>{t}</b>"
def col(t, c): return f'<font color="{c}">{t}</font>'
def bullet(t): return Paragraph(f"• {t}", bullet_s)
def hline(): return HRFlowable(width="100%", thickness=0.5, color=LIGHT_GRAY,
                                spaceAfter=4, spaceBefore=4)

# ── Section Banner ─────────────────────────────────────────────────────────────
class SectionBanner(Flowable):
    def __init__(self, text, bg=ROYAL_BLUE, w=None, h=26):
        super().__init__()
        self.text = text
        self.bg = bg
        self._w = w or (W - 3*cm)
        self._h = h
    def wrap(self, aw, ah): return self._w, self._h + 6
    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.roundRect(0, 0, self._w, self._h, 5, fill=1, stroke=0)
        c.setFillColor(WHITE)
        c.setFont('Helvetica-Bold', 12)
        c.drawCentredString(self._w/2, 7, self.text)

# ── Key Box ────────────────────────────────────────────────────────────────────
class KeyBox(Flowable):
    def __init__(self, lines, bg=LIGHT_GOLD, border=ACCENT_GOLD, w=None):
        super().__init__()
        self.lines = lines
        self.bg = bg
        self.border = border
        self._w = w or (W - 3*cm)
    def wrap(self, aw, ah):
        self._h = len(self.lines) * 16 + 16
        return self._w, self._h
    def draw(self):
        c = self.canv
        c.setFillColor(self.bg)
        c.setStrokeColor(self.border)
        c.setLineWidth(1.5)
        c.roundRect(0, 0, self._w, self._h, 6, fill=1, stroke=1)
        c.setFillColor(DARK_GRAY)
        for i, line in enumerate(self.lines):
            y = self._h - 14 - i*16
            if line.startswith('★'):
                c.setFont('Helvetica-Bold', 9)
                c.setFillColor(ACCENT_RED)
            else:
                c.setFont('Helvetica', 9)
                c.setFillColor(DARK_GRAY)
            c.drawString(10, y, line)

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 1 – Full Urea Cycle
# ══════════════════════════════════════════════════════════════════════════════
def draw_urea_cycle(dw=500, dh=460):
    d = Drawing(dw, dh)
    cx, cy = dw/2, dh/2 - 10

    # ── Background compartments ───────────────────────────────────────────────
    # Mitochondria oval
    mito_rx, mito_ry = 195, 185
    d.add(Ellipse(cx, cy+18, mito_rx, mito_ry,
                  fillColor=MITO_COLOR, strokeColor=MITO_BORDER,
                  strokeWidth=2.5, strokeDashArray=[5,3]))
    d.add(String(cx-40, cy+mito_ry-12, "MITOCHONDRIA",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=MITO_BORDER))

    # Cytoplasm rectangle outside
    d.add(Rect(2, 2, dw-4, dh-4,
               fillColor=CYTO_COLOR, strokeColor=CYTO_BORDER,
               strokeWidth=1.5, strokeDashArray=[4,2]))
    d.add(String(8, dh-18, "CYTOPLASM",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=CYTO_BORDER))

    # Re-draw mito on top
    d.add(Ellipse(cx, cy+18, mito_rx, mito_ry,
                  fillColor=MITO_COLOR, strokeColor=MITO_BORDER,
                  strokeWidth=2.5, strokeDashArray=[5,3]))

    # ── Helper functions ───────────────────────────────────────────────────────
    def node(x, y, text, lines2=None, fill=ROYAL_BLUE, tc=WHITE, w=90, h=28, r=8):
        d.add(Rect(x-w/2, y-h/2, w, h,
                   fillColor=fill, strokeColor=colors.white,
                   strokeWidth=1, rx=r, ry=r))
        d.add(String(x, y + (6 if not lines2 else 8), text,
                     fontName='Helvetica-Bold', fontSize=8.5,
                     fillColor=tc, textAnchor='middle'))
        if lines2:
            d.add(String(x, y-4, lines2,
                         fontName='Helvetica', fontSize=7,
                         fillColor=tc, textAnchor='middle'))

    def enzyme_tag(x, y, text, color=TEAL):
        words = text.split()
        mid = len(words)//2
        line1 = ' '.join(words[:mid])
        line2 = ' '.join(words[mid:])
        tw = max(len(line1), len(line2)) * 5.5 + 8
        d.add(Rect(x - tw/2, y-8, tw, 22,
                   fillColor=color, strokeColor=WHITE,
                   strokeWidth=0.5, rx=4, ry=4))
        if line2:
            d.add(String(x, y+7, line1, fontName='Helvetica-Oblique',
                         fontSize=6.8, fillColor=WHITE, textAnchor='middle'))
            d.add(String(x, y-1, line2, fontName='Helvetica-Oblique',
                         fontSize=6.8, fillColor=WHITE, textAnchor='middle'))
        else:
            d.add(String(x, y+3, text, fontName='Helvetica-Oblique',
                         fontSize=6.8, fillColor=WHITE, textAnchor='middle'))

    def side_label(x, y, text, color=ACCENT_GOLD):
        d.add(String(x, y, text, fontName='Helvetica', fontSize=7.5,
                     fillColor=color, textAnchor='middle'))

    def arrow(x1, y1, x2, y2, color=DARK_GRAY, w=1.8):
        dx, dy = x2-x1, y2-y1
        length = math.sqrt(dx*dx + dy*dy)
        if length == 0: return
        ux, uy = dx/length, dy/length
        # shaft
        d.add(Line(x1, y1, x2-ux*8, y2-uy*8,
                   strokeColor=color, strokeWidth=w))
        # arrowhead
        angle = math.atan2(uy, ux)
        al = 9
        aw2 = 4
        tip_x, tip_y = x2, y2
        left_x  = tip_x - al*math.cos(angle) + aw2*math.sin(angle)
        left_y  = tip_y - al*math.sin(angle) - aw2*math.cos(angle)
        right_x = tip_x - al*math.cos(angle) - aw2*math.sin(angle)
        right_y = tip_y - al*math.sin(angle) + aw2*math.cos(angle)
        d.add(Polygon([tip_x, tip_y, left_x, left_y, right_x, right_y],
                      fillColor=color, strokeColor=color, strokeWidth=0.5))

    # ── Node positions (clock face on a cycle) ────────────────────────────────
    # Mito nodes: NH3+CO2 (top-left in mito), Ornithine (bottom-left mito),
    #             Carbamoyl-P (top-center mito), Citrulline (right mito exit)
    n = {
        'orn_mito': (cx-95, cy+18),        # Ornithine enters mito (left)
        'cp':       (cx-30, cy+130),        # Carbamoyl phosphate (top mito)
        'cit_mito': (cx+100, cy+70),        # Citrulline (right mito)
        'cit_cyto': (cx+135, cy-30),        # Citrulline in cytoplasm
        'ass':      (cx+100, cy-130),       # Argininosuccinate
        'arg':      (cx-50, cy-155),        # Arginine
        'orn_cyto': (cx-140, cy-80),        # Ornithine cytoplasm
        'urea':     (cx-165, cy+18),        # Urea exits
    }

    # Input nodes (substrates)
    nh3_x, nh3_y = cx-105, cy+145
    asp_x, asp_y = cx+30, cy-185

    # ── Arrows between cycle intermediates ───────────────────────────────────
    # NH3 + CO2 → Carbamoyl-P
    arrow(nh3_x+38, nh3_y, n['cp'][0]-10, n['cp'][1]+6, ACCENT_GREEN)
    # Carbamoyl-P → Citrulline (mito)
    arrow(n['cp'][0]+48, n['cp'][1], n['cit_mito'][0]-42, n['cit_mito'][1]+28, DARK_GRAY)
    # Orn (mito) → Citrulline
    arrow(n['orn_mito'][0]+46, n['orn_mito'][1]+5, n['cit_mito'][0]-42, n['cit_mito'][1]-5, DARK_GRAY)
    # Citrulline exits mito into cytoplasm
    arrow(n['cit_mito'][0]+2, n['cit_mito'][1]-14, n['cit_cyto'][0]-2, n['cit_cyto'][1]+10, ACCENT_GOLD, 2)
    # Citrulline+Asp → Argininosuccinate
    arrow(n['cit_cyto'][0]-15, n['cit_cyto'][1]-15, n['ass'][0]+10, n['ass'][1]+14, DARK_GRAY)
    # Asp enters
    arrow(asp_x, asp_y+15, n['ass'][0]-5, n['ass'][1]+14, ACCENT_GREEN)
    # Argininosuccinate → Arginine
    arrow(n['ass'][0]-46, n['ass'][1]+4, n['arg'][0]+44, n['arg'][1]+4, DARK_GRAY)
    # Arginine → Ornithine + Urea
    arrow(n['arg'][0]-42, n['arg'][1], n['orn_cyto'][0]+44, n['orn_cyto'][1]+8, DARK_GRAY)
    # Ornithine (cyto) → Ornithine (mito) re-enters
    arrow(n['orn_cyto'][0]+20, n['orn_cyto'][1]+16, n['orn_mito'][0]-10, n['orn_mito'][1]-10, ACCENT_GOLD, 2)
    # Urea exits
    arrow(n['urea'][0]-10, n['urea'][1]+5, 32, n['urea'][1]+5, ACCENT_RED, 2)

    # Fumarate exits from Argininosuccinate lyase step
    arrow(n['arg'][0]+20, n['arg'][1]-14,
          n['arg'][0]+55, n['arg'][1]-55, ACCENT_PURP)

    # ── Metabolite nodes ──────────────────────────────────────────────────────
    # Substrates / inputs
    node(nh3_x, nh3_y, "NH₃ + CO₂", "2 ATP consumed",
         fill=ACCENT_GREEN, w=100, h=30)
    node(asp_x, asp_y, "Aspartate", "(2nd Nitrogen)",
         fill=ACCENT_GREEN, w=92, h=28)

    # Cycle intermediates
    node(n['cp'][0],       n['cp'][1],       "Carbamoyl", "Phosphate",
         fill=ROYAL_BLUE, w=86, h=30)
    node(n['cit_mito'][0], n['cit_mito'][1], "Citrulline", "(mito)",
         fill=ROYAL_BLUE, w=86, h=28)
    node(n['orn_mito'][0], n['orn_mito'][1], "Ornithine", "(mito)",
         fill=ROYAL_BLUE, w=86, h=28)
    node(n['cit_cyto'][0], n['cit_cyto'][1], "Citrulline", "(cytoplasm)",
         fill=TEAL, w=90, h=28)
    node(n['ass'][0],      n['ass'][1],      "Argino-", "succinate",
         fill=TEAL, w=88, h=30)
    node(n['arg'][0],      n['arg'][1],      "Arginine",
         fill=TEAL, w=82, h=28)
    node(n['orn_cyto'][0], n['orn_cyto'][1], "Ornithine", "(cytoplasm)",
         fill=TEAL, w=88, h=28)

    # Products
    node(n['urea'][0], n['urea'][1], "UREA",
         fill=ACCENT_RED, tc=WHITE, w=70, h=30)
    d.add(String(22, n['urea'][1]+5, "→ Urine",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=ACCENT_RED))

    # Fumarate label
    node(n['arg'][0]+72, n['arg'][1]-70, "Fumarate", "→ TCA cycle",
         fill=ACCENT_PURP, w=90, h=28)

    # ── Enzyme labels ─────────────────────────────────────────────────────────
    enzyme_tag(cx-72, cy+115, "CPS I", ACCENT_GREEN)
    enzyme_tag(cx+42, cy+110, "OTC", MITO_BORDER)
    enzyme_tag(cx+148, cy+20, "Antiporter", MITO_BORDER)
    enzyme_tag(cx+145, cy-90, "ASS", TEAL)
    enzyme_tag(cx+25,  cy-165, "ASL", TEAL)
    enzyme_tag(cx-110, cy-140, "Arginase I", ACCENT_RED)
    enzyme_tag(cx-175, cy-42, "Antiporter", MITO_BORDER)

    # ── Step numbers ──────────────────────────────────────────────────────────
    steps = [(cx-72, cy+138, "①"), (cx+42, cy+125, "②"),
             (cx+160, cy+6, "③"), (cx+145, cy-108, "④"),
             (cx+20, cy-178, "⑤"), (cx-108, cy-155, "⑥")]
    for sx, sy, st in steps:
        d.add(Circle(sx, sy, 8, fillColor=ACCENT_GOLD, strokeColor=WHITE,
                     strokeWidth=0.5))
        d.add(String(sx, sy-3, st,
                     fontName='Helvetica-Bold', fontSize=7,
                     fillColor=WHITE, textAnchor='middle'))

    # ── NAG note ──────────────────────────────────────────────────────────────
    d.add(Rect(cx-175, cy+145, 95, 30,
               fillColor=LIGHT_GOLD, strokeColor=ACCENT_GOLD,
               strokeWidth=1, rx=4, ry=4))
    d.add(String(cx-130, cy+167, "★ NAG activates CPS I",
                 fontName='Helvetica-Bold', fontSize=7,
                 fillColor=ACCENT_RED))
    d.add(String(cx-130, cy+154, "(Rate-limiting step)",
                 fontName='Helvetica', fontSize=6.5,
                 fillColor=DARK_GRAY))

    # ── ATP cost label ────────────────────────────────────────────────────────
    d.add(Rect(cx+30, cy+145, 115, 30,
               fillColor=LIGHT_RED, strokeColor=ACCENT_RED,
               strokeWidth=1, rx=4, ry=4))
    d.add(String(cx+88, cy+167, "4 ATP equivalents used",
                 fontName='Helvetica-Bold', fontSize=7,
                 fillColor=ACCENT_RED, textAnchor='middle'))
    d.add(String(cx+88, cy+154, "per urea synthesized",
                 fontName='Helvetica', fontSize=6.5,
                 fillColor=DARK_GRAY, textAnchor='middle'))

    return d

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 2 – Transdeamination (Transamination + Oxidative Deamination)
# ══════════════════════════════════════════════════════════════════════════════
def draw_transdeamination(dw=480, dh=200):
    d = Drawing(dw, dh)
    y = dh / 2

    def box(x, cy, text, sub=None, fill=ROYAL_BLUE, tc=WHITE, w=95, h=34):
        d.add(Rect(x-w/2, cy-h/2, w, h,
                   fillColor=fill, strokeColor=WHITE, strokeWidth=1, rx=7, ry=7))
        d.add(String(x, cy+(7 if sub else 3), text,
                     fontName='Helvetica-Bold', fontSize=8.5,
                     fillColor=tc, textAnchor='middle'))
        if sub:
            d.add(String(x, cy-7, sub,
                         fontName='Helvetica', fontSize=7,
                         fillColor=tc, textAnchor='middle'))

    def arr(x1, y1, x2, y2, label='', lc=DARK_GRAY):
        d.add(Line(x1, y1, x2-8, y2,
                   strokeColor=DARK_GRAY, strokeWidth=1.8))
        d.add(Polygon([x2, y2, x2-10, y2+5, x2-10, y2-5],
                      fillColor=DARK_GRAY, strokeColor=DARK_GRAY))
        if label:
            d.add(String((x1+x2)/2, y2+9, label,
                         fontName='Helvetica-Oblique', fontSize=7.5,
                         fillColor=TEAL, textAnchor='middle'))

    def note(x, y, text, color=ACCENT_GOLD):
        d.add(String(x, y, text, fontName='Helvetica', fontSize=7,
                     fillColor=color, textAnchor='middle'))

    # Background panels
    d.add(Rect(2, 2, dw/2-5, dh-4,
               fillColor=LIGHT_BLUE, strokeColor=ROYAL_BLUE,
               strokeWidth=1, rx=6, ry=6))
    d.add(String(dw/4, dh-14, "Step 1: TRANSAMINATION",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=ROYAL_BLUE, textAnchor='middle'))

    d.add(Rect(dw/2+3, 2, dw/2-5, dh-4,
               fillColor=LIGHT_GREEN, strokeColor=ACCENT_GREEN,
               strokeWidth=1, rx=6, ry=6))
    d.add(String(3*dw/4, dh-14, "Step 2: OXIDATIVE DEAMINATION",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=ACCENT_GREEN, textAnchor='middle'))

    # Step 1 boxes
    box(55,  y, "Amino Acid", "(e.g., Alanine)", ROYAL_BLUE)
    arr(108, y, 148, y, "")
    box(195, y, "α-Keto Acid", "(e.g., Pyruvate)", TEAL)
    note(150, y+22, "α-KG")
    note(150, y+12, "↕")
    note(150, y+2, "Glutamate")
    note(52, y-28, "Enzyme: Aminotransferase")
    note(52, y-38, "Coenzyme: PLP (Vit B6)")

    # Separator arrow to step 2
    arr(235, y, 270, y, "")

    # Step 2 boxes
    box(310, y, "Glutamate", fill=ACCENT_GREEN)
    arr(360, y, 396, y, "GDH")
    box(435, y, "α-KG +", "Free NH₃", ACCENT_RED)

    note(310, y-25, "NAD⁺ → NADH")
    note(435, y-28, "★ Free NH₃ released")
    note(435, y-38, "→ enters urea cycle")

    # Regulation note
    d.add(Rect(dw/2+8, 10, 100, 32,
               fillColor=LIGHT_GOLD, strokeColor=ACCENT_GOLD,
               strokeWidth=0.8, rx=4, ry=4))
    d.add(String(dw/2+58, 33, "GTP ⛔ Inhibits GDH",
                 fontName='Helvetica', fontSize=6.5,
                 fillColor=DARK_GRAY, textAnchor='middle'))
    d.add(String(dw/2+58, 20, "ADP ✅ Activates GDH",
                 fontName='Helvetica', fontSize=6.5,
                 fillColor=DARK_GRAY, textAnchor='middle'))

    return d

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 3 – Ammonia Transport (Glucose-Alanine Cycle)
# ══════════════════════════════════════════════════════════════════════════════
def draw_alanine_cycle(dw=480, dh=210):
    d = Drawing(dw, dh)

    def box(x, y, text, sub=None, fill=ROYAL_BLUE, tc=WHITE, w=100, h=32):
        d.add(Rect(x-w/2, y-h/2, w, h,
                   fillColor=fill, strokeColor=WHITE, strokeWidth=1, rx=7, ry=7))
        d.add(String(x, y+(6 if sub else 2), text,
                     fontName='Helvetica-Bold', fontSize=8.5,
                     fillColor=tc, textAnchor='middle'))
        if sub:
            d.add(String(x, y-8, sub, fontName='Helvetica', fontSize=7,
                         fillColor=tc, textAnchor='middle'))

    def arr(x1, y1, x2, y2, label='', color=DARK_GRAY, above=True):
        d.add(Line(x1, y1, x2-9, y2, strokeColor=color, strokeWidth=1.8))
        d.add(Polygon([x2, y2, x2-11, y2+5, x2-11, y2-5],
                      fillColor=color, strokeColor=color))
        if label:
            ly = (y1+y2)/2 + (10 if above else -12)
            d.add(String((x1+x2)/2, ly, label,
                         fontName='Helvetica-Oblique', fontSize=7.5,
                         fillColor=TEAL, textAnchor='middle'))

    def label(x, y, text, color=DARK_GRAY, bold=False):
        fn = 'Helvetica-Bold' if bold else 'Helvetica'
        d.add(String(x, y, text, fontName=fn, fontSize=7.5,
                     fillColor=color, textAnchor='middle'))

    # Background panels
    d.add(Rect(4, 4, dw/2-10, dh-8,
               fillColor=LIGHT_BLUE, strokeColor=ROYAL_BLUE,
               strokeWidth=1.2, rx=6, ry=6))
    label(dw/4, dh-14, "MUSCLE", ROYAL_BLUE, bold=True)

    d.add(Rect(dw/2+6, 4, dw/2-10, dh-8,
               fillColor=LIGHT_GREEN, strokeColor=ACCENT_GREEN,
               strokeWidth=1.2, rx=6, ry=6))
    label(3*dw/4, dh-14, "LIVER", ACCENT_GREEN, bold=True)

    # Muscle side
    box(90, 155, "Pyruvate", fill=TEAL)
    box(90, 85,  "Alanine",  fill=ROYAL_BLUE)
    label(90, 120, "ALT + NH₃", DARK_GRAY)
    arr(90, 138, 90, 102, "", ROYAL_BLUE)

    # Transport arrow
    arr(148, 85, 330, 85, "Blood transport", ACCENT_GOLD)

    # Liver side
    box(382, 85,  "Alanine", fill=ROYAL_BLUE)
    box(382, 155, "Pyruvate", fill=TEAL)
    label(382, 120, "ALT releases NH₃", DARK_GRAY)
    arr(382, 102, 382, 138, "", TEAL)

    # NH3 → urea cycle
    box(460, 155, "NH₃", "→ Urea Cycle", ACCENT_RED, w=90)
    arr(428, 155, 414, 155, "", ACCENT_RED)

    # Glucose return
    box(382, 30, "Glucose", "Gluconeogenesis", ACCENT_GREEN)
    arr(382, 138, 382, 46, "", ACCENT_GREEN)
    arr(330, 30, 148, 30, "Glucose → Muscle", ACCENT_GREEN)
    arr(90, 46, 90, 68, "", ACCENT_GREEN)

    label(240, 68, "★ Glucose-Alanine Cycle", ACCENT_RED, bold=True)

    return d

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 4 – Protein Digestion Flow
# ══════════════════════════════════════════════════════════════════════════════
def draw_digestion(dw=480, dh=170):
    d = Drawing(dw, dh)

    stages = [
        ("STOMACH", "HCl + Pepsin\nDenatures & cleaves\n→ Polypeptides", ROYAL_BLUE, 60),
        ("PANCREAS", "Trypsin, Chymotrypsin\nElastase, Carboxypeptidase\n→ Oligopeptides + AAs", TEAL, 180),
        ("BRUSH BORDER", "Aminopeptidase\n→ Di/tripeptides + AAs", ACCENT_PURP, 300),
        ("ABSORPTION", "Na⁺-linked (free AAs)\nH⁺-linked (di/tri)\n→ Portal blood", ACCENT_GREEN, 420),
    ]

    for name, detail, color, x in stages:
        bh = 100
        d.add(Rect(x-55, dh-bh-20, 110, bh,
                   fillColor=color, strokeColor=WHITE, strokeWidth=1, rx=8, ry=8))
        d.add(String(x, dh-25, name,
                     fontName='Helvetica-Bold', fontSize=8,
                     fillColor=WHITE, textAnchor='middle'))
        lines = detail.split('\n')
        for i, line in enumerate(lines):
            d.add(String(x, dh-42-i*16, line,
                         fontName='Helvetica', fontSize=7.5,
                         fillColor=WHITE, textAnchor='middle'))
        if x < 420:
            d.add(Polygon([x+60, dh-68, x+70, dh-62, x+60, dh-56],
                          fillColor=ACCENT_GOLD, strokeColor=ACCENT_GOLD))

    # Activation cascade note
    d.add(Rect(120, 2, 240, 18,
               fillColor=LIGHT_GOLD, strokeColor=ACCENT_GOLD,
               strokeWidth=0.8, rx=3, ry=3))
    d.add(String(240, 7, "★ Enteropeptidase → Trypsin → activates all other zymogens",
                 fontName='Helvetica-Bold', fontSize=6.5,
                 fillColor=ACCENT_RED, textAnchor='middle'))

    return d

# ══════════════════════════════════════════════════════════════════════════════
#  DIAGRAM 5 – Hyperammonemia Types & Treatment
# ══════════════════════════════════════════════════════════════════════════════
def draw_hyperammonemia(dw=480, dh=190):
    d = Drawing(dw, dh)

    # Central circle
    d.add(Circle(240, 100, 55,
                 fillColor=ACCENT_RED, strokeColor=WHITE, strokeWidth=2))
    d.add(String(240, 112, "HYPER-",
                 fontName='Helvetica-Bold', fontSize=10,
                 fillColor=WHITE, textAnchor='middle'))
    d.add(String(240, 98, "AMMONEMIA",
                 fontName='Helvetica-Bold', fontSize=10,
                 fillColor=WHITE, textAnchor='middle'))
    d.add(String(240, 82, ">35 µmol/L",
                 fontName='Helvetica', fontSize=8,
                 fillColor=LIGHT_RED, textAnchor='middle'))

    def side_box(x, y, title, lines, fill, border):
        h = len(lines)*14 + 22
        w = 155
        d.add(Rect(x, y-h/2, w, h,
                   fillColor=fill, strokeColor=border,
                   strokeWidth=1.2, rx=6, ry=6))
        d.add(String(x+w/2, y+h/2-14, title,
                     fontName='Helvetica-Bold', fontSize=8,
                     fillColor=border, textAnchor='middle'))
        for i, line in enumerate(lines):
            d.add(String(x+8, y+h/2-26-i*14, line,
                         fontName='Helvetica', fontSize=7.2,
                         fillColor=DARK_GRAY))

    # Acquired (left)
    side_box(8, 105, "ACQUIRED (Adults)",
             ["• Liver disease (hepatitis/cirrhosis)",
              "• Portal-systemic shunting",
              "• Impaired urea cycle"],
             LIGHT_RED, ACCENT_RED)
    d.add(Line(163, 105, 186, 105, strokeColor=ACCENT_RED, strokeWidth=1.5))
    d.add(Polygon([186,105,178,109,178,101],
                  fillColor=ACCENT_RED, strokeColor=ACCENT_RED))

    # Congenital (right)
    side_box(318, 105, "CONGENITAL (Newborns)",
             ["• OTC deficiency (X-linked) ← most common",
              "• CPS I, ASS, ASL deficiencies (AR)",
              "• Arginine becomes essential AA"],
             LIGHT_GOLD, ACCENT_GOLD)
    d.add(Line(294, 105, 318, 105, strokeColor=ACCENT_GOLD, strokeWidth=1.5))
    d.add(Polygon([318,105,310,109,310,101],
                  fillColor=ACCENT_GOLD, strokeColor=ACCENT_GOLD))

    # Treatment (bottom)
    tx_items = [
        "① Protein restriction + adequate calories",
        "② Phenylbutyrate → exports 2 N as phenylacetylglutamine",
        "③ Na-benzoate → exports 1 N as hippurate",
        "④ Neomycin/lactulose → ↓ gut NH₃",
        "⑤ Arginine/citrulline supplementation",
        "⑥ Liver transplant (definitive cure)",
    ]
    tx_h = len(tx_items)*13 + 18
    d.add(Rect(4, 2, dw-8, tx_h-2,
               fillColor=LIGHT_GREEN, strokeColor=ACCENT_GREEN,
               strokeWidth=1, rx=5, ry=5))
    d.add(String(dw/2, tx_h-4, "TREATMENT STRATEGIES",
                 fontName='Helvetica-Bold', fontSize=8,
                 fillColor=ACCENT_GREEN, textAnchor='middle'))
    for i, item in enumerate(tx_items):
        d.add(String(12, tx_h-16-i*13, item,
                     fontName='Helvetica', fontSize=7,
                     fillColor=DARK_GRAY))

    return d

# ══════════════════════════════════════════════════════════════════════════════
#  TABLE helpers
# ══════════════════════════════════════════════════════════════════════════════
def styled_table(data, col_widths, header_bg=ROYAL_BLUE):
    t = Table(data, colWidths=col_widths)
    style = TableStyle([
        ('BACKGROUND',   (0,0), (-1,0), header_bg),
        ('TEXTCOLOR',    (0,0), (-1,0), WHITE),
        ('FONTNAME',     (0,0), (-1,0), 'Helvetica-Bold'),
        ('FONTSIZE',     (0,0), (-1,0), 9),
        ('ALIGN',        (0,0), (-1,0), 'CENTER'),
        ('ROWBACKGROUNDS',(0,1),(-1,-1),[WHITE, LIGHT_GRAY]),
        ('FONTNAME',     (0,1), (-1,-1),'Helvetica'),
        ('FONTSIZE',     (0,1), (-1,-1), 8.5),
        ('TOPPADDING',   (0,0), (-1,-1), 5),
        ('BOTTOMPADDING',(0,0), (-1,-1), 5),
        ('LEFTPADDING',  (0,0), (-1,-1), 7),
        ('GRID',         (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
        ('ROWBACKGROUNDS',(0,1),(-1,-1),[WHITE, LIGHT_BLUE]),
        ('VALIGN',       (0,0), (-1,-1), 'MIDDLE'),
    ])
    t.setStyle(style)
    return t

def section_header(text, bg=ROYAL_BLUE):
    return SectionBanner(text, bg=bg, w=W-3*cm)

# ══════════════════════════════════════════════════════════════════════════════
#  COVER PAGE
# ══════════════════════════════════════════════════════════════════════════════
class CoverPage(Flowable):
    def __init__(self, w=W, h=H):
        super().__init__()
        self._w = w
        self._h = h
    def wrap(self, aw, ah): return self._w, self._h
    def draw(self):
        c = self.canv
        # Deep gradient background
        c.setFillColor(DEEP_NAVY)
        c.rect(0, 0, self._w, self._h, fill=1, stroke=0)
        # Accent band
        c.setFillColor(ROYAL_BLUE)
        c.rect(0, self._h*0.38, self._w, self._h*0.28, fill=1, stroke=0)
        # Top accent line
        c.setFillColor(ACCENT_GOLD)
        c.rect(0, self._h*0.66+2, self._w, 4, fill=1, stroke=0)
        c.rect(0, self._h*0.38-2, self._w, 4, fill=1, stroke=0)

        # DNA helix decoration (simple circles)
        import random
        random.seed(42)
        for i in range(18):
            x = self._w*0.88 + 10*math.sin(i*0.7)
            y = self._h*0.1 + i*30
            r = 6+3*abs(math.sin(i*0.7))
            c.setFillColor(colors.HexColor("#1B4F8A"))
            c.circle(x, y, r, fill=1, stroke=0)

        # Title text
        c.setFillColor(WHITE)
        c.setFont('Helvetica-Bold', 30)
        c.drawCentredString(self._w/2, self._h*0.72, "Amino Acids:")
        c.setFont('Helvetica-Bold', 30)
        c.drawCentredString(self._w/2, self._h*0.66+12, "Disposal of Nitrogen")

        c.setFillColor(LIGHT_BLUE)
        c.setFont('Helvetica', 14)
        c.drawCentredString(self._w/2, self._h*0.62, "Chapter 19 — Lippincott's Illustrated Reviews: Biochemistry")

        # Chapter tags
        tags = ["Urea Cycle", "Transdeamination", "Hyperammonemia",
                "Protein Digestion", "Ammonia Transport", "Nitrogen Balance"]
        tag_x = 60
        for tag in tags:
            tw = len(tag)*7 + 16
            c.setFillColor(TEAL)
            c.roundRect(tag_x, self._h*0.56, tw, 18, 4, fill=1, stroke=0)
            c.setFillColor(WHITE)
            c.setFont('Helvetica', 8)
            c.drawString(tag_x+8, self._h*0.56+5, tag)
            tag_x += tw + 8

        # Author/source
        c.setFillColor(ACCENT_GOLD)
        c.setFont('Helvetica-Bold', 10)
        c.drawCentredString(self._w/2, self._h*0.34, "Comprehensive Study Guide with Diagrams")
        c.setFillColor(MID_GRAY)
        c.setFont('Helvetica', 9)
        c.drawCentredString(self._w/2, self._h*0.30, "Based on Lippincott's Biochemistry, Chapter 19")

        # Bottom bar
        c.setFillColor(ACCENT_GOLD)
        c.rect(0, 0, self._w, 30, fill=1, stroke=0)
        c.setFillColor(DEEP_NAVY)
        c.setFont('Helvetica-Bold', 9)
        c.drawCentredString(self._w/2, 10, "Biochemistry  •  Amino Acid Metabolism  •  Nitrogen Disposal")


# ══════════════════════════════════════════════════════════════════════════════
#  BUILD THE PDF
# ══════════════════════════════════════════════════════════════════════════════
OUTPUT = "/home/daytona/workspace/nitrogen-study-guide/Amino_Acids_Nitrogen_Disposal_Study_Guide.pdf"

def build_pdf():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=1.5*cm, rightMargin=1.5*cm,
        topMargin=1.5*cm, bottomMargin=1.5*cm,
        title="Amino Acids: Disposal of Nitrogen — Study Guide",
        author="Lippincott's Biochemistry Ch.19",
    )

    story = []
    S = Spacer(1, 0.3*cm)
    SM = Spacer(1, 0.5*cm)
    LG = Spacer(1, 0.8*cm)

    # ── COVER ──────────────────────────────────────────────────────────────────
    story.append(CoverPage())
    story.append(PageBreak())

    # ── TABLE OF CONTENTS ──────────────────────────────────────────────────────
    story.append(section_header("📋  TABLE OF CONTENTS"))
    story.append(SM)
    toc_data = [
        ["#", "Section", "Page"],
        ["1", "Overview & Big Picture", "3"],
        ["2", "Amino Acid Pool & Protein Turnover", "3"],
        ["3", "Protein Digestion (with Diagram)", "4"],
        ["4", "Amino Acid Transport & Genetic Disorders", "4"],
        ["5", "Removal of Nitrogen: Transdeamination (with Diagram)", "5"],
        ["6", "Ammonia Transport: Glutamine & Glucose-Alanine Cycle", "6"],
        ["7", "THE UREA CYCLE — Full Diagram + Steps", "7"],
        ["8", "Urea Cycle Stoichiometry & Regulation", "8"],
        ["9", "Hyperammonemia: Types & Treatment (with Diagram)", "9"],
        ["10", "High-Yield Summary Tables", "10"],
        ["11", "Exam One-Liners & Memory Tricks", "11"],
    ]
    story.append(styled_table(toc_data, [0.7*cm, 11*cm, 1.8*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 1 — OVERVIEW
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("1 ·  Overview & The Big Picture", DEEP_NAVY))
    story.append(SM)
    story.append(Paragraph(
        b("Core principle:") + " Amino acids cannot be stored. Excess amino acids are degraded — "
        "nitrogen is stripped off (toxic as ammonia) and converted to urea for excretion; "
        "carbon skeletons enter central metabolic pathways.",
        highlight))
    story.append(S)
    story.append(Paragraph(b("Two phases of amino acid catabolism:"), h3))
    story.append(bullet(b("Phase 1 — Nitrogen removal:") + " α-amino group removed → free NH₃ + α-keto acid. NH₃ → converted to urea (main route)."))
    story.append(bullet(b("Phase 2 — Carbon skeleton fate:") + " α-keto acid enters TCA cycle, gluconeogenesis, fatty acid synthesis, or ketogenesis."))
    story.append(S)
    story.append(Paragraph(b("Nitrogen balance:"), h3))
    story.append(bullet("Healthy adults: N input = N output (zero balance)"))
    story.append(bullet("Positive balance: growth, pregnancy, recovery from illness"))
    story.append(bullet("Negative balance: starvation, severe illness, muscle wasting"))
    story.append(SM)

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 2 — AMINO ACID POOL & TURNOVER
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("2 ·  Amino Acid Pool & Protein Turnover", ROYAL_BLUE))
    story.append(SM)

    pool_data = [
        ["Fills the Pool", "Drains the Pool"],
        ["Dietary protein digestion & absorption", "Protein synthesis"],
        ["Body protein breakdown (turnover)", "Biosynthesis of N-containing compounds\n(purines, heme, creatine)"],
        ["Synthesis of nonessential amino acids", "Energy production (oxidation)"],
    ]
    story.append(styled_table(pool_data, [8*cm, 8*cm]))
    story.append(S)
    story.append(Paragraph(
        b("Protein turnover:") + " ~300–400 g of protein hydrolyzed and resynthesized DAILY. "
        "Regulatory proteins (enzymes, transcription factors) are short-lived (minutes–hours). "
        "Structural proteins (collagen, muscle) are long-lived (days–years).",
        body))
    story.append(S)
    story.append(Paragraph(b("Two protein degradation systems:"), h3))
    deg_data = [
        ["System", "Energy", "Mechanism", "Targets"],
        ["Ubiquitin-Proteasome", "ATP-dependent", "Proteins tagged with ubiquitin\n→ fed into proteasome barrel", "Intracellular proteins;\nPEST-sequence proteins (fast)"],
        ["Lysosomal Degradation", "ATP-independent", "Acid hydrolases (cathepsins)\ndegrade engulfed material", "Extracellular/membrane proteins;\nautophagocytosed organelles"],
    ]
    story.append(styled_table(deg_data, [3.5*cm, 2.8*cm, 5*cm, 5*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 3 — PROTEIN DIGESTION
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("3 ·  Protein Digestion", TEAL))
    story.append(SM)
    story.append(Paragraph("Figure 1 — Protein Digestion Pipeline (Stomach → Absorption)", caption))
    story.append(S)
    story.append(draw_digestion())
    story.append(S)
    story.append(Paragraph("Caption: Proteins are digested sequentially by three stations. All pancreatic enzymes are secreted as "
                           "inactive zymogens; enteropeptidase triggers the activation cascade by activating trypsinogen → trypsin, "
                           "which then activates all others.", caption))
    story.append(SM)

    dig_data = [
        ["Location", "Enzyme/Agent", "Type", "Action"],
        ["Stomach (Parietal cells)", "HCl", "Acid", "Denatures proteins; activates pepsinogen"],
        ["Stomach (Chief cells)", "Pepsin", "Endopeptidase", "Cleaves large proteins → polypeptides (active at pH 1–2)"],
        ["Pancreas", "Trypsin", "Endopeptidase", "Cleaves after Arg, Lys"],
        ["Pancreas", "Chymotrypsin", "Endopeptidase", "Cleaves after Phe, Tyr, Trp"],
        ["Pancreas", "Elastase", "Endopeptidase", "Cleaves after small neutral AAs"],
        ["Pancreas", "Carboxypeptidases A/B", "Exopeptidase", "Cleaves C-terminal amino acids"],
        ["Brush border", "Aminopeptidase", "Exopeptidase", "Cleaves N-terminal amino acids"],
        ["Enterocytes", "Intracellular peptidases", "Hydrolase", "Hydrolyze di/tripeptides → free AAs"],
    ]
    story.append(styled_table(dig_data, [3.5*cm, 4*cm, 2.8*cm, 5.4*cm]))
    story.append(S)
    story.append(Paragraph(
        b("Absorption:") + " Free AAs → Na⁺-coupled transport. Di/tripeptides → H⁺-coupled (PepT1) → hydrolyzed inside "
        "enterocyte. Only free AAs enter portal blood. " +
        b("Exception:") + " Branched-chain AAs (Val, Leu, Ile) bypass liver and go directly to muscle.",
        body))
    story.append(SM)

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 4 — TRANSPORT & GENETIC DISORDERS
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("4 ·  Amino Acid Transport & Genetic Disorders", ACCENT_PURP))
    story.append(SM)
    story.append(Paragraph(
        "Intracellular [AA] > extracellular [AA] → maintained by active transport (at least 7 transport systems). "
        "The same systems are shared between the intestinal brush border and the renal proximal tubule, so a "
        "single defect causes both malabsorption and aminoaciduria.",
        body))
    story.append(S)
    disorder_data = [
        ["Disorder", "Defect", "Amino Acids Affected", "Consequence"],
        ["Cystinuria", "COAL transport system", "Cystine, Ornithine,\nArginine, Lysine",
         "Kidney stones (cystine precipitates at normal urine pH).\nMost common AA transport disorder (1:7,000)"],
        ["Hartnup Disease", "Neutral AA transporter\n(SLC6A19)", "Tryptophan (main)\n+ other neutral AAs",
         "↓ Tryptophan → ↓ Niacin synthesis → pellagra-like:\ndermatitis, diarrhea, dementia"],
    ]
    story.append(styled_table(disorder_data, [2.8*cm, 3.2*cm, 3.5*cm, 6.7*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 5 — TRANSDEAMINATION
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("5 ·  Removal of Nitrogen: Transdeamination", ROYAL_BLUE))
    story.append(SM)
    story.append(Paragraph("Figure 2 — Transdeamination: Transamination + Oxidative Deamination", caption))
    story.append(S)
    story.append(draw_transdeamination())
    story.append(S)
    story.append(Paragraph(
        "Caption: Step 1 (transamination) funnels nitrogen from most amino acids onto α-ketoglutarate, producing "
        "glutamate — the central nitrogen collector. Step 2 (oxidative deamination by GDH) releases free NH₃ "
        "from glutamate for the urea cycle.", caption))
    story.append(SM)

    story.append(Paragraph(b("Step 1 — Transamination (the nitrogen funnel)"), h2))
    story.append(bullet("Most amino acids transfer their α-amino group to " + b("α-ketoglutarate") + " → " + b("Glutamate") + " + α-keto acid"))
    story.append(bullet("Enzyme: " + b("Aminotransferases (transaminases)") + " — coenzyme: " + b("PLP (pyridoxal phosphate)") + " from Vitamin B6"))
    story.append(bullet("PLP is covalently bound to a lysine residue at the active site (Schiff base linkage)"))
    story.append(bullet("Equilibrium ~1 → " + b("fully reversible") + ": functions in both catabolism (after meals) and anabolism (synthesis)"))
    story.append(bullet(b("Exceptions:") + " Lysine and Threonine do NOT undergo transamination"))
    story.append(S)

    trans_data = [
        ["Enzyme", "Reaction", "Location", "Clinical Significance"],
        ["ALT\n(Alanine aminotransferase)", "Alanine + α-KG ⇌\nPyruvate + Glutamate",
         "Liver (high), also\nmuscle, kidney", "Elevated in hepatocellular damage;\nmore liver-specific than AST"],
        ["AST\n(Aspartate aminotransferase)", "Glutamate + OAA ⇌\nAspartate + α-KG",
         "Heart, liver,\nmuscle, RBCs", "Elevated in MI, liver disease,\nmyopathies"],
    ]
    story.append(styled_table(trans_data, [3.5*cm, 4.5*cm, 3.5*cm, 4.7*cm]))
    story.append(S)

    story.append(Paragraph(b("Clinical: Elevated plasma ALT/AST = tissue damage"), h3))
    elevate_data = [
        ["Condition", "ALT", "AST", "Notes"],
        ["Viral hepatitis", "↑↑↑", "↑↑", "ALT > AST typical"],
        ["Alcoholic liver disease", "↑", "↑↑", "AST:ALT ratio > 2:1"],
        ["Drug/toxin liver injury", "↑↑↑", "↑↑↑", "Can be massive elevation"],
        ["Myocardial infarction", "Normal", "↑↑", "Also ↑ troponin, CK-MB"],
        ["Muscle disorders", "Mild ↑", "↑↑", "Also ↑ CK"],
    ]
    story.append(styled_table(elevate_data, [5*cm, 2*cm, 2*cm, 7.2*cm]))
    story.append(S)

    story.append(Paragraph(b("Step 2 — Oxidative Deamination (GDH)"), h2))
    story.append(bullet(b("Glutamate Dehydrogenase (GDH)") + " — liver/kidney mitochondria"))
    story.append(bullet("Glutamate + NAD⁺ → α-ketoglutarate + " + b("free NH₃") + " + NADH"))
    story.append(bullet("Dual coenzymes: NAD⁺ for deamination (catabolism); NADP⁺ for reductive amination (anabolism)"))
    story.append(bullet(b("Allosteric regulation:") + " GTP ⛔ inhibits (energy-rich) | ADP ✅ activates (energy-poor)"))
    story.append(S)
    story.append(Paragraph(b("D-Amino Acid Oxidase (DAO):") + " FAD-dependent, peroxisomal. Oxidizes dietary D-amino acids → α-keto acid + NH₃ + H₂O₂. "
        "Also degrades D-serine (NMDA receptor modulator) — altered DAO activity linked to schizophrenia.", body))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 6 — AMMONIA TRANSPORT
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("6 ·  Ammonia Transport to the Liver", TEAL))
    story.append(SM)
    story.append(Paragraph(
        "Free NH₃ is neurotoxic even at low concentrations. Peripheral tissues package nitrogen into "
        "non-toxic carriers for safe transport to the liver.",
        body))
    story.append(S)
    story.append(Paragraph("Figure 3 — Glucose-Alanine Cycle (Muscle-Liver Axis)", caption))
    story.append(S)
    story.append(draw_alanine_cycle())
    story.append(S)
    story.append(Paragraph(
        "Caption: In muscle, pyruvate accepts nitrogen (via ALT) to form alanine, which travels to the liver. "
        "There, ALT reverses the reaction — releasing NH₃ for the urea cycle and pyruvate for gluconeogenesis. "
        "The resulting glucose returns to muscle, completing the cycle.", caption))
    story.append(SM)

    transport_data = [
        ["Carrier", "Tissues", "Formation", "Fate in Liver"],
        ["Glutamine\n(main carrier)", "All tissues\n(esp. brain, muscle)", "Glutamine synthetase (ATP):\nNH₃ + Glutamate → Glutamine",
         "Glutaminase:\nGlutamine → Glu + NH₃\n→ urea synthesis"],
        ["Alanine\n(muscle-specific)", "Skeletal muscle", "ALT: Pyruvate + Glu → Alanine\n(packages muscle NH₃)",
         "ALT (reversed): Alanine → Pyruvate\nPyruvate → glucose (gluconeogenesis)"],
    ]
    story.append(styled_table(transport_data, [2.8*cm, 3.2*cm, 5.5*cm, 4.7*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 7 — UREA CYCLE
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("7 ·  THE UREA CYCLE", DEEP_NAVY))
    story.append(SM)
    story.append(Paragraph(
        b("Overview:") + " Urea = primary nitrogen disposal form in humans (~90% of urinary nitrogen). "
        "Each urea molecule carries 2 nitrogen atoms: 1 from free NH₃ (GDH) and 1 from aspartate (AST). "
        "Occurs in hepatocytes (mitochondria + cytoplasm). Urea → blood → kidneys → urine.",
        highlight))
    story.append(SM)
    story.append(Paragraph("Figure 4 — Complete Urea Cycle Diagram", caption))
    story.append(S)
    story.append(draw_urea_cycle(dw=int(W-3*cm), dh=470))
    story.append(S)
    story.append(Paragraph(
        "Caption: Numbered steps ① – ⑥ show the sequential reactions. Yellow background = mitochondrial reactions (Steps ①②); "
        "blue-green background = cytoplasmic reactions (Steps ③④⑤). Ornithine antiporter (③ transition) shuttles "
        "citrulline out and ornithine back in. Fumarate exits to the TCA cycle, linking the two pathways.",
        caption))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 8 — STEPS, STOICHIOMETRY, REGULATION
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("8 ·  Urea Cycle Steps, Stoichiometry & Regulation", ROYAL_BLUE))
    story.append(SM)

    steps_data = [
        ["Step", "Location", "Substrate(s)", "Enzyme", "Product(s)", "Key Notes"],
        ["①", "Mitochondria", "NH₃ + CO₂\n+ 2 ATP", "CPS I\n(Carbamoyl\nPhosphate\nSynthetase I)",
         "Carbamoyl\nPhosphate + 2 ADP", "★ RATE-LIMITING STEP\nActivated by N-acetylglutamate (NAG)\nNAG is essential allosteric activator"],
        ["②", "Mitochondria", "Carbamoyl-P\n+ Ornithine", "OTC\n(Ornithine\nTranscarbamoylase)",
         "Citrulline + Pi", "Most common urea cycle disorder\nis OTC deficiency (X-linked)"],
        ["—", "Membrane", "Citrulline\n(mito → cyto)", "Ornithine/\nCitrulline\nAntiporter",
         "Citrulline\nin cytoplasm", "Ornithine re-enters mito in exchange"],
        ["③", "Cytoplasm", "Citrulline\n+ Aspartate\n+ ATP", "Argininosuccinate\nSynthetase (ASS)",
         "Argininosuccinate\n+ AMP + PPi", "★ SECOND NITROGEN enters here\n(from aspartate)\n1 ATP used → AMP (= 2 bonds)"],
        ["④", "Cytoplasm", "Argininosuccinate", "Argininosuccinate\nLyase (ASL)",
         "Arginine\n+ Fumarate", "Fumarate → TCA cycle (malate → OAA)\nLinks urea cycle to TCA"],
        ["⑤", "Cytoplasm", "Arginine\n+ H₂O", "Arginase I",
         "Urea\n+ Ornithine", "★ Arginase I exclusive to liver\nOrnithine recycled back to mito"],
    ]
    story.append(styled_table(steps_data, [1*cm, 2.2*cm, 2.5*cm, 3*cm, 2.5*cm, 5*cm]))
    story.append(SM)

    story.append(Paragraph(b("Stoichiometry:"), h2))
    story.append(KeyBox([
        "Aspartate + NH₃ + CO₂ + 3 ATP + H₂O  →  Urea + Fumarate + 2 ADP + AMP + 2 Pi + PPi",
        "★ 4 high-energy phosphate bonds consumed per urea molecule (counts PPi hydrolysis)",
        "★ Reaction is IRREVERSIBLE — large negative ΔG",
        "★ Both nitrogens of urea ultimately derive from GLUTAMATE",
    ], bg=LIGHT_BLUE, border=ROYAL_BLUE))
    story.append(SM)

    story.append(Paragraph(b("Regulation:"), h2))
    story.append(bullet(b("Rate-limiting enzyme:") + " CPS I — activated by N-acetylglutamate (NAG)"))
    story.append(bullet(b("NAG synthesis:") + " NAGS enzyme: Acetyl-CoA + Glutamate → NAG; Arginine activates NAGS (positive feedback)"))
    story.append(bullet(b("Short-term:") + " Substrate availability (more protein → more NH₃ → more NAG → more CPS I activity)"))
    story.append(bullet(b("Long-term:") + " High-protein diet induces transcription of urea cycle enzyme genes"))
    story.append(SM)

    story.append(Paragraph(b("Fate of Urea:"), h2))
    story.append(bullet("Diffuses from liver → blood → kidneys → filtered and excreted in urine (main route)"))
    story.append(bullet("~25% diffuses into intestine → gut bacteria urease → CO₂ + NH₃"))
    story.append(bullet(b("Renal failure:") + " elevated plasma urea drives more urea into gut → more bacterial NH₃ → worsens hyperammonemia"))
    story.append(bullet(b("Treatment:") + " oral neomycin (antibiotic reduces gut bacteria) or lactulose (acidifies colon, traps NH₄⁺)"))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 9 — HYPERAMMONEMIA
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("9 ·  Hyperammonemia: Types & Treatment", ACCENT_RED))
    story.append(SM)
    story.append(Paragraph("Figure 5 — Hyperammonemia: Types & Treatment Overview", caption))
    story.append(S)
    story.append(draw_hyperammonemia(dw=int(W-3*cm), dh=200))
    story.append(SM)

    story.append(Paragraph(b("Normal plasma NH₃: 5–35 µmol/L  |  Emergency threshold: ~1000 µmol/L"), alert))
    story.append(S)

    story.append(Paragraph(b("Mechanism of CNS toxicity:"), h3))
    story.append(bullet("NH₃ depletes α-ketoglutarate (TCA intermediate) → impairs brain energy metabolism"))
    story.append(bullet("Excess glutamine synthesis in astrocytes → osmotic swelling → " + b("cerebral edema")))
    story.append(bullet("Direct neuronal membrane depolarization and impaired neurotransmitter balance"))
    story.append(S)

    story.append(Paragraph(b("Symptom progression (in order of severity):"), h3))
    story.append(Paragraph(
        "Tremors → Vomiting → Slurred speech → Asterixis (flapping tremor) → "
        "Encephalopathy/Confusion → " + b("Cerebral Edema → Coma → Death"),
        highlight))
    story.append(SM)

    ucd_data = [
        ["Enzyme Deficiency", "Inheritance", "Severity", "Notes"],
        ["OTC (Ornithine Transcarbamylase)", "X-linked", "Severe", "Most common urea cycle disorder; males severely affected in neonates"],
        ["CPS I deficiency", "Autosomal recessive", "Severe", "No carbamoyl phosphate → complete urea cycle block"],
        ["Argininosuccinate Synthetase\n(Citrullinemia Type I)", "Autosomal recessive", "Severe", "Citrulline accumulates in blood"],
        ["Argininosuccinate Lyase\n(Argininosuccinic aciduria)", "Autosomal recessive", "Moderate-Severe", "Argininosuccinate in blood/urine"],
        ["Arginase I deficiency", "Autosomal recessive", "Mild-Moderate", "Spastic diplegia; seizures; arginine accumulates"],
    ]
    story.append(styled_table(ucd_data, [5.2*cm, 3.2*cm, 2.8*cm, 5*cm]))
    story.append(S)
    story.append(Paragraph(
        b("Key fact:") + " With any urea cycle enzyme defect (except arginase deficiency), "
        b("arginine becomes an essential amino acid") + " because it cannot be synthesized.",
        body))
    story.append(SM)

    tx_data = [
        ["Treatment", "Mechanism", "N Exported"],
        ["Protein restriction + adequate calories", "Reduce nitrogen load; prevent catabolism", "—"],
        ["Phenylbutyrate → phenylacetate\n→ + Glutamine → phenylacetylglutamine", "Excreted in urine; bypasses urea cycle", "2 N per molecule"],
        ["Sodium benzoate → hippurate\n(+ Glycine)", "Excreted in urine", "1 N per molecule"],
        ["Oral neomycin / lactulose", "↓ gut bacteria → ↓ urease activity → ↓ intestinal NH₃", "—"],
        ["Arginine / citrulline supplementation", "Replenish depleted urea cycle intermediates", "—"],
        ["Liver transplant", "Definitive cure — restores full urea cycle enzyme activity", "—"],
    ]
    story.append(styled_table(tx_data, [6*cm, 6.5*cm, 2.5*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 10 — HIGH-YIELD SUMMARY TABLES
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("10 ·  High-Yield Summary Tables", TEAL))
    story.append(SM)

    story.append(Paragraph(b("Key Enzymes of Nitrogen Metabolism"), h2))
    enzyme_data = [
        ["Enzyme", "Location", "Coenzyme/\nActivator", "Direction", "Clinical Relevance"],
        ["Aminotransferases\n(ALT, AST)", "All tissues", "PLP (Vit B6)", "Reversible", "Elevated in liver/muscle damage"],
        ["Glutamate\nDehydrogenase (GDH)", "Liver/kidney\nmitochondria", "NAD⁺ / NADP⁺\nGTP ⛔ ADP ✅", "Both", "Releases free NH₃ for urea cycle"],
        ["CPS I", "Mitochondria\n(liver)", "NAG (activator)\n2 ATP consumed", "Irreversible", "Rate-limiting; deficiency → hyperammonemia"],
        ["OTC", "Mitochondria\n(liver)", "—", "Irreversible", "Most common UCD; X-linked"],
        ["Argininosuccinate\nSynthetase (ASS)", "Cytoplasm", "ATP (→ AMP)", "Irreversible", "Citrullinemia Type I if deficient"],
        ["Argininosuccinate\nLyase (ASL)", "Cytoplasm", "—", "Irreversible", "Argininosuccinic aciduria if deficient"],
        ["Arginase I", "Cytoplasm\n(liver only)", "—", "Irreversible", "Liver-exclusive; produces urea"],
        ["Glutamine\nSynthetase", "Most tissues", "ATP", "Irreversible", "Non-toxic NH₃ transport carrier"],
        ["D-Amino Acid\nOxidase (DAO)", "Peroxisomes", "FAD", "Irreversible", "D-serine metabolism; schizophrenia link"],
    ]
    story.append(styled_table(enzyme_data, [3.5*cm, 2.8*cm, 2.8*cm, 2*cm, 5.1*cm]))
    story.append(SM)

    story.append(Paragraph(b("Sources of Ammonia in the Body"), h2))
    nh3_data = [
        ["Source", "Mechanism", "Relative Contribution"],
        ["Amino acid catabolism", "Transdeamination (aminotransferase + GDH)", "Major"],
        ["Glutamine hydrolysis", "Glutaminase in intestine and kidney", "Major"],
        ["Intestinal bacteria", "Urease converts dietary urea → NH₃", "Significant"],
        ["Biogenic amines", "MAO (monoamine oxidase) deaminates amines", "Minor"],
        ["Purine/pyrimidine catabolism", "Deamination during nucleotide breakdown", "Minor"],
    ]
    story.append(styled_table(nh3_data, [4.5*cm, 7*cm, 4.7*cm]))
    story.append(PageBreak())

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 11 — EXAM ONE-LINERS
    # ══════════════════════════════════════════════════════════════════════════
    story.append(section_header("11 ·  Exam One-Liners & Memory Tricks", ACCENT_GOLD))
    story.append(SM)

    story.append(Paragraph(b("★ Must-Know One-Liners"), h2))
    oneliner_data = [
        ["#", "One-Liner", "Why it matters"],
        ["1", "Amino acids CANNOT be stored — excess is degraded.", "Foundation of the whole chapter"],
        ["2", "Lysine and Threonine do NOT transaminate.", "Exam trap; all others do"],
        ["3", "ALL aminotransferases require PLP (Vitamin B6).", "Any B6 deficiency impairs nitrogen removal"],
        ["4", "ALT is more liver-specific than AST.", "MI raises AST but not ALT significantly"],
        ["5", "Glutamate is the central nitrogen collector.", "All roads lead to glutamate first"],
        ["6", "GDH: GTP inhibits, ADP activates.", "Energy status controls amino acid catabolism"],
        ["7", "CPS I is the rate-limiting step of the urea cycle.", "Activated by NAG (not by substrate alone)"],
        ["8", "NAG = essential allosteric activator of CPS I.", "No NAG = no urea synthesis"],
        ["9", "Arginine activates NAGS → more NAG → more CPS I.", "Positive feedback after protein-rich meal"],
        ["10", "OTC deficiency = most common urea cycle disorder; X-linked.", "Males affected severely; presents in newborns"],
        ["11", "All other urea cycle disorders = autosomal recessive.", "OTC is the only X-linked one"],
        ["12", "4 ATP equivalents consumed per urea molecule.", "Highly exergonic → irreversible"],
        ["13", "2 nitrogens in urea: 1 from NH₃ (GDH), 1 from aspartate (AST).", "Both ultimately from glutamate"],
        ["14", "Arginase I is exclusive to the liver.", "Only liver can complete the full urea cycle"],
        ["15", "Cystinuria = COAL defect → kidney stones.", "Cystine, Ornithine, Arginine, Lysine"],
        ["16", "Hartnup = tryptophan transport defect → pellagra-like.", "Dermatitis, diarrhea, dementia (3 D's)"],
        ["17", "Enteropeptidase activates trypsinogen → trypsin activates all others.", "Master switch of pancreatic digestion"],
        ["18", "Phenylbutyrate exports 2 N; benzoate exports 1 N.", "Nitrogen scavenger drugs for hyperammonemia"],
        ["19", "In urea cycle defects, arginine becomes essential.", "Cannot be synthesized; must be supplemented"],
        ["20", "Branched-chain AAs (Val, Leu, Ile) bypass liver → muscle.", "Oxidized in muscle, not liver"],
    ]
    story.append(styled_table(oneliner_data, [0.8*cm, 9.5*cm, 5.9*cm]))
    story.append(SM)

    story.append(Paragraph(b("Memory Tricks"), h2))
    tricks = [
        ("Urea Cycle Steps", '"Can Citrulline Always Act Usefully?" = Carbamoyl-P → Citrulline → Argininosuccinate → Arginine → Urea'),
        ("COAL transport defect", '"COAL" = Cystine, Ornithine, Arginine, Lysine — all deficient in Cystinuria'),
        ("GDH regulation", '"GTP = Got Too much energy → stop degrading. ADP = A Deficit of energy → go degrade."'),
        ("PLP coenzyme", "B6 → PLP → ALL transaminations. If you see any aminotransferase, think Vitamin B6."),
        ("Urea nitrogens", "NH₃ from GDH (mito) = nitrogen #1. Aspartate from AST (cyto) = nitrogen #2."),
        ("OTC deficiency", "OTC = Only The Child (male newborn); X-linked; urea cycle shuts down → hyperammonemia."),
    ]
    for title, trick in tricks:
        story.append(KeyBox([f"{title}: {trick}"], bg=LIGHT_PURP, border=ACCENT_PURP))
        story.append(Spacer(1, 4))
    story.append(SM)

    # ── FINAL FLOW SUMMARY ─────────────────────────────────────────────────────
    story.append(section_header("★  Master Summary Flow", DEEP_NAVY))
    story.append(SM)
    flow_data = [
        ["Stage", "Process", "Key Enzyme/Agent", "Product"],
        ["Dietary protein", "Digestion (stomach, pancreas, brush border)", "Pepsin → Trypsin → Aminopeptidase", "Free amino acids"],
        ["Absorption", "Na⁺ / H⁺ cotransport into enterocytes", "PepT1 for di/tripeptides", "AAs → portal blood"],
        ["Nitrogen removal (Step 1)", "Transamination to α-ketoglutarate", "Aminotransferases (PLP)", "Glutamate + α-keto acid"],
        ["Nitrogen removal (Step 2)", "Oxidative deamination of glutamate", "GDH (NAD⁺; ADP activates)", "Free NH₃ + α-KG"],
        ["NH₃ transport (general)", "Packaging into glutamine", "Glutamine synthetase (ATP)", "Glutamine → liver"],
        ["NH₃ transport (muscle)", "Packaging into alanine", "ALT (Glucose-Alanine Cycle)", "Alanine → liver"],
        ["Urea synthesis (Mito 1)", "Carbamoyl phosphate formation", "CPS I (NAG activator)", "Carbamoyl-P"],
        ["Urea synthesis (Mito 2)", "Citrulline formation", "OTC", "Citrulline → cytoplasm"],
        ["Urea synthesis (Cyto 3)", "Argininosuccinate synthesis", "ASS (ATP)", "Argininosuccinate"],
        ["Urea synthesis (Cyto 4)", "Argininosuccinate cleavage", "ASL", "Arginine + Fumarate"],
        ["Urea synthesis (Cyto 5)", "Urea formation", "Arginase I (liver only)", "Urea + Ornithine"],
        ["Excretion", "Blood → kidneys → urine", "Renal filtration", "Urea excreted"],
    ]
    story.append(styled_table(flow_data, [4*cm, 5*cm, 4.5*cm, 2.7*cm]))
    story.append(SM)
    story.append(Paragraph(
        "All content based on: " + b("Lippincott's Illustrated Reviews: Biochemistry, Chapter 19") +
        " — Amino Acids: Disposal of Nitrogen.",
        caption))

    doc.build(story)
    print(f"PDF created: {OUTPUT}")

build_pdf()
Running Command

cd /home/daytona/workspace/nitrogen-study-guide && python3 generate_pdf.py 2>&1

Reading File
The issue is implicit string concatenation with function calls. Let me fix those Paragraph calls:
Editing File

~/nitrogen-study-guide/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nitrogen-study-guide/generate_pdf.py'
Running Command

cd /home/daytona/workspace/nitrogen-study-guide && python3 -c " import ast, sys with open('generate_pdf.py') as f: src = f.read() try: ast.parse(src) print('Syntax OK') except SyntaxError as e: print(f'SyntaxError at line {e.lineno}: {e.msg}') "

Running Command

cd /home/daytona/workspace/nitrogen-study-guide && python3 generate_pdf.py 2>&1

Editing File

~/nitrogen-study-guide/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nitrogen-study-guide/generate_pdf.py'
Running Command

cd /home/daytona/workspace/nitrogen-study-guide && python3 generate_pdf.py 2>&1

The CoverPage flowable needs to draw on its own page. Let me fix it to use a canvas-based approach instead:
Editing File

~/nitrogen-study-guide/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nitrogen-study-guide/generate_pdf.py'
Running Command

cd /home/daytona/workspace/nitrogen-study-guide && python3 generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/nitrogen-study-guide/Amino_Acids_Nitrogen_Disposal_Study_Guide.pdf

Your study guide PDF is ready! Here's your download link:

Amino Acids Nitrogen Disposal Study Guide

PDF Document · PDF


What's inside (12 pages):
SectionContent
Cover PageStyled title page with topic tags
Table of ContentsAll 11 sections with page numbers
Section 1-2Overview, amino acid pool, protein turnover & degradation systems
Section 3Protein digestion pipeline — with Figure 1 (4-station flow diagram: Stomach → Pancreas → Brush Border → Absorption)
Section 4Amino acid transport + Cystinuria & Hartnup disease tables
Section 5Transdeamination — with Figure 2 (two-panel transamination + oxidative deamination diagram), ALT/AST clinical table
Section 6Ammonia transport — with Figure 3 (Glucose-Alanine Cycle muscle-liver diagram)
Section 7Figure 4 — Full Urea Cycle Diagram (colour-coded mitochondria vs cytoplasm, all 5 steps numbered, enzymes labelled, NAG regulation box)
Section 8Step-by-step table, stoichiometry box, regulation, fate of urea
Section 9Hyperammonemia — with Figure 5 (types + treatment overview), all UCD deficiencies table
Section 10High-yield enzyme summary table + ammonia sources table
Section 1120 exam one-liners + 6 memory trick boxes
Master SummaryComplete nitrogen disposal flow table (soup to nuts)
This is a shared conversation. Sign in to Orris to start your own chat.