Skip to contents

Build consensus gene expression programs (cGEPs) by clustering GEPs from multiple cNMF results based on their pairwise correlations.

Usage

BuildConsensusReference(
  cnmf_paths,
  ks = NULL,
  density_thresholds = NULL,
  tpm_fns = NULL,
  score_fns = NULL,
  output_dir = ".",
  prefix = "",
  order_thresh = NULL,
  corr_thresh = 0.5,
  pct_thresh = 0.666,
  verbose = TRUE
)

Arguments

cnmf_paths

Character vector of paths to cNMF project directories. Each path should include the cNMF project name at the end, e.g., "cnmf_output_dir/cnmf_name"

ks

Integer vector of K values used for each cNMF result

density_thresholds

Numeric vector of density thresholds used for each cNMF result

tpm_fns

Optional: direct paths to TPM spectra files (alternative to ks/density_thresholds)

score_fns

Optional: direct paths to score spectra files

output_dir

Output directory for results (default: ".")

prefix

Prefix for output filenames (default: "")

order_thresh

Maximum rank for programs to be considered for clustering (default: number of datasets)

corr_thresh

Minimum correlation for programs to cluster (default: 0.5)

pct_thresh

Minimum fraction of connected programs to merge clusters (default: 0.666)

verbose

Print progress messages (default: TRUE)

Value

A list containing:

  • cluster_df: Data frame showing which GEPs clustered together

  • spectra_tpm: Consensus spectra in TPM units

  • spectra_score: Consensus spectra scores

  • hvgs_union: Union of highly variable genes

  • top_genes: Top genes for each cGEP

Examples

if (FALSE) { # \dontrun{
result <- BuildConsensusReference(
  cnmf_paths = c("path/to/cnmf1", "path/to/cnmf2"),
  ks = c(10, 15),
  density_thresholds = c(0.1, 0.1),
  output_dir = "./consensus_output"
)
} # }