[40a513]: / RNA-seq / AnalysisPipeline / NK.analysis.R

Download this file

38 lines (33 with data), 1.3 kB

 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
26
27
28
29
30
31
32
33
34
35
36
37
#' @description: analysis NK cell population
library(Seurat)
library(harmony)
library(clustree)
library(ggpubr)
library(dplyr)
library(tidyverse)
library(patchwork)
library(ComplexHeatmap)
library(circlize)
library(vegan)
library(openxlsx)
set.seed(101)
library(future)
plan("multiprocess", workers = 5)
options(future.globals.maxSize = 50000 * 1024^2) # set 50G RAM
set.resolutions <- seq(0.1, 0.8, by = 0.1)
setwd(dir = "/data/active_data/lzl/RenalTumor-20200713/DataAnalysis-20210803/scRNA")
data.merge <- readRDS("data.merge.pro.rds")
#### observate the marker expression
NK.markers <- c("CD3D", "CD8A", "KLRD1", "GNLY")
pdf("2.Cluster/AnnotateCellType/NK.marker.pdf")
FeaturePlot(data.merge, features = NK.markers, cols = c("lightgrey", "red"), ncol = 2)
dev.off()
cell.Type <- "NK/NKT cell"
sub.scRNA <- subset(data.merge, subset = cellType_low == cell.Type)
#### plot the sub-NK plot
cell.locations <- as.data.frame(sub.scRNA@reductions$umap@cell.embeddings)
cells <- rownames(cell.locations)[which(cell.locations$UMAP_1 < -4 & cell.locations$UMAP_2 > 0)]
sub.scRNA.NK <- subset(sub.scRNA, cells = cells)
pdf("2.Cluster/AnnotateCellType/NK.marker.pdf")
FeaturePlot(sub.scRNA.NK, features = NK.markers, cols = c("lightgrey", "red"), ncol = 2)
dev.off()