This function generates a pseudo bulk samples by random sampled number of cells per subject.
generateBulk(eset,ct.varname,sample,disease = NULL,ct.sub,prop_mat = NULL,
nbulk = 50,samplewithRep = FALSE,low_s = 0.3,upp_s = 0.7)
The `ExpressionSet` object for single cells.
Variable name for 'cell types'.
Variable name for subject/samples.
Indicate the health condition of subjects.
A subset of cell types that are selected to construct pseudo bulk samples. If NULL, then all cell types are used.
Manually input the cell-type proportion for pseudo bulk samples.
The number of pseudo bulk samples to be constructed.
Logical, randomly sample single cells with replacement. Default is F.
Lower support a for uniform distribution U[a,b].
Upper support b for uniform distribution U[a,b].
Pseudo bulk samples in the format of `ExpressionSet`, and the true cell-type proportions.
##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"))
##generate a pseudo bulk data with two samples
set.seed(1234567)
pseudo.seger<-generateBulk(seger[["sc.eset.qc"]], ct.varname = "cluster",
sample = "sample", ct.sub = c("alpha","beta","delta","gamma"),
nbulk = 2, low_s = 0.3, upp_s = 0.7)
#> Using 4 cell types to generate pseudo bulk samples...
#> Generating random cell type proportions...
#> generating bulk 1 from donor one...
#> generating bulk 2 from donor one...
#> generating expression set object for pseudo bulk sample.id...