Closed Naz840 closed 1 year ago
Hi @Naz840 !!
So you have found the first metadata test. Great job! Its always important to look at the metadata in a seurat object, to make sure that: 1) the metadata that you are setting in your active directory is the correct one and 2) the metadata that you are setting in your active directory contains the data that is needed to perform your analysis,
In the pbmc
Seurat object that is present in the folder, in order to check metadata one can run the following code:
> colnames(pbmc@meta.data)
[1] "orig.ident" "nCount_RNA" "nFeature_RNA" "stim" "seurat_annotations"
[6] "k.assign" "donor" "percent.mt" "RNA_snn_res.0.5" "seurat_clusters"
[11] "celltype" "celltype.stim"
As you can see above, both the celltype.stim
and celltype
metadata slots are present in the metadata slot. However, the celltype.stim
metadata slot contains information on 1) celltype and 2) treatment which is necessary when performing a differential test, because seurat needs to know which barcodes/cells are 1) dendritic cells 2) dendritic cells which are either ctrl or control. Alternatively, the celltype
slot contains ONLY celltype information:
> table(pbmc$celltype)
CD14 Mono CD4 Naive T CD4 Memory T CD16 Mono B CD8 T
4323 2478 1716 1064 970 786
T activated NK DC B Activated Mk pDC
658 645 420 390 220 128
Mono/Mk Doublets Eryth
70 55
So...we can't use data here to run a test between treatment and control, Why is this? Well because Seurat can't tell which dendritic cells are treated or not on the basis of the data in this metadata slot. seurat needs to know which dendritic cells are treated: for that we need celltype.stim
containing both pieces of information:
> table(pbmc$celltype.stim)
B Activated_CTRL B Activated_STIM B_CTRL B_STIM CD14 Mono_CTRL
183 207 405 565 2209
CD14 Mono_STIM CD16 Mono_CTRL CD16 Mono_STIM CD4 Memory T_CTRL CD4 Memory T_STIM
2114 518 546 813 903
CD4 Naive T_CTRL CD4 Naive T_STIM CD8 T_CTRL CD8 T_STIM DC_CTRL
1003 1475 320 466 226
DC_STIM Eryth_CTRL Eryth_STIM Mk_CTRL Mk_STIM
194 22 33 98 122
Mono/Mk Doublets_CTRL Mono/Mk Doublets_STIM NK_CTRL NK_STIM pDC_CTRL
42 28 312 333 51
pDC_STIM T activated_CTRL T activated_STIM
77 315 343
I hope that answers your question. If not let me know if you have other questions.
🐲
This issue is now marked as completed and closed if you have another issue please reopen or create a new issue. Thanks.
Hello,
I am facing an issue: after loading
Idents(pbmc) <- "celltype.stim"
in step 13A, which was successfully executed, but in the comment section I noticed as a hint I should notice ident.1 and ident.2 terms should reside in pbmc$celltype, which I was unable to see. Hence, when I was trying to execute the downstream syntax (pasted below), I was unable to execute it and got an error message (also pasted below).Now type in your session info, this is the output of the command sessionInfo in R ` R version 4.3.1 (2023-06-16 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/Chicago tzcode source: internal
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] SeuratObject_4.1.3 Seurat_4.3.0.1 harmony_0.1.1 Rcpp_1.0.11 dplyr_1.1.2
loaded via a namespace (and not attached): [1] deldir_1.0-9 pbapply_1.7-2 gridExtra_2.3 rlang_1.1.1
[5] magrittr_2.0.3 RcppAnnoy_0.0.21 matrixStats_1.0.0 ggridges_0.5.4
[9] compiler_4.3.1 spatstat.geom_3.2-4 png_0.1-8 vctrs_0.6.3
[13] reshape2_1.4.4 stringr_1.5.0 pkgconfig_2.0.3 fastmap_1.1.1
[17] ellipsis_0.3.2 labeling_0.4.2 utf8_1.2.3 promises_1.2.0.1
[21] purrr_1.0.1 jsonlite_1.8.7 goftest_1.2-3 later_1.3.1
[25] spatstat.utils_3.0-3 irlba_2.3.5.1 parallel_4.3.1 cluster_2.1.4
[29] R6_2.5.1 ica_1.0-3 stringi_1.7.12 RColorBrewer_1.1-3
[33] spatstat.data_3.0-1 reticulate_1.31 parallelly_1.36.0 lmtest_0.9-40
[37] scattermore_1.2 tensor_1.5 future.apply_1.11.0 zoo_1.8-12
[41] sctransform_0.3.5 httpuv_1.6.11 Matrix_1.5-4.1 splines_4.3.1
[45] igraph_1.5.1 tidyselect_1.2.0 rstudioapi_0.15.0 abind_1.4-5
[49] spatstat.random_3.1-5 codetools_0.2-19 miniUI_0.1.1.1 spatstat.explore_3.2-1 [53] listenv_0.9.0 lattice_0.21-8 tibble_3.2.1 plyr_1.8.8
[57] withr_2.5.0 shiny_1.7.4.1 ROCR_1.0-11 Rtsne_0.16
[61] future_1.33.0 survival_3.5-5 polyclip_1.10-4 fitdistrplus_1.1-11
[65] pillar_1.9.0 KernSmooth_2.23-21 plotly_4.10.2 generics_0.1.3
[69] sp_2.0-0 ggplot2_3.4.2 munsell_0.5.0 scales_1.2.1
[73] globals_0.16.2 xtable_1.8-4 glue_1.6.2 lazyeval_0.2.2
[77] tools_4.3.1 data.table_1.14.8 RANN_2.6.1 leiden_0.4.3
[81] cowplot_1.1.1 grid_4.3.1 tidyr_1.3.0 colorspace_2.1-0
[85] nlme_3.1-162 patchwork_1.1.2 cli_3.6.1 spatstat.sparse_3.0-2 [89] fansi_1.0.4 viridisLite_0.4.2 uwot_0.1.16 gtable_0.3.3
[93] digest_0.6.33 progressr_0.14.0 ggrepel_0.9.3 farver_2.1.1
[97] htmlwidgets_1.6.2 htmltools_0.5.5 lifecycle_1.0.3 httr_1.4.6
[101] mime_0.12 MASS_7.3-60 `
Additional context Add any other context or screenshots about the feature request here.