All_samples_Merged <- readRDS("../0-Seurat_RDS_OBJECT_FINAL/All_samples_Merged_with_STCAT.rds")
gc()
##. rename columns orig.ident and Patient_origin
# Rename Patient_origin categories
All_samples_Merged$Patient_origin <- factor(All_samples_Merged$Patient_origin,
levels = c("1", "2", "3", "PBMC", "PBMC_10x"),
labels = c("P1", "P2", "P3", "CD4T_lab", "CD4T_10x")
)
# Rename and reorder orig.ident
All_samples_Merged$orig.ident <- factor(All_samples_Merged$orig.ident,
levels = c("L1", "L2", "L3", "L4", "L5", "L6", "L7", "PBMC", "PBMC10x"),
labels = c("L1", "L2", "L3", "L4", "L5", "L6", "L7", "CD4T_lab", "CD4_10x")
)
table(All_samples_Merged$Patient_origin)
levels(All_samples_Merged$Patient_origin)
table(All_samples_Merged$orig.ident)
levels(All_samples_Merged$orig.ident)
table(All_samples_Merged$cell_line)
levels(All_samples_Merged$cell_line)
saveRDS(All_samples_Merged, file = "../0-Seurat_RDS_OBJECT_FINAL/All_samples_Merged_with_STCAT_and_renamed_FINAL.rds")
##. Load Data into Seurat
All_samples_Merged <- readRDS("../0-Seurat_RDS_OBJECT_FINAL/All_samples_Merged_with_STCAT_and_renamed_FINAL.rds")
gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 8325391 444.7 12521134 668.8 11475082 612.9
Vcells 1231309712 9394.2 1528401147 11660.8 1231313627 9394.2
##. rename columns orig.ident and Patient_origin
table(All_samples_Merged$Patient_origin)
P1 P2 P3 CD4T_lab CD4T_10x
11760 12434 16501 5106 3504
levels(All_samples_Merged$Patient_origin)
[1] "P1" "P2" "P3" "CD4T_lab" "CD4T_10x"
table(All_samples_Merged$orig.ident)
L1 L2 L3 L4 L5 L6 L7 CD4T_lab CD4_10x
5825 5935 6428 6006 6022 5148 5331 5106 3504
levels(All_samples_Merged$orig.ident)
[1] "L1" "L2" "L3" "L4" "L5" "L6" "L7" "CD4T_lab" "CD4_10x"
table(All_samples_Merged$cell_line)
L1 L2 L3 L4 L5 L6 L7 CD4Tcells_lab
5825 5935 6428 6006 6022 5148 5331 5106
CD4Tcells_10x
3504
levels(All_samples_Merged$cell_line)
[1] "L1" "L2" "L3" "L4" "L5" "L6"
[7] "L7" "CD4Tcells_lab" "CD4Tcells_10x"
library(SeuratDisk)
Registered S3 method overwritten by 'SeuratDisk':
method from
as.sparse.H5Group Seurat
# Ensure metadata columns are not factors
i <- sapply(All_samples_Merged@meta.data, is.factor)
All_samples_Merged@meta.data[i] <- lapply(All_samples_Merged@meta.data[i], as.character)
# Set default assay to SCT (where normalized data is stored and all downstream analyses were done)
DefaultAssay(All_samples_Merged) <- "SCT"
# Update to latest Seurat object structure if needed
All_samples_Merged <- UpdateSeuratObject(All_samples_Merged)
Validating object structure
Updating object slots
Ensuring keys are in the proper structure
Updating matrix keys for DimReduc ‘integrated_dr’
Updating matrix keys for DimReduc ‘ref.umap’
Updating matrix keys for DimReduc ‘pca’
Updating matrix keys for DimReduc ‘umap’
Updating matrix keys for DimReduc ‘harmony’
Ensuring keys are in the proper structure
Ensuring feature names don't have underscores or pipes
Updating slots in RNA
Updating slots in ADT
Updating slots in prediction.score.celltype.l1
Updating slots in prediction.score.celltype.l2
Updating slots in prediction.score.celltype.l3
Updating slots in SCT
Updating slots in SCT_nn
Setting default assay of SCT_nn to SCT
Updating slots in SCT_snn
Setting default assay of SCT_snn to SCT
Updating slots in harmony_snn
Cannot find harmony in the object, setting default assay of harmony_snn to SCT
Updating slots in integrated_dr
Updating slots in ref.umap
Setting ref.umap DimReduc to global
Updating slots in pca
Updating slots in umap
Setting umap DimReduc to global
Updating slots in harmony
Setting assay used for SCTransform.RNA to RNA
Setting assay used for RunPCA.SCT to SCT
Setting assay used for FindNeighbors.SCT.pca to SCT
Setting assay used for RunUMAP.SCT.pca to SCT
Setting assay used for Seurat..ProjectDim.SCT.harmony to SCT
Setting assay used for FindNeighbors.SCT.harmony to SCT
No assay information could be found for FindClusters
Warning: Adding a command log without an assay associated with itSetting assay used for RunUMAP.SCT.harmony to SCT
Setting assay used for NormalizeData.ADT to ADT
Validating object structure for Assay5 ‘RNA’
Validating object structure for Assay ‘ADT’
Validating object structure for Assay ‘prediction.score.celltype.l1’
Validating object structure for Assay ‘prediction.score.celltype.l2’
Validating object structure for Assay ‘prediction.score.celltype.l3’
Validating object structure for SCTAssay ‘SCT’
Validating object structure for Graph ‘SCT_nn’
Validating object structure for Graph ‘SCT_snn’
Validating object structure for Graph ‘harmony_snn’
Validating object structure for DimReduc ‘integrated_dr’
Validating object structure for DimReduc ‘ref.umap’
Validating object structure for DimReduc ‘pca’
Validating object structure for DimReduc ‘umap’
Validating object structure for DimReduc ‘harmony’
Object representation is consistent with the most current Seurat version
# Save as h5Seurat file
SaveH5Seurat(All_samples_Merged, filename = "All_samples_Merged_for_PAGA.h5seurat", overwrite = TRUE)
Creating h5Seurat file for version 3.1.5.9900
Warning: The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
Please use the `layer` argument instead.Adding counts for ADT
Adding data for ADT
No variable features found for ADT
No feature-level metadata found for ADT
Adding data for prediction.score.celltype.l1
No variable features found for prediction.score.celltype.l1
No feature-level metadata found for prediction.score.celltype.l1
Adding data for prediction.score.celltype.l2
No variable features found for prediction.score.celltype.l2
No feature-level metadata found for prediction.score.celltype.l2
Adding data for prediction.score.celltype.l3
No variable features found for prediction.score.celltype.l3
No feature-level metadata found for prediction.score.celltype.l3
Adding counts for SCT
Adding data for SCT
Adding scale.data for SCT
Adding variable features for SCT
No feature-level metadata found for SCT
Writing out SCTModel.list for SCT
Adding cell embeddings for integrated_dr
No loadings for integrated_dr
No projected loadings for integrated_dr
No standard deviations for integrated_dr
No JackStraw data for integrated_dr
Adding cell embeddings for ref.umap
No loadings for ref.umap
No projected loadings for ref.umap
No standard deviations for ref.umap
No JackStraw data for ref.umap
Adding cell embeddings for pca
Adding loadings for pca
No projected loadings for pca
Adding standard deviations for pca
No JackStraw data for pca
Adding cell embeddings for umap
No loadings for umap
No projected loadings for umap
No standard deviations for umap
No JackStraw data for umap
Adding cell embeddings for harmony
Adding loadings for harmony
Adding projected loadings for harmony
Adding standard deviations for harmony
No JackStraw data for harmony
# Convert h5Seurat to h5ad (Scanpy-readable)
Convert("All_samples_Merged_for_PAGA.h5seurat", dest = "All_samples_Merged_for_PAGA.h5ad", overwrite = TRUE)
Validating h5Seurat file
Adding scale.data from SCT as X
Adding data from SCT as raw
Transfering meta.data to obs
Adding dimensional reduction information for harmony
Adding feature loadings for harmony
Adding dimensional reduction information for integrated_dr
Adding dimensional reduction information for pca
Adding feature loadings for pca
Adding dimensional reduction information for umap
Adding dimensional reduction information for ref.umap (global)
Adding harmony_snn as neighbors