Explain the pdh complex

The pyruvate dehydrogenase (PDH) complex links glycolysis to the TCA cycle by converting pyruvate to acetyl-CoA. It's a large multi-enzyme complex with three main enzymes (E1, E2, E3) and uses five cofactors. Regulation is tight - it's inhibited by its own products and controlled by phosphorylation.
Searching sources...
Reading File
Finding Sources
Finding Sources
Now let me read the core sections on PDH structure and regulation from the textbooks, plus check for diagrams:
Reading File
Reading File
Reading File
Loading Image
Loading Image
Loading Image
I now have all I need. Here is a complete explanation of the PDH complex:

The Pyruvate Dehydrogenase Complex (PDC)

The PDC is a large multi-enzyme complex located in the mitochondrial matrix. Its job is to irreversibly convert pyruvate (the end product of glycolysis) into acetyl-CoA, linking glycolysis to the TCA cycle. Because this step is irreversible, it commits the carbon skeleton of glucose to full oxidation.
Overall reaction:
Pyruvate + CoA + NAD⁺ → Acetyl-CoA + CO₂ + NADH
PDC overview - pyruvate to acetyl CoA
Overview of the PDC reaction - Basic Medical Biochemistry, 6e

1. Structure - Three Enzymes, Five Cofactors

PDC belongs to the α-keto acid dehydrogenase complex family and shares its architecture with the α-ketoglutarate dehydrogenase complex (TCA step 4) and the branched-chain α-keto acid dehydrogenase complex.
SubunitEnzyme NameCofactorFunction
E1Pyruvate decarboxylaseTPP (thiamine pyrophosphate)Decarboxylates pyruvate; releases CO₂
E2Dihydrolipoyl transacetylaseLipoate (lipoic acid)Transfers acetyl group to CoA
E3Dihydrolipoyl dehydrogenaseFAD, then NAD⁺Reoxidizes lipoate; passes electrons to NAD⁺
The complex also contains an E3-binding protein (E3BP), and E1 itself is a tetramer (α₂β₂). E3 is shared among all α-keto acid dehydrogenases - a mutation in E3 therefore knocks out PDC, α-ketoglutarate dehydrogenase, and the branched-chain complex simultaneously.
Memory aid for the 5 cofactors: "Tender Loving Care For Nerds"
  • TPP (thiamine), Lipoic acid, CoA, FAD, NAD⁺

2. The Reaction Mechanism (Step by Step)

Mechanism of oxidative decarboxylation - Harper's Biochemistry 32e
The three-enzyme mechanism showing the lipoate "swinging arm" - Harper's Illustrated Biochemistry, 32e
Step 1 - E1 (decarboxylation): Pyruvate binds to TPP on E1. TPP attacks the carbonyl of pyruvate, releasing CO₂ and forming a hydroxyethyl-TPP intermediate.
Step 2 - E2 (transacetylation): The hydroxyethyl group is transferred to the oxidized lipoate arm on E2, forming acetyl-lipoamide. E2 then transfers the acetyl group to CoA-SH, producing acetyl-CoA and leaving lipoate in its reduced (dihydrolipoyl) form.
Step 3 - E3 (reoxidation): E3 reoxidizes the reduced lipoate using FAD → FADH₂. FADH₂ is then reoxidized by NAD⁺ → NADH, regenerating the oxidized lipoate for the next cycle.
The lipoate group acts as a long, flexible "swinging arm" (attached via an amide bond to a lysine residue) that physically channels intermediates between the active sites of E1, E2, and E3.

3. Regulation

PDC is one of the most tightly regulated enzymes in metabolism. There are two main mechanisms:

A. Covalent Modification (Phosphorylation / Dephosphorylation)

PDC regulation diagram - Basic Medical Biochemistry, 6e
PDC kinase/phosphatase regulation cycle - Basic Medical Biochemistry, 6e
  • PDC kinase phosphorylates serine residues on the E1-α subunit → inactivates PDC. Just one phosphorylation can reduce activity by >99%.
  • PDC phosphatase dephosphorylates E1 → activates PDC.
Both kinase and phosphatase are themselves regulatory subunits embedded within the PDC complex.
Activates PDC kinase (→ turns PDC OFF)Inhibits PDC kinase (→ keeps PDC ON)
Acetyl-CoA (product)ADP (low energy)
NADH (product)Pyruvate (substrate)
High ATP/ADP ratio
Activates PDC phosphatase (→ turns PDC ON)
Ca²⁺ (e.g., during muscle contraction)
Insulin (especially in adipocytes)

B. Allosteric / Product Inhibition

  • Products acetyl-CoA and NADH directly inhibit PDC. Crucially, their binding to PDC also stimulates the kinase, making the inhibition much stronger than simple product inhibition.
  • Substrates CoA and NAD⁺ reverse this inhibition.
Key physiological principle: When fatty acid oxidation is active, acetyl-CoA and NADH build up, which shuts down PDC. The cell conserves pyruvate for gluconeogenesis rather than burning it via the TCA cycle. This is the mechanism by which fat oxidation suppresses glucose oxidation (the reverse of the Randle cycle).

4. Clinical Relevance

PDC Deficiency

  • Among the most common inherited causes of lactic acidemia
  • Most common defect: mutation in the E1-α subunit gene, which is X-linked
  • Because pyruvate cannot enter the TCA cycle, it accumulates and is shunted to lactate (anaerobic glycolysis)
  • Classified under Leigh syndrome (subacute necrotizing encephalopathy)
  • The brain is especially vulnerable because it cannot use fatty acids as fuel and is completely dependent on glucose oxidation
  • Presentations range from severe neonatal lactic acidosis with death, to moderate lactic acidemia with progressive psychomotor disability

Inhibitors of PDC (cause lactic acidosis)

InhibitorMechanism
Arsenite / mercury ionsReact with -SH groups on lipoic acid, blocking E2
Thiamine (B1) deficiencyRemoves the TPP cofactor for E1 - seen in alcoholics and causes Wernicke encephalopathy

Insulin's role

In adipocytes, insulin activates PDC phosphatase, promoting PDC activity and thus providing acetyl-CoA for fatty acid synthesis.

Sources: Basic Medical Biochemistry: A Clinical Approach, 6e - pp. 844-847 | Harper's Illustrated Biochemistry, 32e - pp. 179-180

Discuss the synthesis of amp and gmp from imp

IMP (inosine monophosphate) is the branch point in purine synthesis where the pathway splits to make either AMP or GMP. AMP synthesis requires GTP as energy, while GMP synthesis requires ATP - a cross-regulation that helps balance their production.
Searching sources...
Finding Sources
Finding Sources
Reading File
Reading File
Good - now let me read the GMP synthesis section and get the key diagrams:
Reading File
Loading Image
Loading Image
Finding Sources
Now let me get the AMP synthesis diagram and the regulation section:
Reading File
Loading Image
Loading Image
I now have everything needed for a thorough answer. Let me also quickly get the AMP synthesis diagram from the text:
Reading File
Loading Image
All diagrams and content are now in hand. Here is the full explanation:

Synthesis of AMP and GMP from IMP

IMP (inosine monophosphate) is the branch point of de novo purine synthesis. Its base, hypoxanthine, is not found in DNA - it is exclusively an intermediate whose only purpose is to serve as the precursor for both adenine (AMP) and guanine (GMP) nucleotides. Once the purine ring is built as IMP (at a cost of 6 ATP equivalents starting from ribose 5-phosphate), the pathway splits into two separate two-step routes.

Pathway 1: IMP → AMP

Energy source: GTP
IMP to AMP - two step pathway via adenylosuccinate
IMP → Adenylosuccinate → AMP - Basic Medical Biochemistry, 6e

Step 1: IMP + Aspartate → Adenylosuccinate

  • Enzyme: Adenylosuccinate synthetase
  • Energy: GTP is hydrolyzed to GDP + Pi
  • Aspartate's amino group is condensed with the C-6 carbonyl of the hypoxanthine ring of IMP, forming the intermediate adenylosuccinate
  • This is mechanistically analogous to the argininosuccinate synthetase step in the urea cycle

Step 2: Adenylosuccinate → AMP + Fumarate

  • Enzyme: Adenylosuccinate lyase
  • Fumarate is cleaved off, leaving the amino group of aspartate attached at C-6 of the ring
  • The product is AMP (adenine base = aminopurine)
  • Again analogous to the urea cycle: aspartate donates a nitrogen while its carbon skeleton exits as fumarate
Key point: Aspartate is the nitrogen donor for the amino group that distinguishes adenine from hypoxanthine. The carbon skeleton of aspartate is not incorporated - it leaves as fumarate.

Pathway 2: IMP → GMP

Energy source: ATP
IMP to GMP - two step pathway via XMP
IMP → XMP → GMP - Basic Medical Biochemistry, 6e

Step 1: IMP → XMP (Xanthosine monophosphate)

  • Enzyme: IMP dehydrogenase
  • Cofactor: NAD⁺ → NADH is produced
  • The hypoxanthine base is oxidized at C-2, converting it to xanthine (a dioxypurine)
  • This is the rate-limiting step of GMP synthesis and a major drug target (see below)

Step 2: XMP + Glutamine → GMP

  • Enzyme: GMP synthetase
  • Energy: ATP → AMP + PPi (pyrophosphate is hydrolyzed, driving the reaction forward)
  • Glutamine donates its amide nitrogen to C-2 of the xanthine ring, converting the oxo group to an amino group
  • The product is GMP (guanine base = aminooxypurine)

Side-by-Side Comparison

FeatureIMP → AMPIMP → GMP
IntermediateAdenylosuccinateXMP
Nitrogen donorAspartateGlutamine
Energy requiredGTPATP
Step 1 enzymeAdenylosuccinate synthetaseIMP dehydrogenase
Step 2 enzymeAdenylosuccinate lyaseGMP synthetase
Byproduct releasedFumarateGlutamate + PPi
Step 1 redox changeNoneNAD⁺ → NADH

Regulation - Cross-Reciprocal Control

Purine synthesis regulation showing feedback inhibition loops
Regulation of purine nucleotide synthesis - Basic Medical Biochemistry, 6e
The two branch pathways are regulated in an elegant, cross-reciprocal fashion:
Feedback inhibition at the branch:
  • AMP inhibits adenylosuccinate synthetase (the first step of its own synthesis)
  • GMP inhibits IMP dehydrogenase (the first step of its own synthesis)
Cross-stimulation of energy supply:
  • AMP synthesis requires GTP as energy - so when GMP/GTP levels are high, AMP production is stimulated
  • GMP synthesis requires ATP as energy - so when AMP/ATP levels are high, GMP production is stimulated
This mutual dependence ensures that when one nucleotide accumulates, it simultaneously provides the energy currency needed to make the other, keeping the adenine and guanine pools balanced.
Upstream regulation:
  • PRPP synthetase (makes PRPP, the activated ribose donor) is inhibited by ADP and GDP
  • Glutamine phosphoribosylamidotransferase (the committed step - makes 5-phosphoribosyl 1-amine from PRPP) is strongly inhibited by AMP and GMP binding to distinct allosteric sites; excess product converts the active monomer (133 kDa) into an inactive dimer (270 kDa)

Phosphorylation to Di- and Triphosphates

AMP and GMP do not remain as monophosphates. They are sequentially phosphorylated:
  • AMP → ADP → ATP by adenylate kinase, then nucleoside diphosphate kinase
  • GMP → GDP → GTP by specific NMP kinases, then nucleoside diphosphate kinase
Nucleoside diphosphate kinase is broad-specificity and uses any NTP as the phosphate donor.

Clinical Relevance: IMP Dehydrogenase as a Drug Target

Because IMP dehydrogenase is the committed, rate-limiting step of GMP synthesis, it is a target of immunosuppressive drugs:
  • Mycophenolate mofetil (MMF) - inhibits IMPDH, depleting GMP and GTP pools. Rapidly dividing lymphocytes are especially vulnerable because they depend on de novo purine synthesis (they lack robust salvage), making MMF a potent immunosuppressant used in organ transplantation and autoimmune disease.
  • Inhibition of IMPDH creates a relative GMP deficiency and relative AMP excess, which feeds back to suppress the entire de novo purine pathway.
Sources: Basic Medical Biochemistry: A Clinical Approach, 6e - pp. 1415-1421 | Biochemistry, Lippincott Illustrated Reviews, 8e - pp. 828-830 | Comprehensive Clinical Nephrology, 7e

Explain gluconeogensis with respect to the names of the intermediate? enyme and cofactor

Gluconeogenesis synthesizes glucose from non-carbohydrate precursors (pyruvate, lactate, amino acids, glycerol). It largely reverses glycolysis but uses 4 unique bypass enzymes to get around the irreversible glycolytic steps.
Searching sources...
Finding Sources
Reading File
Finding Sources
Reading File
Loading Image
Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Now let me get the regulation section and the full step-by-step details:
Reading File
Reading File
I now have comprehensive content. Let me compile the full, detailed explanation:

Gluconeogenesis: Intermediates, Enzymes, and Cofactors

Gluconeogenesis is the synthesis of glucose from non-carbohydrate precursors, occurring predominantly in the liver (and kidney cortex during starvation). It is essentially a near-reversal of glycolysis, but three irreversible glycolytic steps are bypassed by four unique gluconeogenic enzymes.
Key reactions of gluconeogenesis - pyruvate to glucose via oxaloacetate and PEP
Overview of gluconeogenesis from pyruvate, lactate, alanine and glycerol - Basic Medical Biochemistry, 6e

Gluconeogenic Precursors (Entry Points)

Before the pathway begins, non-carbohydrate substrates must be converted to pathway intermediates:
PrecursorConverted toEnzymeCofactor
LactatePyruvateLactate dehydrogenaseNAD⁺ → NADH
AlaninePyruvateAlanine aminotransferasePyridoxal phosphate (PLP, B6)
GlycerolGlycerol 3-phosphate → DHAPGlycerol kinase, then glycerol-3-P dehydrogenaseATP; NAD⁺
Glucogenic amino acidsTCA intermediates (OAA, α-KG, fumarate, succinyl-CoA)Various transaminasesPLP (B6)
Odd-chain fatty acidsPropionyl-CoA → Methylmalonyl-CoA → Succinyl-CoAPropionyl-CoA carboxylase, mutaseBiotin; Vitamin B12
Note: Acetyl-CoA (from even-chain fatty acids and ketogenic amino acids) cannot contribute net carbons to glucose - this is why fat cannot be converted to glucose in humans.

The Gluconeogenic Pathway: Step by Step

The pathway runs from pyruvate up to glucose. Steps 1-2 are the unique gluconeogenic bypass; steps 3-10 use the same enzymes as glycolysis (running in reverse); steps 11 and 13 are the remaining two unique bypasses.

BYPASS 1: Pyruvate → Phosphoenolpyruvate (PEP)

(Bypasses the irreversible pyruvate kinase step of glycolysis)
This requires two enzymes and crosses two compartments.

Step 1 (Mitochondria): Pyruvate → Oxaloacetate (OAA)

  • Enzyme: Pyruvate carboxylase
  • Cofactors: Biotin (CO₂ carrier), ATP → ADP + Pi, Mn²⁺
  • Allosteric activator: Acetyl-CoA (obligate activator - the enzyme is inactive without it)
  • Reaction: Pyruvate + CO₂ + ATP → Oxaloacetate + ADP + Pi
  • OAA cannot cross the inner mitochondrial membrane directly. It is converted to malate (by malate dehydrogenase, using NADH) or aspartate (by transamination) to shuttle out to the cytosol. Once in the cytosol, these carriers are reconverted back to OAA.

Step 2 (Cytosol): Oxaloacetate → Phosphoenolpyruvate (PEP)

  • Enzyme: Phosphoenolpyruvate carboxykinase (PEPCK)
  • Cofactor: GTP → GDP + CO₂
  • Reaction: OAA + GTP → PEP + CO₂ + GDP
  • PEPCK is an inducible enzyme - glucagon and epinephrine raise cAMP, activating protein kinase A, which induces transcription of the PEPCK gene. Insulin suppresses it.
Together, these two steps consume 2 high-energy bonds (1 ATP + 1 GTP) to bypass a single step that generates only 1 ATP in glycolysis (pyruvate kinase). The extra energy input makes the bypass thermodynamically favorable in the gluconeogenic direction.

Steps 3-9: PEP → Glyceraldehyde 3-phosphate (Reversal of Glycolysis)

These steps use the same enzymes as glycolysis, running in reverse. They are freely reversible.
StepIntermediateEnzymeCofactor
3PEP → 2-PhosphoglycerateEnolaseMg²⁺
42-Phosphoglycerate → 3-PhosphoglyceratePhosphoglycerate mutase2,3-BPG (cofactor)
53-Phosphoglycerate → 1,3-BisphosphoglyceratePhosphoglycerate kinaseATP consumed (GNG)
61,3-Bisphosphoglycerate → Glyceraldehyde 3-phosphateGlyceraldehyde 3-P dehydrogenaseNADH → NAD⁺
7Glyceraldehyde 3-P ⇌ Dihydroxyacetone phosphate (DHAP)Triose phosphate isomeraseNone
Step 6 is notable: gluconeogenesis consumes NADH here (the reverse of the glycolytic step). The NADH needed is supplied by the malate → OAA conversion in the cytosol (when OAA exits mitochondria as malate).

Step 8: Triose Phosphate Condensation → Fructose 1,6-bisphosphate

  • Two triose phosphates (DHAP + Glyceraldehyde 3-P) condense
  • Enzyme: Aldolase (same as glycolysis, running in reverse)
  • Cofactor: None
  • Intermediate produced: Fructose 1,6-bisphosphate
Glycerol enters the pathway here as DHAP (after glycerol → glycerol 3-P → DHAP).

BYPASS 2: Fructose 1,6-bisphosphate → Fructose 6-phosphate

(Bypasses the irreversible PFK-1 step of glycolysis)
  • Enzyme: Fructose 1,6-bisphosphatase (FBPase-1)
  • Cofactor: H₂O (hydrolysis reaction); Mg²⁺
  • Reaction: Fructose 1,6-bisphosphate + H₂O → Fructose 6-phosphate + Pi
  • Phosphate is hydrolytically removed (not transferred to ADP), so no ATP is generated
  • Inhibited by: AMP, fructose 2,6-bisphosphate (F-2,6-BP)
  • Activated by: Citrate
F-2,6-BP is the most potent regulator of this futile cycle. It simultaneously activates PFK-1 (glycolysis ON) and inhibits FBPase-1 (gluconeogenesis OFF). Glucagon lowers F-2,6-BP levels, tipping the balance toward gluconeogenesis.

Step 9: Fructose 6-phosphate → Glucose 6-phosphate

  • Enzyme: Phosphoglucose isomerase (same as glycolysis)
  • Cofactor: None
  • Intermediate: Glucose 6-phosphate

BYPASS 3: Glucose 6-phosphate → Glucose

(Bypasses the irreversible glucokinase/hexokinase step of glycolysis)
  • Enzyme: Glucose 6-phosphatase
  • Cofactor: H₂O (hydrolysis); located in the ER membrane
  • Reaction: Glucose 6-phosphate + H₂O → Glucose + Pi
  • Again, phosphate is hydrolyzed - no ATP produced
  • Glucose is released into the bloodstream
  • This enzyme is present in liver and kidney, not in muscle or brain - which is why those tissues cannot export free glucose

Complete Pathway Summary Table

StepIntermediateEnzymeCofactorUnique to GNG?
Precursor entryLactate → PyruvateLactate dehydrogenaseNAD⁺No
Precursor entryAlanine → PyruvateAlanine aminotransferasePLP (B6)No
1 (mito)Pyruvate → OxaloacetatePyruvate carboxylaseBiotin, ATP, Mn²⁺YES
2 (cytosol)Oxaloacetate → PEPPEPCKGTPYES
3PEP → 2-PhosphoglycerateEnolaseMg²⁺No (shared)
42-PG → 3-PhosphoglyceratePhosphoglycerate mutase2,3-BPGNo
53-PG → 1,3-BisphosphoglyceratePhosphoglycerate kinaseATPNo
61,3-BPG → Glyceraldehyde 3-PGAPDHNADH → NAD⁺No
7Glyceraldehyde 3-P ⇌ DHAPTriose phosphate isomerase-No
8DHAP + G3P → Fructose 1,6-bisphosphateAldolase-No
9Fructose 1,6-bisphosphate → Fructose 6-PFructose 1,6-bisphosphataseH₂O, Mg²⁺YES
10Fructose 6-P → Glucose 6-PPhosphoglucose isomerase-No
11Glucose 6-P → GlucoseGlucose 6-phosphataseH₂OYES

Energy Cost

Synthesizing 1 molecule of glucose from 2 pyruvates costs:
  • 4 ATP (steps 1 and 5 ×2)
  • 2 GTP (PEPCK ×2)
  • 2 NADH consumed (GAPDH step ×2)
  • Total: 6 high-energy bonds (vs. 2 ATP net yield from glycolysis)

Regulation Summary

EnzymeActivated byInhibited by
Pyruvate carboxylaseAcetyl-CoA (obligate), high ATPADP
PEPCKcAMP (glucagon/epinephrine) → gene inductionInsulin → gene repression
Fructose 1,6-bisphosphataseCitrate, low AMPAMP, Fructose 2,6-bisphosphate
Glucose 6-phosphatase-Product inhibition
(Glycolytic) Pyruvate kinaseF-1,6-BPATP, alanine, phosphorylation (glucagon)
(Glycolytic) PFK-1AMP, F-2,6-BPATP, citrate
The master switch is glucagon (fasting) which:
  1. Raises cAMP → induces PEPCK gene
  2. Raises cAMP → activates protein kinase A → phosphorylates and inactivates pyruvate kinase (blocking glycolysis)
  3. Lowers F-2,6-BP → activates FBPase-1 and inhibits PFK-1 simultaneously
Source: Basic Medical Biochemistry: A Clinical Approach, 6e - pp. 1007-1023

Create a study guide comparing glycolysis vs gluconeogenesis

Asking for Preferences

What format would you like the study guide in? · What level of detail?

Give me the full pdf of this gluconeogensis answer

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or does not exist"

Running Command

mkdir -p /home/daytona/workspace/gluconeogenesis && python3 -c "import reportlab; print('reportlab ok')" && python3 -c "import requests; print('requests ok')"

Now I'll write the full Python script to generate the PDF:
Writing File

~/gluconeogenesis/build_pdf.py

"""
Gluconeogenesis Study Guide PDF Generator
Uses reportlab for PDF creation and downloads images from CDN.
"""

import requests
import os
from io import BytesIO
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    Image, HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus.flowables import BalancedColumns

OUTPUT = "/home/daytona/workspace/gluconeogenesis/Gluconeogenesis_Study_Guide.pdf"
IMG_DIR = "/home/daytona/workspace/gluconeogenesis/images"
os.makedirs(IMG_DIR, exist_ok=True)

# ── colour palette ────────────────────────────────────────────────────────────
NAVY   = colors.HexColor("#1B3A6B")
TEAL   = colors.HexColor("#0E7C7B")
AMBER  = colors.HexColor("#F4A261")
LIGHT  = colors.HexColor("#EAF2FB")
HEADER = colors.HexColor("#D6EAF8")
ALT    = colors.HexColor("#F0F9F9")
WHITE  = colors.white
RED    = colors.HexColor("#C0392B")
GREEN  = colors.HexColor("#1E8449")

# ── image URLs ────────────────────────────────────────────────────────────────
IMAGES = {
    "overview":    "https://cdn.orris.care/cdss_images/1033afbf1aa89f7a4caf415222ecc659d73c3ce80299a80c621c4f972f985406.png",
    "gly_gng":    "https://cdn.orris.care/cdss_images/e3f683aeeab1bc322a2429aabc79da337494be71de652f10c9cd83936890cfb8.png",
}

def download_image(url, name):
    path = os.path.join(IMG_DIR, name + ".png")
    if not os.path.exists(path):
        try:
            r = requests.get(url, timeout=15)
            if r.status_code == 200:
                with open(path, "wb") as f:
                    f.write(r.content)
                print(f"Downloaded {name}")
            else:
                print(f"Failed {name}: {r.status_code}")
                return None
        except Exception as e:
            print(f"Error {name}: {e}")
            return None
    return path

# ── styles ────────────────────────────────────────────────────────────────────
def make_styles():
    base = getSampleStyleSheet()

    styles = {}

    styles["title"] = ParagraphStyle(
        "title", parent=base["Normal"],
        fontSize=26, leading=32, textColor=WHITE,
        fontName="Helvetica-Bold", alignment=TA_CENTER,
        spaceAfter=4
    )
    styles["subtitle"] = ParagraphStyle(
        "subtitle", parent=base["Normal"],
        fontSize=13, leading=18, textColor=colors.HexColor("#BFD7ED"),
        fontName="Helvetica", alignment=TA_CENTER,
        spaceAfter=2
    )
    styles["h1"] = ParagraphStyle(
        "h1", parent=base["Normal"],
        fontSize=16, leading=20, textColor=WHITE,
        fontName="Helvetica-Bold", spaceBefore=6, spaceAfter=4
    )
    styles["h2"] = ParagraphStyle(
        "h2", parent=base["Normal"],
        fontSize=13, leading=17, textColor=NAVY,
        fontName="Helvetica-Bold", spaceBefore=10, spaceAfter=4,
        borderPad=4
    )
    styles["h3"] = ParagraphStyle(
        "h3", parent=base["Normal"],
        fontSize=11, leading=14, textColor=TEAL,
        fontName="Helvetica-Bold", spaceBefore=6, spaceAfter=2
    )
    styles["body"] = ParagraphStyle(
        "body", parent=base["Normal"],
        fontSize=9.5, leading=14, textColor=colors.HexColor("#222222"),
        fontName="Helvetica", spaceAfter=4, alignment=TA_JUSTIFY
    )
    styles["bullet"] = ParagraphStyle(
        "bullet", parent=base["Normal"],
        fontSize=9.5, leading=13, textColor=colors.HexColor("#222222"),
        fontName="Helvetica", leftIndent=14, spaceAfter=2,
        bulletIndent=4
    )
    styles["note"] = ParagraphStyle(
        "note", parent=base["Normal"],
        fontSize=9, leading=13, textColor=colors.HexColor("#555555"),
        fontName="Helvetica-Oblique", spaceAfter=4, leftIndent=8
    )
    styles["caption"] = ParagraphStyle(
        "caption", parent=base["Normal"],
        fontSize=8, leading=11, textColor=colors.HexColor("#666666"),
        fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=6
    )
    styles["cell"] = ParagraphStyle(
        "cell", parent=base["Normal"],
        fontSize=8.5, leading=12, textColor=colors.HexColor("#111111"),
        fontName="Helvetica"
    )
    styles["cell_bold"] = ParagraphStyle(
        "cell_bold", parent=base["Normal"],
        fontSize=8.5, leading=12, textColor=NAVY,
        fontName="Helvetica-Bold"
    )
    styles["cell_hdr"] = ParagraphStyle(
        "cell_hdr", parent=base["Normal"],
        fontSize=9, leading=12, textColor=WHITE,
        fontName="Helvetica-Bold", alignment=TA_CENTER
    )
    return styles

# ── helpers ───────────────────────────────────────────────────────────────────
def section_header(text, styles):
    """Dark navy banner for section headings."""
    tbl = Table([[Paragraph(text, styles["h1"])]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), NAVY),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return tbl

def teal_box(text, styles):
    """Teal info-box for key points."""
    tbl = Table([[Paragraph(text, styles["body"])]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), ALT),
        ("LEFTBORDERPADDING", (0,0), (0,-1), 6),
        ("LINEAFTER",  (0,0), (0,-1), 3, TEAL),  # left accent bar via right border of col
        ("LINEBEFORE", (0,0), (0,-1), 3, TEAL),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return tbl

def amber_box(text, styles):
    """Amber highlight box for clinical points."""
    tbl = Table([[Paragraph(text, styles["body"])]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",  (0,0), (-1,-1), colors.HexColor("#FEF9E7")),
        ("LINEBEFORE",  (0,0), (0,-1), 4, AMBER),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return tbl

def red_box(text, styles):
    tbl = Table([[Paragraph(text, styles["body"])]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",  (0,0), (-1,-1), colors.HexColor("#FDEDEC")),
        ("LINEBEFORE",  (0,0), (0,-1), 4, RED),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return tbl

def make_table(headers, rows, styles, col_widths=None):
    s = styles
    data = [[Paragraph(h, s["cell_hdr"]) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), s["cell_bold"] if j == 0 else s["cell"])
                     for j, c in enumerate(row)])
    if col_widths is None:
        w = 17 * cm
        col_widths = [w / len(headers)] * len(headers)
    tbl = Table(data, colWidths=col_widths, repeatRows=1)
    ts = TableStyle([
        ("BACKGROUND",    (0, 0), (-1, 0), NAVY),
        ("TEXTCOLOR",     (0, 0), (-1, 0), WHITE),
        ("ALIGN",         (0, 0), (-1, -1), "LEFT"),
        ("VALIGN",        (0, 0), (-1, -1), "MIDDLE"),
        ("FONTNAME",      (0, 0), (-1, 0), "Helvetica-Bold"),
        ("FONTSIZE",      (0, 0), (-1, 0), 9),
        ("TOPPADDING",    (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
        ("LEFTPADDING",   (0, 0), (-1, -1), 6),
        ("GRID",          (0, 0), (-1, -1), 0.4, colors.HexColor("#CCCCCC")),
        ("ROWBACKGROUNDS",(0, 1), (-1, -1), [WHITE, LIGHT]),
    ])
    tbl.setStyle(ts)
    return tbl

# ── document builder ──────────────────────────────────────────────────────────
def build():
    s = make_styles()
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=2*cm, rightMargin=2*cm,
        topMargin=2*cm,  bottomMargin=2*cm,
        title="Gluconeogenesis Study Guide",
        author="Orris Medical",
    )

    story = []

    # ── COVER ──────────────────────────────────────────────────────────────────
    cover_tbl = Table(
        [[Paragraph("GLUCONEOGENESIS", s["title"])],
         [Paragraph("Complete Study Guide: Intermediates · Enzymes · Cofactors · Regulation", s["subtitle"])],
         [Paragraph("Source: Basic Medical Biochemistry, 6e  |  Orris Medical", s["subtitle"])]],
        colWidths=[17*cm]
    )
    cover_tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), NAVY),
        ("TOPPADDING",    (0,0), (-1,-1), 18),
        ("BOTTOMPADDING", (0,0), (-1,-1), 18),
        ("LEFTPADDING",   (0,0), (-1,-1), 16),
        ("RIGHTPADDING",  (0,0), (-1,-1), 16),
    ]))
    story.append(cover_tbl)
    story.append(Spacer(1, 0.5*cm))

    # ── OVERVIEW IMAGE ─────────────────────────────────────────────────────────
    img_path = download_image(IMAGES["overview"], "overview")
    if img_path and os.path.exists(img_path):
        story.append(Image(img_path, width=10*cm, height=14*cm, kind="proportional"))
        story.append(Paragraph(
            "Figure 1 – Key reactions of gluconeogenesis. Precursors (lactate, alanine, glycerol, amino acids) → Glucose. "
            "Red arrows mark the four unique gluconeogenic enzymes (bypass steps). "
            "Source: Basic Medical Biochemistry, 6e, p. 1011",
            s["caption"]
        ))

    story.append(Spacer(1, 0.3*cm))

    # ── 1. OVERVIEW ────────────────────────────────────────────────────────────
    story.append(section_header("1.  Overview", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "Gluconeogenesis is the synthesis of glucose from non-carbohydrate precursors. It occurs mainly in "
        "the <b>hepatocyte cytosol and mitochondria</b>, with a minor contribution from the renal cortex during "
        "prolonged starvation. The pathway is essentially the reverse of glycolysis, except at three points "
        "where the irreversible glycolytic reactions are bypassed by four dedicated gluconeogenic enzymes.",
        s["body"]
    ))
    story.append(Spacer(1, 0.15*cm))

    overview_rows = [
        ["Location",         "Liver (primary), renal cortex (starvation)"],
        ["Direction",        "Non-carbohydrate precursors → Glucose"],
        ["Net energy cost",  "6 ATP equivalents (4 ATP + 2 GTP) per glucose"],
        ["NADH consumed",    "2 NADH (at GAPDH step)"],
        ["Unique enzymes",   "4 (pyruvate carboxylase, PEPCK, FBPase-1, G6Pase)"],
        ["Shared enzymes",   "7 steps shared with glycolysis (running in reverse)"],
        ["Key trigger",      "Fasting, stress → glucagon/cortisol/epinephrine rise"],
    ]
    story.append(make_table(["Property", "Detail"], overview_rows, s,
                             col_widths=[5*cm, 12*cm]))
    story.append(Spacer(1, 0.3*cm))
    story.append(red_box(
        "<b>Important:</b> Acetyl-CoA (from even-chain fatty acids and ketogenic amino acids) CANNOT "
        "contribute net carbons to glucose because the two carbons entering the TCA as acetyl-CoA "
        "are lost as CO₂ before OAA can be regenerated. This is why fat cannot be converted to glucose in humans.",
        s
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 2. PRECURSORS ──────────────────────────────────────────────────────────
    story.append(section_header("2.  Gluconeogenic Precursors", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "Before entering the gluconeogenic pathway, non-carbohydrate substrates must be converted "
        "to pathway intermediates. The major precursors and their conversion reactions are:",
        s["body"]
    ))
    story.append(Spacer(1, 0.15*cm))

    prec_rows = [
        ["Lactate",             "Pyruvate",              "Lactate dehydrogenase",                "NAD⁺ → NADH"],
        ["Alanine",             "Pyruvate",              "Alanine aminotransferase",              "Pyridoxal phosphate (B6)"],
        ["Glucogenic AAs",      "TCA intermediates → OAA", "Various transaminases",              "Pyridoxal phosphate (B6)"],
        ["Glycerol",            "Glycerol 3-P → DHAP",   "Glycerol kinase + G3P dehydrogenase",  "ATP; NAD⁺"],
        ["Odd-chain fatty acids","Propionyl-CoA → Succinyl-CoA", "Propionyl-CoA carboxylase + mutase", "Biotin; Vit B12"],
        ["Propionate",          "Succinyl-CoA",          "Methylmalonyl-CoA mutase",              "Vitamin B12 (cobalamin)"],
    ]
    story.append(make_table(
        ["Precursor", "Enters as", "Enzyme(s)", "Cofactor(s)"],
        prec_rows, s, col_widths=[3.5*cm, 4*cm, 5.5*cm, 4*cm]
    ))
    story.append(Spacer(1, 0.3*cm))
    story.append(amber_box(
        "<b>Cori Cycle:</b> Lactate produced by anaerobic glycolysis in red blood cells and exercising "
        "muscle travels to the liver, where it is converted back to glucose by gluconeogenesis. "
        "The glucose returns to peripheral tissues — a metabolic partnership that offloads the energy burden from muscle to liver.",
        s
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 3. STEP-BY-STEP PATHWAY ────────────────────────────────────────────────
    story.append(section_header("3.  Step-by-Step Pathway", s))
    story.append(Spacer(1, 0.15*cm))
    story.append(Paragraph(
        "The pathway is presented in the gluconeogenic direction (pyruvate → glucose). "
        "<b>Steps marked ★ are unique to gluconeogenesis</b>; all other steps use shared glycolytic enzymes running in reverse.",
        s["body"]
    ))
    story.append(Spacer(1, 0.2*cm))

    # BYPASS 1 header
    story.append(Paragraph("★ BYPASS 1 — Pyruvate → Phosphoenolpyruvate (PEP)", s["h2"]))
    story.append(Paragraph(
        "The irreversible pyruvate kinase step of glycolysis is bypassed by a two-enzyme sequence "
        "spanning the mitochondrial matrix and cytosol.",
        s["body"]
    ))

    bypass1_rows = [
        ["★ 1a (Mitochondria)",
         "Pyruvate → Oxaloacetate (OAA)",
         "Pyruvate carboxylase",
         "Biotin (CO₂ carrier), ATP → ADP + Pi, Mn²⁺",
         "Obligate activator: Acetyl-CoA"],
        ["★ 1b (Cytosol)",
         "OAA → Phosphoenolpyruvate (PEP)",
         "PEPCK (PEP carboxykinase)",
         "GTP → GDP + CO₂",
         "Inducible by cAMP (glucagon); suppressed by insulin"],
        ["Transit",
         "OAA → Malate or Aspartate (shuttle across inner mitochondrial membrane)",
         "Malate dehydrogenase / Aspartate aminotransferase",
         "NADH (for malate); PLP (for aspartate)",
         "OAA cannot cross membrane directly"],
    ]
    story.append(make_table(
        ["Step", "Reaction", "Enzyme", "Cofactor(s)", "Notes"],
        bypass1_rows, s,
        col_widths=[2.5*cm, 4*cm, 3.5*cm, 3.5*cm, 3.5*cm]
    ))
    story.append(Spacer(1, 0.2*cm))
    story.append(teal_box(
        "<b>Energy note:</b> Together steps 1a+1b consume 1 ATP + 1 GTP = 2 high-energy bonds to bypass one "
        "step that generates only 1 ATP in glycolysis (pyruvate kinase). The extra energy input drives the "
        "reaction in the gluconeogenic direction.",
        s
    ))
    story.append(Spacer(1, 0.3*cm))

    # Shared steps PEP → Fructose 1,6-BP
    story.append(Paragraph("Shared Steps — PEP → Fructose 1,6-bisphosphate", s["h2"]))
    story.append(Paragraph(
        "These steps use the same enzymes as glycolysis, but the carbon flow is in the reverse direction.",
        s["body"]
    ))
    shared_rows = [
        ["2", "PEP → 2-Phosphoglycerate",                       "Enolase",                       "Mg²⁺",             "—"],
        ["3", "2-Phosphoglycerate → 3-Phosphoglycerate",         "Phosphoglycerate mutase",        "2,3-BPG",          "—"],
        ["4", "3-Phosphoglycerate → 1,3-Bisphosphoglycerate",    "Phosphoglycerate kinase",        "ATP consumed",     "ATP is CONSUMED here (reverse of glycolysis)"],
        ["5", "1,3-BPG → Glyceraldehyde 3-phosphate (G3P)",     "GAPDH",                         "NADH → NAD⁺",      "NADH consumed (source: malate shuttle)"],
        ["6", "G3P ⇌ Dihydroxyacetone phosphate (DHAP)",        "Triose phosphate isomerase",     "None",             "—"],
        ["7", "DHAP + G3P → Fructose 1,6-bisphosphate",         "Aldolase",                      "None",             "Glycerol enters here as DHAP"],
    ]
    story.append(make_table(
        ["Step", "Reaction", "Enzyme", "Cofactor", "Notes"],
        shared_rows, s,
        col_widths=[1.5*cm, 4.5*cm, 3.5*cm, 2.5*cm, 5*cm]
    ))
    story.append(Spacer(1, 0.3*cm))

    # BYPASS 2
    story.append(Paragraph("★ BYPASS 2 — Fructose 1,6-bisphosphate → Fructose 6-phosphate", s["h2"]))
    bypass2_rows = [
        ["★ 8",
         "Fructose 1,6-bisphosphate → Fructose 6-phosphate + Pi",
         "Fructose 1,6-bisphosphatase (FBPase-1)",
         "H₂O, Mg²⁺",
         "Hydrolysis — no ATP produced. Inhibited by AMP, F-2,6-BP; activated by citrate"],
    ]
    story.append(make_table(
        ["Step", "Reaction", "Enzyme", "Cofactor", "Notes"],
        bypass2_rows, s,
        col_widths=[1.5*cm, 4.5*cm, 3.5*cm, 2.5*cm, 5*cm]
    ))
    story.append(Spacer(1, 0.2*cm))

    # Shared F6P → G6P
    story.append(Paragraph("Shared Step — Fructose 6-phosphate → Glucose 6-phosphate", s["h2"]))
    shared2_rows = [
        ["9",
         "Fructose 6-phosphate → Glucose 6-phosphate",
         "Phosphoglucose isomerase",
         "None",
         "Same enzyme as glycolysis"],
    ]
    story.append(make_table(
        ["Step", "Reaction", "Enzyme", "Cofactor", "Notes"],
        shared2_rows, s,
        col_widths=[1.5*cm, 4.5*cm, 3.5*cm, 2.5*cm, 5*cm]
    ))
    story.append(Spacer(1, 0.2*cm))

    # BYPASS 3
    story.append(Paragraph("★ BYPASS 3 — Glucose 6-phosphate → Free Glucose", s["h2"]))
    bypass3_rows = [
        ["★ 10",
         "Glucose 6-phosphate → Glucose + Pi",
         "Glucose 6-phosphatase",
         "H₂O",
         "ER membrane enzyme. Present in liver & kidney ONLY — not muscle/brain. Hydrolysis, no ATP produced."],
    ]
    story.append(make_table(
        ["Step", "Reaction", "Enzyme", "Cofactor", "Notes"],
        bypass3_rows, s,
        col_widths=[1.5*cm, 4.5*cm, 3.5*cm, 2.5*cm, 5*cm]
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 4. MASTER SUMMARY TABLE ────────────────────────────────────────────────
    story.append(PageBreak())
    story.append(section_header("4.  Master Summary Table", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "Complete step-by-step overview of gluconeogenesis from pyruvate to glucose. "
        "★ marks the four unique gluconeogenic enzymes.",
        s["body"]
    ))
    story.append(Spacer(1, 0.15*cm))

    master_rows = [
        ["Precursor entry",  "Lactate → Pyruvate",                      "Lactate dehydrogenase",         "NAD⁺",              "No"],
        ["Precursor entry",  "Alanine → Pyruvate",                      "Alanine aminotransferase",      "PLP (B6)",          "No"],
        ["Precursor entry",  "Glycerol → Glycerol-3-P → DHAP",         "Glycerol kinase + G3PDH",        "ATP; NAD⁺",        "No"],
        ["★ 1a (mito)",      "Pyruvate → Oxaloacetate",                  "Pyruvate carboxylase",          "Biotin, ATP, Mn²⁺", "YES"],
        ["★ 1b (cytosol)",   "OAA → PEP",                               "PEPCK",                         "GTP",               "YES"],
        ["2",                "PEP → 2-Phosphoglycerate",                 "Enolase",                       "Mg²⁺",              "No"],
        ["3",                "2-PG → 3-Phosphoglycerate",               "Phosphoglycerate mutase",        "2,3-BPG",           "No"],
        ["4",                "3-PG → 1,3-Bisphosphoglycerate",          "Phosphoglycerate kinase",        "ATP consumed",      "No"],
        ["5",                "1,3-BPG → Glyceraldehyde 3-P",           "GAPDH",                         "NADH → NAD⁺",      "No"],
        ["6",                "G3P ⇌ DHAP",                              "Triose phosphate isomerase",    "None",              "No"],
        ["7",                "DHAP + G3P → Fructose 1,6-bisphosphate",  "Aldolase",                      "None",              "No"],
        ["★ 8",              "Fructose 1,6-BP → Fructose 6-P",          "Fructose 1,6-bisphosphatase",   "H₂O, Mg²⁺",        "YES"],
        ["9",                "Fructose 6-P → Glucose 6-P",              "Phosphoglucose isomerase",      "None",              "No"],
        ["★ 10",             "Glucose 6-P → Glucose",                   "Glucose 6-phosphatase",         "H₂O",               "YES"],
    ]
    story.append(make_table(
        ["Step", "Reaction (Intermediate → Intermediate)", "Enzyme", "Cofactor(s)", "Unique to GNG?"],
        master_rows, s,
        col_widths=[2*cm, 5.5*cm, 4*cm, 3*cm, 2.5*cm]
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 5. ENERGY COST ─────────────────────────────────────────────────────────
    story.append(section_header("5.  Energy Cost", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "Synthesizing 1 molecule of glucose from 2 pyruvates requires a net input of <b>6 high-energy bonds</b>:",
        s["body"]
    ))
    story.append(Spacer(1, 0.1*cm))
    energy_rows = [
        ["Pyruvate carboxylase (×2)",    "2 ATP consumed"],
        ["Phosphoglycerate kinase (×2)", "2 ATP consumed"],
        ["PEPCK (×2)",                   "2 GTP consumed"],
        ["GAPDH (×2)",                   "2 NADH consumed (provided by malate shuttle)"],
        ["FBPase-1 (×1)",                "No ATP (hydrolysis of low-energy phosphate)"],
        ["Glucose 6-phosphatase (×1)",   "No ATP (hydrolysis of low-energy phosphate)"],
        ["NET COST",                     "4 ATP + 2 GTP = 6 high-energy bonds per glucose"],
    ]
    story.append(make_table(
        ["Step", "Energy"],
        energy_rows, s, col_widths=[8*cm, 9*cm]
    ))
    story.append(Spacer(1, 0.2*cm))
    story.append(teal_box(
        "<b>Compare to glycolysis:</b> Glycolysis generates a net of only 2 ATP per glucose. "
        "Gluconeogenesis costs 6 high-energy bonds to run the pathway in reverse — reflecting the thermodynamic "
        "work required to synthesize an ordered, energy-rich molecule from simpler precursors.",
        s
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 6. REGULATION ──────────────────────────────────────────────────────────
    story.append(section_header("6.  Regulation", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "Three reaction sequences in gluconeogenesis are regulated to control the direction of carbon flow "
        "(glycolysis vs gluconeogenesis). The regulation is reciprocal — when one pathway is ON, the other is OFF.",
        s["body"]
    ))
    story.append(Spacer(1, 0.15*cm))

    reg_rows = [
        ["Pyruvate carboxylase",
         "Acetyl-CoA (obligate allosteric activator); high ATP",
         "ADP; when acetyl-CoA is absent the enzyme is inactive",
         "Ensures GNG only runs when fatty acid oxidation is active"],
        ["PEPCK",
         "cAMP (via glucagon/epinephrine) → gene transcription; thyroid hormone; glucocorticoids",
         "Insulin → mRNA repression",
         "Inducible enzyme — regulation at gene expression level"],
        ["Fructose 1,6-bisphosphatase",
         "Citrate; low AMP",
         "AMP; Fructose 2,6-bisphosphate (F-2,6-BP)",
         "F-2,6-BP is the master switch between glycolysis and GNG"],
        ["Glucose 6-phosphatase",
         "—",
         "Product inhibition by glucose/Pi",
         "Determines whether G6P is exported or kept in liver"],
        ["(Glycolytic) Pyruvate kinase",
         "F-1,6-BP (feed-forward)",
         "ATP; Alanine; Phosphorylation by PKA (glucagon)",
         "Must be OFF for GNG to proceed past PEP"],
        ["(Glycolytic) PFK-1",
         "AMP; F-2,6-BP",
         "ATP; Citrate",
         "Must be OFF so F-6-P is not trapped as F-1,6-BP"],
    ]
    story.append(make_table(
        ["Enzyme", "Activated by", "Inhibited by", "Significance"],
        reg_rows, s,
        col_widths=[3.5*cm, 4*cm, 4*cm, 5.5*cm]
    ))
    story.append(Spacer(1, 0.3*cm))
    story.append(amber_box(
        "<b>Fructose 2,6-bisphosphate (F-2,6-BP) is the master switch:</b><br/>"
        "• High F-2,6-BP → PFK-1 active (glycolysis ON) + FBPase-1 inhibited (GNG OFF)<br/>"
        "• Low F-2,6-BP (raised by glucagon via cAMP) → FBPase-1 active (GNG ON) + PFK-1 inhibited<br/>"
        "Glucagon lowers F-2,6-BP by activating the kinase/phosphatase bifunctional enzyme (PFK-2/FBPase-2) "
        "toward phosphatase activity.",
        s
    ))
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph("Hormonal Control Summary", s["h3"]))
    hormonal_rows = [
        ["Glucagon (fasting)",    "↑ cAMP → PKA → ↑PEPCK transcription, ↓PK, ↓PFK-1 (via F-2,6-BP)", "GNG ↑↑"],
        ["Epinephrine (stress)",  "↑ cAMP → same as glucagon in liver",                                 "GNG ↑"],
        ["Cortisol (prolonged)",  "↑ PEPCK transcription; ↑ muscle proteolysis (more AA substrate)",    "GNG ↑"],
        ["Insulin (fed state)",   "↓ PEPCK transcription; ↑ F-2,6-BP; activates PFK-1",                "GNG ↓↓"],
        ["Acetyl-CoA (from fat)", "Activates pyruvate carboxylase; inhibits pyruvate dehydrogenase",    "GNG ↑ (directs pyruvate to OAA)"],
    ]
    story.append(make_table(
        ["Hormone/Signal", "Mechanism", "Effect on GNG"],
        hormonal_rows, s, col_widths=[3.5*cm, 9*cm, 4.5*cm]
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 7. COMPARISON WITH GLYCOLYSIS ─────────────────────────────────────────
    story.append(PageBreak())
    story.append(section_header("7.  Glycolysis vs Gluconeogenesis — Key Bypass Comparison", s))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "The three irreversible steps of glycolysis are bypassed by four dedicated gluconeogenic enzymes. "
        "These pairs of opposing enzymes form <b>substrate cycles</b> (futile cycles) that are tightly "
        "regulated to ensure only one pathway runs at a time.",
        s["body"]
    ))
    story.append(Spacer(1, 0.15*cm))

    compare_rows = [
        ["Pyruvate → PEP",
         "Pyruvate kinase\n(PEP + ADP → Pyruvate + ATP)",
         "Pyruvate carboxylase + PEPCK\n(Pyruvate + ATP + GTP → PEP + ADP + GDP + 2CO₂... wait, net)",
         "GNG uses 2 steps & 2 energy bonds vs 1 step generating 1 ATP"],
        ["Fructose 6-P → Fructose 1,6-BP",
         "Phosphofructokinase-1 (PFK-1)\n(F-6-P + ATP → F-1,6-BP + ADP)",
         "Fructose 1,6-bisphosphatase\n(F-1,6-BP + H₂O → F-6-P + Pi)",
         "F-2,6-BP is the reciprocal master regulator of this pair"],
        ["Glucose 6-P → Glucose",
         "Glucokinase/Hexokinase\n(Glucose + ATP → G-6-P + ADP)",
         "Glucose 6-phosphatase\n(G-6-P + H₂O → Glucose + Pi)",
         "G6Pase present in liver/kidney only; hexokinase in all tissues"],
    ]
    story.append(make_table(
        ["Bypass Point", "Glycolytic Enzyme", "Gluconeogenic Enzyme(s)", "Key Difference"],
        compare_rows, s,
        col_widths=[3*cm, 4.5*cm, 4.5*cm, 5*cm]
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 8. CLINICAL CORRELATIONS ───────────────────────────────────────────────
    story.append(section_header("8.  Clinical Correlations", s))
    story.append(Spacer(1, 0.2*cm))

    clinical_items = [
        ("<b>Ethanol-induced hypoglycemia:</b>",
         "Ethanol oxidation generates excess NADH, driving the equilibrium of LDH and malate dehydrogenase "
         "toward lactate and malate respectively. This depletes pyruvate and OAA — the main gluconeogenic "
         "intermediates — causing hypoglycemia in fasting individuals who drink alcohol."),
        ("<b>Metformin (Type 2 Diabetes):</b>",
         "Metformin inhibits Complex I of the mitochondrial respiratory chain, reducing ATP production. "
         "Low ATP raises AMP, which inhibits FBPase-1 (and activates AMPK, which suppresses PEPCK). "
         "Net result: hepatic gluconeogenesis is suppressed, lowering fasting blood glucose."),
        ("<b>Von Gierke Disease (GSD Type Ia):</b>",
         "Deficiency of glucose 6-phosphatase (G6Pase). Glucose 6-phosphate cannot be dephosphorylated, "
         "so glucose cannot be released from the liver during fasting. Presents with severe fasting "
         "hypoglycemia, lactic acidosis, hyperuricemia, and hepatomegaly."),
        ("<b>Biotin deficiency:</b>",
         "Pyruvate carboxylase requires biotin as a CO₂ carrier (covalently attached to a lysine residue). "
         "Biotin deficiency impairs the first step of gluconeogenesis, causing pyruvate accumulation, "
         "lactic acidosis, and hypoglycemia. Biotin is also required by acetyl-CoA carboxylase (fatty acid synthesis) "
         "and propionyl-CoA carboxylase."),
        ("<b>Glucocorticoid excess (Cushing's / steroid therapy):</b>",
         "Cortisol induces PEPCK gene transcription and promotes muscle protein catabolism (providing "
         "gluconeogenic amino acids). This leads to hyperglycemia and steroid-induced diabetes."),
        ("<b>Pyruvate carboxylase deficiency:</b>",
         "Rare inherited disorder causing lactic acidosis, hypoglycemia, and hyperammonemia. "
         "Also impairs the TCA cycle (as OAA replenishment fails), reducing ATP synthesis in the brain. "
         "Classified under Leigh syndrome."),
    ]

    for title, text in clinical_items:
        story.append(amber_box(f"{title}<br/>{text}", s))
        story.append(Spacer(1, 0.15*cm))

    story.append(Spacer(1, 0.2*cm))

    # ── 9. QUICK REFERENCE COFACTORS ──────────────────────────────────────────
    story.append(section_header("9.  Cofactor Quick Reference", s))
    story.append(Spacer(1, 0.2*cm))
    cf_rows = [
        ["Biotin",              "Pyruvate carboxylase",               "CO₂ carrier; covalently bound to enzyme lysine",      "Biotin deficiency → GNG failure"],
        ["GTP",                 "PEPCK",                              "Energy donor; CO₂ released",                          "Derived from TCA succinyl-CoA step"],
        ["ATP",                 "Pyruvate carboxylase; PGK",          "Energy donor",                                        "4 ATP total consumed per glucose"],
        ["NADH",                "GAPDH (consumed); Malate DH (source)", "Reducing equivalent",                              "Supplied by malate shuttle from mito"],
        ["Pyridoxal phosphate (B6)", "Alanine aminotransferase",      "Transaminase cofactor (Schiff base intermediate)",    "B6 deficiency impairs amino acid entry"],
        ["Mg²⁺",                "Enolase, FBPase-1, many kinases",   "Metal ion cofactor",                                  "Required for phosphate chemistry"],
        ["2,3-BPG",             "Phosphoglycerate mutase",            "Phosphate shuttle cofactor",                          "Also regulates Hb O₂ affinity"],
        ["Vitamin B12",         "Methylmalonyl-CoA mutase",           "Cofactor for propionyl-CoA → succinyl-CoA",           "Deficiency blocks odd-chain FA gluconeogenesis"],
    ]
    story.append(make_table(
        ["Cofactor", "Enzyme(s)", "Role", "Clinical Note"],
        cf_rows, s,
        col_widths=[3.5*cm, 4.5*cm, 4.5*cm, 4.5*cm]
    ))

    story.append(Spacer(1, 0.4*cm))

    # ── 10. MEMORY AIDS ────────────────────────────────────────────────────────
    story.append(section_header("10.  Memory Aids", s))
    story.append(Spacer(1, 0.2*cm))

    memory_items = [
        ("<b>4 unique enzymes of GNG — 'Pretty PEPCK Feeds Glucose':</b>",
         "<b>P</b>yruvate carboxylase · <b>P</b>EPCKinase · <b>F</b>BPase-1 · <b>G</b>6Pase"),
        ("<b>Pyruvate carboxylase needs acetyl-CoA:</b>",
         "When fat is being oxidized (high acetyl-CoA), pyruvate carboxylase is activated — "
         "this ensures gluconeogenesis is fuelled by the energy released from fat, not by precious glucose itself."),
        ("<b>AMP is the 'energy crisis' signal:</b>",
         "High AMP → inhibit FBPase-1 (and PFK-1 is activated) → glycolysis ON, GNG OFF. "
         "This makes sense: if energy is low, break down glucose rather than make it."),
        ("<b>Glucose 6-phosphatase — liver and kidney only:</b>",
         "Muscle cannot export glucose because it lacks G6Pase. Muscle glycogen is for muscle use only. "
         "Only liver can release glucose into blood."),
        ("<b>Fructose 2,6-bisphosphate is the master switch:</b>",
         "High insulin → high F-2,6-BP → glycolysis ON. High glucagon → low F-2,6-BP → GNG ON."),
    ]

    for title, text in memory_items:
        story.append(teal_box(f"{title}<br/>{text}", s))
        story.append(Spacer(1, 0.12*cm))

    story.append(Spacer(1, 0.3*cm))

    # ── FOOTER ─────────────────────────────────────────────────────────────────
    story.append(HRFlowable(width="100%", thickness=1, color=NAVY))
    story.append(Spacer(1, 0.1*cm))
    story.append(Paragraph(
        "<i>Source: Basic Medical Biochemistry: A Clinical Approach, 6e, pp. 1007-1023  |  "
        "Harper's Illustrated Biochemistry, 32e  |  Generated by Orris Medical AI</i>",
        s["caption"]
    ))

    doc.build(story)
    print(f"\n✅ PDF saved to: {OUTPUT}")

if __name__ == "__main__":
    build()
Running Command

cd /home/daytona/workspace/gluconeogenesis && python3 build_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/gluconeogenesis/Gluconeogenesis_Study_Guide.pdf

Your PDF is ready (2.1 MB):

Gluconeogenesis Study Guide

PDF Document · PDF

What's inside (10 sections):
  1. Overview - location, direction, energy cost, key stats
  2. Precursors - lactate, alanine, glycerol, glucogenic AAs, odd-chain FAs with their conversion enzymes and cofactors
  3. Step-by-step pathway - every intermediate, enzyme, and cofactor from pyruvate to glucose, with the 3 bypass points clearly marked (★)
  4. Master summary table - all 10 steps in one reference table
  5. Energy cost - exactly which steps consume ATP/GTP/NADH
  6. Regulation - allosteric, covalent, and hormonal control of all 4 key enzymes, including the F-2,6-BP master switch
  7. Glycolysis vs GNG bypass comparison - the 3 paired enzyme sets side by side
  8. Clinical correlations - ethanol hypoglycemia, metformin, Von Gierke, biotin deficiency, Cushing's, pyruvate carboxylase deficiency
  9. Cofactor quick reference - biotin, GTP, NADH, PLP, B12 and their roles
  10. Memory aids - mnemonics and conceptual hooks for the exam

Explain regulatory steps of glycolysis with respect to name structure of intermediate enzyme and covector

Glycolysis has three irreversible, regulated steps: hexokinase/glucokinase (glucose → G6P), phosphofructokinase-1 (F6P → F1,6-BP), and pyruvate kinase (PEP → pyruvate). PFK-1 is the main rate-limiting step.
Searching sources...
Finding Sources
Finding Sources
Finding Sources
Finding Sources
This is a shared conversation. Sign in to Orris to start your own chat.