Extract_Sample_Meta {scCustomize} | R Documentation |
Extract sample level meta.data
Description
Returns a by identity meta.data data.frame with one row per sample. Useful for downstream quick view of sample breakdown, meta data table creation, and/or use in pseudobulk analysis
Usage
Extract_Sample_Meta(
object,
sample_name = "orig.ident",
variables_include = NULL,
variables_exclude = NULL,
include_all = FALSE
)
Arguments
object |
Seurat object |
sample_name |
meta.data column to use as sample. Output data.frame will contain one row per level or unique value in this variable. |
variables_include |
|
variables_exclude |
columns to discard in final data.frame. Many cell level columns are irrelevant at the sample level (e.g., nFeature_RNA, percent_mito).
|
include_all |
logical, whether or not to include all object meta data columns in output data.frame. Default is FALSE. |
Value
Returns a data.frame with one row per sample_name
.
Examples
library(Seurat)
pbmc_small[["batch"]] <- sample(c("batch1", "batch2"), size = ncol(pbmc_small), replace = TRUE)
sample_meta <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident")
# Only return specific columns from meta data (orig.ident and batch)
sample_meta2 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident",
variables_include = "batch")
# Return all columns from meta data
sample_meta3 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident",
include_all = TRUE)