res <- seq(0.5, 3, 0.5)
ndims <- 30
vars.reg <- c('nCount_RNA')
combined <- NormalizeData(combined)
combined <- FindVariableFeatures(combined, selection.method = 'vst', nfeatures = 2000)
hvg <- VariableFeatures(combined)
var_regex = '^HLA-|^IG[HJKL]|^RNA|^MT|^RP' # remove HLA, immunoglobulin, RNA, MT, and RP genes based on HUGO gene names
hvg = grep(var_regex, hvg, invert=T, value=T)
combined %<>%
ScaleData(vars.to.regress = vars.reg) %>%
RunPCA(features = hvg) %>%
FindNeighbors(dims = 1:ndims) %>%
FindClusters(resolution = res) %>%
RunUMAP(dims = 1:ndims) %>%
RunTSNE(dims = 1:ndims)