#Load Seurat Object merged from cell lines and a control(PBMC) after filtration
load("AllSample_corrected.Robj")
AllSample
An object of class Seurat
38620 features across 49193 samples within 3 assays
Active assay: integrated (1991 features, 1991 variable features)
2 layers present: data, scale.data
2 other assays present: RNA, ADT
3 dimensional reductions calculated: pca, umap, tsne
ElbowPlot(AllSample)
NA
NA
# understanding resolution
AllSample <- FindClusters(AllSample, resolution = c(0.4, 0.5, 0.7, 1.2))
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 49193
Number of edges: 1512234
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8921
Number of communities: 18
Elapsed time: 15 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 49193
Number of edges: 1512234
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8838
Number of communities: 18
Elapsed time: 14 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 49193
Number of edges: 1512234
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8669
Number of communities: 19
Elapsed time: 12 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 49193
Number of edges: 1512234
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8375
Number of communities: 24
Elapsed time: 10 seconds
#5. Visualization
# non-linear dimensionality reduction --------------
# All_samples_Merged <- RunUMAP(All_samples_Merged,
# dims = 1:8,
# verbose = FALSE)
#
# note that you can set `label = TRUE` or use the LabelClusters function to help label
# individual clusters
DimPlot(AllSample,group.by = "orig.ident",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(AllSample,
group.by = "integrated_snn_res.0.4",
reduction = "umap",
label.size = 2,
repel = T,
label = T, label.box = T)
DimPlot(AllSample,
group.by = "integrated_snn_res.0.5",
reduction = "umap",
label.size = 2,
repel = T,
label = T, label.box = T)
DimPlot(AllSample,
group.by = "integrated_snn_res.1.2",
reduction = "umap",
label.size = 2,
repel = T,
label = T, label.box = T)
cluster_table <- table(Idents(AllSample))
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
5038 4655 4640 3724 3017 2960 2907 2839 2328 2178 1813 1742 1654 1525 1525 1073 900 891 858 825 817 493 444 347
#0.4
cell_distribution_table <- table(AllSample$cell_line, AllSample$integrated_snn_res.0.4)
cell_distribution_df <- as.data.frame.matrix(cell_distribution_table)
print(cell_distribution_df)
#write.csv(cell_distribution_df, file = "/home/bioinfo/Downloads/integration_table_Marie-0.4.csv", row.names = TRUE)
#0.5
cell_distribution_table <- table(AllSample$cell_line, AllSample$integrated_snn_res.0.5)
cell_distribution_df <- as.data.frame.matrix(cell_distribution_table)
print(cell_distribution_df)
#write.csv(cell_distribution_df, file = "/home/bioinfo/Downloads/integration_table_Marie-0.4.csv", row.names = TRUE)
#0.7
cell_distribution_table <- table(AllSample$cell_line, AllSample$integrated_snn_res.0.7)
cell_distribution_df <- as.data.frame.matrix(cell_distribution_table)
print(cell_distribution_df)
#write.csv(cell_distribution_df, file = "/home/bioinfo/Downloads/integration_table_Marie-0.4.csv", row.names = TRUE)
#1.2
cell_distribution_table <- table(AllSample$cell_line, AllSample$integrated_snn_res.1.2)
cell_distribution_df <- as.data.frame.matrix(cell_distribution_table)
print(cell_distribution_df)
#write.csv(cell_distribution_df, file = "/home/bioinfo/Downloads/integration_table_Marie-0.4.csv", row.names = TRUE)
Idents(AllSample) <- AllSample@meta.data$seurat_clusters
# find markers for every cluster compared to all remaining cells, report both positive and negative
SS.markers <- FindAllMarkers(AllSample,
only.pos = FALSE,
logfc.threshold = 0.25, verbose = FALSE)
SS.markers
#write.table(SS.markers, file = "/home/bioinfo/Documents/1-SS-STeps/9-Integration/1-Marie_Uncorrected_Robj/SS_markers_all_clusters.tsv", sep = "\t", row.names = FALSE)
DefaultAssay(AllSample) <- "RNA"
myfeatures <- c("CD3", "CD3E", "CD4","CD8", "CD8A", "CD14", "CD19")
FeaturePlot(AllSample, reduction = "umap", dims = 1:2, features = myfeatures, ncol = 3, order = T)
Warning: Could not find CD3 in the default search locations, found in 'ADT' assay insteadWarning: The following requested variables were not found: CD8