Case 2: COVID19
Datasource: COVID-19 immune features revealed by a large-scale single-cell transcriptome atlas
This example data has been integrated in the SPARKLE
(SPARKLE::covid.data)
Input data
Input formats : Seurat metadata
library(SPARKLE)
covid.data.ratio <-SPARKLE::covid.data
knitr::kable(head(metadata), caption = "Seurat metadata") | orig.ident | nCount_RNA | nFeature_RNA | Initial.No | Study.No | Ascites.1_Blood.2_Breast.3_Colon.4_Stomach.5_Kidney.6_Liver.7_Lung.8_Pancreas.9_Skin.10_Spleen.11_Tonsil.12 | Patient.No | MirgDC.1_DC1.2_DC2.3_MacroMono.4 | Study | Tissue | Status | Clusters.NO | Clusters | nCount_integrated | nFeature_integrated | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ACTTGTTCACCGCTAG.1_1 | SeuratProject | 1628.662 | 719 | 1 | 1 | 1 | 1 | 3 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 337.7403 | 1387 |
| ATTGGACCATGTCCTC.1_1 | SeuratProject | 1028.799 | 342 | 2 | 1 | 1 | 1 | 3 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 262.4473 | 1390 |
| CCTTACGTCCCTGACT.1_1 | SeuratProject | 1779.581 | 959 | 3 | 1 | 1 | 1 | 3 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 332.5596 | 1415 |
| TGTTCCGCAGAAGCAC.1_1 | SeuratProject | 1493.055 | 578 | 4 | 1 | 1 | 1 | 1 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 350.6807 | 1364 |
| TTGACTTGTACTCAAC.1_1 | SeuratProject | 1555.572 | 806 | 5 | 1 | 1 | 1 | 1 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 320.1611 | 1435 |
| AACTCAGGTAAGTGGC.2_1 | SeuratProject | 1460.183 | 767 | 6 | 1 | 1 | 1 | 3 | Tang-Huau | Ascites | Healthy | 6 | T cell doublets | 334.7708 | 1478 |
sparkle.data <- cwas_build_model_data(inputdata = covid.data.ratio,Sample = "sampleID",Phenotype = "severity",Celltype ="celltype",Group ="tissue",Subgroup = "dataset",Control_label = "control",Disease_label = "severe/critical",Cellrate ="cellratio",selected_celltype = c("CD8","DC","Macro") )## [1] "Warning: No Covariate1 infomation"
## [1] "Warning: No Covariate2 infomation"
## [1] "No gene infomation added"
## [1] "No geneset score infomation added"
Data exporlation (Optional)
PCA
PCA plot for data exploration
cwas_pcadraw(sparkle.data) Wilcoxon
Wilcoxon rank sum test and plot
cwas_classic_comparision(sparkle.data) Hausman_test
Test for Group
df <- cwas_hausman_test_all(sparkle.data,variable = "Group")
knitr::kable(df, caption = "Hausman test") | Celltype | Hausman_Statistic | Pvalue | Model_Selection | Varible |
|---|---|---|---|---|
| CD8 | -0.1813483 | 1 | Random Effects Model | Group : tissue |
| Macro | -0.6184158 | 1 | Random Effects Model | Group : tissue |
| DC | -7.7350413 | 1 | Random Effects Model | Group : tissue |
Test for Subgroup
df2 <- cwas_hausman_test_all(sparkle.data,variable = "Subgroup")
knitr::kable(df2, caption = "Hausman test") | Celltype | Hausman_Statistic | Pvalue | Model_Selection | Varible |
|---|---|---|---|---|
| CD8 | 25.4053173 | 3e-06 | Fixed Effects Model | Subgroup : dataset |
| Macro | -0.0011404 | 1e+00 | Random Effects Model | Subgroup : dataset |
| DC | -0.1209747 | 1e+00 | Random Effects Model | Subgroup : dataset |
Cell-phenotype association analysis
All model calculation
all.models <- cwas_allmodel_cal(sparkle.data)### calculation for all modelHeatmap plot for all model
p <- cwas_allmodel_heatmap(all.models)# Plot all model AIC and PvalueForest plot for Best model selection
best.model <- cwas_autoselected_model(all.models)# Select the best model and plotCell-phenotype covariate analysis
all.model.cov <- cwas_2celltype_allmodel_cal(sparkle.data)# Select the best model and plot
cwas_allmodel_heatmap(all.model.cov)# Plot all model AIC and Pvaluebest.model.cov <- cwas_autoselected_model(all.model.cov)# Select the best model and plotCell-phenotype mediation analysis
Your_interested_celltype="CD8"
all.model.med <- cwas_mediation_analysis(sparkle.data,X.cell = Your_interested_celltype,Best_model =best.model,method = "cell_mediate_cell" )# Select the best model and plotCell-phenotype moderation analysis
all.model.mod <- cwas_moderation_analysis(sparkle.data,X.cell =Your_interested_celltype,Best_model =best.model,method = "cell_moderation_cell" )# Select the best model and plotModeration network plot
# sparkle.data <- cwas_build_model_data(inputdata = covid.data.ratio,Sample = "sampleID",Phenotype = "severity",Celltype ="celltype",Group ="tissue",Subgroup = "dataset",Control_label = "control",Disease_label = "severe/critical",Cellrate ="cellratio",selected_celltype = c("CD8","DC","Macro") )
SPARKLE::Cell_phenotype_network_plot(sparkle.data )