** Generate Figure S2A **
# get the Seurat object for gated cell subsets frequencies
# merge <- readRDS("input/2020_08_09.rmBuffSHD8.allcelltypelabels.merge.SNG.wmeta.WithinBatchClustered.Rds")
# merge.UnSort <- subset(merge, subset = Sorted == "N")
# merge_cell_UnSort_gate_merged <- data.frame(table(merge.UnSort$sample_id, merge.UnSort$gate_group_merged)) %>% dplyr::group_by(Var1) %>% dplyr::mutate(ratio = Freq/sum(Freq))
# saveRDS(merge_cell_UnSort_gate_merged, "output/merge_cell_UnSort_gate_merged.rds")
# merge_cell_UnSort_course <- data.frame(table(merge.UnSort$sample_id, merge.UnSort$gate_group_course)) %>%
# dplyr::group_by(Var1) %>% dplyr::mutate(ratio = Freq/sum(Freq))
# saveRDS(merge_cell_UnSort_course, "output/merge_cell_UnSort_gate_course.rds")
merge_cell_UnSort_gate_merged <- readRDS("output/merge_cell_UnSort_gate_merged.rds")
merge_cell_UnSort_course <- readRDS("output/merge_cell_UnSort_gate_course.rds")
merge_cell_UnSort <- rbind(merge_cell_UnSort_gate_merged, merge_cell_UnSort_course)
flow_of_total_mtx <- read.xlsx("input/Frequency_Manual.xlsx", sheet = "Freq_of_total", rowNames = TRUE)
flow_of_total <- melt(flow_of_total_mtx, id = c("Subject", "Timepoint", "Class", "Assay")) %>%
mutate("sample_id" = paste(Subject, Timepoint, sep = "_"))
merge_cell_UnSort$sample_id <- sapply(str_split(merge_cell_UnSort$Var1, pattern = "_", n = 2), function(x)x[[2]])
flow_merge_cell_of_total <- inner_join(flow_of_total, merge_cell_UnSort, c("sample_id"="sample_id", "variable"="Var2")) %>%
mutate(value.y = 100*ratio) %>%
filter(!is.na(value.y)) %>%
mutate(variable = factor(variable, levels = c("B", "B_Naive", "B_Mem",
"CD4", "CD4_Mem", "Treg", "Tfh",
"CD8", "CD8_Mem", "NK", "NK_CD16hi",
"NK_CD56hiCD16lo", "NK_CD56loCD16lo",
"Mono", "Mono_Classical", "Mono_Nonclassical",
"mDC", "pDC", "Gr", "Baso")))
p <- ggplot(flow_merge_cell_of_total, aes(x = value, y = value.y))+
geom_point(aes(color = Class))+
facet_wrap(~variable, scales = "free")+
geom_smooth(method = lm, se=FALSE, linetype = "dashed")+
labs(title = "freq of total single cells",
x = "Flow_Cell_Freq%", y = "CITEseq_cell_Freq%")+
stat_cor(method = "pearson") +
theme_bw()
p
sI <- sessionInfo()
utils:::print.sessionInfo(sI[-c(10,11)])
## R version 3.6.2 (2019-12-12)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Mojave 10.14.6
##
## Matrix products: default
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggpubr_0.4.0.999 reshape2_1.4.3 openxlsx_4.1.4 forcats_0.4.0
## [5] stringr_1.4.0 dplyr_0.8.4 purrr_0.3.3 readr_1.3.1
## [9] tidyr_1.0.2 tibble_3.0.3 ggplot2_3.3.2 tidyverse_1.3.0
## [13] plyr_1.8.5 matrixStats_0.55.0 Seurat_3.1.4
##
## loaded via a namespace (and not attached):
## [1] readxl_1.3.1 backports_1.1.5 sn_1.5-5
## [4] igraph_1.2.4.2 lazyeval_0.2.2 splines_3.6.2
## [7] listenv_0.8.0 TH.data_1.0-10 digest_0.6.25
## [10] htmltools_0.4.0 gdata_2.18.0 fansi_0.4.1
## [13] magrittr_1.5 cluster_2.1.0 ROCR_1.0-7
## [16] globals_0.12.5 modelr_0.1.6 RcppParallel_4.4.4
## [19] sandwich_2.5-1 colorspace_1.4-1 rvest_0.3.5
## [22] ggrepel_0.8.1 haven_2.2.0 xfun_0.12
## [25] crayon_1.3.4 jsonlite_1.6.1 survival_3.1-8
## [28] zoo_1.8-7 ape_5.3 glue_1.3.1
## [31] gtable_0.3.0 leiden_0.3.3 car_3.0-6
## [34] future.apply_1.4.0 BiocGenerics_0.32.0 abind_1.4-5
## [37] scales_1.1.0 mvtnorm_1.1-0 DBI_1.1.0
## [40] bibtex_0.4.2.2 rstatix_0.6.0 Rcpp_1.0.3
## [43] metap_1.3 plotrix_3.7-7 viridisLite_0.3.0
## [46] reticulate_1.14 foreign_0.8-75 rsvd_1.0.3
## [49] stats4_3.6.2 tsne_0.1-3 htmlwidgets_1.5.1
## [52] httr_1.4.1 gplots_3.0.3 RColorBrewer_1.1-2
## [55] TFisher_0.2.0 ellipsis_0.3.0 ica_1.0-2
## [58] farver_2.0.3 pkgconfig_2.0.3 uwot_0.1.5
## [61] dbplyr_1.4.2 labeling_0.3 tidyselect_1.0.0
## [64] rlang_0.4.7 munsell_0.5.0 cellranger_1.1.0
## [67] tools_3.6.2 cli_2.0.2 generics_0.0.2
## [70] broom_0.7.0 ggridges_0.5.2 evaluate_0.14
## [73] yaml_2.2.1 npsurv_0.4-0 knitr_1.28
## [76] fs_1.3.1 fitdistrplus_1.0-14 zip_2.0.4
## [79] caTools_1.18.0 RANN_2.6.1 pbapply_1.4-2
## [82] future_1.16.0 nlme_3.1-144 xml2_1.2.2
## [85] compiler_3.6.2 rstudioapi_0.11 curl_4.3
## [88] plotly_4.9.2 png_0.1-7 lsei_1.2-0
## [91] ggsignif_0.6.0 reprex_0.3.0 stringi_1.4.6
## [94] lattice_0.20-40 Matrix_1.2-18 multtest_2.42.0
## [97] vctrs_0.3.4 mutoss_0.1-12 pillar_1.4.3
## [100] lifecycle_0.2.0 Rdpack_0.11-1 lmtest_0.9-37
## [103] RcppAnnoy_0.0.15 data.table_1.12.8 cowplot_1.0.0
## [106] bitops_1.0-6 irlba_2.3.3 gbRd_0.4-11
## [109] patchwork_1.0.0 R6_2.4.1 rio_0.5.16
## [112] KernSmooth_2.23-16 gridExtra_2.3 codetools_0.2-16
## [115] MASS_7.3-51.5 gtools_3.8.1 assertthat_0.2.1
## [118] withr_2.1.2 sctransform_0.2.1 mnormt_1.5-6
## [121] multcomp_1.4-12 mgcv_1.8-31 parallel_3.6.2
## [124] hms_0.5.3 grid_3.6.2 rmarkdown_2.1
## [127] carData_3.0-3 Rtsne_0.15 numDeriv_2016.8-1.1
## [130] Biobase_2.46.0 lubridate_1.7.4