#Load Seurat Object merged from cell lines and a control(PBMC) after filtration
load("All_T_cells_Merged_filtered_Mono_using_clusters.Robj")
All_samples_Merged <- filtered_data
All_samples_Merged
An object of class Seurat
62626 features across 46976 samples within 6 assays
Active assay: SCT (25902 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
4 dimensional reductions calculated: pca, umap, integrated_dr, ref.umap
rm(filtered_data)
Idents(object = All_samples_Merged) <- "cell_line"
All_samples_Merged[["percent.rb"]] <- PercentageFeatureSet(All_samples_Merged,
pattern = "^RP[SL]")
VlnPlot(All_samples_Merged, features = c("nFeature_RNA",
"nCount_RNA",
"percent.mt",
"percent.rb"),
ncol = 4, pt.size = 0.1) &
theme(plot.title = element_text(size=10))
FeatureScatter(All_samples_Merged, feature1 = "percent.mito",
feature2 = "percent.rb")
FeatureScatter(All_samples_Merged,
feature1 = "nCount_RNA",
feature2 = "nFeature_RNA") +
geom_smooth(method = 'lm')
##FeatureScatter is typically used to visualize feature-feature relationships ##for anything calculated by the object, ##i.e. columns in object metadata, PC scores etc.
FeatureScatter(All_samples_Merged,
feature1 = "nCount_RNA",
feature2 = "percent.mito")+
geom_smooth(method = 'lm')
FeatureScatter(All_samples_Merged,
feature1 = "nCount_RNA",
feature2 = "nFeature_RNA")+
geom_smooth(method = 'lm')
Warning: The following features are not present in the object: MLF1IP, not searching for symbol synonymsWarning: The following features are not present in the object: FAM64A, HN1, not searching for symbol synonyms
# Apply SCTransform
All_samples_Merged <- SCTransform(All_samples_Merged,
vars.to.regress = c("percent.rb","percent.mito", "CC.Difference"),
verbose = TRUE)
Running SCTransform on assay: RNA
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Calculating cell attributes from input UMI matrix: log_umi
Variance stabilizing transformation of count matrix of size 25901 by 46976
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 5000 cells
Found 484 outliers - those will be ignored in fitting/regularization step
Second step: Get residuals using fitted parameters for 25901 genes
Computing corrected count matrix for 25901 genes
Calculating gene attributes
Wall clock passed: Time difference of 2.332449 mins
Determine variable features
Regressing out percent.rb, percent.mito, CC.Difference
|
| | 0%
|
|= | 0%
|
|= | 1%
|
|== | 1%
|
|== | 2%
|
|=== | 2%
|
|=== | 3%
|
|==== | 3%
|
|==== | 4%
|
|===== | 4%
|
|====== | 5%
|
|======= | 5%
|
|======= | 6%
|
|======== | 6%
|
|======== | 7%
|
|========= | 7%
|
|========= | 8%
|
|========== | 8%
|
|========== | 9%
|
|=========== | 9%
|
|============ | 9%
|
|============ | 10%
|
|============= | 10%
|
|============= | 11%
|
|============== | 11%
|
|============== | 12%
|
|=============== | 12%
|
|=============== | 13%
|
|================ | 13%
|
|================ | 14%
|
|================= | 14%
|
|================== | 14%
|
|================== | 15%
|
|=================== | 15%
|
|=================== | 16%
|
|==================== | 16%
|
|==================== | 17%
|
|===================== | 17%
|
|===================== | 18%
|
|====================== | 18%
|
|======================= | 18%
|
|======================= | 19%
|
|======================== | 19%
|
|======================== | 20%
|
|========================= | 20%
|
|========================= | 21%
|
|========================== | 21%
|
|========================== | 22%
|
|=========================== | 22%
|
|=========================== | 23%
|
|============================ | 23%
|
|============================= | 23%
|
|============================= | 24%
|
|============================== | 24%
|
|============================== | 25%
|
|=============================== | 25%
|
|=============================== | 26%
|
|================================ | 26%
|
|================================ | 27%
|
|================================= | 27%
|
|================================== | 27%
|
|================================== | 28%
|
|=================================== | 28%
|
|=================================== | 29%
|
|==================================== | 29%
|
|==================================== | 30%
|
|===================================== | 30%
|
|===================================== | 31%
|
|====================================== | 31%
|
|====================================== | 32%
|
|======================================= | 32%
|
|======================================== | 32%
|
|======================================== | 33%
|
|========================================= | 33%
|
|========================================= | 34%
|
|========================================== | 34%
|
|========================================== | 35%
|
|=========================================== | 35%
|
|=========================================== | 36%
|
|============================================ | 36%
|
|============================================= | 36%
|
|============================================= | 37%
|
|============================================== | 37%
|
|============================================== | 38%
|
|=============================================== | 38%
|
|=============================================== | 39%
|
|================================================ | 39%
|
|================================================ | 40%
|
|================================================= | 40%
|
|================================================= | 41%
|
|================================================== | 41%
|
|=================================================== | 41%
|
|=================================================== | 42%
|
|==================================================== | 42%
|
|==================================================== | 43%
|
|===================================================== | 43%
|
|===================================================== | 44%
|
|====================================================== | 44%
|
|====================================================== | 45%
|
|======================================================= | 45%
|
|======================================================== | 46%
|
|========================================================= | 46%
|
|========================================================= | 47%
|
|========================================================== | 47%
|
|========================================================== | 48%
|
|=========================================================== | 48%
|
|=========================================================== | 49%
|
|============================================================ | 49%
|
|============================================================ | 50%
|
|============================================================= | 50%
|
|============================================================== | 50%
|
|============================================================== | 51%
|
|=============================================================== | 51%
|
|=============================================================== | 52%
|
|================================================================ | 52%
|
|================================================================ | 53%
|
|================================================================= | 53%
|
|================================================================= | 54%
|
|================================================================== | 54%
|
|================================================================== | 55%
|
|=================================================================== | 55%
|
|==================================================================== | 55%
|
|==================================================================== | 56%
|
|===================================================================== | 56%
|
|===================================================================== | 57%
|
|====================================================================== | 57%
|
|====================================================================== | 58%
|
|======================================================================= | 58%
|
|======================================================================= | 59%
|
|======================================================================== | 59%
|
|========================================================================= | 59%
|
|========================================================================= | 60%
|
|========================================================================== | 60%
|
|========================================================================== | 61%
|
|=========================================================================== | 61%
|
|=========================================================================== | 62%
|
|============================================================================ | 62%
|
|============================================================================ | 63%
|
|============================================================================= | 63%
|
|============================================================================= | 64%
|
|============================================================================== | 64%
|
|=============================================================================== | 64%
|
|=============================================================================== | 65%
|
|================================================================================ | 65%
|
|================================================================================ | 66%
|
|================================================================================= | 66%
|
|================================================================================= | 67%
|
|================================================================================== | 67%
|
|================================================================================== | 68%
|
|=================================================================================== | 68%
|
|==================================================================================== | 68%
|
|==================================================================================== | 69%
|
|===================================================================================== | 69%
|
|===================================================================================== | 70%
|
|====================================================================================== | 70%
|
|====================================================================================== | 71%
|
|======================================================================================= | 71%
|
|======================================================================================= | 72%
|
|======================================================================================== | 72%
|
|======================================================================================== | 73%
|
|========================================================================================= | 73%
|
|========================================================================================== | 73%
|
|========================================================================================== | 74%
|
|=========================================================================================== | 74%
|
|=========================================================================================== | 75%
|
|============================================================================================ | 75%
|
|============================================================================================ | 76%
|
|============================================================================================= | 76%
|
|============================================================================================= | 77%
|
|============================================================================================== | 77%
|
|=============================================================================================== | 77%
|
|=============================================================================================== | 78%
|
|================================================================================================ | 78%
|
|================================================================================================ | 79%
|
|================================================================================================= | 79%
|
|================================================================================================= | 80%
|
|================================================================================================== | 80%
|
|================================================================================================== | 81%
|
|=================================================================================================== | 81%
|
|=================================================================================================== | 82%
|
|==================================================================================================== | 82%
|
|===================================================================================================== | 82%
|
|===================================================================================================== | 83%
|
|====================================================================================================== | 83%
|
|====================================================================================================== | 84%
|
|======================================================================================================= | 84%
|
|======================================================================================================= | 85%
|
|======================================================================================================== | 85%
|
|======================================================================================================== | 86%
|
|========================================================================================================= | 86%
|
|========================================================================================================== | 86%
|
|========================================================================================================== | 87%
|
|=========================================================================================================== | 87%
|
|=========================================================================================================== | 88%
|
|============================================================================================================ | 88%
|
|============================================================================================================ | 89%
|
|============================================================================================================= | 89%
|
|============================================================================================================= | 90%
|
|============================================================================================================== | 90%
|
|============================================================================================================== | 91%
|
|=============================================================================================================== | 91%
|
|================================================================================================================ | 91%
|
|================================================================================================================ | 92%
|
|================================================================================================================= | 92%
|
|================================================================================================================= | 93%
|
|================================================================================================================== | 93%
|
|================================================================================================================== | 94%
|
|=================================================================================================================== | 94%
|
|=================================================================================================================== | 95%
|
|==================================================================================================================== | 95%
|
|===================================================================================================================== | 96%
|
|====================================================================================================================== | 96%
|
|====================================================================================================================== | 97%
|
|======================================================================================================================= | 97%
|
|======================================================================================================================= | 98%
|
|======================================================================================================================== | 98%
|
|======================================================================================================================== | 99%
|
|========================================================================================================================= | 99%
|
|========================================================================================================================= | 100%
|
|==========================================================================================================================| 100%
Centering data matrix
|
| | 0%
|
|============================== | 25%
|
|============================================================= | 50%
|
|============================================================================================ | 75%
|
|==========================================================================================================================| 100%
Place corrected count matrix in counts slot
Warning: Different cells and/or features from existing assay SCTSet default assay to SCT
Variables_genes <- All_samples_Merged@assays$SCT@var.features
# Exclude genes starting with "HLA-" or "Xist"
Variables_genes_after_exclusion <- Variables_genes[!grepl("^HLA-|^XIST|^TRBV|^TRAV", Variables_genes)]
# These are now standard steps in the Seurat workflow for visualization and clustering
All_samples_Merged <- RunPCA(All_samples_Merged,
features = Variables_genes_after_exclusion,
do.print = TRUE,
pcs.print = 1:5,
genes.print = 15,
npcs = 50)
PC_ 1
Positive: CCL17, TNFRSF4, CA2, SYT4, MIR155HG, SEC11C, EGFL6, C12orf75, IL2RA, CA10
CCL5, IGHE, KRT7, PRG4, LTA, STC1, TIGIT, CD74, EEF1A2, ALOX5AP
THY1, CFI, HDGFL3, MIIP, RANBP17, RXFP1, PHLDA2, ONECUT2, BACE2, HACD1
Negative: CD7, XCL1, KIR3DL1, MALAT1, XCL2, LTB, KIR2DL3, CST7, CD52, RPS4Y1
MT1G, KLRC1, IL7R, KIR2DL4, ESYT2, GIMAP7, IFITM1, TMSB4X, IFITM2, ID3
SH3BGRL3, CXCR3, KRT81, GZMM, KIR3DL2, KRT86, MYO1E, CLEC2B, KLF2, KLRK1
PC_ 2
Positive: CCL17, XCL1, CD7, KIR3DL1, XCL2, LTB, CST7, MT1G, KLRC1, KIR2DL4
CA2, KIR2DL3, TNFRSF4, PLPP1, SPINT2, KRT81, CYBA, MATK, GZMM, KRT86
ESYT2, HIST1H1B, MYO1E, EPCAM, SYT4, TRGV2, CORO1B, HIST1H4C, CXCR3, NKG7
Negative: PPBP, CD74, MT2A, PAGE5, CD70, LMNA, TENM3, RPL22L1, LGALS3, STAT1
RBPMS, CCDC50, B2M, FABP5, IQCG, GSTP1, PPP2R2B, ANXA1, MACROD2, SPOCK1
CTAG2, PIM2, FTL, SLC7A11-AS1, BASP1, GAPDH, LGALS1, VIM, TNFSF10, AHNAK
PC_ 3
Positive: RPS4Y1, MALAT1, IL7R, BTG1, PNRC1, CCL17, LINC00861, TCF7, GIMAP7, SELL
SARAF, B2M, GIMAP5, PIK3IP1, ZFP36, FTH1, KLF2, TRBC2, CCR7, SESN3
YPEL3, PCED1B-AS1, CCL5, TRBC1, GIMAP4, PABPC1, RGCC, ZFP36L2, FYB1, ITM2B
Negative: PPBP, XCL1, KRT1, GAPDH, CD74, ACTB, KIR3DL1, XCL2, FABP5, MT2A
RPL22L1, HIST1H4C, RPS2, TUBA1B, TUBB, C1QBP, KIR2DL3, TTC29, CST7, NME2
GZMA, ACTG1, RPL13, NKG7, RPLP0, RPS15, FTL, RPS4X, RPLP1, PFN1
PC_ 4
Positive: CCL17, PPBP, MT2A, CD7, CA2, CCL5, LTA, XCL1, MIR155HG, CD74
CA10, MGST3, STC1, XCL2, MALAT1, KIR2DL3, RXFP1, FCER2, RANBP17, CFI
KIR3DL1, AL590550.1, IQCG, RYR2, IGHE, THY1, IL7R, STAT1, MT1G, KLRC1
Negative: EEF1A2, TNFRSF4, IL2RA, WFDC1, PHLDA2, FN1, MIIP, S100A4, KRT1, HIST1H1C
S100A11, PXYLP1, RDH10, S100A6, DUSP4, GPAT3, TIGIT, CDKN1A, LGALS1, HOXC9
TNFRSF18, CORO1B, GATA3, AL136456.1, CEP135, EGLN3, HIST1H2BK, TP73, PTGDR2, TMEM163
PC_ 5
Positive: PPBP, RPS4Y1, FABP5, GSTP1, CD7, ENPP2, DNAJC12, AC068672.2, MGST1, IL7R
CSMD1, LINC00861, SLC7A11-AS1, TCF7, FCER2, IL2RA, RDH10, CCDC50, EEF1A2, FAM162A
HSP90B1, HSPD1, HSPE1, C1QBP, MIIP, SELL, EIF5A, PPID, SPINK6, FTH1
Negative: S100A4, MT2A, GZMA, LGALS3, CD74, KRT1, CCL17, S100A6, GZMB, NKG7
CCL1, IL32, CSF2, SERPINE1, TNFSF10, NCR3, CCL4, TSC22D3, TTC29, VIM
PTGIS, MAL, SH3BGRL3, AC114977.1, CD52, RYR2, S100A11, CYP1B1, LMNA, PLD1
# determine dimensionality of the data
ElbowPlot(All_samples_Merged, ndims = 50)
NA
NA
library(ggplot2)
library(RColorBrewer)
# Assuming you have 10 different cell lines, generating a color palette with 10 colors
cell_line_colors <- brewer.pal(10, "Set3")
# Assuming All_samples_Merged$cell_line is a factor or character vector containing cell line names
data <- as.data.frame(table(All_samples_Merged$cell_line))
colnames(data) <- c("cell_line", "nUMI") # Change column name to nUMI
ncells <- ggplot(data, aes(x = cell_line, y = nUMI, fill = cell_line)) +
geom_col() +
theme_classic() +
geom_text(aes(label = nUMI),
position = position_dodge(width = 0.9),
vjust = -0.25) +
scale_fill_manual(values = cell_line_colors) +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
plot.title = element_text(hjust = 0.5)) + # Adjust the title position
ggtitle("Filtered cells per sample") +
xlab("Cell lines") + # Adjust x-axis label
ylab("Frequency") # Adjust y-axis label
print(ncells)
# TEST-1
# given that the output of RunPCA is "pca"
# replace "so" by the name of your seurat object
pct <- All_samples_Merged[["pca"]]@stdev / sum(All_samples_Merged[["pca"]]@stdev) * 100
cumu <- cumsum(pct) # Calculate cumulative percents for each PC
# Determine the difference between variation of PC and subsequent PC
co2 <- sort(which((pct[-length(pct)] - pct[-1]) > 0.1), decreasing = T)[1] + 1
# last point where change of % of variation is more than 0.1%. -> co2
co2
[1] 21
# TEST-2
# get significant PCs
stdv <- All_samples_Merged[["pca"]]@stdev
sum.stdv <- sum(All_samples_Merged[["pca"]]@stdev)
percent.stdv <- (stdv / sum.stdv) * 100
cumulative <- cumsum(percent.stdv)
co1 <- which(cumulative > 90 & percent.stdv < 5)[1]
co2 <- sort(which((percent.stdv[1:length(percent.stdv) - 1] -
percent.stdv[2:length(percent.stdv)]) > 0.1),
decreasing = T)[1] + 1
min.pc <- min(co1, co2)
min.pc
[1] 21
# Create a dataframe with values
plot_df <- data.frame(pct = percent.stdv,
cumu = cumulative,
rank = 1:length(percent.stdv))
# Elbow plot to visualize
ggplot(plot_df, aes(cumulative, percent.stdv, label = rank, color = rank > min.pc)) +
geom_text() +
geom_vline(xintercept = 90, color = "grey") +
geom_hline(yintercept = min(percent.stdv[percent.stdv > 5]), color = "grey") +
theme_bw()
NA
NA
NA
All_samples_Merged <- FindNeighbors(All_samples_Merged,
dims = 1:21,
verbose = FALSE)
# understanding resolution
All_samples_Merged <- FindClusters(All_samples_Merged,
resolution = c(0.1,0.2,0.3,0.4,0.5, 0.6, 0.7,0.8, 0.9, 1))
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9859
Number of communities: 9
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9743
Number of communities: 12
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9634
Number of communities: 14
Elapsed time: 7 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9531
Number of communities: 16
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9443
Number of communities: 17
Elapsed time: 7 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9368
Number of communities: 21
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9298
Number of communities: 24
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9236
Number of communities: 26
Elapsed time: 7 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9183
Number of communities: 27
Elapsed time: 8 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 46976
Number of edges: 1576843
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9130
Number of communities: 27
Elapsed time: 8 seconds
# non-linear dimensionality reduction --------------
All_samples_Merged <- RunUMAP(All_samples_Merged,
dims = 1:21,
verbose = FALSE)
Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session
# note that you can set `label = TRUE` or use the LabelClusters function to help label
# individual clusters
DimPlot(All_samples_Merged,group.by = "cell_line",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.1",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.2",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.3",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.4",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.5",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.6",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.7",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.8",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.0.9",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
DimPlot(All_samples_Merged,
group.by = "SCT_snn_res.1",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
cluster_table <- table(Idents(All_samples_Merged))
barplot(cluster_table, main = "Number of Cells in Each Cluster",
xlab = "Cluster",
ylab = "Number of Cells",
col = rainbow(length(cluster_table)))
print(cluster_table)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
4072 3754 3401 3311 3305 3134 3048 2571 2348 2313 2225 1818 1772 1731 1477 1220 1102 1010 723 620 547 481 290 278 220 131
26
74
InstallData("pbmcref")
Warning: The following packages are already installed and will not be reinstalled: pbmcref
# The RunAzimuth function can take a Seurat object as input
All_samples_Merged <- RunAzimuth(All_samples_Merged, reference = "pbmcref")
Warning: Overwriting miscellanous data for modelWarning: Adding a dimensional reduction (refUMAP) without the associated assay being presentWarning: Adding a dimensional reduction (refUMAP) without the associated assay being presentdetected inputs from HUMAN with id type Gene.name
reference rownames detected HUMAN with id type Gene.name
Normalizing query using reference SCT model
Warning: 113 features of the features specified were not present in both the reference query assays.
Continuing with remaining 4887 features.Projecting cell embeddings
Finding query neighbors
Finding neighborhoods
Finding anchors
Found 4803 anchors
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Predicting cell labels
Predicting cell labels
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')Predicting cell labels
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
| | 0 % ~calculating
Integrating dataset 2 with reference dataset
Finding integration vectors
Integrating data
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_dr_ to integrateddr_Computing nearest neighbors
Running UMAP projection
Warning: Number of neighbors between query and reference is not equal to the number of neighbors within reference13:04:37 Read 46976 rows
13:04:37 Processing block 1 of 1
13:04:37 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 20
13:04:37 Initializing by weighted average of neighbor coordinates using 1 thread
13:04:37 Commencing optimization for 67 epochs, with 939520 positive edges
Using method 'umap'
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
13:04:41 Finished
Warning: No assay specified, setting assay as RNA by default.Projecting reference PCA onto query
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Projecting back the query cells into original PCA space
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Computing scores:
Finding neighbors of original query cells
Finding neighbors of transformed query cells
Computing query SNN
Determining bandwidth and computing transition probabilities
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Total elapsed time: 21.0875782966614
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = F)
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
library(clustree)
Loading required package: ggraph
Attaching package: 'ggraph'
The following object is masked from 'package:sp':
geometry
clustree(All_samples_Merged, prefix = "SCT_snn_res.")
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l1",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l1",
reduction = "umap",
label.size = 3,
repel = T,
label = F)
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = F)
DimPlot(All_samples_Merged, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
table(All_samples_Merged$predicted.celltype.l2, All_samples_Merged$SCT_snn_res.0.4)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ASDC 44 0 26 0 0 1 6 0 0 1 8 0 0 0 3 0
B intermediate 2 0 0 2 4 0 0 0 0 0 0 0 5 37 0 0
B memory 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0
CD4 CTL 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0
CD4 Naive 0 0 0 747 0 0 0 0 0 0 0 0 0 0 0 0
CD4 Proliferating 5251 2899 5252 2 3686 1484 2861 2917 935 1320 1034 0 380 126 165 41
CD4 TCM 445 289 332 4299 65 2051 62 7 768 7 168 29 3 46 9 70
CD4 TEM 0 0 0 12 0 11 0 0 0 0 0 36 0 0 0 0
CD8 Naive 1 0 147 372 2 0 15 0 0 0 40 5 0 0 1 0
CD8 Proliferating 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
CD8 TCM 0 14 0 79 0 229 0 0 204 0 0 174 0 0 0 18
CD8 TEM 0 1 0 1 0 0 0 0 0 0 0 206 0 0 0 0
cDC2 470 0 43 0 837 3 198 84 0 95 424 0 86 8 34 0
dnT 0 1 0 43 0 3 0 0 0 0 0 0 0 7 0 0
gdT 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0
HSPC 40 0 1 1 180 4 647 421 0 391 0 0 52 3 2 0
ILC 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
MAIT 0 0 0 3 0 0 0 0 0 0 0 55 0 0 0 0
NK 0 0 0 1 0 0 0 0 0 0 0 91 0 0 0 0
NK Proliferating 4 2725 43 0 204 13 12 9 5 0 20 0 11 23 1 0
Platelet 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0
Treg 0 0 0 166 1 1 0 0 0 0 0 0 0 25 1 0