Cell Line L6 Analysis
1. load libraries
2. Load Seurat Object
#Load Seurat Object L6
load("../Documents/1-SS-STeps/4-Analysis_and_Robj_Marie/analyse juillet 2023/ObjetsR/L6.Robj")
L6
## An object of class Seurat
## 36629 features across 5148 samples within 2 assays
## Active assay: RNA (36601 features, 0 variable features)
## 2 layers present: counts, data
## 1 other assay present: ADT
3. QC
# Set identity classes to an existing column in meta data
Idents(object = L6) <- "cell_line"
L6[["percent.rb"]] <- PercentageFeatureSet(L6, pattern = "^RP[SL]")
VlnPlot(L6, features = c("nFeature_RNA",
"nCount_RNA",
"percent.mito",
"percent.rb"),
ncol = 4, pt.size = 0.1) &
theme(plot.title = element_text(size=10))
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
##FeatureScatter is typically used to visualize feature-feature
relationships ##for anything calculated by the object, ##i.e. columns in
object metadata, PC scores etc.
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Assign
Cell-Cycle Scores
## 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 18079 by 5148
## Model formula is y ~ log_umi
## Get Negative Binomial regression parameters per gene
## Using 2000 genes, 5000 cells
## Found 71 outliers - those will be ignored in fitting/regularization step
## Second step: Get residuals using fitted parameters for 18079 genes
## Computing corrected count matrix for 18079 genes
## Calculating gene attributes
## Wall clock passed: Time difference of 20.65746 secs
## Determine variable features
## Place corrected count matrix in counts slot
## Set default assay to SCT
## Warning: The following features are not present in the object: MLF1IP, not
## searching for symbol synonyms
## Warning: The following features are not present in the object: FAM64A, HN1, not
## searching for symbol synonyms
4. Normalize data
# Apply SCTransform
L6 <- SCTransform(L6, vars.to.regress = c("percent.rb","percent.mito", "CC.Difference"),
do.scale=TRUE,
do.center=TRUE,
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 18079 by 5148
## Model formula is y ~ log_umi
## Get Negative Binomial regression parameters per gene
## Using 2000 genes, 5000 cells
## Found 71 outliers - those will be ignored in fitting/regularization step
## Second step: Get residuals using fitted parameters for 18079 genes
## Computing corrected count matrix for 18079 genes
## Calculating gene attributes
## Wall clock passed: Time difference of 16.90913 secs
## Determine variable features
## Regressing out percent.rb, percent.mito, CC.Difference
## Centering and scaling data matrix
## Place corrected count matrix in counts slot
## Set default assay to SCT
5. Perform PCA
Variables_genes <- L6@assays$SCT@var.features
# Exclude genes starting with "HLA-" AND "Xist" AND "TRBV, TRAV"
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
L6 <- RunPCA(L6,
features = Variables_genes_after_exclusion,
do.print = TRUE,
pcs.print = 1:5,
genes.print = 15,
npcs = 50)
## PC_ 1
## Positive: RABGAP1L, MBNL1, LRBA, DENND4A, RYR2, GRAMD1B, ATXN1, SIK3, ELMO1, NCALD
## TIAM2, MSC-AS1, RAD51B, VPS13B, AC010967.1, WWOX, MED12L, DISC1FP1, ATP2C1, ARHGAP15
## NCOA3, TSHZ2, RUNX1, PICALM, NFAT5, MAGI1, BCL2, PVT1, PTPRJ, ST8SIA4
## Negative: IL32, TMSB4X, ACTB, S100A4, PFN1, ARHGDIB, CORO1A, B2M, RAC2, CLIC1
## MYL6, MYL12A, S100A6, S100A11, TUBA4A, HMGB1, SH3BGRL3, STMN1, HMGB2, SLC9A3R1
## CD3E, TUBA1B, IFITM1, GMFG, CALM1, CD74, ALOX5AP, EMP3, H3F3A, IFITM2
## PC_ 2
## Positive: TUBA1B, RRM2, H2AFZ, TUBB, DUT, TYMS, PCLAF, HIST1H4C, HMGB2, PSAT1
## SMC4, DHFR, HIST1H1E, CCNA2, H2AFX, NEIL3, STMN1, MKI67, LMNB1, MCM3
## MTHFD2, TOP2A, PKMYT1, RPS2, NSD2, NUSAP1, TK1, ATAD2, ALYREF, GARS
## Negative: LGALS3, CCL1, RGCC, IL2RG, CD82, DUSP4, IQCG, SERPINE1, IL4I1, TNFSF9
## SRGN, GZMB, LGALS1, SH3BGRL3, LMNA, CFLAR, SQSTM1, TNFAIP8, CCL3, CD52
## CD2, CAVIN3, AC114977.1, CCL4, MFSD10, TRAF1, CD40, UCP3, JUND, IGFLR1
## PC_ 3
## Positive: HSP90AB1, NPM1, SEC11C, HSPD1, HSPE1, NME1, CCT5, RPL22L1, ENO1, CCR7
## PRDX1, TUBA3C, MIR155HG, HNRNPA2B1, PSME2, HMGN5, UBE2S, EBNA1BP2, WARS, NME2
## RPL35A, HMGA1, LDHA, PPBP, CDC20, RRP1B, STAT1, PPP1R14B, IFNGR2, TXN
## Negative: CTSW, S100A4, EVL, CD52, IL32, ALOX5AP, PTPRC, SH3BGRL3, LAPTM5, CD3E
## LCK, ITM2B, TUBA4A, NCR3, NKG7, ENTPD1, MAL, H3F3A, STK17B, IFITM2
## CORO1A, YPEL3, CST7, FXYD5, HCST, TMSB4X, ARHGDIB, SKAP1, CXCR3, MALAT1
## PC_ 4
## Positive: PTTG1, COTL1, PPIB, JPT1, ANXA2, IFITM1, YWHAZ, HSPA8, ADAM19, FUT7
## ARHGDIB, BST2, SLC9A3R1, CD99, GPR15, S100A4, CDC20, ITGA4, RNF213, CCNB1
## TRAF3IP3, PSME2, HNRNPA2B1, IQGAP2, DANCR, CLIC1, MYL12A, LCK, HSP90B1, PIM2
## Negative: HIST1H4C, RRM2, HIST1H1E, PKMYT1, TYMS, HIST1H1C, TUBB, MTHFD2, EIF1, TK1
## DUT, MT2A, PCLAF, STMN1, NUSAP1, PCNA, DDIT3, CENPM, H2AFX, CCR7
## UBE2T, EZH2, TOP2A, CAVIN3, CCL1, KIFC1, NDC80, CDCA5, HIST1H1D, CENPU
## PC_ 5
## Positive: IFIT3, OASL, HERC5, IFIT2, ISG15, ZC3HAV1, PMAIP1, IFIT1, IFIH1, PARP14
## CCL5, PLCG2, ZBTB32, RSAD2, CXCL10, NCF2, SAR1A, PLAAT4, CSAG3, PELI1
## SPAG9, TTC28, B2M, CMPK2, KDM6A, RHEBL1, DDX58, RNF149, RPS6KC1, GBP4
## Negative: RPL6, CCL1, RPL5, RPL23, CAVIN3, GZMB, RPS7, PABPC1, NPM1, ZBED2
## RGCC, CTIF, PTPN7, GJB6, LINC02341, RPL17, UCP3, PTPN6, AL117329.1, SMARCA2
## TNIP3, FABP5, LYST, GNLY, BCAT1, CAMTA2, UCP2, LMNA, EGR2, SRM
# Perform
PCA TEST
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 L6$cell_line is a factor or character vector containing cell line names
data <- as.data.frame(table(L6$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 <- L6[["pca"]]@stdev / sum(L6[["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] 12
# TEST-2
# get significant PCs
stdv <- L6[["pca"]]@stdev
sum.stdv <- sum(L6[["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] 12
# 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()
6. Clustering
L6 <- FindNeighbors(L6,
dims = 1:min.pc,
verbose = FALSE)
# understanding resolution
L6 <- FindClusters(L6,
resolution = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
0.7,0.8, 0.9, 1, 1.1, 1.2))
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.9038
## Number of communities: 2
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.8415
## Number of communities: 4
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.8067
## Number of communities: 5
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7834
## Number of communities: 6
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7665
## Number of communities: 7
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7513
## Number of communities: 9
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7370
## Number of communities: 9
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7229
## Number of communities: 9
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.7102
## Number of communities: 10
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.6978
## Number of communities: 12
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.6885
## Number of communities: 13
## Elapsed time: 0 seconds
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 5148
## Number of edges: 162488
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.6797
## Number of communities: 13
## Elapsed time: 0 seconds
# non-linear dimensionality reduction --------------
L6 <- RunUMAP(L6,
dims = 1:min.pc,
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 Label Clusters function to help label
# individual clusters
DimPlot(L6,group.by = "cell_line",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.1",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.2",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.3",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.4",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.5",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.6",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.7",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.8",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.0.9",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.1",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.1.1",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6,
group.by = "SCT_snn_res.1.2",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
7. Azimuth Annotation
## Warning: The following packages are already installed and will not be
## reinstalled: pbmcref
# The RunAzimuth function can take a Seurat object as input
L6 <- RunAzimuth(L6, reference = "pbmcref")
## Warning: Overwriting miscellanous data for model
## Warning: Adding a dimensional reduction (refUMAP) without the associated assay
## being present
## Warning: Adding a dimensional reduction (refUMAP) without the associated assay
## being present
## detected 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 272 anchors
## Finding integration vectors
## Finding integration vector weights
## 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
## ('-')
##
## Integrating dataset 2 with reference dataset
## Finding integration vectors
## Integrating data
## 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 in RunUMAP.default(object = neighborlist, reduction.model =
## reduction.model, : Number of neighbors between query and reference is not equal
## to the number of neighbors within reference
## 16:22:55 Read 5148 rows
## 16:22:55 Processing block 1 of 1
## 16:22:55 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 20
## 16:22:55 Initializing by weighted average of neighbor coordinates using 1 thread
## 16:22:55 Commencing optimization for 67 epochs, with 102960 positive edges
## 16:22:56 Finished
## Warning: No assay specified, setting assay as RNA by default.
## Projecting reference PCA onto query
## Finding integration vector weights
## Projecting back the query cells into original PCA space
## Finding integration vector weights
## Computing scores:
## Finding neighbors of original query cells
## Finding neighbors of transformed query cells
## Computing query SNN
## Determining bandwidth and computing transition probabilities
## Total elapsed time: 1.79595708847046
DimPlot(L6, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = F)
DimPlot (L6, group.by = "predicted.celltype.l2",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
8. Cell type annotation using ProjectTils
#Load reference atlas and query data
ref <- readRDS(file = "CD4T_human_ref_v1.rds")
#Run Projection algorithm
query.projected <- Run.ProjecTILs(L6, ref = ref)
## | | | 0%[1] "Using assay SCT for query"
## Pre-filtering cells with scGate...
##
## ### Detected a total of 2583 pure 'Target' cells (50.17% of total)
## [1] "2565 out of 5148 ( 50% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
## [1] "Aligning query to reference map for batch-correction..."
## Warning: Layer counts isn't present in the assay object[[assay]]; returning
## NULL
## Preparing PCA embeddings for objects...
## Warning: Number of dimensions changing from 50 to 20
##
## Projecting corrected query onto Reference PCA space
##
## Projecting corrected query onto Reference UMAP space
## Warning: Not all features provided are in this Assay object, removing the
## following feature(s): CXCL13, CD177, CGA, G0S2, IGFL2, TRDC, IL10, IL1RL1,
## ACTG2, KLRB1, DIRAS3, KLRD1, THBS1, NPPC, IL17RB, COCH, CXCR6, MS4A6A, LAYN,
## TYROBP, TUBA3D, IL2, FCER1G, PVALB, MRC1, TASL, TMIGD2, H1-4, METTL7A, ZNF80,
## CLIC3, H2AZ1, ACP5, ANKRD55, GPR25, TNFSF8, ELAPOR1, CCL3L3, POLR1F, PDCD1,
## CXCR5, ADTRP, IL1R1, AHSP, CCR2, GIMAP4, HTRA1, LIMS2, H1-2, H1-0, WARS1, H1-3,
## CAMK1, ASCL2, DTHD1, H2BC11, ADRB2, NELL2, GPX1, STAC, H2AC6, IRAG2, CYP7B1,
## SLC40A1, H1-10, SCML1, CLEC7A, H3C10, FBLN7, TRIM2, FGFBP2, IL22, ECEL1, HES1,
## HSD11B1, CPE, ARC, NLRP3, H4C3, AUTS2, NEBL, HS3ST1, GSTM2
## | |======================================================================| 100%
## Creating slots functional.cluster and functional.cluster.conf in query object
#Plot the predicted composition of the query in terms of reference T cell subtypes
plot.statepred.composition(ref, query.projected, metric = "Percent")
## | | | 0%[1] "Using assay SCT for query"
## Pre-filtering cells with scGate...
##
## ### Detected a total of 2583 pure 'Target' cells (50.17% of total)
## [1] "2565 out of 5148 ( 50% ) non-pure cells removed. Use filter.cells=FALSE to avoid pre-filtering"
## [1] "Aligning query to reference map for batch-correction..."
## Warning: Layer counts isn't present in the assay object[[assay]]; returning
## NULL
## Preparing PCA embeddings for objects...
## Warning: Number of dimensions changing from 50 to 20
##
## Projecting corrected query onto Reference PCA space
##
## Projecting corrected query onto Reference UMAP space
## Warning: Not all features provided are in this Assay object, removing the
## following feature(s): CXCL13, CD177, CGA, G0S2, IGFL2, TRDC, IL10, IL1RL1,
## ACTG2, KLRB1, DIRAS3, KLRD1, THBS1, NPPC, IL17RB, COCH, CXCR6, MS4A6A, LAYN,
## TYROBP, TUBA3D, IL2, FCER1G, PVALB, MRC1, TASL, TMIGD2, H1-4, METTL7A, ZNF80,
## CLIC3, H2AZ1, ACP5, ANKRD55, GPR25, TNFSF8, ELAPOR1, CCL3L3, POLR1F, PDCD1,
## CXCR5, ADTRP, IL1R1, AHSP, CCR2, GIMAP4, HTRA1, LIMS2, H1-2, H1-0, WARS1, H1-3,
## CAMK1, ASCL2, DTHD1, H2BC11, ADRB2, NELL2, GPX1, STAC, H2AC6, IRAG2, CYP7B1,
## SLC40A1, H1-10, SCML1, CLEC7A, H3C10, FBLN7, TRIM2, FGFBP2, IL22, ECEL1, HES1,
## HSD11B1, CPE, ARC, NLRP3, H4C3, AUTS2, NEBL, HS3ST1, GSTM2
## | |======================================================================| 100%
## Creating slots functional.cluster and functional.cluster.conf in query object
UMAPPlot(L6, group.by = "functional.cluster",
reduction = "umap",
label.size = 3,
repel = T,
label = T)
9.Cell type annotation using SingleR
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
## see ?celldex and browseVignettes('celldex') for documentation
## loading from cache
#convert our Seurat object to single cell experiment (SCE)
sce <- as.SingleCellExperiment(DietSeurat(L6))
#using SingleR
monaco.main <- SingleR(test = sce,assay.type.test = 1,ref = monaco.ref,labels = monaco.ref$label.main)
monaco.fine <- SingleR(test = sce,assay.type.test = 1,ref = monaco.ref,labels = monaco.ref$label.fine)
hpca.main <- SingleR(test = sce,assay.type.test = 1,ref = hpca.ref,labels = hpca.ref$label.main)
hpca.fine <- SingleR(test = sce,assay.type.test = 1,ref = hpca.ref,labels = hpca.ref$label.fine)
dice.main <- SingleR(test = sce,assay.type.test = 1,ref = dice.ref,labels = dice.ref$label.main)
dice.fine <- SingleR(test = sce,assay.type.test = 1,ref = dice.ref,labels = dice.ref$label.fine)
bpe.main <- SingleR(test = sce,assay.type.test = 1,ref = bpe.ref,labels = bpe.ref$label.main)
bpe.fine <- SingleR(test = sce,assay.type.test = 1,ref = bpe.ref,labels = bpe.ref$label.fine)
#summary of general cell type annotations
#table(monaco.main$pruned.labels)
#table(hpca.main$pruned.labels)
#table(dice.main$pruned.labels)
#table(bpe.main$pruned.labels)
#The finer cell types annotations are you after, the harder they are to get reliably.
#This is where comparing many databases, as well as using individual markers from literature,
#would all be very valuable.
#table(monaco.fine$pruned.labels)
#table(hpca.fine$pruned.labels)
#table(dice.fine$pruned.labels)
#table(bpe.fine$pruned.labels)
#add the annotations to the Seurat object metadata
L6@meta.data$monaco.main <- monaco.main$pruned.labels
L6@meta.data$monaco.fine <- monaco.fine$pruned.labels
#
L6@meta.data$hpca.main <- hpca.main$pruned.labels
L6@meta.data$hpca.fine <- hpca.fine$pruned.labels
#
L6@meta.data$dice.main <- dice.main$pruned.labels
L6@meta.data$dice.fine <- dice.fine$pruned.labels
#
L6@meta.data$bpe.main <- bpe.main$pruned.labels
L6@meta.data$bpe.fine <- bpe.fine$pruned.labels
# Monaco Annotations
DimPlot(L6, group.by = "monaco.main",
reduction = "umap",
label.size = 3,
repel = T,
label = F)
DimPlot(L6, group.by = "monaco.main",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6, group.by = "monaco.fine",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
# HPCA Annotations
DimPlot(L6, group.by = "hpca.main",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6, group.by = "hpca.fine",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
## Warning: ggrepel: 7 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
# DICE Annotations
DimPlot(L6, group.by = "dice.main",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6, group.by = "dice.fine",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
# BPE Annotations
DimPlot(L6, group.by = "bpe.main",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
DimPlot(L6, group.by = "bpe.fine",
reduction = "umap",
label.size = 3,
repel = T,
label = T, label.box = T)
10. clusTree
## Loading required package: ggraph
##
## Attaching package: 'ggraph'
## The following object is masked from 'package:sp':
##
## geometry