# Load a small example Seurat object
data("pbmc_small", package = "SeuratObject")
pbmc_small$timepoint <- sample(c("0h", "6h"), ncol(pbmc_small), replace = TRUE)
pbmc_small$timepoint_celltype <- paste(pbmc_small$timepoint, pbmc_small$RNA_snn_res.0.8, sep = "_")
features <- c("CD3D", "CD79A", "MS4A1")
# Prepare expression matrices first
matrices <- prepare_expression_matrices(pbmc_small, features, group_by = "timepoint_celltype")
# Create cell annotations with custom ordering
col_annotations <- create_cell_annotations(
exp_mat = matrices$exp_mat,
percent_mat = matrices$percent_mat,
split_pattern = "_",
time_points_order = c("0h", "6h"),
cell_types_order = levels(pbmc_small$RNA_snn_res.0.8)
)
# Access results
ordered_exp_mat <- col_annotations$exp_mat_ordered
Run the code above in your browser using DataLab