R/supportingfunctions.R
pop.ct.prop.scRNA.Rd
Calculate population-level cell type proportions from single-cell data.
pop.ct.prop.scRNA(scRNA,cluster="cluster",sample="sample",cell_type_unique)
The `ExpressionSet` object for single-cell data.
The character string specifying the variable name for cell types. The default is "cluster".
The character string specifying the variable name for subject/samples. The default is "sample".
A vector of cell types. It should match the order in list.marker.
The population-level cell type proportions (`pop.ct.prop`) and corresponding standard deviations (`pop.ct.sd`).
##read data
library(InteRD)
readRDSFromWeb<-function(ref) {readRDS(gzcon(url(ref)))}
urlremote<-"https://github.com/chencxxy28/Data/raw/main/data_InteRD/"
seger<-readRDSFromWeb(paste0(urlremote,"segerstolpe.rds"))
cell_type_unique<-c("alpha","beta","delta","gamma")
ave_est<-pop.ct.prop.scRNA(scRNA=seger[["sc.eset.qc"]],
cell_type_unique=cell_type_unique)$pop.ct.prop
ave_est
#> alpha beta delta gamma
#> 0.58701276 0.23180970 0.08954594 0.09163159