HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
66 stars 31 forks source link

pull statistics of sce #408

Closed HuangW1105 closed 1 month ago

HuangW1105 commented 1 month ago

Dear Helena,

After I did clustering, merging clustering, is there a way to pull out the information of each sample from sce: cell number of each cluster (original cluster and newly assigned cluster), and medium expression of the functional marker (labelled "state") of each cluster.

Really appreciate!

Huang

HelenaLC commented 1 month ago

Would suggest familiarizing yourself with basic SingleCellExperiment operations for things like this, and the supporting infrastructure, e.g., scuttle::aggregateAcrossCells to aggregate data any way you like. The two things you asked can be done in many ways, for example:

# data prep. & clustering
data(PBMC_fs, PBMC_panel, PBMC_md)
sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
sce <- cluster(sce, verbose=FALSE)

# clustering of interest
kid <- "meta8" 

# tabulate number of cells
table(cluster_ids(sce, kid))

# median state marker expression
scuttle::aggregateAcrossCells(sce,
    subset.row=state_markers(sce),
    ids=cluster_ids(sce, kid),
    use.assay.type="exprs",
    statistics="median")