Skip to contents

Reads the command history of a Seurat object to extract key analysis parameters (resolution, PCs, Harmony variables, cell count, cluster count) and writes them to analysis_params.json in output_dir. When ExtractMethods() is available in the session the full structured summary it returns is used; otherwise parameters are read directly from obj@commands.

Usage

log_analysis_params(
  obj,
  output_dir,
  dataset = "",
  subset_name = "",
  assay_type = NULL,
  params_json = file.path(output_dir, "analysis_params.json")
)

Arguments

obj

A Seurat object.

output_dir

Character. Directory where figures are saved (and where analysis_params.json will be written).

dataset

Character. Human-readable dataset label (e.g. "SEAAD snRNAseq").

subset_name

Character. Subset label (e.g. "All_Clusters").

assay_type

Character. Sequencing modality. Controls the word used for individual observations in auto-generated legends and methods text. Recognized values (case-sensitive):

  • "scRNAseq" → "single-cell RNA-seq" / "cells" (default)

  • "snRNAseq" → "single-nucleus RNA-seq" / "nuclei"

  • "scATACseq" → "single-cell ATAC-seq" / "cells"

  • "scMultiome" → "single-cell multiome" / "cells"

  • "Spatial" → "spatial transcriptomics" / "spots"

  • "Visium" → "Visium spatial transcriptomics" / "spots"

  • "VisiumHD" → "Visium HD spatial transcriptomics" / "bins"

  • "Xenium" → "Xenium in situ transcriptomics" / "cells"

Any other string is passed through as-is (long name) with "cells" as the observation word.

params_json

Character. Full path for the JSON file. Defaults to file.path(output_dir, "analysis_params.json").

Value

Invisibly returns the logged parameter list.

Details

Call this once, after RunHarmony / FindClusters / RunUMAP are complete. Then call create_analysis_pptx() at the end of the Rmd.