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 L5
SS_L5 <- subset(SS, subset = cell_line == "L5")
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_L5) <- "RNA"
library(Matrix)
# Example: subsetting L5 but keeping all individual cells
sparse_matrix_L5 <- GetAssayData(SS_L5, assay = "RNA", slot = "counts")
# Remove genes with zero counts
nonzero_genes <- rowSums(sparse_matrix_L5) > 0
sparse_matrix_L5_filtered <- sparse_matrix_L5[nonzero_genes, ]
# Run scATOMIC
cell_predictions_L5 <- run_scATOMIC(sparse_matrix_L5_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 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"
# Inspect top predictions
head(cell_predictions_L5)
$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_L5, use_CNVs = F, modify_results = T, mc.cores = 1, raw_counts = sparse_matrix_L5, 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] "Sample classification confidence = 0.42"
table(SS$scATOMIC_pred)
Any Cell Blood Cell Effector/Memory CD4+ T cells
266 13 297
Effector/Memory CD8+ T cells Lung Cancer Cell Non Stromal Cell
1 4750 14
Normal Tissue Cell T regulatory cells
624 57
tree_results_SS <- scATOMICTree(predictions_list = cell_predictions_L5, 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_L5, summary_matrix = SS,
interactive_mode = F, save_results = F)
tree_results_non_interactive
NA
SS_L5 <- AddMetaData(SS_L5, SS)
DimPlot(SS_L5, group.by = "scATOMIC_pred") + ggtitle("L5 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("L5 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] RcppAnnoy_0.0.22 splines_4.5.1 later_1.4.4 tibble_3.3.0
[5] polyclip_1.10-7 hardhat_1.4.2 pROC_1.19.0.1 rpart_4.1.24
[9] fastDummies_1.7.5 lifecycle_1.0.4 globals_0.18.0 MASS_7.3-65
[13] tree_1.0-45 magrittr_2.0.4 plotly_4.11.0 yaml_2.3.10
[17] httpuv_1.6.16 sctransform_0.4.2 spam_2.11-1 spatstat.sparse_3.1-0
[21] cowplot_1.2.0 pbapply_1.7-4 RColorBrewer_1.1-3 lubridate_1.9.4
[25] abind_1.4-8 Rtsne_0.17 purrr_1.1.0 nnet_7.3-20
[29] ipred_0.9-15 lava_1.8.1 data.tree_1.2.0 ggrepel_0.9.6
[33] irlba_2.3.5.1 listenv_0.9.1 spatstat.utils_3.2-0 goftest_1.2-3
[37] RSpectra_0.16-2 spatstat.random_3.4-2 fitdistrplus_1.2-4 parallelly_1.45.1
[41] codetools_0.2-20 tidyselect_1.2.1 farver_2.1.2 matrixStats_1.5.0
[45] stats4_4.5.1 spatstat.explore_3.5-3 jsonlite_2.0.0 progressr_0.16.0
[49] ggridges_0.5.7 survival_3.8-3 iterators_1.0.14 bbmle_1.0.25.1
[53] foreach_1.5.2 tools_4.5.1 ica_1.0-3 Rcpp_1.1.0
[57] glue_1.8.0 prodlim_2025.04.28 gridExtra_2.3 dlm_1.1-6.1
[61] xfun_0.53 amap_0.8-20 withr_3.0.2 numDeriv_2016.8-1.1
[65] fastmap_1.2.0 digest_0.6.37 parallelDist_0.2.6 timechange_0.3.0
[69] R6_2.6.1 mime_0.13 scattermore_1.2 tensor_1.5.1
[73] dichromat_2.0-0.1 spatstat.data_3.1-8 DiagrammeR_1.0.11 tidyr_1.3.1
[77] generics_0.1.4 recipes_1.3.1 class_7.3-23 httr_1.4.7
[81] htmlwidgets_1.6.4 uwot_0.2.3 ModelMetrics_1.2.2.2 pkgconfig_2.0.3
[85] gtable_0.3.6 timeDate_4041.110 lmtest_0.9-40 S7_0.2.0
[89] htmltools_0.5.8.1 dotCall64_1.2 scales_1.4.0 png_0.1-8
[93] gower_1.0.2 spatstat.univar_3.1-4 knitr_1.50 rstudioapi_0.17.1
[97] reshape2_1.4.4 visNetwork_2.1.4 nlme_3.1-168 bdsmatrix_1.3-7
[101] zoo_1.8-14 stringr_1.5.2 KernSmooth_2.23-26 miniUI_0.1.2
[105] pillar_1.11.1 grid_4.5.1 vctrs_0.6.5 RANN_2.6.2
[109] promises_1.3.3 xtable_1.8-4 cluster_2.1.8.1 evaluate_1.0.5
[113] mvtnorm_1.3-3 cli_3.6.5 compiler_4.5.1 rlang_1.1.6
[117] crayon_1.5.3 future.apply_1.20.0 labeling_0.4.3 stringi_1.8.7
[121] viridisLite_0.4.2 deldir_2.0-4 lazyeval_0.2.2 spatstat.geom_3.6-0
[125] RcppHNSW_0.6.0 shiny_1.11.1 ROCR_1.0-11 igraph_2.1.4
[129] RcppParallel_5.1.11-1 collapsibleTree_0.1.8