Bellow we load the HCA object that has been filtered for bad quality samples (filter_bad_oligos_and_samples.R), for clusters that were formed by a single individual(filter_bad_clusters.Rmd) and annotated.
Plot the proportions for caseNo
Some general distributions about the data. We started with equal number of sex/age/tissues but because we deleted samples these are not equal any more. Also the number of cells from each one might differ
## Old men Old women Young men Young women
## 13 13 12 10
## BA4 CB CSC
## 15 14 19
##
## BA4 CB CSC
## Old men 3 5 5
## Old women 5 4 4
## Young men 4 3 5
## Young women 3 2 5
##
## Old men Old women Young men Young women
## 14486 10755 11582 8705
##
## BA4 CB CSC
## 9915 15963 19650
##
## BA4 CB CSC
## Old men 2025 6322 6139
## Old women 2630 3940 4185
## Young men 3613 3600 4369
## Young women 1647 2101 4957
At a sample level more young women and CB samples were deleted.We can see there are less cells from young women, however there are less cells in the BA4 than the other two.
Separate by both things in 4 plots. The plots are corrected by number of cells per sexage group first (looking at the distribution of each group across clusters) and then corrected for the number of cells per cluster (to visualize the small and big clusters equally).
Calculate proportion clusters for each AgeSex
split the clustering by the original tissues
Calculate proportion clusters for each Tissue
To better understand the proportions I show the different steps with tables
##
## Old men Old women Young men Young women
## Astrocyte_1 952 593 376 535
## Astrocyte_2 132 148 311 73
## Astrocyte_3 75 36 41 192
## Astrocyte_4 65 23 6 38
## Endothelial-Pericyte_1 779 408 483 346
## Endothelial-Pericyte_2 635 460 503 325
## Stromal_1 159 103 124 89
## Stromal_2 83 244 50 89
## Immune 164 124 125 86
## Microglia-Macrophages_1 782 468 368 476
## Microglia-Macrophages_2 588 225 491 453
## Neuron_Ex_1 275 292 301 150
## Neuron_Ex_2 328 224 306 133
## Neuron_Ex_3 78 70 212 133
## Neuron_In_1 424 542 305 213
## Neuron_In_2 509 198 276 401
## Neuron_In_3 146 113 172 76
## Neuron_In_4 51 29 96 18
## Neuron_RELN+_1 731 477 1209 55
## Neuron_RELN+_2 639 439 344 24
## Neuron_RELN+_3 128 101 488 28
## Oligo 5672 4716 4211 3978
## OPC 1091 722 784 794
##
## Old men Old women Young men Young women
## Astrocyte_1 6.57186249 5.51371455 3.24641685 6.14589316
## Astrocyte_2 0.91122463 1.37610414 2.68520117 0.83859851
## Astrocyte_3 0.51774127 0.33472803 0.35399758 2.20562895
## Astrocyte_4 0.44870910 0.21385402 0.05180452 0.43653073
## Endothelial-Pericyte_1 5.37760596 3.79358438 4.17026420 3.97472717
## Endothelial-Pericyte_2 4.38354273 4.27708043 4.34294595 3.73348650
## Stromal_1 1.09761149 0.95769410 1.07062683 1.02240092
## Stromal_2 0.57296700 2.26871223 0.43170437 1.02240092
## Immune 1.13212757 1.15295212 1.07926092 0.98793797
## Microglia-Macrophages_1 5.39831562 4.35146444 3.17734415 5.46812177
## Microglia-Macrophages_2 4.05909154 2.09205021 4.23933690 5.20390580
## Neuron_Ex_1 1.89838465 2.71501627 2.59886030 1.72314762
## Neuron_Ex_2 2.26425514 2.08275221 2.64203074 1.52785755
## Neuron_Ex_3 0.53845092 0.65086007 1.83042652 1.52785755
## Neuron_In_1 2.92696397 5.03951650 2.63339665 2.44686962
## Neuron_In_2 3.51373740 1.84100418 2.38300812 4.60654796
## Neuron_In_3 1.00786967 1.05067411 1.48506303 0.87306146
## Neuron_In_4 0.35206406 0.26964203 0.82887239 0.20677771
## Neuron_RELN+_1 5.04625155 4.43514644 10.43861164 0.63182079
## Neuron_RELN+_2 4.41115560 4.08182241 2.97012606 0.27570362
## Neuron_RELN+_3 0.88361176 0.93909809 4.21343464 0.32165422
## Oligo 39.15504625 43.84937238 36.35814194 45.69787478
## OPC 7.53140964 6.71315667 6.76912450 9.12119472
## R version 4.0.4 (2021-02-15)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19041)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United Kingdom.1252
## [2] LC_CTYPE=English_United Kingdom.1252
## [3] LC_MONETARY=English_United Kingdom.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United Kingdom.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggsci_2.9 tidyr_1.1.3 ggplot2_3.3.3 here_1.0.1
## [5] SeuratObject_4.0.0 Seurat_4.0.0
##
## loaded via a namespace (and not attached):
## [1] Rtsne_0.15 colorspace_2.0-0 deldir_0.2-10
## [4] ellipsis_0.3.1 ggridges_0.5.3 rprojroot_2.0.2
## [7] spatstat.data_2.0-0 farver_2.1.0 leiden_0.3.7
## [10] listenv_0.8.0 ggrepel_0.9.1 fansi_0.4.2
## [13] codetools_0.2-18 splines_4.0.4 knitr_1.31
## [16] polyclip_1.10-0 jsonlite_1.7.2 ica_1.0-2
## [19] cluster_2.1.1 png_0.1-7 uwot_0.1.10
## [22] shiny_1.6.0 sctransform_0.3.2 compiler_4.0.4
## [25] httr_1.4.2 assertthat_0.2.1 Matrix_1.3-2
## [28] fastmap_1.1.0 lazyeval_0.2.2 later_1.1.0.1
## [31] htmltools_0.5.1.1 tools_4.0.4 igraph_1.2.6
## [34] gtable_0.3.0 glue_1.4.2 RANN_2.6.1
## [37] reshape2_1.4.4 dplyr_1.0.5 Rcpp_1.0.6
## [40] spatstat_1.64-1 scattermore_0.7 jquerylib_0.1.3
## [43] vctrs_0.3.6 nlme_3.1-152 lmtest_0.9-38
## [46] xfun_0.21 stringr_1.4.0 globals_0.14.0
## [49] mime_0.10 miniUI_0.1.1.1 lifecycle_1.0.0
## [52] irlba_2.3.3 goftest_1.2-2 future_1.21.0
## [55] MASS_7.3-53.1 zoo_1.8-9 scales_1.1.1
## [58] promises_1.2.0.1 spatstat.utils_2.1-0 parallel_4.0.4
## [61] RColorBrewer_1.1-2 yaml_2.2.1 reticulate_1.18
## [64] pbapply_1.4-3 gridExtra_2.3 sass_0.3.1
## [67] rpart_4.1-15 stringi_1.5.3 highr_0.8
## [70] rlang_0.4.10 pkgconfig_2.0.3 matrixStats_0.58.0
## [73] evaluate_0.14 lattice_0.20-41 ROCR_1.0-11
## [76] purrr_0.3.4 tensor_1.5 patchwork_1.1.1
## [79] htmlwidgets_1.5.3 labeling_0.4.2 cowplot_1.1.1
## [82] tidyselect_1.1.0 parallelly_1.24.0 RcppAnnoy_0.0.18
## [85] plyr_1.8.6 magrittr_2.0.1 R6_2.5.0
## [88] generics_0.1.0 DBI_1.1.1 pillar_1.5.1
## [91] withr_2.4.1 mgcv_1.8-34 fitdistrplus_1.1-3
## [94] survival_3.2-10 abind_1.4-5 tibble_3.1.0
## [97] future.apply_1.7.0 crayon_1.4.1 KernSmooth_2.23-18
## [100] utf8_1.2.1 plotly_4.9.3 rmarkdown_2.7
## [103] grid_4.0.4 data.table_1.14.0 digest_0.6.27
## [106] xtable_1.8-4 httpuv_1.5.5 munsell_0.5.0
## [109] viridisLite_0.3.0 bslib_0.2.4