SS <- readRDS("../../0-Seurat_RDS_OBJECT_FINAL/Seurat_object_Final_changes/All_samples_Merged_with_STCAT_Annotation_final-5-09-2025.rds")
# Subset SS for cell line L6
SS_L6 <- subset(SS, subset = cell_line == "L6")
rm(SS)
library(reticulate)
use_virtualenv("/home/bioinfo/.virtualenvs/r-reticulate", required=TRUE)
py_config()
python: /home/bioinfo/.virtualenvs/r-reticulate/bin/python
libpython: /usr/lib/python3.12/config-3.12-x86_64-linux-gnu/libpython3.12.so
pythonhome: /home/bioinfo/.virtualenvs/r-reticulate:/home/bioinfo/.virtualenvs/r-reticulate
version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]
numpy: /home/bioinfo/.virtualenvs/r-reticulate/lib/python3.12/site-packages/numpy
numpy_version: 1.26.4
NOTE: Python version was forced by use_python() function
py_module_available("magic")
[1] TRUE
library(scATOMIC)
library(plyr)
library(dplyr)
library(data.table)
library(randomForest)
library(caret)
library(parallel)
library(reticulate)
library(Rmagic)
library(Matrix)
library(Seurat)
library(agrmt)
library(cutoff.scATOMIC)
library(copykat)
library(ggplot2)
DefaultAssay(SS_L6) <- "RNA"
library(Matrix)
# Example: subsetting L6 but keeping all individual cells
sparse_matrix_L6 <- GetAssayData(SS_L6, assay = "RNA", slot = "counts")
# Remove genes with zero counts
nonzero_genes <- rowSums(sparse_matrix_L6) > 0
sparse_matrix_L6_filtered <- sparse_matrix_L6[nonzero_genes, ]
# Run scATOMIC
cell_predictions_L6 <- run_scATOMIC(sparse_matrix_L6_filtered)
[1] "Starting Layer 1"
[1] "Done Layer 1"
[1] "Starting Layer 2 Non Blood"
[1] "Done Layer 2 Non Blood"
[1] "Starting Layer 3 Non Stromal"
[1] "Done Layer 3 Non Stromal"
[1] "Starting Layer 4 Non GI"
[1] "Done Layer 4 Non GI"
[1] "Starting Layer 5 Breast Lung Prostate"
[1] "nothing to score in this layer"
[1] "Done Layer 5 Breast Lung Prostate"
[1] "Starting Layer 4 Soft Tissue Neuro"
[1] "Done Layer 4 Soft Tissue Neuro"
[1] "Starting Layer 2 Blood"
[1] "Done Layer 2 Blood"
[1] "Starting Layer 3 TNK"
[1] "Done Layer 3 TNK"
[1] "Starting Layer 4 CD4 CD8"
[1] "nothing to score in this layer"
[1] "Done Layer 4 CD4 CD8"
[1] "Starting Layer 4 CD8 NK"
[1] "nothing to score in this layer"
[1] "Done Layer 4 CD8 NK"
[1] "Starting Layer 5 CD4"
[1] "nothing to score in this layer"
[1] "Done Layer 5 CD4"
[1] "Starting Layer 5 CD8"
[1] "nothing to score in this layer"
[1] "Done Layer 5 CD8"
[1] "Starting Layer 3 Myeloid"
[1] "Done Layer 3 Myeloid"
[1] "Starting Layer 4 Dendritic"
[1] "nothing to score in this layer"
[1] "Done Layer 4 Dendritic"
[1] "Starting Layer 5 cDC"
[1] "nothing to score in this layer"
[1] "Done Layer 5 cDC"
# Inspect top predictions
head(cell_predictions_L6)
$layer_1
$layer_2_non_blood
$layer_3_non_stromal
$layer_4_non_GI
$layer_5_breast_lung_prostate
$layer_4_soft_tissue_neuro
NA
SS <- create_summary_matrix(prediction_list = cell_predictions_L6, use_CNVs = F, modify_results = T, mc.cores = 1, raw_counts = sparse_matrix_L6, min_prop = 0.5 )
|
| | 0%
|
|= | 0%
|
|= | 1%
|
|== | 2%
|
|=== | 2%
|
|=== | 3%
|
|==== | 3%
|
|==== | 4%
|
|===== | 4%
|
|===== | 5%
|
|====== | 5%
|
|====== | 6%
|
|======= | 6%
|
|======= | 7%
|
|======== | 7%
|
|======== | 8%
|
|========= | 8%
|
|========= | 9%
|
|========== | 9%
|
|========== | 10%
|
|=========== | 10%
|
|=========== | 11%
|
|============ | 11%
|
|============ | 12%
|
|============= | 12%
|
|============= | 13%
|
|============== | 13%
|
|============== | 14%
|
|=============== | 14%
|
|=============== | 15%
|
|================ | 15%
|
|================ | 16%
|
|================= | 16%
|
|================= | 17%
|
|================== | 17%
|
|================== | 18%
|
|=================== | 18%
|
|=================== | 19%
|
|==================== | 19%
|
|==================== | 20%
|
|===================== | 20%
|
|===================== | 21%
|
|====================== | 21%
|
|====================== | 22%
|
|======================= | 22%
|
|======================= | 23%
|
|======================== | 23%
|
|======================== | 24%
|
|========================= | 24%
|
|========================= | 25%
|
|========================== | 25%
|
|========================== | 26%
|
|=========================== | 26%
|
|=========================== | 27%
|
|============================ | 27%
|
|============================ | 28%
|
|============================= | 28%
|
|============================= | 29%
|
|============================== | 29%
|
|============================== | 30%
|
|=============================== | 30%
|
|=============================== | 31%
|
|================================ | 31%
|
|================================ | 32%
|
|================================= | 32%
|
|================================= | 33%
|
|================================== | 33%
|
|================================== | 34%
|
|=================================== | 34%
|
|=================================== | 35%
|
|==================================== | 35%
|
|==================================== | 36%
|
|===================================== | 36%
|
|===================================== | 37%
|
|====================================== | 37%
|
|====================================== | 38%
|
|======================================= | 38%
|
|======================================= | 39%
|
|======================================== | 39%
|
|======================================== | 40%
|
|========================================= | 40%
|
|========================================= | 41%
|
|========================================== | 41%
|
|========================================== | 42%
|
|=========================================== | 42%
|
|=========================================== | 43%
|
|============================================ | 43%
|
|============================================ | 44%
|
|============================================= | 44%
|
|============================================= | 45%
|
|============================================== | 45%
|
|============================================== | 46%
|
|=============================================== | 46%
|
|=============================================== | 47%
|
|================================================ | 47%
|
|================================================ | 48%
|
|================================================= | 48%
|
|================================================== | 49%
|
|================================================== | 50%
|
|=================================================== | 50%
|
|==================================================== | 50%
|
|==================================================== | 51%
|
|===================================================== | 52%
|
|====================================================== | 52%
|
|====================================================== | 53%
|
|======================================================= | 53%
|
|======================================================= | 54%
|
|======================================================== | 54%
|
|======================================================== | 55%
|
|========================================================= | 55%
|
|========================================================= | 56%
|
|========================================================== | 56%
|
|========================================================== | 57%
|
|=========================================================== | 57%
|
|=========================================================== | 58%
|
|============================================================ | 58%
|
|============================================================ | 59%
|
|============================================================= | 59%
|
|============================================================= | 60%
|
|============================================================== | 60%
|
|============================================================== | 61%
|
|=============================================================== | 61%
|
|=============================================================== | 62%
|
|================================================================ | 62%
|
|================================================================ | 63%
|
|================================================================= | 63%
|
|================================================================= | 64%
|
|================================================================== | 64%
|
|================================================================== | 65%
|
|=================================================================== | 65%
|
|=================================================================== | 66%
|
|==================================================================== | 66%
|
|==================================================================== | 67%
|
|===================================================================== | 67%
|
|===================================================================== | 68%
|
|====================================================================== | 68%
|
|====================================================================== | 69%
|
|======================================================================= | 69%
|
|======================================================================= | 70%
|
|======================================================================== | 70%
|
|======================================================================== | 71%
|
|========================================================================= | 71%
|
|========================================================================= | 72%
|
|========================================================================== | 72%
|
|========================================================================== | 73%
|
|=========================================================================== | 73%
|
|=========================================================================== | 74%
|
|============================================================================ | 74%
|
|============================================================================ | 75%
|
|============================================================================= | 75%
|
|============================================================================= | 76%
|
|============================================================================== | 76%
|
|============================================================================== | 77%
|
|=============================================================================== | 77%
|
|=============================================================================== | 78%
|
|================================================================================ | 78%
|
|================================================================================ | 79%
|
|================================================================================= | 79%
|
|================================================================================= | 80%
|
|================================================================================== | 80%
|
|================================================================================== | 81%
|
|=================================================================================== | 81%
|
|=================================================================================== | 82%
|
|==================================================================================== | 82%
|
|==================================================================================== | 83%
|
|===================================================================================== | 83%
|
|===================================================================================== | 84%
|
|====================================================================================== | 84%
|
|====================================================================================== | 85%
|
|======================================================================================= | 85%
|
|======================================================================================= | 86%
|
|======================================================================================== | 86%
|
|======================================================================================== | 87%
|
|========================================================================================= | 87%
|
|========================================================================================= | 88%
|
|========================================================================================== | 88%
|
|========================================================================================== | 89%
|
|=========================================================================================== | 89%
|
|=========================================================================================== | 90%
|
|============================================================================================ | 90%
|
|============================================================================================ | 91%
|
|============================================================================================= | 91%
|
|============================================================================================= | 92%
|
|============================================================================================== | 92%
|
|============================================================================================== | 93%
|
|=============================================================================================== | 93%
|
|=============================================================================================== | 94%
|
|================================================================================================ | 94%
|
|================================================================================================ | 95%
|
|================================================================================================= | 95%
|
|================================================================================================= | 96%
|
|================================================================================================== | 96%
|
|================================================================================================== | 97%
|
|=================================================================================================== | 97%
|
|=================================================================================================== | 98%
|
|==================================================================================================== | 98%
|
|===================================================================================================== | 99%
|
|===================================================================================================== | 100%
|
|======================================================================================================| 100%
|
| | 0%
|
|=================================================== | 50%
|
|======================================================================================================| 100%
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Added MAGIC output to MAGIC_RNA. To use it, pass assay='MAGIC_RNA' to downstream methods or set seurat_object@active.assay <- 'MAGIC_RNA'."
[1] "Sample classification confidence = 0.07"
table(SS$scATOMIC_pred)
CD4 or CD8 T cell cDC2 Effector/Memory CD4+ T cells
93 22 4461
Effector/Memory CD8+ T cells Exhausted CD8+ T cells LAMP3 cDC
33 1 2
Lung Cancer Cell Naive CD4+ T cells T regulatory cells
263 8 258
Tfh/Th1 helper CD4+ T cells
7
tree_results_SS <- scATOMICTree(predictions_list = cell_predictions_L6, summary_matrix = SS,
interactive_mode = T, collapsed = T, save_results = F,height = 700, width = 1000)
tree_results_SS
NA
tree_results_non_interactive <- scATOMICTree(predictions_list = cell_predictions_L6, summary_matrix = SS,
interactive_mode = F, save_results = F)
tree_results_non_interactive
NA
SS_L6 <- AddMetaData(SS_L6, SS)
DimPlot(SS_L6, group.by = "scATOMIC_pred") + ggtitle("L6 from Cell lines") + labs(fill="scATOMIC Annotations")
NA
NA
All_cell_Lines <- readRDS("../../0-Seurat_RDS_OBJECT_FINAL/Seurat_object_Final_changes/All_samples_Merged_with_STCAT_Annotation_final-5-09-2025.rds")
All_cell_Lines <- AddMetaData(All_cell_Lines, SS)
DimPlot(All_cell_Lines, group.by = "scATOMIC_pred") + ggtitle("L6 from Cell lines") + labs(fill="scATOMIC Annotations")
NA
NA
sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Paris
tzcode source: system (glibc)
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] future_1.67.0 cutoff.scATOMIC_0.1.0 agrmt_1.42.12 Rmagic_2.0.3
[5] Matrix_1.7-4 caret_7.0-1 lattice_0.22-7 data.table_1.17.8
[9] plyr_1.8.9 scATOMIC_2.0.3 copykat_1.1.0 randomForest_4.7-1.2
[13] reticulate_1.43.0 pheatmap_1.0.13 ggplot2_4.0.0 patchwork_1.3.2
[17] dplyr_1.1.4 Seurat_5.3.0 SeuratObject_5.2.0 sp_2.2-0
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 rstudioapi_0.17.1 jsonlite_2.0.0 magrittr_2.0.4
[5] spatstat.utils_3.2-0 farver_2.1.2 vctrs_0.6.5 ROCR_1.0-11
[9] spatstat.explore_3.5-3 htmltools_0.5.8.1 pROC_1.19.0.1 sctransform_0.4.2
[13] parallelly_1.45.1 KernSmooth_2.23-26 htmlwidgets_1.6.4 ica_1.0-3
[17] lubridate_1.9.4 plotly_4.11.0 zoo_1.8-14 igraph_2.1.4
[21] mime_0.13 lifecycle_1.0.4 iterators_1.0.14 pkgconfig_2.0.3
[25] R6_2.6.1 fastmap_1.2.0 fitdistrplus_1.2-4 shiny_1.11.1
[29] digest_0.6.37 tensor_1.5.1 RSpectra_0.16-2 irlba_2.3.5.1
[33] labeling_0.4.3 progressr_0.16.0 timechange_0.3.0 spatstat.sparse_3.1-0
[37] httr_1.4.7 polyclip_1.10-7 abind_1.4-8 compiler_4.5.1
[41] withr_3.0.2 S7_0.2.0 fastDummies_1.7.5 collapsibleTree_0.1.8
[45] lava_1.8.1 MASS_7.3-65 ModelMetrics_1.2.2.2 tools_4.5.1
[49] lmtest_0.9-40 httpuv_1.6.16 future.apply_1.20.0 nnet_7.3-20
[53] goftest_1.2-3 glue_1.8.0 DiagrammeR_1.0.11 nlme_3.1-168
[57] promises_1.3.3 grid_4.5.1 Rtsne_0.17 cluster_2.1.8.1
[61] reshape2_1.4.4 recipes_1.3.1 generics_0.1.4 gtable_0.3.6
[65] spatstat.data_3.1-8 class_7.3-23 tidyr_1.3.1 spatstat.geom_3.6-0
[69] RcppAnnoy_0.0.22 ggrepel_0.9.6 RANN_2.6.2 foreach_1.5.2
[73] pillar_1.11.1 stringr_1.5.2 spam_2.11-1 RcppHNSW_0.6.0
[77] later_1.4.4 splines_4.5.1 survival_3.8-3 deldir_2.0-4
[81] tidyselect_1.2.1 miniUI_0.1.2 pbapply_1.7-4 amap_0.8-20
[85] knitr_1.50 gridExtra_2.3 scattermore_1.2 stats4_4.5.1
[89] xfun_0.53 hardhat_1.4.2 timeDate_4041.110 matrixStats_1.5.0
[93] visNetwork_2.1.4 stringi_1.8.7 dlm_1.1-6.1 yaml_2.3.10
[97] lazyeval_0.2.2 evaluate_1.0.5 codetools_0.2-20 data.tree_1.2.0
[101] tibble_3.3.0 cli_3.6.5 rpart_4.1.24 uwot_0.2.3
[105] RcppParallel_5.1.11-1 xtable_1.8-4 dichromat_2.0-0.1 Rcpp_1.1.0
[109] globals_0.18.0 spatstat.random_3.4-2 png_0.1-8 spatstat.univar_3.1-4
[113] gower_1.0.2 dotCall64_1.2 parallelDist_0.2.6 listenv_0.9.1
[117] viridisLite_0.4.2 ipred_0.9-15 prodlim_2025.04.28 scales_1.4.0
[121] ggridges_0.5.7 crayon_1.5.3 purrr_1.1.0 rlang_1.1.6
[125] cowplot_1.2.0