Map 5 prime single cell RNA data
Load packages and functions
library(Seurat)
library(tidyverse)
library(readxl)
source("R/ReadPackages.R")
source("R/Functions.R")
source("R/ThemesColors.R")
<-
mytheme theme_bw()+
theme(legend.position = "none",
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank())
Read data
<- readRDS("output/Tcells_Integrated.rds") Combined_T
Read and Process 5’ scRNA data
<- list.files(path = "countMatrices", pattern = "_Tcells_5'RNA.txt", full.names = T)
files names(files) <- strsplit(files, split = "_") %>% sapply("[[", 1) %>% strsplit(split = "/") %>% sapply("[[", 2)
<- lapply(1:length(files), function(x) {
sobjs_T
# Read count tables
<- read.delim(files[x], sep = " ")
rna
# Create Seurat Object
<- CreateSeuratObject(counts = rna)
sobj
# Add Percentage of mitochondrial genes and PatientID
"percent.mt"]] <- PercentageFeatureSet(sobj, pattern = "^MT-")
sobj[[$PatientID <- names(files)[x]
sobj
# Normalize data
<- NormalizeData(sobj, normalization.method = "LogNormalize", scale.factor = 10000)
sobj
# Run Seurat Processing
<- SeuratProc_T(sobj, verbose=FALSE,
sobj dims.clustering=1:14,
resolution.clustering = 0.4,
dims.umap=1:13)
return(sobj)
})
names(sobjs_T) <- names(files)
Map individual samples to CITE-seq reference
<- lapply(sobjs_T, function(sobj) {
sobjs_T_mapped
<- FindTransferAnchors(reference = Combined_T, query = sobj,
anchors reference.reduction = "pcaRNA")
<- MapQuery(anchorset = anchors, reference = Combined_T,
sobj query = sobj, reduction.model = "wnn.umap",
refdata = list(celltype = "IdentI"),
reference.reduction = "pcaRNA")
return(sobj)
})
names(sobjs_T_mapped) <- names(sobjs_T)
Plots
<-
p1 DimPlot(Combined_T, group.by = "IdentI", raster = TRUE, raster.dpi = c(500,500),
reduction = "wnn.umap", label = TRUE)+
scale_color_manual(values = colors_umap_cl)+
xlim(-10, 13)+ylim(-10, 10)+
coord_fixed()+
mytheme
<- lapply(names(sobjs_T), function(sample){
p2 DimPlot(subset(Combined_T, subset=PatientID==sample), raster.dpi = c(500,500), raster = TRUE,
reduction = "wnn.umap", group.by = "IdentI", label = TRUE)+
scale_color_manual(values = colors_umap_cl)+
xlim(-10, 13)+ylim(-10, 10)+
coord_fixed()+
mytheme%>% `names<-`(names(sobjs_T))
})
<- lapply(sobjs_T_mapped, function(sample){
p3 DimPlot(sample, label = TRUE, raster.dpi = c(500,500), raster = TRUE,
group.by = "predicted.celltype", reduction = "ref.umap")+
scale_color_manual(values = colors_umap_cl)+
xlim(-10, 13)+ylim(-10, 10)+
coord_fixed()+
mytheme%>% `names<-`(names(sobjs_T_mapped)) })
LN0078
+p2$LN0078+p3$LN0078 p1
LN0132
+p2$LN0132+p3$LN0132 p1
LN0144
+p2$LN0144+p3$LN0144 p1
LN0178
+p2$LN0178+p3$LN0178 p1
LN0193
+p2$LN0193+p3$LN0193 p1
LN0217
+p2$LN0217+p3$LN0217 p1
LN0302
+p2$LN0302+p3$LN0302 p1
LN0110
+p2$LN0110+p3$LN0110 p1
LN0198
+p2$LN0198+p3$LN0198 p1
LN0259
+p2$LN0259+p3$LN0259 p1
LN0278
+p2$LN0278+p3$LN0278 p1
Save object
saveRDS(sobjs_T_mapped, file = "output/List_SeuratObjects_T_5prime.rds")
Session Info
sessionInfo()
## R version 4.1.2 (2021-11-01)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: CentOS Linux 7 (Core)
##
## Matrix products: default
## BLAS/LAPACK: /g/easybuild/x86_64/CentOS/7/haswell/software/FlexiBLAS/3.0.4-GCC-11.2.0/lib64/libflexiblas.so.3.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
## [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] grid stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] pamr_1.56.1 cluster_2.1.2 glmnet_4.1-2 Matrix_1.5-1 immunarch_0.7.0 data.table_1.14.2 dtplyr_1.2.2 rmdformats_1.0.4
## [9] ggplotify_0.1.0 ggraph_2.0.6 igraph_1.3.5 ggrastr_1.0.1 ggtext_0.1.1 ggalluvial_0.12.3 maxstat_0.7-25 survival_3.2-13
## [17] survminer_0.4.9 ggridges_0.5.3 cowplot_1.1.1 R.utils_2.11.0 R.oo_1.24.0 R.methodsS3_1.8.1 caret_6.0-90 lattice_0.20-45
## [25] patchwork_1.1.2 rstatix_0.7.0 ggpubr_0.4.0 ggrepel_0.9.1 matrixStats_0.61.0 scales_1.2.1 RColorBrewer_1.1-3 viridis_0.6.2
## [33] viridisLite_0.4.1 readxl_1.4.1 forcats_0.5.1 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.4 readr_2.1.2 tidyr_1.2.1
## [41] tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.1 SeuratObject_4.0.4 Seurat_4.1.0 knitr_1.40
##
## loaded via a namespace (and not attached):
## [1] scattermore_0.8 prabclus_2.3-2 ModelMetrics_1.2.2.2 exactRankTests_0.8-34 irlba_2.3.5 rpart_4.1-15
## [7] doParallel_1.0.17 generics_0.1.3 RANN_2.6.1 future_1.23.0 tzdb_0.3.0 rlist_0.4.6.2
## [13] spatstat.data_2.1-2 xml2_1.3.2 lubridate_1.8.0 httpuv_1.6.6 ggpp_0.4.4 assertthat_0.2.1
## [19] gower_0.2.2 xfun_0.33 hms_1.1.2 jquerylib_0.1.4 evaluate_0.16 promises_1.2.0.1
## [25] DEoptimR_1.0-11 fansi_1.0.3 dbplyr_2.1.1 km.ci_0.5-2 DBI_1.1.2 htmlwidgets_1.5.4
## [31] spatstat.geom_2.3-2 stringdist_0.9.8 stats4_4.1.2 ellipsis_0.3.2 RSpectra_0.16-0 backports_1.4.1
## [37] bookdown_0.29 deldir_1.0-6 vctrs_0.4.2 ROCR_1.0-11 abind_1.4-5 cachem_1.0.6
## [43] withr_2.5.0 ggforce_0.4.0 robustbase_0.95-0 sctransform_0.3.3 mclust_5.4.10 goftest_1.2-3
## [49] ape_5.6-2 lazyeval_0.2.2 crayon_1.5.2 labeling_0.4.2 recipes_0.1.17 pkgconfig_2.0.3
## [55] tweenr_2.0.2 nlme_3.1-153 vipor_0.4.5 nnet_7.3-16 rlang_1.0.6 globals_0.14.0
## [61] diptest_0.76-0 lifecycle_1.0.2 miniUI_0.1.1.1 modelr_0.1.8 cellranger_1.1.0 polyclip_1.10-0
## [67] lmtest_0.9-39 phangorn_2.10.0 ggseqlogo_0.1 KMsurv_0.1-5 carData_3.0-5 zoo_1.8-9
## [73] reprex_2.0.1 beeswarm_0.4.0 GlobalOptions_0.1.2 pheatmap_1.0.12 png_0.1-7 KernSmooth_2.23-20
## [79] pROC_1.18.0 shape_1.4.6 parallelly_1.30.0 spatstat.random_2.1-0 gridGraphics_0.5-1 ggsignif_0.6.3
## [85] magrittr_2.0.3 plyr_1.8.7 ica_1.0-2 compiler_4.1.2 factoextra_1.0.7 fitdistrplus_1.1-6
## [91] cli_3.4.1 listenv_0.8.0 pbapply_1.5-0 MASS_7.3-54 mgcv_1.8-38 tidyselect_1.1.2
## [97] stringi_1.7.8 highr_0.9 yaml_2.3.5 survMisc_0.5.5 sass_0.4.2 fastmatch_1.1-3
## [103] tools_4.1.2 future.apply_1.8.1 parallel_4.1.2 uuid_1.1-0 circlize_0.4.15 rstudioapi_0.13
## [109] foreach_1.5.2 gridExtra_2.3 prodlim_2019.11.13 farver_2.1.1 Rtsne_0.16 digest_0.6.29
## [115] shiny_1.7.2 lava_1.6.10 quadprog_1.5-8 fpc_2.2-9 Rcpp_1.0.9 gridtext_0.1.4
## [121] car_3.1-0 broom_1.0.1 later_1.3.0 RcppAnnoy_0.0.19 httr_1.4.2 kernlab_0.9-31
## [127] colorspace_2.0-3 rvest_1.0.2 fs_1.5.2 tensor_1.5 reticulate_1.24 splines_4.1.2
## [133] uwot_0.1.11 yulab.utils_0.0.4 spatstat.utils_2.3-0 graphlayouts_0.8.2 shinythemes_1.2.0 flexmix_2.3-18
## [139] plotly_4.10.0 xtable_1.8-4 jsonlite_1.8.0 tidygraph_1.2.2 timeDate_3043.102 UpSetR_1.4.0
## [145] modeltools_0.2-23 ipred_0.9-12 R6_2.5.1 pillar_1.8.1 htmltools_0.5.3 mime_0.12
## [151] glue_1.6.1 fastmap_1.1.0 class_7.3-19 codetools_0.2-18 mvtnorm_1.1-3 utf8_1.2.2
## [157] bslib_0.4.0 spatstat.sparse_2.1-0 ggbeeswarm_0.6.0 leiden_0.3.9 rmarkdown_2.17 munsell_0.5.0
## [163] iterators_1.0.14 haven_2.4.3 reshape2_1.4.4 gtable_0.3.1 spatstat.core_2.4-0