makeDesign | R Documentation |
This function generate design matrix and make preparations for following fitModel and csTest.
makeDesign(design, Prop)
design |
A N by P phenotype matrix, with rows as samples and columns as phenotypes (e.g. age, gender, disease, etc.). |
Prop |
A N by K proportion matrix, with rows as samples and columns as cell types |
design_matrix |
A comprehensive design matrix incorporated phenotype and proportion information. |
Prop |
The input proportion matrix. |
design |
The input design/phenotype matrix. |
all_coefs |
The names of all phenotypes. |
all_cell_types |
The names of all cell types. |
formula |
The formula of the tested model, including all phenotypes, cell types and interaction terms. |
Ziyi Li <zli16@mdanderson.org>
Ziyi Li, Zhijin Wu, Peng Jin, Hao Wu. "Dissecting differential signals in high-throughput data from complex tissues."
N = 300 # simulation a dataset with 300 samples K = 3 # 3 cell types ### simulate proportion matrix Prop = matrix(runif(N*K, 10,60), ncol=K) Prop = sweep(Prop, 1, rowSums(Prop), FUN="/") colnames(Prop) = c("Neuron", "Astrocyte", "Microglia") ### simulate phenotype names design <- data.frame(disease=factor(sample(0:1, size = N,replace=TRUE)), age=round(runif(N, 30,50)), race=factor(sample(1:3, size = N,replace=TRUE))) Design_out <- makeDesign(design, Prop)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.