The goal of this script is to explore Ptcra expression in our dataset. This gene has been described by Toto et al. (once).
We load the libraries of interest :
library(Seurat)
library(ggplot2)
.libPaths()
## [1] "/shared/home/aonfroy/R/x86_64-conda-linux-gnu-library/4.4"
## [2] "/shared/ifbstor1/software/miniconda/envs/r-4.4.1/lib/R/library"
We set the directory to load and save data:
data_dir = "/shared/projects/2422_ebaii_n1/atelier_scrnaseq/Intro_Rmd/"
We load data:
sobj = readRDS(paste0(data_dir, "sobj.rds"))
sobj
## An object of class Seurat
## 12926 features across 200 samples within 1 assay
## Active assay: RNA (12926 features, 2000 variable features)
## 3 layers present: counts, data, scale.data
## 3 dimensional reductions calculated: pca, harmony, tsne
We visualize our favorite gene :
Seurat::FeaturePlot(sobj, reduction = "tsne", features = "Ptcra") +
ggplot2::theme(aspect.ratio = 1)
Which cells are positive for Ptcra ?
sobj$is_Ptcra_pos = (Seurat::FetchData(sobj, "Ptcra")[, 1] > 0)
head(sobj$is_Ptcra_pos)
## AAACCTGAGACGCTTT.1_1 AAACCTGAGGCATTGG.1_1 AAACCTGGTCAACATC.1_1
## FALSE FALSE FALSE
## AAACCTGTCGAGGTAG.1_1 AAACCTGTCGATCCCT.1_1 AAACGGGCACTTACGA.1_1
## TRUE FALSE FALSE
We visualize the positive and negative cells :
Seurat::DimPlot(sobj, reduction = "tsne", group.by = "is_Ptcra_pos") +
ggplot2::theme(aspect.ratio = 1)
How many cells are positive ?
table(sobj$is_Ptcra_pos)
##
## FALSE TRUE
## 110 90
Half of cells are Ptcra+.
Eventually here, we can save the dataset that has been processed through this notebook.
saveRDS(sobj, file = paste0(data_dir, "sobj_processed.rds"))
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-conda-linux-gnu
## Running under: Ubuntu 20.04.6 LTS
##
## Matrix products: default
## BLAS/LAPACK: /shared/ifbstor1/software/miniconda/envs/r-4.4.1/lib/libopenblasp-r0.3.27.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Europe/Paris
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggplot2_3.5.1 Seurat_5.1.0 SeuratObject_5.0.2 sp_2.1-4
##
## loaded via a namespace (and not attached):
## [1] deldir_2.0-4 pbapply_1.7-2 gridExtra_2.3
## [4] rlang_1.1.4 magrittr_2.0.3 RcppAnnoy_0.0.22
## [7] spatstat.geom_3.3-3 matrixStats_1.4.1 ggridges_0.5.6
## [10] compiler_4.4.1 png_0.1-8 vctrs_0.6.5
## [13] reshape2_1.4.4 stringr_1.5.1 pkgconfig_2.0.3
## [16] fastmap_1.2.0 labeling_0.4.3 utf8_1.2.4
## [19] promises_1.3.0 rmarkdown_2.28 purrr_1.0.2
## [22] xfun_0.48 cachem_1.1.0 jsonlite_1.8.9
## [25] goftest_1.2-3 highr_0.11 later_1.3.2
## [28] spatstat.utils_3.1-0 irlba_2.3.5.1 parallel_4.4.1
## [31] cluster_2.1.6 R6_2.5.1 ica_1.0-3
## [34] spatstat.data_3.1-2 bslib_0.8.0 stringi_1.8.4
## [37] RColorBrewer_1.1-3 reticulate_1.39.0 spatstat.univar_3.0-1
## [40] parallelly_1.38.0 lmtest_0.9-40 jquerylib_0.1.4
## [43] scattermore_1.2 Rcpp_1.0.13 knitr_1.48
## [46] tensor_1.5 future.apply_1.11.2 zoo_1.8-12
## [49] sctransform_0.4.1 httpuv_1.6.15 Matrix_1.7-1
## [52] splines_4.4.1 igraph_2.1.1 tidyselect_1.2.1
## [55] abind_1.4-8 rstudioapi_0.17.0 yaml_2.3.10
## [58] spatstat.random_3.3-2 spatstat.explore_3.3-2 codetools_0.2-20
## [61] miniUI_0.1.1.1 listenv_0.9.1 lattice_0.22-6
## [64] tibble_3.2.1 plyr_1.8.9 withr_3.0.1
## [67] shiny_1.9.1 ROCR_1.0-11 evaluate_1.0.1
## [70] Rtsne_0.17 future_1.34.0 fastDummies_1.7.4
## [73] survival_3.7-0 polyclip_1.10-7 fitdistrplus_1.2-1
## [76] pillar_1.9.0 KernSmooth_2.23-24 plotly_4.10.4
## [79] generics_0.1.3 RcppHNSW_0.6.0 munsell_0.5.1
## [82] scales_1.3.0 globals_0.16.3 xtable_1.8-4
## [85] glue_1.8.0 lazyeval_0.2.2 tools_4.4.1
## [88] data.table_1.16.2 RSpectra_0.16-2 RANN_2.6.2
## [91] leiden_0.4.3.1 dotCall64_1.2 cowplot_1.1.3
## [94] grid_4.4.1 tidyr_1.3.1 colorspace_2.1-1
## [97] nlme_3.1-165 patchwork_1.3.0 cli_3.6.3
## [100] spatstat.sparse_3.1-0 spam_2.11-0 fansi_1.0.6
## [103] viridisLite_0.4.2 dplyr_1.1.4 uwot_0.2.2
## [106] gtable_0.3.5 sass_0.4.9 digest_0.6.37
## [109] progressr_0.14.0 ggrepel_0.9.6 htmlwidgets_1.6.4
## [112] farver_2.1.2 htmltools_0.5.8.1 lifecycle_1.0.4
## [115] httr_1.4.7 mime_0.12 MASS_7.3-61