1. Load Libraries

2. Load Seurat Object


#Load Seurat Object merged from cell lines and a control(PBMC) after filtration
load("0-imp_Robj/Harmony_integrated_CD4Tcells_harmony_integrated.Robj")

All_samples_Merged 
An object of class Seurat 
62926 features across 49360 samples within 6 assays 
Active assay: SCT (26174 features, 3000 variable features)
 3 layers present: counts, data, scale.data
 5 other assays present: RNA, ADT, prediction.score.celltype.l1, prediction.score.celltype.l2, prediction.score.celltype.l3
 6 dimensional reductions calculated: integrated_dr, ref.umap, pca, umap, harmony, umap.harmony

3. Set Up Identifiers for Clustering

# Assign cluster identities to the Seurat object
Idents(All_samples_Merged) <- "seurat_clusters"


DimPlot(All_samples_Merged, reduction = "umap.harmony", group.by = "seurat_clusters",label = T, label.box = T, repel = T) + 
  ggtitle("Harmony Integration - By Clusters")

4. Differential Expression Analysis

4.1 Using MAST with Latent Variables (Batch Correction)

markers_mast_batch <- FindMarkers(
  All_samples_Merged,
  ident.1 = c("0", "1", "2", "3", "4", "5", "7", "9"), # Cell lines
  ident.2 = c("6", "8", "10", "11"), # CD4 T cells
  assay = "SCT",
  test.use = "MAST",
  latent.vars = c("cell_line"), # Adjust for batch effects
  min.pct = 0,
  logfc.threshold = 0
)
Avis : sparse->dense coercion: allocating vector of size 9.6 GiBAvis : Dropping illegal slot(s) norm.method for class BayesGLMlike.  
                    This likely indicates a bug in an upstream package.
 Completed [-----------------------------------------------------------------------------]   0% with 0 failuresRegistered S3 method overwritten by 'rmarkdown':
  method         from
  print.paged_df     

 Completed [-----------------------------------------------------------------------------]   1% with 0 failures
 Completed [>----------------------------------------------------------------------------]   1% with 0 failures
 Completed [>----------------------------------------------------------------------------]   2% with 0 failures
 Completed [=>---------------------------------------------------------------------------]   2% with 0 failures
 Completed [=>---------------------------------------------------------------------------]   3% with 0 failures
 Completed [==>--------------------------------------------------------------------------]   3% with 0 failures
 Completed [==>--------------------------------------------------------------------------]   4% with 0 failures
 Completed [==>--------------------------------------------------------------------------]   5% with 0 failures
 Completed [===>-------------------------------------------------------------------------]   5% with 0 failures
 Completed [===>-------------------------------------------------------------------------]   6% with 0 failures
 Completed [====>------------------------------------------------------------------------]   6% with 0 failures
 Completed [====>------------------------------------------------------------------------]   7% with 0 failures
 Completed [=====>-----------------------------------------------------------------------]   7% with 0 failures
 Completed [=====>-----------------------------------------------------------------------]   8% with 0 failures
 Completed [======>----------------------------------------------------------------------]   8% with 0 failures
 Completed [======>----------------------------------------------------------------------]   9% with 0 failures
 Completed [======>----------------------------------------------------------------------]  10% with 0 failures
 Completed [=======>---------------------------------------------------------------------]  10% with 0 failures
 Completed [=======>---------------------------------------------------------------------]  11% with 0 failures
 Completed [========>--------------------------------------------------------------------]  11% with 0 failures
 Completed [========>--------------------------------------------------------------------]  12% with 0 failures
 Completed [=========>-------------------------------------------------------------------]  12% with 0 failures
 Completed [=========>-------------------------------------------------------------------]  13% with 0 failures
 Completed [=========>-------------------------------------------------------------------]  14% with 0 failures
 Completed [==========>------------------------------------------------------------------]  14% with 0 failures
 Completed [==========>------------------------------------------------------------------]  15% with 0 failures
 Completed [===========>-----------------------------------------------------------------]  15% with 0 failures
 Completed [===========>-----------------------------------------------------------------]  16% with 0 failures
 Completed [============>----------------------------------------------------------------]  16% with 0 failures
 Completed [============>----------------------------------------------------------------]  17% with 0 failures
 Completed [============>----------------------------------------------------------------]  18% with 0 failures
 Completed [=============>---------------------------------------------------------------]  18% with 0 failures
 Completed [=============>---------------------------------------------------------------]  19% with 0 failures
 Completed [==============>--------------------------------------------------------------]  19% with 0 failures
 Completed [==============>--------------------------------------------------------------]  20% with 0 failures
 Completed [===============>-------------------------------------------------------------]  20% with 0 failures
 Completed [===============>-------------------------------------------------------------]  21% with 0 failures
 Completed [================>------------------------------------------------------------]  21% with 0 failures
 Completed [================>------------------------------------------------------------]  22% with 0 failures
 Completed [================>------------------------------------------------------------]  23% with 0 failures
 Completed [=================>-----------------------------------------------------------]  23% with 0 failures
 Completed [=================>-----------------------------------------------------------]  24% with 0 failures
 Completed [==================>----------------------------------------------------------]  24% with 0 failures
 Completed [==================>----------------------------------------------------------]  25% with 0 failures
 Completed [===================>---------------------------------------------------------]  25% with 0 failures
 Completed [===================>---------------------------------------------------------]  26% with 0 failures
 Completed [===================>---------------------------------------------------------]  27% with 0 failures
 Completed [====================>--------------------------------------------------------]  27% with 0 failures
 Completed [====================>--------------------------------------------------------]  28% with 0 failures
 Completed [=====================>-------------------------------------------------------]  28% with 0 failures
 Completed [=====================>-------------------------------------------------------]  29% with 0 failures
 Completed [======================>------------------------------------------------------]  29% with 0 failures
 Completed [======================>------------------------------------------------------]  30% with 0 failures
 Completed [======================>------------------------------------------------------]  31% with 0 failures
 Completed [=======================>-----------------------------------------------------]  31% with 0 failures
 Completed [=======================>-----------------------------------------------------]  32% with 0 failures
 Completed [========================>----------------------------------------------------]  32% with 0 failures
 Completed [========================>----------------------------------------------------]  33% with 0 failures
 Completed [=========================>---------------------------------------------------]  33% with 0 failures
 Completed [=========================>---------------------------------------------------]  34% with 0 failures
 Completed [==========================>--------------------------------------------------]  34% with 0 failures
 Completed [==========================>--------------------------------------------------]  35% with 0 failures
 Completed [==========================>--------------------------------------------------]  36% with 0 failures
 Completed [===========================>-------------------------------------------------]  36% with 0 failures
 Completed [===========================>-------------------------------------------------]  37% with 0 failures
 Completed [============================>------------------------------------------------]  37% with 0 failures
 Completed [============================>------------------------------------------------]  38% with 0 failures
 Completed [=============================>-----------------------------------------------]  38% with 0 failures
 Completed [=============================>-----------------------------------------------]  39% with 0 failures
 Completed [=============================>-----------------------------------------------]  40% with 0 failures
 Completed [==============================>----------------------------------------------]  40% with 0 failures
 Completed [==============================>----------------------------------------------]  41% with 0 failures
 Completed [===============================>---------------------------------------------]  41% with 0 failures
 Completed [===============================>---------------------------------------------]  42% with 0 failures
 Completed [================================>--------------------------------------------]  42% with 0 failures
 Completed [================================>--------------------------------------------]  43% with 0 failures
 Completed [================================>--------------------------------------------]  44% with 0 failures
 Completed [=================================>-------------------------------------------]  44% with 0 failures
 Completed [=================================>-------------------------------------------]  45% with 0 failures
 Completed [==================================>------------------------------------------]  45% with 0 failures
 Completed [==================================>------------------------------------------]  46% with 0 failures
 Completed [===================================>-----------------------------------------]  46% with 0 failures
 Completed [===================================>-----------------------------------------]  47% with 0 failures
 Completed [====================================>----------------------------------------]  47% with 0 failures
 Completed [====================================>----------------------------------------]  48% with 0 failures
 Completed [====================================>----------------------------------------]  49% with 0 failures
 Completed [=====================================>---------------------------------------]  49% with 0 failures
 Completed [=====================================>---------------------------------------]  50% with 0 failures
 Completed [======================================>--------------------------------------]  50% with 0 failures
 Completed [======================================>--------------------------------------]  51% with 0 failures
 Completed [=======================================>-------------------------------------]  51% with 0 failures
 Completed [=======================================>-------------------------------------]  52% with 0 failures
 Completed [=======================================>-------------------------------------]  53% with 0 failures
 Completed [========================================>------------------------------------]  53% with 0 failures
 Completed [========================================>------------------------------------]  54% with 0 failures
 Completed [=========================================>-----------------------------------]  54% with 0 failures
 Completed [=========================================>-----------------------------------]  55% with 0 failures
 Completed [==========================================>----------------------------------]  55% with 0 failures
 Completed [==========================================>----------------------------------]  56% with 0 failures
 Completed [===========================================>---------------------------------]  56% with 0 failures
 Completed [===========================================>---------------------------------]  57% with 0 failures
 Completed [===========================================>---------------------------------]  58% with 0 failures
 Completed [============================================>--------------------------------]  58% with 0 failures
 Completed [============================================>--------------------------------]  59% with 0 failures
 Completed [=============================================>-------------------------------]  59% with 0 failures
 Completed [=============================================>-------------------------------]  60% with 0 failures
 Completed [==============================================>------------------------------]  60% with 0 failures
 Completed [==============================================>------------------------------]  61% with 0 failures
 Completed [==============================================>------------------------------]  62% with 0 failures
 Completed [===============================================>-----------------------------]  62% with 0 failures
 Completed [===============================================>-----------------------------]  63% with 0 failures
 Completed [================================================>----------------------------]  63% with 0 failures
 Completed [================================================>----------------------------]  64% with 0 failures
 Completed [=================================================>---------------------------]  64% with 0 failures
 Completed [=================================================>---------------------------]  65% with 0 failures
 Completed [=================================================>---------------------------]  66% with 0 failures
 Completed [==================================================>--------------------------]  66% with 0 failures
 Completed [==================================================>--------------------------]  67% with 0 failures
 Completed [===================================================>-------------------------]  67% with 0 failures
 Completed [===================================================>-------------------------]  68% with 0 failures
 Completed [====================================================>------------------------]  68% with 0 failures
 Completed [====================================================>------------------------]  69% with 0 failures
 Completed [=====================================================>-----------------------]  69% with 0 failures
 Completed [=====================================================>-----------------------]  70% with 0 failures
 Completed [=====================================================>-----------------------]  71% with 0 failures
 Completed [======================================================>----------------------]  71% with 0 failures
 Completed [======================================================>----------------------]  72% with 0 failures
 Completed [=======================================================>---------------------]  72% with 0 failures
 Completed [=======================================================>---------------------]  73% with 0 failures
 Completed [========================================================>--------------------]  73% with 0 failures
 Completed [========================================================>--------------------]  74% with 0 failures
 Completed [========================================================>--------------------]  75% with 0 failures
 Completed [=========================================================>-------------------]  75% with 0 failures
 Completed [=========================================================>-------------------]  76% with 0 failures
 Completed [==========================================================>------------------]  76% with 0 failures
 Completed [==========================================================>------------------]  77% with 0 failures
 Completed [===========================================================>-----------------]  77% with 0 failures
 Completed [===========================================================>-----------------]  78% with 0 failures
 Completed [===========================================================>-----------------]  79% with 0 failures
 Completed [============================================================>----------------]  79% with 0 failures
 Completed [============================================================>----------------]  80% with 0 failures
 Completed [=============================================================>---------------]  80% with 0 failures
 Completed [=============================================================>---------------]  81% with 0 failures
 Completed [==============================================================>--------------]  81% with 0 failures
 Completed [==============================================================>--------------]  82% with 0 failures
 Completed [===============================================================>-------------]  82% with 0 failures
 Completed [===============================================================>-------------]  83% with 0 failures
 Completed [===============================================================>-------------]  84% with 0 failures
 Completed [================================================================>------------]  84% with 0 failures
 Completed [================================================================>------------]  85% with 0 failures
 Completed [=================================================================>-----------]  85% with 0 failures
 Completed [=================================================================>-----------]  86% with 0 failures
 Completed [==================================================================>----------]  86% with 0 failures
 Completed [==================================================================>----------]  87% with 0 failures
 Completed [==================================================================>----------]  88% with 0 failures
 Completed [===================================================================>---------]  88% with 0 failures
 Completed [===================================================================>---------]  89% with 0 failures
 Completed [====================================================================>--------]  89% with 0 failures
 Completed [====================================================================>--------]  90% with 0 failures
 Completed [=====================================================================>-------]  90% with 0 failures
 Completed [=====================================================================>-------]  91% with 0 failures
 Completed [=====================================================================>-------]  92% with 0 failures
 Completed [======================================================================>------]  92% with 0 failures
 Completed [======================================================================>------]  93% with 0 failures
 Completed [=======================================================================>-----]  93% with 0 failures
 Completed [=======================================================================>-----]  94% with 0 failures
 Completed [========================================================================>----]  94% with 0 failures
 Completed [========================================================================>----]  95% with 0 failures
 Completed [=========================================================================>---]  95% with 0 failures
 Completed [=========================================================================>---]  96% with 0 failures
 Completed [=========================================================================>---]  97% with 0 failures
 Completed [==========================================================================>--]  97% with 0 failures
 Completed [==========================================================================>--]  98% with 0 failures
 Completed [===========================================================================>-]  98% with 0 failures
 Completed [===========================================================================>-]  99% with 0 failures
 Completed [============================================================================>]  99% with 0 failures
 Completed [============================================================================>] 100% with 0 failures
 Completed [=============================================================================] 100% with 0 failures
                                                                                                               

Done!
Combining coefficients and standard errors
Calculating log-fold changes

Processed 219380 groups out of 471132. 47% done. Time elapsed: 3s. ETA: 3s.
Processed 289789 groups out of 471132. 62% done. Time elapsed: 4s. ETA: 2s.
Processed 361491 groups out of 471132. 77% done. Time elapsed: 5s. ETA: 1s.
Processed 436911 groups out of 471132. 93% done. Time elapsed: 6s. ETA: 0s.
Processed 471132 groups out of 471132. 100% done. Time elapsed: 6s. ETA: 0s.
Calculating likelihood ratio tests
Refitting on reduced model...

 Completed [---------------------------------------------------------------------------------------]   0% with 0 failures
 Completed [---------------------------------------------------------------------------------------]   1% with 0 failures
 Completed [>--------------------------------------------------------------------------------------]   1% with 0 failures
 Completed [>--------------------------------------------------------------------------------------]   2% with 0 failures
 Completed [=>-------------------------------------------------------------------------------------]   2% with 0 failures
 Completed [=>-------------------------------------------------------------------------------------]   3% with 0 failures
 Completed [==>------------------------------------------------------------------------------------]   3% with 0 failures
 Completed [==>------------------------------------------------------------------------------------]   4% with 0 failures
 Completed [===>-----------------------------------------------------------------------------------]   4% with 0 failures
 Completed [===>-----------------------------------------------------------------------------------]   5% with 0 failures
 Completed [====>----------------------------------------------------------------------------------]   5% with 0 failures
 Completed [====>----------------------------------------------------------------------------------]   6% with 0 failures
 Completed [=====>---------------------------------------------------------------------------------]   6% with 0 failures
 Completed [=====>---------------------------------------------------------------------------------]   7% with 0 failures
 Completed [======>--------------------------------------------------------------------------------]   7% with 0 failures
 Completed [======>--------------------------------------------------------------------------------]   8% with 0 failures
 Completed [======>--------------------------------------------------------------------------------]   9% with 0 failures
 Completed [=======>-------------------------------------------------------------------------------]   9% with 0 failures
 Completed [=======>-------------------------------------------------------------------------------]  10% with 0 failures
 Completed [========>------------------------------------------------------------------------------]  10% with 0 failures
 Completed [========>------------------------------------------------------------------------------]  11% with 0 failures
 Completed [=========>-----------------------------------------------------------------------------]  11% with 0 failures
 Completed [=========>-----------------------------------------------------------------------------]  12% with 0 failures
 Completed [==========>----------------------------------------------------------------------------]  12% with 0 failures
 Completed [==========>----------------------------------------------------------------------------]  13% with 0 failures
 Completed [===========>---------------------------------------------------------------------------]  13% with 0 failures
 Completed [===========>---------------------------------------------------------------------------]  14% with 0 failures
 Completed [============>--------------------------------------------------------------------------]  14% with 0 failures
 Completed [============>--------------------------------------------------------------------------]  15% with 0 failures
 Completed [============>--------------------------------------------------------------------------]  16% with 0 failures
 Completed [=============>-------------------------------------------------------------------------]  16% with 0 failures
 Completed [=============>-------------------------------------------------------------------------]  17% with 0 failures
 Completed [==============>------------------------------------------------------------------------]  17% with 0 failures
 Completed [==============>------------------------------------------------------------------------]  18% with 0 failures
 Completed [===============>-----------------------------------------------------------------------]  18% with 0 failures
 Completed [===============>-----------------------------------------------------------------------]  19% with 0 failures
 Completed [================>----------------------------------------------------------------------]  19% with 0 failures
 Completed [================>----------------------------------------------------------------------]  20% with 0 failures
 Completed [=================>---------------------------------------------------------------------]  20% with 0 failures
 Completed [=================>---------------------------------------------------------------------]  21% with 0 failures
 Completed [==================>--------------------------------------------------------------------]  21% with 0 failures
 Completed [==================>--------------------------------------------------------------------]  22% with 0 failures
 Completed [===================>-------------------------------------------------------------------]  22% with 0 failures
 Completed [===================>-------------------------------------------------------------------]  23% with 0 failures
 Completed [===================>-------------------------------------------------------------------]  24% with 0 failures
 Completed [====================>------------------------------------------------------------------]  24% with 0 failures
 Completed [====================>------------------------------------------------------------------]  25% with 0 failures
 Completed [=====================>-----------------------------------------------------------------]  25% with 0 failures
 Completed [=====================>-----------------------------------------------------------------]  26% with 0 failures
 Completed [======================>----------------------------------------------------------------]  26% with 0 failures
 Completed [======================>----------------------------------------------------------------]  27% with 0 failures
 Completed [=======================>---------------------------------------------------------------]  27% with 0 failures
 Completed [=======================>---------------------------------------------------------------]  28% with 0 failures
 Completed [========================>--------------------------------------------------------------]  28% with 0 failures
 Completed [========================>--------------------------------------------------------------]  29% with 0 failures
 Completed [=========================>-------------------------------------------------------------]  29% with 0 failures
 Completed [=========================>-------------------------------------------------------------]  30% with 0 failures
 Completed [==========================>------------------------------------------------------------]  30% with 0 failures
 Completed [==========================>------------------------------------------------------------]  31% with 0 failures
 Completed [==========================>------------------------------------------------------------]  32% with 0 failures
 Completed [===========================>-----------------------------------------------------------]  32% with 0 failures
 Completed [===========================>-----------------------------------------------------------]  33% with 0 failures
 Completed [============================>----------------------------------------------------------]  33% with 0 failures
 Completed [============================>----------------------------------------------------------]  34% with 0 failures
 Completed [=============================>---------------------------------------------------------]  34% with 0 failures
 Completed [=============================>---------------------------------------------------------]  35% with 0 failures
 Completed [==============================>--------------------------------------------------------]  35% with 0 failures
 Completed [==============================>--------------------------------------------------------]  36% with 0 failures
 Completed [===============================>-------------------------------------------------------]  36% with 0 failures
 Completed [===============================>-------------------------------------------------------]  37% with 0 failures
 Completed [================================>------------------------------------------------------]  37% with 0 failures
 Completed [================================>------------------------------------------------------]  38% with 0 failures
 Completed [================================>------------------------------------------------------]  39% with 0 failures
 Completed [=================================>-----------------------------------------------------]  39% with 0 failures
 Completed [=================================>-----------------------------------------------------]  40% with 0 failures
 Completed [==================================>----------------------------------------------------]  40% with 0 failures
 Completed [==================================>----------------------------------------------------]  41% with 0 failures
 Completed [===================================>---------------------------------------------------]  41% with 0 failures
 Completed [===================================>---------------------------------------------------]  42% with 0 failures
 Completed [====================================>--------------------------------------------------]  42% with 0 failures
 Completed [====================================>--------------------------------------------------]  43% with 0 failures
 Completed [=====================================>-------------------------------------------------]  43% with 0 failures
 Completed [=====================================>-------------------------------------------------]  44% with 0 failures
 Completed [======================================>------------------------------------------------]  44% with 0 failures
 Completed [======================================>------------------------------------------------]  45% with 0 failures
 Completed [=======================================>-----------------------------------------------]  45% with 0 failures
 Completed [=======================================>-----------------------------------------------]  46% with 0 failures
 Completed [=======================================>-----------------------------------------------]  47% with 0 failures
 Completed [========================================>----------------------------------------------]  47% with 0 failures
 Completed [========================================>----------------------------------------------]  48% with 0 failures
 Completed [=========================================>---------------------------------------------]  48% with 0 failures
 Completed [=========================================>---------------------------------------------]  49% with 0 failures
 Completed [==========================================>--------------------------------------------]  49% with 0 failures
 Completed [==========================================>--------------------------------------------]  50% with 0 failures
 Completed [===========================================>-------------------------------------------]  50% with 0 failures
 Completed [===========================================>-------------------------------------------]  51% with 0 failures
 Completed [============================================>------------------------------------------]  51% with 0 failures
 Completed [============================================>------------------------------------------]  52% with 0 failures
 Completed [=============================================>-----------------------------------------]  52% with 0 failures
 Completed [=============================================>-----------------------------------------]  53% with 0 failures
 Completed [==============================================>----------------------------------------]  53% with 0 failures
 Completed [==============================================>----------------------------------------]  54% with 0 failures
 Completed [==============================================>----------------------------------------]  55% with 0 failures
 Completed [===============================================>---------------------------------------]  55% with 0 failures
 Completed [===============================================>---------------------------------------]  56% with 0 failures
 Completed [================================================>--------------------------------------]  56% with 0 failures
 Completed [================================================>--------------------------------------]  57% with 0 failures
 Completed [=================================================>-------------------------------------]  57% with 0 failures
 Completed [=================================================>-------------------------------------]  58% with 0 failures
 Completed [==================================================>------------------------------------]  58% with 0 failures
 Completed [==================================================>------------------------------------]  59% with 0 failures
 Completed [===================================================>-----------------------------------]  59% with 0 failures
 Completed [===================================================>-----------------------------------]  60% with 0 failures
 Completed [====================================================>----------------------------------]  60% with 0 failures
 Completed [====================================================>----------------------------------]  61% with 0 failures
 Completed [=====================================================>---------------------------------]  61% with 0 failures
 Completed [=====================================================>---------------------------------]  62% with 0 failures
 Completed [=====================================================>---------------------------------]  63% with 0 failures
 Completed [======================================================>--------------------------------]  63% with 0 failures
 Completed [======================================================>--------------------------------]  64% with 0 failures
 Completed [=======================================================>-------------------------------]  64% with 0 failures
 Completed [=======================================================>-------------------------------]  65% with 0 failures
 Completed [========================================================>------------------------------]  65% with 0 failures
 Completed [========================================================>------------------------------]  66% with 0 failures
 Completed [=========================================================>-----------------------------]  66% with 0 failures
 Completed [=========================================================>-----------------------------]  67% with 0 failures
 Completed [==========================================================>----------------------------]  67% with 0 failures
 Completed [==========================================================>----------------------------]  68% with 0 failures
 Completed [===========================================================>---------------------------]  68% with 0 failures
 Completed [===========================================================>---------------------------]  69% with 0 failures
 Completed [===========================================================>---------------------------]  70% with 0 failures
 Completed [============================================================>--------------------------]  70% with 0 failures
 Completed [============================================================>--------------------------]  71% with 0 failures
 Completed [=============================================================>-------------------------]  71% with 0 failures
 Completed [=============================================================>-------------------------]  72% with 0 failures
 Completed [==============================================================>------------------------]  72% with 0 failures
 Completed [==============================================================>------------------------]  73% with 0 failures
 Completed [===============================================================>-----------------------]  73% with 0 failures
 Completed [===============================================================>-----------------------]  74% with 0 failures
 Completed [================================================================>----------------------]  74% with 0 failures
 Completed [================================================================>----------------------]  75% with 0 failures
 Completed [=================================================================>---------------------]  75% with 0 failures
 Completed [=================================================================>---------------------]  76% with 0 failures
 Completed [==================================================================>--------------------]  76% with 0 failures
 Completed [==================================================================>--------------------]  77% with 0 failures
 Completed [==================================================================>--------------------]  78% with 0 failures
 Completed [===================================================================>-------------------]  78% with 0 failures
 Completed [===================================================================>-------------------]  79% with 0 failures
 Completed [====================================================================>------------------]  79% with 0 failures
 Completed [====================================================================>------------------]  80% with 0 failures
 Completed [=====================================================================>-----------------]  80% with 0 failures
 Completed [=====================================================================>-----------------]  81% with 0 failures
 Completed [======================================================================>----------------]  81% with 0 failures
 Completed [======================================================================>----------------]  82% with 0 failures
 Completed [=======================================================================>---------------]  82% with 0 failures
 Completed [=======================================================================>---------------]  83% with 0 failures
 Completed [========================================================================>--------------]  83% with 0 failures
 Completed [========================================================================>--------------]  84% with 0 failures
 Completed [=========================================================================>-------------]  84% with 0 failures
 Completed [=========================================================================>-------------]  85% with 0 failures
 Completed [=========================================================================>-------------]  86% with 0 failures
 Completed [==========================================================================>------------]  86% with 0 failures
 Completed [==========================================================================>------------]  87% with 0 failures
 Completed [===========================================================================>-----------]  87% with 0 failures
 Completed [===========================================================================>-----------]  88% with 0 failures
 Completed [============================================================================>----------]  88% with 0 failures
 Completed [============================================================================>----------]  89% with 0 failures
 Completed [=============================================================================>---------]  89% with 0 failures
 Completed [=============================================================================>---------]  90% with 0 failures
 Completed [==============================================================================>--------]  90% with 0 failures
 Completed [==============================================================================>--------]  91% with 0 failures
 Completed [===============================================================================>-------]  91% with 0 failures
 Completed [===============================================================================>-------]  92% with 0 failures
 Completed [===============================================================================>-------]  93% with 0 failures
 Completed [================================================================================>------]  93% with 0 failures
 Completed [================================================================================>------]  94% with 0 failures
 Completed [=================================================================================>-----]  94% with 0 failures
 Completed [=================================================================================>-----]  95% with 0 failures
 Completed [==================================================================================>----]  95% with 0 failures
 Completed [==================================================================================>----]  96% with 0 failures
 Completed [===================================================================================>---]  96% with 0 failures
 Completed [===================================================================================>---]  97% with 0 failures
 Completed [====================================================================================>--]  97% with 0 failures
 Completed [====================================================================================>--]  98% with 0 failures
 Completed [=====================================================================================>-]  98% with 0 failures
 Completed [=====================================================================================>-]  99% with 0 failures
 Completed [======================================================================================>]  99% with 0 failures
 Completed [======================================================================================>] 100% with 0 failures
 Completed [=======================================================================================] 100% with 0 failures
                                                                                                                         

Done!
gc()
             used   (Mb) gc trigger    (Mb)   max used    (Mb)
Ncells    8388915  448.1   15661334   836.5   15661334   836.5
Vcells 1232996630 9407.1 6392433025 48770.4 7990541281 60963.0
gc()
             used   (Mb) gc trigger    (Mb)   max used    (Mb)
Ncells    8388837  448.1   15661334   836.5   15661334   836.5
Vcells 1232961244 9406.8 5113946420 39016.4 7990541281 60963.0
write.csv(markers1, file = "0-imp_Robj/1-MAST_with_batch_as_Covariate.csv", row.names = TRUE)
Erreur dans is.data.frame(x) : objet 'markers1' introuvable

4.2 Using Wilcoxon Test (Without Batch Correction)

4.3 Using MAST Without Latent Variables (No Batch Correction)

markers_mast_no_batch <- FindMarkers(
  All_samples_Merged,
  ident.1 = c("0", "1", "2", "3", "4", "5", "7", "9"), # Cell lines
  ident.2 = c("6", "8", "10", "11"), # CD4 T cells
  assay = "SCT",
  test.use = "MAST",
  min.pct = 0,
  logfc.threshold = 0
)
Avis : sparse->dense coercion: allocating vector of size 9.6 GiBAvis : Dropping illegal slot(s) norm.method for class BayesGLMlike.  
                    This likely indicates a bug in an upstream package.
 Completed [----------------------------------------------------------]   0% with 0 failures
 Completed [----------------------------------------------------------]   1% with 0 failures
 Completed [>---------------------------------------------------------]   1% with 0 failures
 Completed [>---------------------------------------------------------]   2% with 0 failures
 Completed [>---------------------------------------------------------]   3% with 0 failures
 Completed [=>--------------------------------------------------------]   3% with 0 failures
 Completed [=>--------------------------------------------------------]   4% with 0 failures
 Completed [==>-------------------------------------------------------]   4% with 0 failures
 Completed [==>-------------------------------------------------------]   5% with 0 failures
 Completed [==>-------------------------------------------------------]   6% with 0 failures
 Completed [===>------------------------------------------------------]   6% with 0 failures
 Completed [===>------------------------------------------------------]   7% with 0 failures
 Completed [===>------------------------------------------------------]   8% with 0 failures
 Completed [====>-----------------------------------------------------]   8% with 0 failures
 Completed [====>-----------------------------------------------------]   9% with 0 failures
 Completed [=====>----------------------------------------------------]   9% with 0 failures
 Completed [=====>----------------------------------------------------]  10% with 0 failures
 Completed [=====>----------------------------------------------------]  11% with 0 failures
 Completed [======>---------------------------------------------------]  11% with 0 failures
 Completed [======>---------------------------------------------------]  12% with 0 failures
 Completed [======>---------------------------------------------------]  13% with 0 failures
 Completed [=======>--------------------------------------------------]  13% with 0 failures
 Completed [=======>--------------------------------------------------]  14% with 0 failures
 Completed [=======>--------------------------------------------------]  15% with 0 failures
 Completed [========>-------------------------------------------------]  15% with 0 failures
 Completed [========>-------------------------------------------------]  16% with 0 failures
 Completed [=========>------------------------------------------------]  16% with 0 failures
 Completed [=========>------------------------------------------------]  17% with 0 failures
 Completed [=========>------------------------------------------------]  18% with 0 failures
 Completed [==========>-----------------------------------------------]  18% with 0 failures
 Completed [==========>-----------------------------------------------]  19% with 0 failures
 Completed [==========>-----------------------------------------------]  20% with 0 failures
 Completed [===========>----------------------------------------------]  20% with 0 failures
 Completed [===========>----------------------------------------------]  21% with 0 failures
 Completed [===========>----------------------------------------------]  22% with 0 failures
 Completed [============>---------------------------------------------]  22% with 0 failures
 Completed [============>---------------------------------------------]  23% with 0 failures
 Completed [=============>--------------------------------------------]  23% with 0 failures
 Completed [=============>--------------------------------------------]  24% with 0 failures
 Completed [=============>--------------------------------------------]  25% with 0 failures
 Completed [==============>-------------------------------------------]  25% with 0 failures
 Completed [==============>-------------------------------------------]  26% with 0 failures
 Completed [==============>-------------------------------------------]  27% with 0 failures
 Completed [===============>------------------------------------------]  27% with 0 failures
 Completed [===============>------------------------------------------]  28% with 0 failures
 Completed [================>-----------------------------------------]  28% with 0 failures
 Completed [================>-----------------------------------------]  29% with 0 failures
 Completed [================>-----------------------------------------]  30% with 0 failures
 Completed [=================>----------------------------------------]  30% with 0 failures
 Completed [=================>----------------------------------------]  31% with 0 failures
 Completed [=================>----------------------------------------]  32% with 0 failures
 Completed [==================>---------------------------------------]  32% with 0 failures
 Completed [==================>---------------------------------------]  33% with 0 failures
 Completed [==================>---------------------------------------]  34% with 0 failures
 Completed [===================>--------------------------------------]  34% with 0 failures
 Completed [===================>--------------------------------------]  35% with 0 failures
 Completed [====================>-------------------------------------]  35% with 0 failures
 Completed [====================>-------------------------------------]  36% with 0 failures
 Completed [====================>-------------------------------------]  37% with 0 failures
 Completed [=====================>------------------------------------]  37% with 0 failures
 Completed [=====================>------------------------------------]  38% with 0 failures
 Completed [=====================>------------------------------------]  39% with 0 failures
 Completed [======================>-----------------------------------]  39% with 0 failures
 Completed [======================>-----------------------------------]  40% with 0 failures
 Completed [======================>-----------------------------------]  41% with 0 failures
 Completed [=======================>----------------------------------]  41% with 0 failures
 Completed [=======================>----------------------------------]  42% with 0 failures
 Completed [========================>---------------------------------]  42% with 0 failures
 Completed [========================>---------------------------------]  43% with 0 failures
 Completed [========================>---------------------------------]  44% with 0 failures
 Completed [=========================>--------------------------------]  44% with 0 failures
 Completed [=========================>--------------------------------]  45% with 0 failures
 Completed [=========================>--------------------------------]  46% with 0 failures
 Completed [==========================>-------------------------------]  46% with 0 failures
 Completed [==========================>-------------------------------]  47% with 0 failures
 Completed [===========================>------------------------------]  47% with 0 failures
 Completed [===========================>------------------------------]  48% with 0 failures
 Completed [===========================>------------------------------]  49% with 0 failures
 Completed [============================>-----------------------------]  49% with 0 failures
 Completed [============================>-----------------------------]  50% with 0 failures
 Completed [============================>-----------------------------]  51% with 0 failures
 Completed [=============================>----------------------------]  51% with 0 failures
 Completed [=============================>----------------------------]  52% with 0 failures
 Completed [=============================>----------------------------]  53% with 0 failures
 Completed [==============================>---------------------------]  53% with 0 failures
 Completed [==============================>---------------------------]  54% with 0 failures
 Completed [===============================>--------------------------]  54% with 0 failures
 Completed [===============================>--------------------------]  55% with 0 failures
 Completed [===============================>--------------------------]  56% with 0 failures
 Completed [================================>-------------------------]  56% with 0 failures
 Completed [================================>-------------------------]  57% with 0 failures
 Completed [================================>-------------------------]  58% with 0 failures
 Completed [=================================>------------------------]  58% with 0 failures
 Completed [=================================>------------------------]  59% with 0 failures
 Completed [==================================>-----------------------]  59% with 0 failures
 Completed [==================================>-----------------------]  60% with 0 failures
 Completed [==================================>-----------------------]  61% with 0 failures
 Completed [===================================>----------------------]  61% with 0 failures
 Completed [===================================>----------------------]  62% with 0 failures
 Completed [===================================>----------------------]  63% with 0 failures
 Completed [====================================>---------------------]  63% with 0 failures
 Completed [====================================>---------------------]  64% with 0 failures
 Completed [====================================>---------------------]  65% with 0 failures
 Completed [=====================================>--------------------]  65% with 0 failures
 Completed [=====================================>--------------------]  66% with 0 failures
 Completed [======================================>-------------------]  66% with 0 failures
 Completed [======================================>-------------------]  67% with 0 failures
 Completed [======================================>-------------------]  68% with 0 failures
 Completed [=======================================>------------------]  68% with 0 failures
 Completed [=======================================>------------------]  69% with 0 failures
 Completed [=======================================>------------------]  70% with 0 failures
 Completed [========================================>-----------------]  70% with 0 failures
 Completed [========================================>-----------------]  71% with 0 failures
 Completed [========================================>-----------------]  72% with 0 failures
 Completed [=========================================>----------------]  72% with 0 failures
 Completed [=========================================>----------------]  73% with 0 failures
 Completed [==========================================>---------------]  73% with 0 failures
 Completed [==========================================>---------------]  74% with 0 failures
 Completed [==========================================>---------------]  75% with 0 failures
 Completed [===========================================>--------------]  75% with 0 failures
 Completed [===========================================>--------------]  76% with 0 failures
 Completed [===========================================>--------------]  77% with 0 failures
 Completed [============================================>-------------]  77% with 0 failures
 Completed [============================================>-------------]  78% with 0 failures
 Completed [=============================================>------------]  78% with 0 failures
 Completed [=============================================>------------]  79% with 0 failures
 Completed [=============================================>------------]  80% with 0 failures
 Completed [==============================================>-----------]  80% with 0 failures
 Completed [==============================================>-----------]  81% with 0 failures
 Completed [==============================================>-----------]  82% with 0 failures
 Completed [===============================================>----------]  82% with 0 failures
 Completed [===============================================>----------]  83% with 0 failures
 Completed [===============================================>----------]  84% with 0 failures
 Completed [================================================>---------]  84% with 0 failures
 Completed [================================================>---------]  85% with 0 failures
 Completed [=================================================>--------]  85% with 0 failures
 Completed [=================================================>--------]  86% with 0 failures
 Completed [=================================================>--------]  87% with 0 failures
 Completed [==================================================>-------]  87% with 0 failures
 Completed [==================================================>-------]  88% with 0 failures
 Completed [==================================================>-------]  89% with 0 failures
 Completed [===================================================>------]  89% with 0 failures
 Completed [===================================================>------]  90% with 0 failures
 Completed [===================================================>------]  91% with 0 failures
 Completed [====================================================>-----]  91% with 0 failures
 Completed [====================================================>-----]  92% with 0 failures
 Completed [=====================================================>----]  92% with 0 failures
 Completed [=====================================================>----]  93% with 0 failures
 Completed [=====================================================>----]  94% with 0 failures
 Completed [======================================================>---]  94% with 0 failures
 Completed [======================================================>---]  95% with 0 failures
 Completed [======================================================>---]  96% with 0 failures
 Completed [=======================================================>--]  96% with 0 failures
 Completed [=======================================================>--]  97% with 0 failures
 Completed [========================================================>-]  97% with 0 failures
 Completed [========================================================>-]  98% with 0 failures
 Completed [========================================================>-]  99% with 0 failures
 Completed [=========================================================>]  99% with 0 failures
 Completed [=========================================================>] 100% with 0 failures
 Completed [==========================================================] 100% with 0 failures
                                                                                            

Done!
Combining coefficients and standard errors
Calculating log-fold changes
Calculating likelihood ratio tests
Refitting on reduced model...

 Completed [----------------------------------------------------------]   0% with 0 failures
 Completed [----------------------------------------------------------]   1% with 0 failures
 Completed [>---------------------------------------------------------]   1% with 0 failures
 Completed [>---------------------------------------------------------]   2% with 0 failures
 Completed [>---------------------------------------------------------]   3% with 0 failures
 Completed [=>--------------------------------------------------------]   3% with 0 failures
 Completed [=>--------------------------------------------------------]   4% with 0 failures
 Completed [==>-------------------------------------------------------]   4% with 0 failures
 Completed [==>-------------------------------------------------------]   5% with 0 failures
 Completed [==>-------------------------------------------------------]   6% with 0 failures
 Completed [===>------------------------------------------------------]   6% with 0 failures
 Completed [===>------------------------------------------------------]   7% with 0 failures
 Completed [===>------------------------------------------------------]   8% with 0 failures
 Completed [====>-----------------------------------------------------]   8% with 0 failures
 Completed [====>-----------------------------------------------------]   9% with 0 failures
 Completed [=====>----------------------------------------------------]   9% with 0 failures
 Completed [=====>----------------------------------------------------]  10% with 0 failures
 Completed [=====>----------------------------------------------------]  11% with 0 failures
 Completed [======>---------------------------------------------------]  11% with 0 failures
 Completed [======>---------------------------------------------------]  12% with 0 failures
 Completed [======>---------------------------------------------------]  13% with 0 failures
 Completed [=======>--------------------------------------------------]  13% with 0 failures
 Completed [=======>--------------------------------------------------]  14% with 0 failures
 Completed [=======>--------------------------------------------------]  15% with 0 failures
 Completed [========>-------------------------------------------------]  15% with 0 failures
 Completed [========>-------------------------------------------------]  16% with 0 failures
 Completed [=========>------------------------------------------------]  16% with 0 failures
 Completed [=========>------------------------------------------------]  17% with 0 failures
 Completed [=========>------------------------------------------------]  18% with 0 failures
 Completed [==========>-----------------------------------------------]  18% with 0 failures
 Completed [==========>-----------------------------------------------]  19% with 0 failures
 Completed [==========>-----------------------------------------------]  20% with 0 failures
 Completed [===========>----------------------------------------------]  20% with 0 failures
 Completed [===========>----------------------------------------------]  21% with 0 failures
 Completed [===========>----------------------------------------------]  22% with 0 failures
 Completed [============>---------------------------------------------]  22% with 0 failures
 Completed [============>---------------------------------------------]  23% with 0 failures
 Completed [=============>--------------------------------------------]  23% with 0 failures
 Completed [=============>--------------------------------------------]  24% with 0 failures
 Completed [=============>--------------------------------------------]  25% with 0 failures
 Completed [==============>-------------------------------------------]  25% with 0 failures
 Completed [==============>-------------------------------------------]  26% with 0 failures
 Completed [==============>-------------------------------------------]  27% with 0 failures
 Completed [===============>------------------------------------------]  27% with 0 failures
 Completed [===============>------------------------------------------]  28% with 0 failures
 Completed [================>-----------------------------------------]  28% with 0 failures
 Completed [================>-----------------------------------------]  29% with 0 failures
 Completed [================>-----------------------------------------]  30% with 0 failures
 Completed [=================>----------------------------------------]  30% with 0 failures
 Completed [=================>----------------------------------------]  31% with 0 failures
 Completed [=================>----------------------------------------]  32% with 0 failures
 Completed [==================>---------------------------------------]  32% with 0 failures
 Completed [==================>---------------------------------------]  33% with 0 failures
 Completed [==================>---------------------------------------]  34% with 0 failures
 Completed [===================>--------------------------------------]  34% with 0 failures
 Completed [===================>--------------------------------------]  35% with 0 failures
 Completed [====================>-------------------------------------]  35% with 0 failures
 Completed [====================>-------------------------------------]  36% with 0 failures
 Completed [====================>-------------------------------------]  37% with 0 failures
 Completed [=====================>------------------------------------]  37% with 0 failures
 Completed [=====================>------------------------------------]  38% with 0 failures
 Completed [=====================>------------------------------------]  39% with 0 failures
 Completed [======================>-----------------------------------]  39% with 0 failures
 Completed [======================>-----------------------------------]  40% with 0 failures
 Completed [======================>-----------------------------------]  41% with 0 failures
 Completed [=======================>----------------------------------]  41% with 0 failures
 Completed [=======================>----------------------------------]  42% with 0 failures
 Completed [========================>---------------------------------]  42% with 0 failures
 Completed [========================>---------------------------------]  43% with 0 failures
 Completed [========================>---------------------------------]  44% with 0 failures
 Completed [=========================>--------------------------------]  44% with 0 failures
 Completed [=========================>--------------------------------]  45% with 0 failures
 Completed [=========================>--------------------------------]  46% with 0 failures
 Completed [==========================>-------------------------------]  46% with 0 failures
 Completed [==========================>-------------------------------]  47% with 0 failures
 Completed [===========================>------------------------------]  47% with 0 failures
 Completed [===========================>------------------------------]  48% with 0 failures
 Completed [===========================>------------------------------]  49% with 0 failures
 Completed [============================>-----------------------------]  49% with 0 failures
 Completed [============================>-----------------------------]  50% with 0 failures
 Completed [============================>-----------------------------]  51% with 0 failures
 Completed [=============================>----------------------------]  51% with 0 failures
 Completed [=============================>----------------------------]  52% with 0 failures
 Completed [=============================>----------------------------]  53% with 0 failures
 Completed [==============================>---------------------------]  53% with 0 failures
 Completed [==============================>---------------------------]  54% with 0 failures
 Completed [===============================>--------------------------]  54% with 0 failures
 Completed [===============================>--------------------------]  55% with 0 failures
 Completed [===============================>--------------------------]  56% with 0 failures
 Completed [================================>-------------------------]  56% with 0 failures
 Completed [================================>-------------------------]  57% with 0 failures
 Completed [================================>-------------------------]  58% with 0 failures
 Completed [=================================>------------------------]  58% with 0 failures
 Completed [=================================>------------------------]  59% with 0 failures
 Completed [==================================>-----------------------]  59% with 0 failures
 Completed [==================================>-----------------------]  60% with 0 failures
 Completed [==================================>-----------------------]  61% with 0 failures
 Completed [===================================>----------------------]  61% with 0 failures
 Completed [===================================>----------------------]  62% with 0 failures
 Completed [===================================>----------------------]  63% with 0 failures
 Completed [====================================>---------------------]  63% with 0 failures
 Completed [====================================>---------------------]  64% with 0 failures
 Completed [====================================>---------------------]  65% with 0 failures
 Completed [=====================================>--------------------]  65% with 0 failures
 Completed [=====================================>--------------------]  66% with 0 failures
 Completed [======================================>-------------------]  66% with 0 failures
 Completed [======================================>-------------------]  67% with 0 failures
 Completed [======================================>-------------------]  68% with 0 failures
 Completed [=======================================>------------------]  68% with 0 failures
 Completed [=======================================>------------------]  69% with 0 failures
 Completed [=======================================>------------------]  70% with 0 failures
 Completed [========================================>-----------------]  70% with 0 failures
 Completed [========================================>-----------------]  71% with 0 failures
 Completed [========================================>-----------------]  72% with 0 failures
 Completed [=========================================>----------------]  72% with 0 failures
 Completed [=========================================>----------------]  73% with 0 failures
 Completed [==========================================>---------------]  73% with 0 failures
 Completed [==========================================>---------------]  74% with 0 failures
 Completed [==========================================>---------------]  75% with 0 failures
 Completed [===========================================>--------------]  75% with 0 failures
 Completed [===========================================>--------------]  76% with 0 failures
 Completed [===========================================>--------------]  77% with 0 failures
 Completed [============================================>-------------]  77% with 0 failures
 Completed [============================================>-------------]  78% with 0 failures
 Completed [=============================================>------------]  78% with 0 failures
 Completed [=============================================>------------]  79% with 0 failures
 Completed [=============================================>------------]  80% with 0 failures
 Completed [==============================================>-----------]  80% with 0 failures
 Completed [==============================================>-----------]  81% with 0 failures
 Completed [==============================================>-----------]  82% with 0 failures
 Completed [===============================================>----------]  82% with 0 failures
 Completed [===============================================>----------]  83% with 0 failures
 Completed [===============================================>----------]  84% with 0 failures
 Completed [================================================>---------]  84% with 0 failures
 Completed [================================================>---------]  85% with 0 failures
 Completed [=================================================>--------]  85% with 0 failures
 Completed [=================================================>--------]  86% with 0 failures
 Completed [=================================================>--------]  87% with 0 failures
 Completed [==================================================>-------]  87% with 0 failures
 Completed [==================================================>-------]  88% with 0 failures
 Completed [==================================================>-------]  89% with 0 failures
 Completed [===================================================>------]  89% with 0 failures
 Completed [===================================================>------]  90% with 0 failures
 Completed [===================================================>------]  91% with 0 failures
 Completed [====================================================>-----]  91% with 0 failures
 Completed [====================================================>-----]  92% with 0 failures
 Completed [=====================================================>----]  92% with 0 failures
 Completed [=====================================================>----]  93% with 0 failures
 Completed [=====================================================>----]  94% with 0 failures
 Completed [======================================================>---]  94% with 0 failures
 Completed [======================================================>---]  95% with 0 failures
 Completed [======================================================>---]  96% with 0 failures
 Completed [=======================================================>--]  96% with 0 failures
 Completed [=======================================================>--]  97% with 0 failures
 Completed [========================================================>-]  97% with 0 failures
 Completed [========================================================>-]  98% with 0 failures
 Completed [========================================================>-]  99% with 0 failures
 Completed [=========================================================>]  99% with 0 failures
 Completed [=========================================================>] 100% with 0 failures
 Completed [==========================================================] 100% with 0 failures
                                                                                            

Done!
View(markers_mast_batch)
View(markers_wilcox)
View(markers_wilcox)
View(markers_wilcox)
write.csv(markers_mast_no_batch, file = "0-imp_Robj/3-MAST_without_batch_as_Covariate.csv", row.names = TRUE)

5. Compute Mean Expression for Groups

# Define cell groups
group1_cells <- WhichCells(All_samples_Merged, idents = c("0", "1", "2", "3", "4", "5", "7", "9"))
group2_cells <- WhichCells(All_samples_Merged, idents = c("6", "8", "10", "11"))

# Extract normalized expression values
expression_data <- GetAssayData(All_samples_Merged, slot = "data")  # Log-normalized values
Avis : The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
Please use the `layer` argument instead.
# Calculate mean expression for each group
calculate_mean_expression <- function(markers, group1_cells, group2_cells, expression_data) {
  group1_mean <- rowMeans(expression_data[, group1_cells])
  group2_mean <- rowMeans(expression_data[, group2_cells])
  
  markers <- markers %>%
    rownames_to_column("gene") %>%
    mutate(mean_expr_group1 = group1_mean[gene],
           mean_expr_group2 = group2_mean[gene])
  
  return(markers)
}

markers_mast_batch <- calculate_mean_expression(markers_mast_batch, group1_cells, group2_cells, expression_data)
markers_wilcox <- calculate_mean_expression(markers_wilcox, group1_cells, group2_cells, expression_data)
markers_mast_no_batch <- calculate_mean_expression(markers_mast_no_batch, group1_cells, group2_cells, expression_data)

# Save updated results with mean expression
write.csv(markers_mast_batch, file = "0-imp_Robj/1-MAST_with_batch_as_Covariate_with_meanExpression.csv", row.names = TRUE)
write.csv(markers_wilcox, file = "0-imp_Robj/2-Wilcox_min.pct_logfcT-0_with_meanExpression.csv", row.names = TRUE)
write.csv(markers_mast_no_batch, file = "0-imp_Robj/3-MAST_without_batch_as_Covariate_with_meanExpression.csv", row.names = TRUE)

6. Summarize Results

6.1 Summary Function

summarize_markers <- function(markers) {
  num_pval0 <- sum(markers$p_val_adj == 0)
  num_pval1 <- sum(markers$p_val_adj == 1)
  num_significant <- sum(markers$p_val_adj < 0.05)
  num_upregulated <- sum(markers$avg_log2FC > 1)
  num_downregulated <- sum(markers$avg_log2FC < -1)
  
  cat("Number of genes with p_val_adj = 0:", num_pval0, "\n")
  cat("Number of genes with p_val_adj = 1:", num_pval1, "\n")
  cat("Number of significant genes (p_val_adj < 0.05):", num_significant, "\n")
  cat("Number of upregulated genes (avg_log2FC > 1):", num_upregulated, "\n")
  cat("Number of downregulated genes (avg_log2FC < -1):", num_downregulated, "\n")
}

6.2 Summarize Markers1 (MAST with Batch Correction)

cat("Markers1 Summary (MAST with Batch Correction):\n")
Markers1 Summary (MAST with Batch Correction):
summarize_markers(markers_mast_batch)
Number of genes with p_val_adj = 0: 1 
Number of genes with p_val_adj = 1: 16799 
Number of significant genes (p_val_adj < 0.05): 8601 
Number of upregulated genes (avg_log2FC > 1): 14796 
Number of downregulated genes (avg_log2FC < -1): 2494 

6.3 Summary for Markers2 (Wilcoxon Test)

cat("Markers2 Summary (Wilcoxon Test):\n")
Markers2 Summary (Wilcoxon Test):
summarize_markers(markers_wilcox)
Number of genes with p_val_adj = 0: 4502 
Number of genes with p_val_adj = 1: 10049 
Number of significant genes (p_val_adj < 0.05): 15357 
Number of upregulated genes (avg_log2FC > 1): 14796 
Number of downregulated genes (avg_log2FC < -1): 2494 

6.4 Summary for Markers3 (MAST without Batch Correction)

cat("Markers3 Summary (MAST without Batch Correction):\n")
Markers3 Summary (MAST without Batch Correction):
summarize_markers(markers_mast_no_batch)
Number of genes with p_val_adj = 0: 4957 
Number of genes with p_val_adj = 1: 9570 
Number of significant genes (p_val_adj < 0.05): 15882 
Number of upregulated genes (avg_log2FC > 1): 14796 
Number of downregulated genes (avg_log2FC < -1): 2494 

7. Visualization

7.1 Volcano Plot for MAST with Batch Correction

EnhancedVolcano(markers_mast_batch,
                lab = markers_mast_batch$gene,
                x = "avg_log2FC",
                y = "p_val_adj",
                title = "MAST with Batch Correction",
                pCutoff = 0.05,
                FCcutoff = 1.0)
Avis : One or more p-values is 0. Converting to 10^-1 * current lowest non-zero p-value...

7.2 Volcano Plot for Wilcoxon Test

EnhancedVolcano(markers_wilcox,
                lab = markers_wilcox$gene,
                x = "avg_log2FC",
                y = "p_val_adj",
                title = "MAST with Batch Correction",
                pCutoff = 0.05,
                FCcutoff = 1.0)
Avis : One or more p-values is 0. Converting to 10^-1 * current lowest non-zero p-value...

7.3 Volcano Plot for MAST without Batch Correction

EnhancedVolcano(markers_mast_no_batch,
                lab = markers_mast_no_batch$gene,
                x = "avg_log2FC",
                y = "p_val_adj",
                title = "MAST with Batch Correction",
                pCutoff = 0.05,
                FCcutoff = 1.0)
Avis : One or more p-values is 0. Converting to 10^-1 * current lowest non-zero p-value...

7.4 Heatmap of Top Differentially Expressed Genes

# Load required package
library(pheatmap)

# Define cell groups
group1_cells <- WhichCells(All_samples_Merged, idents = c("0", "1", "2", "3", "4", "5", "7", "9"))
group2_cells <- WhichCells(All_samples_Merged, idents = c("6", "8", "10", "11"))

# Define thresholds for adjusted p-value and avg_log2fc
p_val_adj_threshold <- 0.05
avg_logFC_threshold <- 1

# Ensure avg_log2fc column is numeric
markers_mast_batch$avg_log2fc <- as.numeric(as.character(markers_mast_batch$avg_log2FC))

# Identify and remove rows where avg_log2fc is NA after conversion
markers_mast_batch <- markers_mast_batch[!is.na(markers_mast_batch$avg_log2fc), ]

# Filter genes based on both adjusted p-value and avg_log2fc
filtered_genes <- markers_mast_batch[markers_mast_batch$p_val_adj < p_val_adj_threshold & 
                                     markers_mast_batch$avg_log2fc > avg_logFC_threshold, ]

# Define top genes based on adjusted p-value
top_genes <- head(filtered_genes$gene[order(filtered_genes$p_val_adj)], 20)

# Extract the corresponding expression data
expression_data <- GetAssayData(All_samples_Merged, slot = "data")  # Log-normalized values
heatmap_data <- expression_data[top_genes, c(group1_cells, group2_cells)]

# Create annotation data
annotation_data <- data.frame(
  CellLine = factor(All_samples_Merged$cell_line[c(group1_cells, group2_cells)]),
  Cluster = factor(All_samples_Merged$seurat_clusters[c(group1_cells, group2_cells)])
)

# Set row names for annotation data to match column names of heatmap_data
rownames(annotation_data) <- c(group1_cells, group2_cells)

# Generate the heatmap
pheatmap(heatmap_data, 
         cluster_rows = TRUE, 
         cluster_cols = TRUE, 
         show_rownames = TRUE,
         show_colnames = FALSE,  # Hide cell labels below the heatmap
         annotation_col = annotation_data,
         fontsize = 10)  # Adjust font size for readability

LS0tCnRpdGxlOiAiRGlmZmVyZW50aWFsIEV4cHJlc3Npb24gQW5hbHlzaXMgdXNpbmcgSGFybW9ueSBJbnRlZ3JhdGVkIENsdXN0ZXJzIgphdXRob3I6IE5hc2lyIE1haG1vb2QgQWJiYXNpCmRhdGU6ICJgciBTeXMuRGF0ZSgpYCIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6CiAgICB0b2M6IHRydWUKICAgIHRvY19mbG9hdDogdHJ1ZQogICAgdG9jX2NvbGxhcHNlZDogdHJ1ZQotLS0KCiMjIDEuIExvYWQgTGlicmFyaWVzCmBgYHtyIHNldHVwLCBpbmNsdWRlPUZBTFNFfQpsaWJyYXJ5KFNldXJhdCkKbGlicmFyeShoYXJtb255KQpsaWJyYXJ5KGRwbHlyKQpsaWJyYXJ5KEVuaGFuY2VkVm9sY2FubykKbGlicmFyeShn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