# Code below was used to generate the object : # sobj = readRDS("/shared/projects/2325_ebaii/SingleCell/TD_DATA/DATA_START/CLUSTERING/TD3A.TDCT_Scal2K.IntH20.RDS") # sobj = Seurat::RunPCA(sobj) # sobj = Seurat::RunTSNE(sobj) # sobj = sobj[, 1:200] # saveRDS(sobj, file = "/shared/projects/2325_ebaii/SingleCell/TD_RMDs/Introduction_Rmd/sobj.rds") # Load data sobj = readRDS("/shared/projects/2325_ebaii/SingleCell/TD_RMDs/Introduction_Rmd/sobj.rds") sobj # Libraries of interest library(Seurat) library(ggplot2) # Visualize our favorite gene FeaturePlot(sobj, reduction = "tsne", features = "Ptcra") + theme(aspect.ratio = 1) # Ptcra is more expressed on the right, but how many cells are concerned ? # Which cells are positive for Ptcra ? sobj$is_Ptcra_pos = (FetchData(sobj, "Ptcra")[, 1] > 0) DimPlot(sobj, reduction = "tsne", group.by = "is_Ptcra_pos") + theme(aspect.ratio = 1) # How many cells are positive ? table(sobj$is_Ptcra_pos) # half of cells are Ptcra+