Skip to contents

Collects all PDFs in output_dir, converts them to images with magick::image_read_pdf(), groups them into labeled sections based on filename patterns, and assembles a polished .pptx via the officer package.

Usage

create_analysis_pptx(
  output_dir,
  params_json = NULL,
  out_pptx = NULL,
  slide_format = "standard",
  slide_width = NULL,
  slide_height = NULL,
  pdf_density = 150,
  include_legends = TRUE,
  legend_font_size = 8,
  include = NULL,
  exclude = NULL
)

Arguments

output_dir

Character. Folder containing PDF figures.

params_json

Character or NULL. Path to analysis_params.json. When NULL (default) the function walks up the directory tree from output_dir until it finds the file - this lets you call create_analysis_pptx on a sub-folder (e.g., the CellChat or GSEA output directory) and still get the shared analysis parameters from the parent folder.

out_pptx

Character or NULL. Where to save the .pptx. When NULL (default) a filename is auto-generated from the dataset/subset labels and the current date, saved inside output_dir.

slide_format

Character. Slide aspect ratio preset: "standard" (4:3, 10 × 7.5 in, default) or "widescreen" (16:9, 13.33 × 7.5 in). Override with explicit slide_width / slide_height if needed.

slide_width, slide_height

Numeric. Explicit slide dimensions in inches. When provided these override slide_format.

pdf_density

Integer. DPI used when rasterising PDFs. Increase (e.g. 200) for sharper figures at the cost of speed. Default 150.

include_legends

Logical. If TRUE (default), a legend sentence is placed below each figure slide, sourced from the .legend sidecar file beside the PDF or from auto-generated fallback templates.

legend_font_size

Numeric. Font size in points for the legend text box on each slide. Default 8.

include

Character vector or NULL. Section names to include; all other sections are dropped. When NULL (default) all sections are included. PDFs are assigned to sections by filename pattern matching - see .pptx_section_rules for the rules. Valid section names:

  • "Quality Control" - QC density plots, doublet scores, filtration barplots

  • "Dimensionality Reduction" - PCA elbow, UMAP before/after Harmony, RNA UMAPs

  • "Cluster Markers" - ComplexHeatmap heatmaps, presto marker tables

  • "Dotplots" - any PDF with "dotplot" in the filename

  • "Cell Type Annotation" - AutoAssignment UMAPs, SingleR, scType, featureheatmaps, assignment helper

  • "All UMAPs" - the combined multi-panel UMAP PDF

  • "Composition" - barplots, chord diagrams, rose/trend plots, iteration-with-bar figures

  • "Feature Maps" - PlotFeaturePlots per-gene UMAPs

  • "Pathway Analysis" - GSEA heatmaps and lollipop PDFs

  • "CellChat" - RunCellChat, CompareCellChat, and RankCellChatPathways output PDFs

  • "Other" - anything not matched by the rules above

exclude

Character vector or NULL. Section names to drop (applied after include). NULL excludes nothing. Same valid values as include. Typical use: exclude = c("Feature Maps", "CellChat") to keep the main analysis compact while running separate sub-folder PPTXs for those heavy sections.

Value

Invisibly returns the path to the saved .pptx file.

Details

A parameters / methods overview slide is generated automatically from analysis_params.json (written by log_analysis_params()).