from pptx import Presentation from pptx.util import Inches, Pt, Emu from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.dml.color import RGBColor from pptx.enum.shapes import MSO_SHAPE from pptx.enum.dml import MSO_LINE_DASH_STYLE import os
Create presentation
prs = Presentation() prs.slide_width = Inches(13.333) # 16:9 aspect ratio prs.slide_height = Inches(7.5)
Define colors
UKE_BLUE = RGBColor(0, 82, 147) DARK_GRAY = RGBColor(64, 64, 64) LIGHT_GRAY = RGBColor(240, 240, 240)
============================================================================
HELPER FUNCTIONS
============================================================================
def add_uke_logo(slide, logo_path=None): “””Add UKE logo placeholder or actual logo if path provided”””
Logo position: top right corner
logo_left = Inches(11.5)
logo_top = Inches(0.2)
logo_width = Inches(1.5)
logo_height = Inches(0.8)
if logo_path and os.path.exists(logo_path):
# Add actual logo
slide.shapes.add_picture(logo_path, logo_left, logo_top, logo_width, logo_height)
else:
# Add placeholder box for logo
logo_box = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, logo_left, logo_top, logo_width, logo_height)
logo_box.fill.solid()
logo_box.fill.fore_color.rgb = RGBColor(255, 255, 255)
logo_box.line.color.rgb = UKE_BLUE
logo_box.line.width = Pt(1)
# Add text to placeholder
tf = logo_box.text_frame
tf.text = "UKE Logo"
tf.paragraphs[0].alignment = PP_ALIGN.CENTER
tf.paragraphs[0].font.size = Pt(10)
tf.paragraphs[0].font.color.rgb = UKE_BLUE
def add_title_with_line(slide, title_text): “””Add title with separator line below”””
Add title
title_shape = slide.shapes.add_textbox(Inches(0.5), Inches(0.2), Inches(10.5), Inches(0.8))
title_frame = title_shape.text_frame
title_para = title_frame.paragraphs[0]
title_para.text = title_text
title_para.font.size = Pt(28)
title_para.font.bold = True
title_para.font.color.rgb = UKE_BLUE
title_para.font.name = 'Arial'
# Add separator line below title
line_left = Inches(0.5)
line_top = Inches(1.05)
line_width = Inches(12.333)
line_height = Inches(0.05)
line_shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, line_left, line_top, line_width, line_height)
line_shape.fill.solid()
line_shape.fill.fore_color.rgb = UKE_BLUE
line_shape.line.fill.background()
return title_shape
def add_content_slide(prs, title): “””Add a content slide with title and separator line””” slide = prs.slides.add_slide(prs.slide_layouts[5]) add_title_with_line(slide, title) add_uke_logo(slide) return slide
def add_table_to_slide(slide, data, left, top, width, height, header_color=UKE_BLUE, font_size=10): “””Add a formatted table to slide””” rows = len(data) cols = len(data[0])
table = slide.shapes.add_table(rows, cols, left, top, width, height).table
col_width = Inches(width.inches / cols)
for i, col in enumerate(table.columns):
col.width = col_width
for i, row in enumerate(data):
for j, cell_text in enumerate(row):
cell = table.cell(i, j)
cell.text = str(cell_text)
for paragraph in cell.text_frame.paragraphs:
paragraph.alignment = PP_ALIGN.LEFT
for run in paragraph.runs:
run.font.size = Pt(font_size)
run.font.name = 'Arial'
if i == 0:
run.font.bold = True
run.font.size = Pt(font_size + 1)
run.font.color.rgb = RGBColor(255, 255, 255)
cell.fill.solid()
cell.fill.fore_color.rgb = header_color
else:
run.font.color.rgb = DARK_GRAY
cell.vertical_anchor = MSO_ANCHOR.MIDDLE
return table
def add_image_placeholder(slide, left, top, width, height, label, figure_ref=””): “””Add an image placeholder box with figure reference””” shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, left, top, width, height) shape.fill.solid() shape.fill.fore_color.rgb = LIGHT_GRAY shape.line.color.rgb = UKE_BLUE shape.line.width = Pt(2) shape.line.dash_style = MSO_LINE_DASH_STYLE.DASH
tf = shape.text_frame
tf.text = f"📊 INSERT FIGURE\n{figure_ref}\n\n{label}"
tf.paragraphs[0].alignment = PP_ALIGN.CENTER
tf.paragraphs[0].font.size = Pt(12)
tf.paragraphs[0].font.color.rgb = DARK_GRAY
tf.paragraphs[0].font.bold = True
return shape
def add_textbox(slide, left, top, width, height, text, font_size=11, bold=False, color=DARK_GRAY, align_left=True): “””Add a formatted textbox””” textbox = slide.shapes.add_textbox(left, top, width, height) tf = textbox.text_frame tf.word_wrap = True
para = tf.paragraphs[0]
para.text = text
para.font.size = Pt(font_size)
para.font.bold = bold
para.font.color.rgb = color
para.font.name = 'Arial'
if align_left:
para.alignment = PP_ALIGN.LEFT
else:
para.alignment = PP_ALIGN.CENTER
return textbox
def add_speaker_notes(slide, notes_text): “””Add speaker notes to slide””” notes_slide = slide.notes_slide text_frame = notes_slide.notes_text_frame text_frame.text = notes_text
============================================================================
SLIDE 1: Overview
============================================================================
slide1 = add_content_slide(prs, “Metagenomic Sequencing: From Data to Clinical Insight”)
add_textbox(slide1, Inches(0.5), Inches(1.3), Inches(8), Inches(0.5), “Institute of Molecular Virology and Tumor Virology – UKE”, font_size=14, color=UKE_BLUE)
table1_data = [ [“Sequencing Approach”, “Primary Application”, “Key Study”, “Clinical/Research Insight”], [“16S Amplicon Sequencing”, “Microbiome community profiling”, “Piepke et al. (in submission)”, “Sex-specific gut microbiota signatures predict IL-17 antibody treatment response in aged stroke mice”], [“Target Enrichment Sequencing”, “Low-titer viral genome recovery”, “Baier et al., 2022”, “Confirmed monoclonal RSV-B outbreak in immunocompromised hematology patients”], [“Shotgun Metagenomics”, “Unbiased pathogen discovery & co-infection profiling”, “Pfefferle et al., 2021”, “Simultaneous detection of SARS-CoV-2 + bacterial co-pathogens; dynamic respiratory microbiome monitoring”] ]
add_table_to_slide(slide1, table1_data, Inches(0.5), Inches(1.9), Inches(12.333), Inches(3.8), font_size=11)
add_speaker_notes(slide1, “”” BACKGROUND INFORMATION FOR SLIDE 1:
This slide provides an overview of the three complementary metagenomic sequencing approaches we routinely apply at the UKE Institute of Molecular Virology and Tumor Virology. Each modality addresses distinct clinical and research questions:
-
16S Amplicon Sequencing (Microbiome Profiling):
- Targets the hypervariable V3-V4 regions of the bacterial 16S rRNA gene
- Provides cost-effective, high-depth profiling of bacterial community composition
- Key study: Piepke et al. (in submission) used this approach to identify sex-specific gut microbiota signatures in aged mice that predict differential response to IL-17 antibody treatment after experimental stroke
- Clinical insight: Enables stratification of patients based on microbial biomarkers for personalized immunotherapy
-
Target Enrichment Sequencing (Viral Genomics):
- Uses custom RNA/DNA baits to capture and enrich specific pathogen genomes from complex clinical samples
- Critical for low-titer samples where standard shotgun sequencing fails
- Key study: Baier et al. (2022) applied this method to confirm a monoclonal RSV-B outbreak in immunocompromised hematology patients
- Clinical insight: Provides definitive evidence for infection control decisions in vulnerable patient populations
-
Shotgun Metagenomics (Unbiased Pathogen Discovery):
- Sequences all nucleic acids in a sample without prior assumptions
- Enables simultaneous detection of viruses, bacteria, fungi, and host response markers
- Key study: Pfefferle et al. (2021) used this approach during the COVID-19 pandemic to detect SARS-CoV-2 and monitor dynamic respiratory microbiome changes suggesting bacterial co-infections
- Clinical insight: Supports antibiotic stewardship and early detection of opportunistic pathogens in critically ill patients
Together, these three modalities form a comprehensive analytical pipeline that transforms raw sequencing data into actionable biological and clinical insights. “””)
============================================================================
SLIDE 2: Case 1 – 16S Amplicon Sequencing (UPDATED WITH REQUESTED TEXT)
============================================================================
slide2 = add_content_slide(prs, “A Sex-Specific Microbial Signature is Associated with Reduced SCFA Production in Aged Male Compared to Aged Female Mice”)
add_textbox(slide2, Inches(0.5), Inches(1.3), Inches(6), Inches(0.4), “Reference: Piepke et al. (in submission) | Supplemental PDF, Page 34”, font_size=12, color=DARK_GRAY)
KEY FINDINGS – EXACT TEXT AS REQUESTED BY USER
findings_text = “””✓ 16S rRNA-seq of gut microbiota in aged male vs. female mice
✓ PERMANOVA (Bray-Curtis): Significant community structure differences between sexes
✓ DESeq2 analysis: Aged females enriched in SCFA-producing families: • Lachnospiraceae • Ruminococcaceae • Muribaculaceae
✓ Targeted mass spectrometry: Aged males show ↓ systemic SCFAs: • Acetate • Butyrate • Propionate • Caproate • Valerate
✓ Inverse association: Male sex ↔ Lower SCFA bioavailability in blood & brain”””
add_textbox(slide2, Inches(0.5), Inches(1.8), Inches(6.2), Inches(4.5), findings_text, font_size=11)
Image placeholders for Figures 4A, 4B, 4C (right side)
add_image_placeholder(slide2, Inches(7.0), Inches(1.8), Inches(5.8), Inches(1.8), “Experimental workflow: 16S rRNA-seq pipeline”, “Fig 4A | Suppl. PDF p.34”)
add_image_placeholder(slide2, Inches(7.0), Inches(3.8), Inches(2.8), Inches(2.2), “PCoA plot: Bray-Curtis dissimilarity\nSex-separated microbial communities”, “Fig 4B | Suppl. PDF p.34”)
add_image_placeholder(slide2, Inches(10.0), Inches(3.8), Inches(2.8), Inches(2.2), “Bubble plot: Differentially abundant OTUs\nEnriched in aged females (SCFA producers)”, “Fig 4C | Suppl. PDF p.34”)
add_speaker_notes(slide2, “”” BACKGROUND INFORMATION FOR SLIDE 2 – FIGURES 4A, 4B, 4C:
This slide presents the core microbiome findings from Piepke et al. (in submission) that link sex-specific gut microbiota composition to differential IL-17A production and treatment response after experimental stroke.
FIGURE 4A: Experimental Workflow
- Fecal samples were collected from aged (60-70 week) male and female C57BL/6J mice under homeostatic conditions
- Genomic DNA was extracted using the QIAamp Fast DNA Stool Mini Kit with mechanical homogenization
- 16S rRNA gene amplicons (V3-V4 region) were generated using degenerate primers with Illumina adapter overhangs
- Libraries were multiplexed and sequenced on an Illumina MiSeq (2×250 bp paired-end)
- Bioinformatics: Raw FASTQ files processed through QIIME 2; ASVs inferred using DADA2; taxonomy assigned against SILVA (release 132) at 97% identity
FIGURE 4B: PCoA Plot (Bray-Curtis Dissimilarity)
- Principal Coordinates Analysis visualizes sample-to-sample relationships based on Bray-Curtis dissimilarity, which captures both species presence/absence and relative abundance
- Clear separation between aged male (blue) and female (red) microbial communities along PCoA axes
- PERMANOVA (adonis2 in vegan package) confirmed statistically significant differences in overall community structure between sexes (p<0.001)
- This demonstrates that biological sex is a major determinant of gut microbiome composition in aged mice, independent of other environmental variables
FIGURE 4C: Bubble Plot of Differentially Abundant OTUs
- DESeq2 analysis (negative binomial GLM) identified Operational Taxonomic Units (OTUs) with significant differential abundance between aged females and males
- Bubble size represents adjusted p-value (Benjamini-Hochberg FDR correction); color denotes bacterial order
- Key finding: Aged females show significant enrichment of OTUs assigned to: • Lachnospiraceae (order Clostridiales) • Ruminococcaceae (order Clostridiales) • Muribaculaceae (order Bacteroidales) • Clostridiales vadinBB60 group • Burkholderiaceae (order Betaproteobacteriales) • Erysipelotrichaceae (order Erysipelotrichales)
- Critically, Lachnospiraceae, Ruminococcaceae, and Muribaculaceae are well-established producers of short-chain fatty acids (SCFAs), key microbial metabolites involved in host metabolic and inflammatory regulation
INTEGRATED INTERPRETATION: These three figures together demonstrate a complete sequencing-based analytical pipeline:
- Methodological rigor (4A) → 2. Community-level differences (4B) → 3. Taxon-level drivers (4C)
The data support the hypothesis that aged female mice harbor a microbiome enriched in SCFA-producing bacteria. Since SCFAs are known to modulate γδ T cell function and IL-17A production, this provides a testable mechanism for the observed sex-specific treatment response: aged males, with reduced SCFA-producing bacteria, exhibit heightened IL-17A-driven inflammation that is more responsive to IL-17 antibody neutralization.
This end-to-end analysis—from sequencing to mechanistic hypothesis—exemplifies the type of integrated insight our metagenomics platform can generate from your data. “””)
============================================================================
SLIDE 3: Case 2 – Target Enrichment Sequencing (WITH PATIENT TABLE)
============================================================================
slide3 = add_content_slide(prs, “Resolving a Monoclonal RSV Outbreak in Immunocompromised Patients”)
add_textbox(slide3, Inches(0.5), Inches(1.3), Inches(6), Inches(0.4), “Reference: Baier et al., 2022 | Seminar PDF, Pages 13-15”, font_size=12, color=DARK_GRAY)
challenge_text = “””CHALLENGE: ⚠️ Viral loads too low for standard shotgun sequencing in hematology patients
SOLUTION: Custom RNA Bait Enrichment Workflow
Clinical sample → Fragmentation → Biotin-bait hybridization → Streptavidin capture → PCR → Sequencing
KEY RESULT: ✓ Phylogenetic tree: 4 patient isolates clustered with near-identical RSV-B genomes ✓ All patients: severely immunocompromised adults ✓ Confirmed MONOCLONAL outbreak → guided infection control interventions”””
add_textbox(slide3, Inches(0.5), Inches(1.8), Inches(6.0), Inches(3.0), challenge_text, font_size=11)
patient_table_data = [ [“ID”, “Underlying Disease”, “RSV Infection”, “WBC (per ml)”, “RSV Treatment”, “Antibiotic”, “Outcome”], [“1”, “Recurrent AML”, “URTI”, “2200”, “Immunoglobulins”, “No”, “recovered”], [“2”, “Multiple myeloma”, “LRTI”, “0”, “Immunoglobulins”, “Yes”, “recovered”], [“3”, “Secondary hemophagocytosis”, “URTI”, “1800”, “None”, “Yes”, “recovered”], [“4”, “Multiple myeloma”, “URTI”, “0”, “Immunoglobulins”, “Yes”, “recovered”] ]
add_table_to_slide(slide3, patient_table_data, Inches(0.5), Inches(4.9), Inches(6.0), Inches(1.8), header_color=UKE_BLUE, font_size=9)
add_image_placeholder(slide3, Inches(7.0), Inches(1.8), Inches(5.8), Inches(2.0), “Bait-design workflow diagram\nShow enrichment method”, “Seminar PDF p.13”)
add_image_placeholder(slide3, Inches(7.0), Inches(4.0), Inches(5.8), Inches(2.7), “Phylogenetic tree + Patient table\nCircle outbreak cluster”, “Seminar PDF pp.14-15”)
add_speaker_notes(slide3, “”” BACKGROUND INFORMATION FOR SLIDE 3:
This slide illustrates how target enrichment sequencing resolves a critical clinical challenge: obtaining high-quality viral genomes from low-titer clinical samples in immunocompromised patients.
CLINICAL CONTEXT:
- Four adult hematology patients (recurrent AML, multiple myeloma, secondary hemophagocytosis) presented with RSV infections
- All patients were severely immunocompromised (white blood cell counts: 0-2200/ml), resulting in very low viral loads in respiratory samples
- Standard shotgun metagenomics failed to generate sufficient genome coverage for outbreak investigation
METHOD: Custom RNA Bait Enrichment (Seminar PDF p.13)
- Clinical sample DNA shearing and adapter ligation
- Hybridization with biotin-labeled RNA baits designed against conserved RSV genomic regions
- Streptavidin bead capture of bait-bound viral fragments
- PCR amplification and high-throughput sequencing
- Bioinformatics: Host read removal (Bowtie2), de novo assembly (SPAdes), variant calling, phylogenetic reconstruction (RAxML)
RESULTS (Seminar PDF pp.14-15):
- Phylogenetic tree based on whole-genome RSV-B sequences showed that isolates from all four patients clustered together with near-identical genomes
- This provided definitive molecular evidence of a monoclonal outbreak, distinguishing it from coincidental community-acquired infections
- Patient characteristics table confirmed all cases occurred in the same hematology ward within a narrow time window
CLINICAL IMPACT:
- Confirmed outbreak triggered immediate infection control measures (cohorting, enhanced PPE, environmental decontamination)
- Prevented further transmission in a highly vulnerable patient population
- Demonstrated the value of target enrichment for outbreak investigation when viral loads are too low for standard approaches
This case exemplifies how our bioinformatics workflows can extract actionable insights from challenging clinical samples—exactly the capability you can leverage for your own pathogen surveillance or outbreak response needs. “””)
============================================================================
SLIDE 4: Case 3 – Shotgun Metagenomics
============================================================================
slide4 = add_content_slide(prs, “Unbiased Pathogen Discovery in Clinical Samples”)
add_textbox(slide4, Inches(0.5), Inches(1.3), Inches(6), Inches(0.4), “Reference: Pfefferle et al., 2021 | Seminar PDF, Page 17”, font_size=12, color=DARK_GRAY)
left_panel_text = “””UNBIASED PATHOGEN DETECTION:
✓ Shotgun metagenomic RNA sequencing of respiratory samples from COVID-19 patient
✓ Simultaneous detection without prior assumptions: • SARS-CoV-2 genome • Bacterial co-pathogens • Dynamic microbiome composition changes
✓ Key observation: Day 1 → Day 4 shift in respiratory microbiome • Day 1: Diverse commensal flora • Day 4: Prevotella dominance → suggests secondary bacterial infection
✓ Clinical value: • Informs antibiotic stewardship decisions • Detects unexpected/novel pathogens • No need for pathogen-specific primers or probes
BIOINFORMATICS PIPELINE (DAMIAN):
✓ Trimming (Trimmomatic) ✓ Host read removal (Bowtie2) ✓ De novo assembly (SPAdes, IDBA-ud) ✓ ORF calling and domain annotation ✓ Taxonomic annotation (BLAST-based) ✓ Comprehensive reporting”””
add_textbox(slide4, Inches(0.5), Inches(1.8), Inches(6.2), Inches(4.5), left_panel_text, font_size=9)
add_image_placeholder(slide4, Inches(7.0), Inches(1.8), Inches(5.8), Inches(4.5), “Respiratory microbiome shift: Day 1 → Day 4\nBacterial abundance changes during COVID-19 infection\nShows dynamic microbiome dynamics and potential co-infection risk”, “Seminar PDF p.17”)
add_speaker_notes(slide4, “”” BACKGROUND INFORMATION FOR SLIDE 4:
This slide demonstrates the power of shotgun metagenomics for unbiased pathogen discovery in clinical samples.
APPLICATION: Pathogen Discovery in COVID-19 (Pfefferle et al., 2021; Seminar PDF p.17)
- Shotgun metagenomic RNA sequencing of respiratory samples from a hospitalized COVID-19 patient
- Simultaneously detected: (1) SARS-CoV-2 genome, (2) bacterial co-pathogens, (3) dynamic microbiome changes over time
- Key observation: On day 1, the respiratory microbiome showed diverse commensal flora; by day 4, Prevotella became dominant
- Clinical interpretation: This shift suggested potential secondary bacterial infection or dysbiosis-driven inflammation, informing antibiotic stewardship decisions
- Advantage over targeted PCR: No prior assumptions needed; can detect unexpected or novel pathogens
BIOINFORMATICS PIPELINE (DAMIAN): Our in-house DAMIAN pipeline ensures robust pathogen identification:
- Trimming (Trimmomatic): Removes low-quality bases and adapter sequences
- Host read removal (Bowtie2): Filters out human reads to focus on microbial content
- De novo assembly (SPAdes, IDBA-ud): Reconstructs microbial genomes/contigs without reference bias
- ORF calling and domain annotation: Identifies potential protein-coding regions and functional domains
- Taxonomic annotation (BLAST-based): Assigns taxonomy using comprehensive databases
- Comprehensive reporting: Generates clinician-friendly reports with pathogen lists and confidence scores
CLINICAL VALUE:
- Early detection of SARS-CoV-2 without prior knowledge of the pathogen
- Simultaneous monitoring of respiratory microbiome dynamics
- Identification of potential bacterial co-infections guiding antibiotic therapy
- No need for pathogen-specific primers or probes
This unbiased approach is particularly valuable for:
- Novel pathogen discovery (as demonstrated during the COVID-19 pandemic)
- Immunocompromised patients with atypical presentations
- Cases where standard diagnostic panels return negative results
- Outbreak investigation when the causative agent is unknown
Whether your goal is pathogen surveillance, outbreak investigation, or comprehensive microbiome profiling, shotgun metagenomics provides the most comprehensive view of all nucleic acids in your sample. “””)
============================================================================
SAVE PRESENTATION
============================================================================
output_dir = “presentation_output” if not os.path.exists(output_dir): os.makedirs(output_dir)
output_file = os.path.join(output_dir, “Metagenomics_Presentation_UKE_Final.pptx”) prs.save(output_file)
print(“=” 70) print(“✓ PRESENTATION GENERATED SUCCESSFULLY!”) print(“=” 70) print(f”\n📁 Output file: {output_file}”) print(f”\n📊 Total slides: 4″) print(“\n📝 SLIDE 2 – KEY FINDINGS TEXT:”) print(“-” 70) print(findings_text) print(“-” 70) print(“\n🖼️ NEXT STEPS – Add Images:”) print(“”” SLIDE 1: No images needed – table only SLIDE 2: Fig 4A, 4B, 4C from Supplemental PDF p.34 SLIDE 3: Bait-design workflow (p.13) + Phylogenetic tree (pp.14-15) SLIDE 4: Respiratory microbiome table (Seminar PDF p.17) “””) print(“=” * 70)
📧 How to Extract Speaker Notes for Email
After running the script, you have two options to get the email-ready text:
Option A: Manual Extraction from PowerPoint
- Open
Metagenomics_Presentation_UKE.pptx - Go to View → Notes Page
- Copy the text from each slide’s notes section
- Paste into your email
Option B: Programmatic Extraction (Python)
from pptx import Presentation
#mv presentation_output/Metagenomics_Presentation_UKE_Final.pptx presentation_output/Metagenomics_Presentation.pptx
prs = Presentation("presentation_output/Metagenomics_Presentation.pptx")
for i, slide in enumerate(prs.slides, 1):
notes = slide.notes_slide.notes_text_frame.text
if notes.strip():
print(f"\n{'='*70}")
print(f"SLIDE {i} NOTES:")
print(f"{'='*70}\n")
print(notes)
✅ What This Script Delivers
| Feature | Description |
|---|---|
| ✅ 4 Complete Slides | Professional layout with tables, text, image placeholders |
| ✅ Editable Tables | Using python-pptx native table elements |
| ✅ Image Placeholders | Clearly labeled with figure references and PDF page numbers |
| ✅ Email-Ready Speaker Notes | Detailed scientific background for each slide, ready to copy into email |
| ✅ Slide 2 Updated | Title and figures (4A-4D) with comprehensive explanation of methodology and interpretation |
| ✅ Professional Styling | UKE blue colors, Arial font, 16:9 ratio |
▶️ Quick Start
# 1. Install dependency
pip install python-pptx
# 2. Save script as generate_slides_email.py
# 3. Run:
python generate_slides_email.py
# 4. Open the PPTX, insert figures, then extract notes for your email
Let me know if you’d like me to:
- 🔹 Add a title slide with your name/date/department
- 🔹 Adjust the tone of the speaker notes (more concise / more technical)
- 🔹 Export the speaker notes as a separate text file for easy email copying
- 🔹 Add a final “Key Takeaways” summary slide