OSCR

Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8<sup>+</sup> T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial.

Code ↔ Paper

12 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

9 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 12 matches
  1. [1] § Methods › Pathway enrichment and gene module score analysis ↔ DESeq2_prot_clin.trial_bulk.R, lines 580 to 665 · score 0.99 · ATP6V0D1, ATP6V1B2, ATP6V1G1, FCGR1A, P2RX7, CORO1A · block oscr:b:GYHB3PYHX05Z8-E · Report a mismatch
  2. [2] § Methods › Pathway enrichment and gene module score analysis ↔ V5_prot_clin_trial.R, lines 1514 to 1594 · score 0.99 · ATP6V0D1, ATP6V1B2, ATP6V1G1, FCGR1A, P2RX7, CORO1A · block oscr:b:0A4XTVQXXEW0P-7 · Report a mismatch
  3. [3] § Results › Nasal Protollin reduces the classical monocyte pro-inflammatory/apoptotic signature in AD subjects ↔ figs_protollin_clin_trial_paper.R, lines 61 to 104 · score 0.84 · IFI44L, S100A12, S100A9, IL1B, ISG15, CCL5 · block oscr:b:BT6MD60B3HHFQ-2 · Report a mismatch
  4. [4] § Methods › Single-cell RNA-seq analysis ↔ V5_prot_clin_trial.R, lines 559 to 595 · score 0.83 · FindClusters, FindNeighbors, dimensional reduction, UMAP, Seurat, resolution · block oscr:b:WGTMFFA6XS896-F · Report a mismatch
  5. [5] § Results › Monocytes from Protollin-treated subjects have an increased phagocytic signature ↔ DESeq2_prot_clin.trial_bulk.R, lines 580 to 665 · score 0.77 · FCGR1A, P2RX7, CORO1A, ROS, CD36, CD93 · block oscr:b:GYHB3PYHX05Z8-E · Report a mismatch
  6. [6] § Results › Monocytes from Protollin-treated subjects have an increased phagocytic signature ↔ V5_prot_clin_trial.R, lines 1514 to 1594 · score 0.77 · FCGR1A, P2RX7, CORO1A, ROS, CD36, CD93 · block oscr:b:0A4XTVQXXEW0P-7 · Report a mismatch
  7. [7] § Results › Nasal Protollin downregulates CD8 + T cell cytotoxicity-related genes ↔ figs_protollin_clin_trial_paper.R, lines 271 to 333 · score 0.73 · MAP3K8, effector CD8, CD81, CEBPB, TNFAIP3, CD74 · block oscr:b:P4KRK587WHPKQ-O · Report a mismatch
  8. [8] § Results › Protollin reduces the expression of costimulatory molecules in classical monocytes, which are related to T cell-myeloid interactions ↔ figs_protollin_clin_trial_paper.R, lines 271 to 333 · score 0.68 · CLEC2B, nonclassical monocytes, KLRF1, CD58, CD28, CD55 · block oscr:b:P4KRK587WHPKQ-O · Report a mismatch
  9. [9] § Results › In vitro treatment of AD monocytes with Protollin reverses their pro-inflammatory and apoptotic-related profile ↔ DESeq2_prot_pien.R, lines 538 to 602 · score 0.68 · PPP2CA, FADD, ROCK1, THBD, TNFRSF21, TRIM4 · block oscr:b:M64V93SCMZ6BZ-C · Report a mismatch
  10. [10] § Results › In vitro treatment of AD monocytes with Protollin reverses their pro-inflammatory and apoptotic-related profile ↔ DESeq2_prot_pien.R, lines 372 to 441 · score 0.66 · G0S2, IL1B, HC monocytes, NFKBID, JUNB, endocytic · block oscr:b:QADNMVQHS9THT-A · Report a mismatch
  11. [11] § Methods › Differential gene expression analysis using bulk RNA-seq ↔ DESeq2_prot_pien.R, lines 768 to 854 · score 0.57 · variable genes, DESeq2, outliers, distance, Transcript, clustering · block oscr:b:8AGSD97HRAFNW-2 · Report a mismatch
  12. [12] § Methods › Cell–cell communication inference using single-cell data ↔ V5_prot_clin_trial.R, lines 2351 to 2414 · score 0.56 · ligand receptor, expressed genes, interactions, cell · block oscr:b:GYZJM02PX6AHB-Z · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 2,957 lines · 116 KB · no license · 4 matches

  1. # Calling libraries
  2. # Seurat v5
  3. library(openxlsx)
  4. library(Seurat)
  5. library(harmony)
  6. library(reticulate)
  7. library(BPCells)
  8. library(dplyr)
  9. #library(SeuratData)
  10. library(SeuratWrappers)
  11. library(Azimuth)
  12. library(Matrix)
  13. library(sctransform)
  14. library(car)
  15. library(scater)
  16. library(ggplot2)
  17. library(patchwork)
  18. library(ggrepel)
  19. options(future.globals.maxSize = 3e+09)
  20. options(Seurat.object.assay.version = "v5")
  21. library(BiocParallel)
  22. register(MulticoreParam(14))
  23. #library(CellChat)
  24. #library(SeuratDisk)
  25. ######################### BPCells ###################
  26. ################### First try ----->>> The one that worked
  27. ##################################################### PBMC
  28. # # Set working dir
  29. # setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/PBMC/")
  30. #
  31. # ## Loop through h5 files and output BPCells matrices on-disk
  32. # file.dir <- "../../../cellranger/"
  33. #
  34. # files.set <- c(
  35. # "GEM5",
  36. # "GEM6",
  37. # "GEM7",
  38. # "GEM8",
  39. # "GEM13",
  40. # "GEM14",
  41. # "GEM15",
  42. # "GEM16",
  43. # "GEM20",
  44. # "GEM21",
  45. # "GEM22"
  46. # )
  47. #
  48. # data.list <- c()
  49. #
  50. # for (i in 1:length(files.set)) {
  51. # ## Create binary matrices
  52. # path <- paste0(file.dir, files.set[i], "/outs/filtered_feature_bc_matrix.h5")
  53. # data <- open_matrix_10x_hdf5(path = path)
  54. # write_matrix_dir(mat = data, dir = paste0(files.set[i], "_BP2"))
  55. # ## Load in BP matrices
  56. # mat <- open_matrix_dir(dir = paste0(files.set[i], "_BP2"))
  57. # mat <- Azimuth:::ConvertEnsembleToSymbol(mat = mat, species = "human")
  58. # dataset_name <- files.set[i]
  59. # mat2 <- CreateSeuratObject(counts = mat, min.features = 500) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>%
  60. # subset(subset = nFeature_RNA < 5000 & percent.mt < 20 #& ("FCGR3A" > 0 | "CD14" > 0)
  61. # ) %>% NormalizeData(normalization.method = "LogNormalize") %>%
  62. # FindVariableFeatures(selection.method = "vst")
  63. # mat2$GEM <- dataset_name
  64. # data.list[[i]] <- mat2
  65. # rm(mat)
  66. # rm(mat2)
  67. # rm(data)
  68. # }
  69. # # Name layers
  70. # names(data.list) <- files.set
  71. #
  72. # # Merge layers and create seurat obj during merging
  73. # features <- SelectIntegrationFeatures(object.list = data.list, nfeatures = 2000)
  74. # prot.combined <- merge(data.list[[1]], y = data.list[2:length(data.list)],
  75. # add.cell.ids = files.set, merge.data = T)
  76. # #DefaultAssay(prot.combined) <- "RNA"
  77. # VariableFeatures(prot.combined) <- features
  78. # #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$GEM)
  79. #
  80. # # Normalize and scale merged obj
  81. # prot.combined <- NormalizeData(prot.combined)
  82. # prot.combined <- FindVariableFeatures(prot.combined)
  83. # prot.combined <- ScaleData(prot.combined)
  84. #
  85. # ## Dimensionality reduction and integration
  86. # prot.combined <- RunPCA(prot.combined)
  87. # gc()
  88. # ElbowPlot(prot.combined, ndims = 50)
  89. # prot.combined <- FindNeighbors(prot.combined, dims = 1:30, reduction = "pca")
  90. # prot.combined <- FindClusters(prot.combined, resolution = 0.5, cluster.name = "unintegrated_clusters")
  91. #
  92. # prot.combined <- RunUMAP(prot.combined, dims = 1:30, reduction = "pca", reduction.name = "umap.unintegrated")
  93. # gc()
  94. #
  95. #
  96. #
  97. #
  98. #
  99. #
  100. #
  101. #
  102. #
  103. #
  104. #
  105. # #################################################### Monocytes
  106. # # Set working dir
  107. # setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/Mono/")
  108. #
  109. # ## Loop through h5 files and output BPCells matrices on-disk
  110. # file.dir <- "../../../cellranger/"
  111. #
  112. # files.set <- c(
  113. # "GEM1",
  114. # "GEM2",
  115. # "GEM3",
  116. # "GEM4",
  117. # "GEM9",
  118. # "GEM10",
  119. # "GEM11",
  120. # "GEM12",
  121. # "GEM17",
  122. # "GEM18",
  123. # "GEM19"
  124. # )
  125. #
  126. # data.list <- c()
  127. #
  128. # for (i in 1:length(files.set)) {
  129. # ## Create binary matrices
  130. # path <- paste0(file.dir, files.set[i], "/outs/filtered_feature_bc_matrix.h5")
  131. # data <- open_matrix_10x_hdf5(path = path)
  132. # write_matrix_dir(mat = data, dir = paste0(files.set[i], "_BP2"))
  133. # ## Load in BP matrices
  134. # mat <- open_matrix_dir(dir = paste0(files.set[i], "_BP2"))
  135. # mat <- Azimuth:::ConvertEnsembleToSymbol(mat = mat, species = "human")
  136. # dataset_name <- files.set[i]
  137. # mat2 <- CreateSeuratObject(counts = mat, min.features = 500) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>%
  138. # subset(subset = nFeature_RNA < 5000 & percent.mt < 20 #& ("FCGR3A" > 0 | "CD14" > 0)
  139. # ) %>% NormalizeData(normalization.method = "LogNormalize") %>%
  140. # FindVariableFeatures(selection.method = "vst")
  141. # mat2$GEM <- dataset_name
  142. # data.list[[i]] <- mat2
  143. # rm(mat)
  144. # rm(mat2)
  145. # rm(data)
  146. # }
  147. # # Name layers
  148. # names(data.list) <- files.set
  149. #
  150. # # Merge layers and create seurat obj during merging
  151. # features <- SelectIntegrationFeatures(object.list = data.list, nfeatures = 2000)
  152. # prot.combined <- merge(data.list[[1]], y = data.list[2:length(data.list)],
  153. # add.cell.ids = files.set, merge.data = T)
  154. # #DefaultAssay(prot.combined) <- "RNA"
  155. # VariableFeatures(prot.combined) <- features
  156. # #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$GEM)
  157. #
  158. # # Normalize and scale merged obj
  159. # prot.combined <- NormalizeData(prot.combined)
  160. # prot.combined <- FindVariableFeatures(prot.combined)
  161. # prot.combined <- ScaleData(prot.combined)
  162. #
  163. # ## Dimensionality reduction and integration
  164. # prot.combined <- RunPCA(prot.combined)
  165. # gc()
  166. # ElbowPlot(prot.combined, ndims = 50)
  167. # prot.combined <- FindNeighbors(prot.combined, dims = 1:30, reduction = "pca")
  168. # prot.combined <- FindClusters(prot.combined, resolution = 0.9, cluster.name = "unintegrated_clusters")
  169. #
  170. # prot.combined <- RunUMAP(prot.combined, dims = 1:30, reduction = "pca", reduction.name = "umap.unintegrated")
  171. # gc()
  172. #
  173. # ## add metadata
  174. # meta.data <- read.csv("meta.txt", header = T)
  175. # prot.combined$patient <- prot.combined$GEM
  176. # prot.combined$day <- prot.combined$GEM
  177. # prot.combined$group <- prot.combined$GEM
  178. #
  179. # for (i in 1:length(meta.data$GEM)) {
  180. # prot.combined$patient <- recode(prot.combined$patient, "meta.data$GEM[i] = meta.data$Patient[i]")
  181. # prot.combined$day <- recode(prot.combined$day, "meta.data$GEM[i] = meta.data$Day[i]")
  182. # prot.combined$group <- recode(prot.combined$group, "meta.data$GEM[i] = meta.data$Group[i]")
  183. # }
  184. # prot.combined$patient_day <- paste(prot.combined$patient, prot.combined$day, sep = "_")
  185. #
  186. #
  187. #
  188. # ## Save and Load data
  189. # saveRDS(object = prot.combined, file = "obj_BP2_unintegrated_mono.Rds")
  190. # prot.combined <- readRDS("./obj_BP2_unintegrated_mono.Rds")
  191. #
  192. # DimPlot(prot.combined, reduction = "umap.unintegrated", raster = F,
  193. # ncol = 3,
  194. # label = T,
  195. # #group.by = "GEM"
  196. # split.by = "patient_day"
  197. # )#, combine = F)
  198. #
  199. # FeaturePlot(prot.combined, features = "IL1B",#c("CD14","FCGR3A"),
  200. # pt.size = 0.1,
  201. # #ncol = 3,
  202. # reduction = "umap.unintegrated", raster = F#,
  203. # #split.by = "GEM"
  204. # )
  205. #
  206. #
  207. # ################################################### PBMC and Monocytes Prot treated samples day 0 and 15
  208. # # Set working dir
  209. # setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/prot_treated/")
  210. #
  211. # ## Loop through h5 files and output BPCells matrices on-disk
  212. # file.dir <- "../../../cellranger/"
  213. #
  214. # files.set <- c(
  215. # "GEM1",
  216. # "GEM10",
  217. # "GEM11",
  218. # "GEM12",
  219. # "GEM13",
  220. # "GEM14",
  221. # "GEM15",
  222. # "GEM16",
  223. # "GEM2",
  224. # "GEM3",
  225. # "GEM4",
  226. # "GEM5",
  227. # "GEM6",
  228. # "GEM7",
  229. # "GEM8",
  230. # "GEM9"
  231. # )
  232. #
  233. # data.list <- c()
  234. #
  235. # for (i in 1:length(files.set)) {
  236. # ## Create binary matrices
  237. # # path <- paste0(file.dir, files.set[i], "/outs/filtered_feature_bc_matrix.h5")
  238. # # data <- open_matrix_10x_hdf5(path = path)
  239. # # write_matrix_dir(mat = data, dir = paste0(files.set[i], "_BP2"))
  240. # ## Load in BP matrices
  241. # mat <- open_matrix_dir(dir = paste0(files.set[i], "_BP2"))
  242. # mat <- Azimuth:::ConvertEnsembleToSymbol(mat = mat, species = "human")
  243. # dataset_name <- files.set[i]
  244. # mat2 <- CreateSeuratObject(counts = mat, min.features = 500) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>%
  245. # subset(subset = nFeature_RNA < 5000 & percent.mt < 20 #& ("FCGR3A" > 0 | "CD14" > 0)
  246. # ) %>% NormalizeData(normalization.method = "LogNormalize") %>%
  247. # FindVariableFeatures(selection.method = "vst")
  248. # mat2$GEM <- dataset_name
  249. # data.list[[i]] <- mat2
  250. # rm(mat)
  251. # rm(mat2)
  252. # rm(data)
  253. # }
  254. # # Name layers
  255. # names(data.list) <- files.set
  256. #
  257. # # Merge layers and create seurat obj during merging
  258. # features <- SelectIntegrationFeatures(object.list = data.list, nfeatures = 3000)
  259. # prot.combined <- merge(data.list[[1]], y = data.list[2:length(data.list)],
  260. # add.cell.ids = files.set, merge.data = T)
  261. # #DefaultAssay(prot.combined) <- "RNA"
  262. # VariableFeatures(prot.combined) <- features
  263. # #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$GEM)
  264. #
  265. # prot.combined <- NormalizeData(prot.combined, normalization.method = "LogNormalize")
  266. # prot.combined <- FindVariableFeatures(prot.combined, selection.method = "vst", nfeatures = 3000)
  267. # prot.combined <- ScaleData(prot.combined, vars.to.regress = c("percent.mt","nCount_RNA"), #latent.data = "nFeature_RNA",
  268. # model.use = "linear")#, features = all.genes)
  269. # gc()
  270. #
  271. # ## Dimensionality reduction and integration
  272. # prot.combined <- RunPCA(prot.combined)
  273. # gc()
  274. # ElbowPlot(prot.combined, ndims = 50)
  275. # prot.combined <- FindNeighbors(prot.combined, dims = 1:40, reduction = "pca")
  276. # prot.combined <- FindClusters(prot.combined, resolution = 1.2, cluster.name = "unintegrated_clusters")
  277. #
  278. # prot.combined <- RunUMAP(prot.combined, dims = 1:40, reduction = "pca", reduction.name = "umap.unintegrated")
  279. # gc()
  280. #
  281. # ## add metadata
  282. # meta.data <- read.csv("meta.txt", header = T)
  283. # prot.combined$patient <- prot.combined$GEM
  284. # prot.combined$day <- prot.combined$GEM
  285. # prot.combined$group <- prot.combined$GEM
  286. # prot.combined$dose <- prot.combined$GEM
  287. #
  288. # for (i in 1:length(meta.data$GEM)) {
  289. # prot.combined$patient <- recode(prot.combined$patient, "meta.data$GEM[i] = meta.data$Patient[i]")
  290. # prot.combined$day <- recode(prot.combined$day, "meta.data$GEM[i] = meta.data$Day[i]")
  291. # prot.combined$group <- recode(prot.combined$group, "meta.data$GEM[i] = meta.data$Group[i]")
  292. # prot.combined$dose <- recode(prot.combined$dose, "meta.data$GEM[i] = meta.data$Dose[i]")
  293. # }
  294. # prot.combined$patient_day <- paste(prot.combined$patient, prot.combined$day, sep = "_")
  295. #
  296. # DimPlot(prot.combined, reduction = "umap.unintegrated", raster = F,
  297. # ncol = 1,
  298. # label = T,
  299. # repel = T,
  300. # #group.by = "cohort2"
  301. # #split.by = "cohort2"
  302. # )#, combine = F)
  303. #
  304. # ## Save and Load data
  305. # saveRDS(object = prot.combined, file = "obj_BP2_unintegrated_prot.Rds")
  306. # prot.combined <- readRDS("./obj_BP2_unintegrated_prot.Rds")
  307. #
  308. # DimPlot(prot.combined, reduction = "umap.unintegrated", raster = F,
  309. # #ncol = 3,
  310. # label = T,
  311. # #group.by = "GEM"
  312. # #split.by = "patient_day"
  313. # )#, combine = F)
  314. #
  315. # FeaturePlot(prot.combined, features = "IL1B",#c("CD14","FCGR3A"),
  316. # pt.size = 0.1,
  317. # #ncol = 3,
  318. # reduction = "umap.unintegrated", raster = F#,
  319. # #split.by = "GEM"
  320. # )
  321. #
  322. #
  323. #
  324. #
  325. # ##################################### PBMC and Monocytes -------- Without P11
  326. # # Set working dir
  327. # setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/noP11/")
  328. #
  329. # ## Loop through h5 files and output BPCells matrices on-disk
  330. # file.dir <- "../../../cellranger/"
  331. #
  332. # files.set <- c(
  333. # "GEM1",
  334. # "GEM10",
  335. # "GEM11",
  336. # "GEM12",
  337. # "GEM13",
  338. # "GEM14",
  339. # "GEM15",
  340. # "GEM16",
  341. # # "GEM17",
  342. # "GEM18",
  343. # "GEM19",
  344. # "GEM2",
  345. # # "GEM20",
  346. # "GEM21",
  347. # "GEM22",
  348. # "GEM3",
  349. # "GEM4",
  350. # "GEM5",
  351. # "GEM6",
  352. # "GEM7",
  353. # "GEM8",
  354. # "GEM9"
  355. # )
  356. #
  357. # data.list <- c()
  358. #
  359. # for (i in 1:length(files.set)) {
  360. # ## Create binary matrices
  361. # path <- paste0(file.dir, files.set[i], "/outs/filtered_feature_bc_matrix.h5")
  362. # data <- open_matrix_10x_hdf5(path = path)
  363. # write_matrix_dir(mat = data, dir = paste0(files.set[i], "_BP2"))
  364. # ## Load in BP matrices
  365. # mat <- open_matrix_dir(dir = paste0(files.set[i], "_BP2"))
  366. # mat <- Azimuth:::ConvertEnsembleToSymbol(mat = mat, species = "human")
  367. # dataset_name <- files.set[i]
  368. # mat2 <- CreateSeuratObject(counts = mat, min.features = 500) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>%
  369. # subset(subset = nFeature_RNA < 5000 & percent.mt < 20 #& ("FCGR3A" > 0 | "CD14" > 0)
  370. # ) %>% NormalizeData(normalization.method = "LogNormalize") %>%
  371. # FindVariableFeatures(selection.method = "vst")
  372. # mat2$GEM <- dataset_name
  373. # data.list[[i]] <- mat2
  374. # rm(mat)
  375. # rm(mat2)
  376. # rm(data)
  377. # }
  378. # # Name layers
  379. # names(data.list) <- files.set
  380. #
  381. # # Merge layers and create seurat obj during merging
  382. # features <- SelectIntegrationFeatures(object.list = data.list, nfeatures = 2000)
  383. # prot.combined <- merge(data.list[[1]], y = data.list[2:length(data.list)],
  384. # add.cell.ids = files.set, merge.data = T)
  385. # #DefaultAssay(prot.combined) <- "RNA"
  386. # VariableFeatures(prot.combined) <- features
  387. # #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$GEM)
  388. #
  389. # # Normalize and scale merged obj
  390. # prot.combined <- NormalizeData(prot.combined)
  391. # prot.combined <- FindVariableFeatures(prot.combined)
  392. # prot.combined <- ScaleData(prot.combined)
  393. #
  394. # ## Dimensionality reduction and integration
  395. # prot.combined <- RunPCA(prot.combined)
  396. # gc()
  397. # ElbowPlot(prot.combined, ndims = 50)
  398. # prot.combined <- FindNeighbors(prot.combined, dims = 1:40, reduction = "pca")
  399. # prot.combined <- FindClusters(prot.combined, resolution = 1, cluster.name = "unintegrated_clusters")
  400. #
  401. # prot.combined <- RunUMAP(prot.combined, dims = 1:40, reduction = "pca", reduction.name = "umap.unintegrated")
  402. # gc()
  403. #
  404. # ## add metadata
  405. # meta.data <- read.csv("meta.txt", header = T)
  406. # prot.combined$patient <- prot.combined$GEM
  407. # prot.combined$day <- prot.combined$GEM
  408. # prot.combined$group <- prot.combined$GEM
  409. # prot.combined$dose <- prot.combined$GEM
  410. # prot.combined$treatment <- prot.combined$GEM
  411. #
  412. # for (i in 1:length(meta.data$GEM)) {
  413. # prot.combined$patient <- recode(prot.combined$patient, "meta.data$GEM[i] = meta.data$Patient[i]")
  414. # prot.combined$day <- recode(prot.combined$day, "meta.data$GEM[i] = meta.data$Day[i]")
  415. # prot.combined$group <- recode(prot.combined$group, "meta.data$GEM[i] = meta.data$Group[i]")
  416. # prot.combined$dose <- recode(prot.combined$dose, "meta.data$GEM[i] = meta.data$Dose[i]")
  417. # prot.combined$treatment <- recode(prot.combined$treatment, "meta.data$GEM[i] = meta.data$Treatment[i]")
  418. # }
  419. # prot.combined$patient_day <- paste(prot.combined$patient, prot.combined$day, sep = "_")
  420. #
  421. # ## Save and Load data
  422. # saveRDS(object = prot.combined, file = "obj_BP2_unintegrated_all.Rds")
  423. # prot.combined <- readRDS("./obj_BP2_unintegrated_all.Rds")
  424. #
  425. # DimPlot(prot.combined, reduction = "umap.unintegrated", raster = F,
  426. # #ncol = 3,
  427. # label = T,
  428. # #group.by = "GEM"
  429. # #split.by = "treatment"
  430. # )#, combine = F)
  431. #
  432. # FeaturePlot(prot.combined, features = c("CD14","FCGR3A"),
  433. # pt.size = 0.1,
  434. # #ncol = 3,
  435. # reduction = "umap.unintegrated", raster = F#,
  436. # #split.by = "GEM"
  437. # )
  438. # classic.mono <- c("CD14","CCR2","CCR5","SELL")
  439. # nonclassic.mono <- c("FCGR3A","CX3CR1","HLA-DRA")
  440. # inter.mono <- c("CD14","HLA-DRA","ITGAX","CD68")
  441. # Macrophages <- c("CD14", "FCGR3A", "CD64", "CD68", "CD71", "CCR5")
  442. # bcells <- c("CD19","IGKC","IGHM","CD27", "CD1D", "CD22","CD86", "MS4A1", "IGLC2", "IGLL5", "IGLC7", "IGLC3")
  443. # dc <- c("ITGAX","FCER1A", "CCR7","CD1C","NRP1")
  444. # modc <- c("FCER1A","ZBTB46", "IRF4","CD1C","KLF4","ITGAM","SIRPA","MRC1")
  445. # baso <- c("ITGB2","PECAM1","IL3RA","LAMP1")
  446. # platelets <- c("CD41","CD42b","CD61","CD31","PPBP","PF4","GNG11","SDPR","CLU","CD41","CD110")
  447. # all.markers <- c("CD14","CCR2","CCR5","SELL","FCGR3A","CX3CR1","HLA-DRA","ITGAX","CD68","FCER1A","CD1C")
  448. #
  449. # VlnPlot(prot.combined, features = "CD48"#Macrophages
  450. # , pt.size = 0.1, ncol = 1, raster = F, split.by = "day"#, idents = "6"
  451. # #, combine = F
  452. # )
  453. #
  454. # prot.combined <- JoinLayers(prot.combined)
  455. # prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$patient)
  456. # prot.combined <- RunHarmony(prot.combined, group.by.vars = "patient")
  457. # gc()
  458. #
  459. #
  460. # zk.response0 <- FindMarkers(myeloids, ident.1 = "5_Progressor",
  461. # ident.2 = c("5_RRMS","5_Nonprogressor","5_HC"),#NULL,
  462. # slot = "data",
  463. # assay = "RNA",
  464. # features = NULL,
  465. # logfc.threshold = 0,
  466. # test.use = "wilcox",
  467. # min.pct = 0.5,
  468. # min.diff.pct = -Inf,
  469. # verbose = TRUE,
  470. # only.pos = F,
  471. # max.cells.per.ident = Inf,
  472. # random.seed = 1,
  473. # latent.vars = NULL,
  474. # min.cells.feature = 3,
  475. # min.cells.group = 3,
  476. # pseudocount.use = 1,
  477. # mean.fxn = NULL,
  478. # fc.name = NULL,
  479. # base = 2,
  480. # densify = FALSE,
  481. # recorrect_umi = TRUE
  482. # )
  483. # write.xlsx(as.data.frame(zk.response0), rowNames = T, file="wilcox_5_progx5_RRMS-HC_Nonprog_DEGs.xlsx")
  484. # rm(zk.response0)
  485. #
  486. #
  487. # prot.combined <- JoinLayers(prot.combined)
  488. # Idents(prot.combined) <- "seurat_clusters"
  489. # #Idents(prot.combined) <- "disease.state"
  490. #
  491. # #prot.markers <- FindAllMarkers(prot.combined, assay = "RNA", slot = "data", only.pos = T, min.pct = 0.3) %>% group_by(cluster)
  492. # #write.csv(as.data.frame(prot.markers), file="All_clus_markers.csv")
  493. ################### PBMC and Monocytes
  494. # Set working dir
  495. setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/")
  496. ## Loop through h5 files and output BPCells matrices on-disk
  497. file.dir <- "../../cellranger/"
  498. files.set <- c(
  499. "GEM1",
  500. "GEM10",
  501. "GEM11",
  502. "GEM12",
  503. "GEM13",
  504. "GEM14",
  505. "GEM15",
  506. "GEM16",
  507. "GEM17",
  508. "GEM18",
  509. "GEM19",
  510. "GEM2",
  511. "GEM20",
  512. "GEM21",
  513. "GEM22",
  514. "GEM3",
  515. "GEM4",
  516. "GEM5",
  517. "GEM6",
  518. "GEM7",
  519. "GEM8",
  520. "GEM9"
  521. )
  522. data.list <- c()
  523. for (i in 1:length(files.set)) {
  524. ## Create binary matrices
  525. # path <- paste0(file.dir, files.set[i], "/outs/filtered_feature_bc_matrix.h5")
  526. # data <- open_matrix_10x_hdf5(path = path)
  527. # write_matrix_dir(mat = data, dir = paste0(files.set[i], "_BP2"))
  528. ## Load in BP matrices
  529. mat <- open_matrix_dir(dir = paste0(files.set[i], "_BP2"))
  530. mat <- Azimuth:::ConvertEnsembleToSymbol(mat = mat, species = "human")
  531. dataset_name <- files.set[i]
  532. mat2 <- CreateSeuratObject(counts = mat, min.features = 500) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>%
  533. subset(subset = nFeature_RNA < 5000 & percent.mt < 20 #& ("FCGR3A" > 0 | "CD14" > 0)
  534. ) %>% NormalizeData(normalization.method = "LogNormalize") %>%
  535. FindVariableFeatures(selection.method = "vst")
  536. mat2$GEM <- dataset_name
  537. data.list[[i]] <- mat2
  538. rm(mat)
  539. rm(mat2)
  540. rm(data)
  541. }
  542. # Name layers
  543. names(data.list) <- files.set
  544. # Merge layers and create seurat obj during merging
  545. features <- SelectIntegrationFeatures(object.list = data.list, nfeatures = 2000)
  546. prot.combined <- merge(data.list[[1]], y = data.list[2:length(data.list)],
  547. add.cell.ids = files.set, merge.data = T)
  548. #DefaultAssay(prot.combined) <- "RNA"
  549. VariableFeatures(prot.combined) <- features
  550. #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$GEM)
  551. # # Visualize QC metrics as a violin plot
  552. # VlnPlot(prot.combined, pt.size = 0.0, #group.by = "cohort",
  553. # raster = F,
  554. # features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
  555. # plot1 <- FeatureScatter(prot.combined, feature1 = "nCount_RNA", feature2 = "percent.mt",raster = F, pt.size = 0.05)
  556. # plot2 <- FeatureScatter(prot.combined, feature1 = "nCount_RNA", feature2 = "nFeature_RNA",raster = F, pt.size = 0.05)
  557. # plot1 + plot2
  558. # Normalize and scale merged obj
  559. prot.combined <- NormalizeData(prot.combined)
  560. prot.combined <- FindVariableFeatures(prot.combined)
  561. prot.combined <- ScaleData(prot.combined)
  562. #### Dimensionality reduction and integration
  563. prot.combined <- RunPCA(prot.combined)
  564. gc()
  565. ElbowPlot(prot.combined, ndims = 50)
  566. prot.combined <- FindNeighbors(prot.combined, dims = 1:40, reduction = "pca")
  567. prot.combined <- FindClusters(prot.combined, resolution = 1, cluster.name = "unintegrated_clusters")
  568. prot.combined <- RunUMAP(prot.combined, dims = 1:40, reduction = "pca", reduction.name = "umap.unintegrated")
  569. gc()
  570. # Visualization on UMAP
  571. DimPlot(prot.combined, reduction = "umap.unintegrated", label = TRUE, repel = TRUE,
  572. raster = F
  573. #group.by = 'customclassif',
  574. #split.by = "condition"
  575. )
  576. ## add metadata
  577. meta.data <- read.csv("meta.txt", header = T)
  578. prot.combined$patient <- prot.combined$GEM
  579. prot.combined$day <- prot.combined$GEM
  580. prot.combined$group <- prot.combined$GEM
  581. prot.combined$dose <- prot.combined$GEM
  582. prot.combined$treatment <- prot.combined$GEM
  583. prot.combined$condition <- prot.combined$GEM
  584. for (i in 1:length(meta.data$GEM)) {
  585. prot.combined$condition <- recode(prot.combined$condition, "meta.data$GEM[i] = meta.data$condition[i]")
  586. # prot.combined$patient <- recode(prot.combined$patient, "meta.data$GEM[i] = meta.data$Patient[i]")
  587. # prot.combined$day <- recode(prot.combined$day, "meta.data$GEM[i] = meta.data$Day[i]")
  588. # prot.combined$group <- recode(prot.combined$group, "meta.data$GEM[i] = meta.data$Group[i]")
  589. # prot.combined$dose <- recode(prot.combined$dose, "meta.data$GEM[i] = meta.data$Dose[i]")
  590. # prot.combined$treatment <- recode(prot.combined$treatment, "meta.data$GEM[i] = meta.data$Treatment[i]")
  591. }
  592. prot.combined$patient_day <- paste(prot.combined$patient, prot.combined$day, sep = "_")
  593. ## Save and Load data
  594. saveRDS(object = prot.combined, file = "obj_BP2_unintegrated_all.Rds")
  595. prot.combined <- readRDS("./obj_BP2_unintegrated_all.Rds")
  596. prot.combined <- JoinLayers(prot.combined)
  597. #prot.combined[["RNA"]] <- split(prot.combined[["RNA"]], f = prot.combined$patient)
  598. prot.combined[["RNA"]]$scale.data <- NULL
  599. prot.combined[["RNA3"]] <- as(object = prot.combined[["RNA"]], Class = "Assay")
  600. ############## Identify cell types with scType
  601. # lapply(c("dplyr","Seurat","HGNChelper"), library, character.only = T)
  602. # source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/gene_sets_prepare.R");
  603. # source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/sctype_score_.R")
  604. #
  605. # # DB file
  606. # db_ = "https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/ScTypeDB_full.xlsx";
  607. # tissue = "Immune system" # e.g. Immune system,Pancreas,Liver,Eye,Kidney,Brain,Lung,Adrenal,Heart,Intestine,Muscle,Placenta,Spleen,Stomach,Thymus
  608. #
  609. # # prepare gene sets
  610. # gs_list = gene_sets_prepare(db_, tissue)
  611. #
  612. # # get cell-type by cell matrix
  613. # es.max = sctype_score(scRNAseqData = prot.combined[["SCT"]]@scale.data, scaled = TRUE, gs = gs_list$gs_positive, gs2 = gs_list$gs_negative)
  614. # # NOTE: scRNAseqData parameter should correspond to your input scRNA-seq matrix.
  615. # # In case Seurat is used, it is either pbmc[["RNA"]]@scale.data (default), pbmc[["SCT"]]@scale.data, in case sctransform is used for normalization,
  616. # # or pbmc[["integrated"]]@scale.data, in case a joint analysis of multiple single-cell datasets is performed.
  617. #
  618. # # merge by cluster
  619. # cL_results = do.call("rbind", lapply(unique([email hidden]$seurat_clusters), function(cl){
  620. # es.max.cl = sort(rowSums(es.max[ ,rownames([email hidden][[email hidden]$seurat_clusters==cl, ])]), decreasing = !0)
  621. # head(data.frame(cluster = cl, type = names(es.max.cl), scores = es.max.cl, ncells = sum([email hidden]$seurat_clusters==cl)), 10)
  622. # }))
  623. # sctype_scores = cL_results %>% group_by(cluster) %>% top_n(n = 1, wt = scores)
  624. #
  625. # # set low-confident (low ScType score) clusters to "unknown"
  626. # sctype_scores$type[as.numeric(as.character(sctype_scores$scores)) < sctype_scores$ncells/4] = "Unknown"
  627. # print(sctype_scores[,1:3])
  628. #
  629. # [email hidden]$customclassif = ""
  630. # for(j in unique(sctype_scores$cluster)){
  631. # cl_type = sctype_scores[sctype_scores$cluster==j,];
  632. # [email hidden]$customclassif[[email hidden]$seurat_clusters == j] = as.character(cl_type$type[1])
  633. # }
  634. #
  635. # # Visualization on UMAP
  636. # DimPlot(prot.combined, reduction = "umap", label = TRUE, repel = TRUE,
  637. # #group.by = 'customclassif',
  638. # #split.by = "condition"
  639. # )
  640. ######### celltypes records
  641. library(ggstatsplot)
  642. Idents(prot.combined) <- "celltypes"
  643. myeloids <- subset(prot.combined, idents = c("0","4","8","13","27","11","7","22","12"))
  644. #prot.combined2$disease.patient <- paste(prot.combined2$disease.state, prot.combined2$GEM, sep = "_")
  645. num.cells <- as.data.frame(table(prot.combined$patient_day, prot.combined$patient_day))
  646. num.cells <- num.cells[num.cells[,3] !=0,][,2:3]
  647. num.cells.celltype <- as.data.frame.matrix(table(prot.combined$patient_day, prot.combined$seurat_clusters))
  648. freq.num.cells.celltype <- num.cells.celltype / num.cells[,2]*100
  649. tfreq.num.cells.celltype <- t(freq.num.cells.celltype)
  650. tfreq.num.cells.celltype <- tfreq.num.cells.celltype[rowSums(tfreq.num.cells.celltype) > 0,]
  651. write.csv(as.data.frame(freq.num.cells.celltype), file="freq.num.clusters_harmony_no.unk_patient_day.csv")
  652. #tfreq.num.cells.celltype <- read.csv("treated_tfreq.num.cells.cluster_myeloids_patient_day.csv", header = T, row.names = 1)
  653. f_freqs <- read.csv("freq.num.cell.types_harmony_no.unk_patient_day.csv",header = T)
  654. cell.types <- c(
  655. Classical.monocytes,
  656. Intermediate.monocytes,
  657. Nonclassical.monocytes,
  658. iNK,
  659. mNK,
  660. Treg,
  661. Memory.B.cells,
  662. Naive.B.cells,
  663. mature.B.cells,
  664. Plasma.B.cells,
  665. Platelets,
  666. mo.DC,
  667. pDC,
  668. CD8..NKT.like,
  669. Memory.T.CD8.,
  670. Naive.CD8..T.cells,
  671. Effector.CD8..T.cells,
  672. Memory.T.CD4.,
  673. Naive.CD4..T.cells
  674. )
  675. plt <- ggbetweenstats(data = f_freqs,
  676. x = dose,
  677. y = Classical.monocytes,
  678. p.adjust.method = "none",
  679. type = "np"
  680. )
  681. ggsave(filename = "Classical.monocytes_np_freq_dose.pdf",
  682. plot = plt,
  683. width = 4,
  684. height = 6,
  685. device = "pdf")
  686. plt <- ggbetweenstats(data = f_freqs,
  687. x = dose,
  688. y = CD8..NKT.like,
  689. p.adjust.method = "none",
  690. type = "p"
  691. )
  692. ggsave(filename = "CD8..NKT.like_p_freq_dose.pdf",
  693. plot = plt,
  694. width = 4,
  695. height = 6,
  696. device = "pdf")
  697. library(RColorBrewer)
  698. paletteLength <- 40
  699. colors <- colorRampPalette( rev(brewer.pal(11, "Set3")))(paletteLength)
  700. n <- 60
  701. qual_col_pals = brewer.pal.info[brewer.pal.info$category == 'qual',]
  702. col_vector = unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals)))
  703. #pie(rep(1,n), col=sample(col_vector, n))
  704. barplot(tfreq.num.cells.celltype, col = sample(col_vector, n), legend.text = rownames(tfreq.num.cells.celltype),
  705. xlim = c(0,12), main = "Cell types distribution")
  706. ## Dimensionality reduction of integrated data
  707. prot.combined <- RunHarmony(prot.combined, group.by.vars = "patient")
  708. gc()
  709. ElbowPlot(prot.combined, ndims = 50, reduction = "harmony")
  710. prot.combined <- RunUMAP(prot.combined, dims = 1:40, reduction = "harmony", reduction.name = "umap")
  711. prot.combined <- FindNeighbors(prot.combined, reduction = "harmony", dims = 1:40)
  712. prot.combined <- FindClusters(prot.combined, resolution = 2, cluster.name = "harmony_clusters")
  713. gc()
  714. no.placebo <- subset(prot.combined, subset = patient %in% c("P12","P13","P15","P16"))
  715. DimPlot(prot.combined, reduction = "umap", raster = F,
  716. #ncol = 4,
  717. label = T,
  718. group.by = "seurat_clusters"
  719. #split.by = "patient_day"
  720. )#, combine = F)
  721. ## Save and Load data
  722. saveRDS(object = prot.combined, file = "obj_BP2_harmony_no.unk.Rds")
  723. prot.combined <- readRDS("./obj_BP2_harmony_no.unk.Rds")
  724. FeaturePlot(prot.combined, features = c("IL1B","PTGS2","CXCL8","NLRP3"),#Macrophages,#c("CD8A","CD8B"),
  725. pt.size = 0.1,
  726. ncol = 2,
  727. reduction = "umap",
  728. raster = F,
  729. #min.cutoff = 1,
  730. #max.cutoff = 1.5,
  731. #split.by = "treatment"
  732. )
  733. FeaturePlot(prot.combined, features = c("G0S2","EGR1","SDC2","GPR183"),#Macrophages,#c("CD8A","CD8B"),
  734. pt.size = 0.1,
  735. ncol = 2,
  736. reduction = "umap",
  737. raster = F,
  738. #min.cutoff = 1,
  739. #max.cutoff = 1.5,
  740. #split.by = "treatment"
  741. )
  742. FeaturePlot(prot.combined, features = c("RGCC","PPIF","MIR222HG","TRIB1"),#Macrophages,#c("CD8A","CD8B"),
  743. pt.size = 0.1,
  744. ncol = 2,
  745. reduction = "umap",
  746. raster = F,
  747. #min.cutoff = 1,
  748. #max.cutoff = 1.5,
  749. #split.by = "treatment"
  750. )
  751. VlnPlot(prot.combined, features = "NCAM1"
  752. , pt.size = 0.1, ncol = 1, raster = F#, split.by = "day"#, idents = "6"
  753. #, combine = F
  754. )
  755. FeaturePlot(prot.combined, features = "IL16",
  756. pt.size = 0.1,
  757. #ncol = 2,
  758. reduction = "umap", raster = F,
  759. #split.by = "treatment"
  760. )
  761. cell.types <- c(
  762. "Classical monocytes",
  763. "Intermediate monocytes",
  764. "Nonclassical monocytes",
  765. "iNK",
  766. "mNK",
  767. "Treg",
  768. "Memory B cells",
  769. "Naive B cells",
  770. #"mature B cells",
  771. "Plasma B cells",
  772. "Platelets",
  773. "mo-DC",
  774. "pDC",
  775. "CD8+ NKT-like",
  776. "Memory T CD8+",
  777. "Naive CD8+ T cells",
  778. "Effector CD8+ T cells",
  779. "Memory T CD4+",
  780. "Naive CD4+ T cells"
  781. )
  782. p2 <- VlnPlot(prot.combined, features = "TOX",#c("JUN","STAT1", "CCL3", "CCL3L1"),#c("IRF1","IFNG","IFNGR1","IFNGR2"),#c("CD8A","CD4","CD19"),#c("TMEM176A","TMEM176B"),
  783. #split.by = "disease",
  784. group.by = "patient_day",
  785. #group.by = "celltypes",
  786. pt.size = 0.05,
  787. raster = F,
  788. #ncol = 5,
  789. #slot = "counts",
  790. #add.noise = F,
  791. #log = T,
  792. #sort = "increasing",
  793. idents = #c("5"),
  794. "Effector CD8+ T cells"
  795. #"8", # moDC
  796. #"2", # Nonclassical
  797. #"6", # Intermediate
  798. # c("0","1","3","4","5","9","17"),#,"13","25"), # Classical monocytes
  799. ) + scale_y_continuous(limits = c(0.000, 4)) +
  800. stat_summary(fun = mean, geom = "point",size = 35, colour = "black", shape = 95)
  801. p2$layers[[2]]$aes_params$alpha <- 0.3
  802. p2
  803. DotPlot(prot.combined, features = c("TOX","CD8A","IRF1","GZMA","GZMH","GZMM","IFNG","TNF","PRF1","BATF","TYROBP","GSDMB"
  804. #"FOXP3","ITGA4","HLA-DRA","TIGIT"
  805. #"ITGAE","CCR2","TNFRSF18","GPA33","ICOS","CD4","IL2RA","SELL"
  806. #"CCR7","RELA","CXCR3","ENTPD1","IL10","PDCD1","RELB","PECAM1","IL2RB"
  807. ),
  808. #cols = c("blue","blue"),#"blue"),#"red"),#"green","yellow","gray","pink","brown","lightblue"),
  809. col.max = 20, #idents = #c("Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C"),#"Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"),
  810. #c("Classical Mono_1","Classical Mono_2","Intermediate Mono","Nonclassical Mono",
  811. #"pDC_AD","pDC_C",
  812. #"mo-DC_AD","mo-DC_C"
  813. #),
  814. idents = "Effector CD8+ T cells",
  815. # c("NK_4_C","NK_4_AD","NK_8_C","NK_8_AD","NK_21_C","NK_21_AD",
  816. # "CD8+ NKT-like_C", "CD8+ NKT-like_AD"#, "NK_AD", "NK_C"
  817. # c("NK_AD","NK_C","Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C","Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"
  818. #c("62","67","49","47"),
  819. dot.scale = 10,
  820. cluster.idents = F, group.by = "dose",
  821. #scale = F,
  822. #split.by = "disease"
  823. ) + RotatedAxis()
  824. classic.mono <- c("CD14","CCR2","CCR5","SELL")
  825. nonclassic.mono <- c("FCGR3A","CX3CR1","HLA-DRA")
  826. inter.mono <- c("CD14","HLA-DRA","ITGAX","CD68")
  827. Macrophages <- c("CD14", "FCGR3A", "CD64", "CD68", "CD71", "CCR5")
  828. bcells <- c("CD19","IGKC","IGHM","CD27", "CD1D", "CD22","CD86", "MS4A1", "IGLC2", "IGLL5", "IGLC7", "IGLC3")
  829. dc <- c("ITGAX","FCER1A", "CCR7","CD1C","NRP1")
  830. modc <- c("FCER1A","ZBTB46", "IRF4","CD1C","KLF4","ITGAM","SIRPA","MRC1")
  831. baso <- c("ITGB2","PECAM1","IL3RA","LAMP1")
  832. platelets <- c("CD41","CD42b","CD61","CD31","PPBP","PF4","GNG11","SDPR","CLU","CD41","CD110")
  833. all.markers <- c("CD14","CCR2","CCR5","SELL","FCGR3A","CX3CR1","HLA-DRA","ITGAX","CD68","FCER1A","CD1C")
  834. DotPlot(prot.combined, features = c("TNF","IFNG","KLRC1","NCAM1","IL2RB","IL7R","TBX21","EOMES",# iNKs
  835. "PRF1","GZMM","GZMH","GZMA","GZMB", # mNKs
  836. "LILRB1", "KLRB1", "ZBTB16", # NKT-like
  837. "CD3E","CD3D", # T cells
  838. "CD8A","CD8B","PTPRC","CCL5", #"CD244", # T cells
  839. "CD4","S100A4","SELL", # T cells
  840. "FOXP3", "IL2RA", # Tregs
  841. "TRDC","TRDV1","TRDV2","TRGC2","TRGV9","TRGC1", #gamma delta
  842. "ITGB2","PECAM1","IL3RA","LAMP1",#, #baso
  843. "CD64", "CD68", "CD71", "CCR5","ITGAM", # Macrophages
  844. "CD1C","ITGAX","FCER1A","CCR7","NRP1", # DC
  845. "CD14","FCGR3A", #monocytes
  846. "PF4", # platelets
  847. "CD19","IGKC","IGHM","CD27","CD1D","CD22","CD86","MS4A1","IGLC2","IGLC3","IGHD","CD79A","CD79B","AIM2", "BANK1","RALGPS2","TNFRSF13B", # B cells
  848. "IL4R","CXCR4", "BTG1", "TCL1A", "YBX3", # Naive B cells
  849. "COCH", "SSPN", "TEX9", "TNFRSF13C", "LINC01781", # Memory B cells
  850. "LINC01857", # mature B cells
  851. "IGHA2","MZB1","TNFRSF17","DERL3","TXNDC5","POU2AF1","CPNE5","NT5DC2"# plasma cells
  852. # "IL10"#,"IL1B","IL15","IL7" #"IL2","IL3","IL6","IL4","IL22"
  853. ),
  854. #cols = c("blue","blue"),#"blue"),#"red"),#"green","yellow","gray","pink","brown","lightblue"),
  855. col.max = 20, #idents = #c("Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C"),#"Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"),
  856. #c("Classical Mono_1","Classical Mono_2","Intermediate Mono","Nonclassical Mono",
  857. #"pDC_AD","pDC_C",
  858. #"mo-DC_AD","mo-DC_C"
  859. #),
  860. #idents = "CD8+ TEM",
  861. # c("NK_4_C","NK_4_AD","NK_8_C","NK_8_AD","NK_21_C","NK_21_AD",
  862. # "CD8+ NKT-like_C", "CD8+ NKT-like_AD"#, "NK_AD", "NK_C"
  863. # c("NK_AD","NK_C","Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C","Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"
  864. #c("62","67","49","47"),
  865. dot.scale = 10,
  866. cluster.idents = T, #group.by = "patho",
  867. #scale = F,
  868. #split.by = "disease"
  869. ) + RotatedAxis()
  870. prot.combined <- RenameIdents(prot.combined,
  871. `0` = "Classical monocytes_1",
  872. `1` = "Naive CD4+ T cells_1",
  873. `2` = "Memory T CD4+_1",
  874. `3` = "mNK_1",
  875. `4` = "Classical monocytes_2",
  876. `5` = "Effector CD8+ T cells_1",
  877. `6` = "Naive CD8+ T cells_1",
  878. `7` = "Nonclassical monocytes_1",
  879. `8` = "Classical monocytes_3",
  880. `9` = "Naive B cells_1",
  881. `10` = "Naive B cells_2",
  882. `11` = "Intermediate monocytes_1",
  883. `12` = "mo-DC_1",
  884. `13` = "Classical monocytes_4",
  885. #`14` = "Unk_1",
  886. `15` = "Memory B cells_1",
  887. `16` = "CD8+ NKT-like_1",
  888. `17` = "Memory T CD8+_1",
  889. `18` = "Treg_1",
  890. #`19` = "Unk_2",
  891. `20` = "iNKT_1",
  892. `21` = "pDC_1",
  893. `22` = "Nonclassical monocytes_3",
  894. `23` = "Naive B cells_3",
  895. `24` = "Naive B cells_4",
  896. `25` = "mature B cells_1",
  897. #`26` = "Unk_3",
  898. `27` = "Classical monocytes_5",
  899. `28` = "iNK_1",
  900. `29` = "Memory T CD4+_1",
  901. `30` = "CD8+ NKT-like_1",
  902. `31` = "mNK_2",
  903. `32` = "mNK_3",
  904. #`33` = "Unk_4",
  905. `34` = "Nonclassical monocytes_2",
  906. #`35` = "Unk_5",
  907. `36` = "Platelets_1",
  908. `37` = "Naive B cells_5",
  909. `38` = "mature B cells_2",
  910. `39` = "mo-DC_2",
  911. `40` = "Plasma B cells_1",
  912. `41` = "pDC_2"
  913. )
  914. ## Final annotations
  915. Idents(prot.combined) <- "seurat_clusters"
  916. prot.combined$cluster.dose <- paste(Idents(prot.combined), prot.combined$dose, sep = "_")
  917. Idents(prot.combined) <- "cluster.dose"
  918. prot.combined$clus.celltypes <- Idents(prot.combined)
  919. prot.combined$celltypes <- sub("(.*)_.*", "\\1", Idents(prot.combined))
  920. Idents(prot.combined) <- "celltypes"
  921. prot.combined$celltypes.dose <- paste(prot.combined$celltypes, prot.combined$dose, sep = "_")
  922. Idents(prot.combined) <- "celltypes.dose"
  923. prot.combined$celltypes.patientday <- paste(prot.combined$celltypes, prot.combined$patient_day, sep = "_")
  924. Idents(prot.combined) <- "celltypes.patientday"
  925. prot.combined$celltypes.condition <- paste(prot.combined$celltypes, prot.combined$treatment, sep = "_")
  926. Idents(prot.combined) <- "celltypes.condition"
  927. prot.combined$cluster.patientday <- paste(prot.combined$new_clusters, prot.combined$patient_day, sep = "_")
  928. Idents(prot.combined) <- "cluster.patientday"
  929. ## Save and Load data
  930. saveRDS(object = prot.combined, file = "obj_BP2_integrated_annotated_all.Rds")
  931. prot.combined <- readRDS("./obj_BP2_integrated_annotated_all.Rds")
  932. prot.combined2 <- subset(prot.combined, idents = c("Classical monocytes",
  933. "CD4+ Tcm",
  934. "CD4+ Naive",
  935. "mNK",
  936. "CD8+ Teff",
  937. "CD8+ Tcm",
  938. "Nonclassical monocytes",
  939. "B cells",
  940. "Intermediate monocytes",
  941. "mo-DC",
  942. "CD8+ NKT-like",
  943. "CD8+ Naive",
  944. "Treg",
  945. "pDC",
  946. "iNK",
  947. "Platelets"))
  948. saveRDS(object = prot.combined2, file = "obj_BP2_integrated_annotated_no.unk.Rds")
  949. prot.combined <- readRDS("./obj_BP2_integrated_annotated_no.unk.Rds")
  950. DimPlot(prot.combined, reduction = "umap", raster = F,
  951. #ncol = 4,
  952. repel = T,
  953. label = T,
  954. group.by = "celltypes",
  955. #split.by = "dose"
  956. )#, combine = F)
  957. ###### Diff exp analysis
  958. cell.types <- c("0","4","7","8","11","12","13","20")
  959. cell.types <- c(
  960. "Classical monocytes",
  961. "Intermediate monocytes",
  962. "Nonclassical monocytes",
  963. #"iNK",
  964. #"iNKT",
  965. "mNK",
  966. "Treg",
  967. "Memory B cells",
  968. "Naive B cells",
  969. #"mature B cells",
  970. #"Plasma B cells",
  971. #"Platelets",
  972. "mo-DC",
  973. "pDC",
  974. "CD8+ NKT-like",
  975. "Memory T CD8+",
  976. "Naive CD8+ T cells",
  977. "Effector CD8+ T cells",
  978. "Memory T CD4+",
  979. "Naive CD4+ T cells"
  980. )
  981. up.list <- c()
  982. down.list <- c()
  983. for (i in 1:length(cell.types)) {
  984. zk.response0 <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_P12_D15")
  985. ,ident.2 =
  986. paste0(cell.types[i], "_P12_D0")
  987. , slot = "data",
  988. assay = "RNA",
  989. features = NULL,
  990. logfc.threshold = 0,
  991. test.use = "wilcox",
  992. min.pct = 0.0,
  993. min.diff.pct = -Inf,
  994. verbose = TRUE,
  995. only.pos = FALSE,
  996. max.cells.per.ident = Inf,
  997. random.seed = 1,
  998. latent.vars = NULL,
  999. min.cells.feature = 3,
  1000. min.cells.group = 3,
  1001. pseudocount.use = 1,
  1002. mean.fxn = NULL,
  1003. fc.name = NULL,
  1004. base = 2,
  1005. densify = FALSE,
  1006. recorrect_umi = TRUE
  1007. )
  1008. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1009. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_P12_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1010. zk.response1 <- zk.response0[zk.response0$avg_log2FC > 0,]
  1011. zk.response2 <- zk.response0[zk.response0$avg_log2FC < 0,]
  1012. zk.response0b <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_P13_D15")
  1013. ,ident.2 =
  1014. paste0(cell.types[i], "_P13_D0")
  1015. , slot = "data",
  1016. assay = "RNA",
  1017. features = NULL,
  1018. logfc.threshold = 0,
  1019. test.use = "wilcox",
  1020. min.pct = 0.1,
  1021. min.diff.pct = -Inf,
  1022. verbose = TRUE,
  1023. only.pos = FALSE,
  1024. max.cells.per.ident = Inf,
  1025. random.seed = 1,
  1026. latent.vars = NULL,
  1027. min.cells.feature = 3,
  1028. min.cells.group = 3,
  1029. pseudocount.use = 1,
  1030. mean.fxn = NULL,
  1031. fc.name = NULL,
  1032. base = 2,
  1033. densify = FALSE,
  1034. recorrect_umi = TRUE
  1035. )
  1036. zk.response0b <- zk.response0b[zk.response0b$p_val_adj < 0.1,]
  1037. write.xlsx(as.data.frame(zk.response0b), rowNames = T,file=paste0("wilcox_P13_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1038. zk.response1b <- zk.response0b[zk.response0b$avg_log2FC > 0,]
  1039. zk.response2b <- zk.response0b[zk.response0b$avg_log2FC < 0,]
  1040. zk.response0c <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_P15_D15")
  1041. ,ident.2 =
  1042. paste0(cell.types[i], "_P15_D0")
  1043. , slot = "data",
  1044. assay = "RNA",
  1045. features = NULL,
  1046. logfc.threshold = 0,
  1047. test.use = "wilcox",
  1048. min.pct = 0.1,
  1049. min.diff.pct = -Inf,
  1050. verbose = TRUE,
  1051. only.pos = FALSE,
  1052. max.cells.per.ident = Inf,
  1053. random.seed = 1,
  1054. latent.vars = NULL,
  1055. min.cells.feature = 3,
  1056. min.cells.group = 3,
  1057. pseudocount.use = 1,
  1058. mean.fxn = NULL,
  1059. fc.name = NULL,
  1060. base = 2,
  1061. densify = FALSE,
  1062. recorrect_umi = TRUE
  1063. )
  1064. zk.response0c <- zk.response0c[zk.response0c$p_val_adj < 0.1,]
  1065. write.xlsx(as.data.frame(zk.response0c), rowNames = T,file=paste0("wilcox_P15_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1066. zk.response1c <- zk.response0c[zk.response0c$avg_log2FC > 0,]
  1067. zk.response2c <- zk.response0c[zk.response0c$avg_log2FC < 0,]
  1068. zk.response0d <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_P16_D15")
  1069. ,ident.2 =
  1070. paste0(cell.types[i], "_P16_D0")
  1071. , slot = "data",
  1072. assay = "RNA",
  1073. features = NULL,
  1074. logfc.threshold = 0,
  1075. test.use = "wilcox",
  1076. min.pct = 0.1,
  1077. min.diff.pct = -Inf,
  1078. verbose = TRUE,
  1079. only.pos = FALSE,
  1080. max.cells.per.ident = Inf,
  1081. random.seed = 1,
  1082. latent.vars = NULL,
  1083. min.cells.feature = 3,
  1084. min.cells.group = 3,
  1085. pseudocount.use = 1,
  1086. mean.fxn = NULL,
  1087. fc.name = NULL,
  1088. base = 2,
  1089. densify = FALSE,
  1090. recorrect_umi = TRUE
  1091. )
  1092. zk.response0d <- zk.response0d[zk.response0d$p_val_adj < 0.1,]
  1093. write.xlsx(as.data.frame(zk.response0d), rowNames = T,file=paste0("wilcox_P16_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1094. zk.response1d <- zk.response0d[zk.response0d$avg_log2FC > 0,]
  1095. zk.response2d <- zk.response0d[zk.response0d$avg_log2FC < 0,]
  1096. zk.response1f <- zk.response1[!(row.names(zk.response1) %in% row.names(zk.response1b)),]
  1097. zk.response1f <- zk.response1f[!(row.names(zk.response1f) %in% row.names(zk.response1c)),]
  1098. zk.response1f <- zk.response1f[!(row.names(zk.response1f) %in% row.names(zk.response1d)),]
  1099. write.xlsx(as.data.frame(zk.response1f), rowNames = T,file=paste0("wilcox_exclusive_up_P12_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1100. zk.response2f <- zk.response2[!(row.names(zk.response2) %in% row.names(zk.response2b)),]
  1101. zk.response2f <- zk.response2f[!(row.names(zk.response2f) %in% row.names(zk.response2c)),]
  1102. zk.response2f <- zk.response2f[!(row.names(zk.response2f) %in% row.names(zk.response2d)),]
  1103. write.xlsx(as.data.frame(zk.response2f), rowNames = T,file=paste0("wilcox_exclusive_down_P12_D15xD0_",cell.types[i],"_DEGs.xlsx"))
  1104. zk.response1e <- zk.response1b[row.names(zk.response1b) %in% row.names(zk.response1),]
  1105. zk.response1e <- zk.response1e[row.names(zk.response1e) %in% row.names(zk.response1c),]
  1106. zk.response1e <- zk.response1e[row.names(zk.response1e) %in% row.names(zk.response1d),]
  1107. zk.response2e <- zk.response2b[row.names(zk.response2b) %in% row.names(zk.response2),]
  1108. zk.response2e <- zk.response2e[row.names(zk.response2e) %in% row.names(zk.response2c),]
  1109. zk.response2e <- zk.response2e[row.names(zk.response2e) %in% row.names(zk.response2d),]
  1110. up.list[[i]] <- row.names(zk.response1e)
  1111. down.list[[i]] <- row.names(zk.response2e)
  1112. rm(zk.response1)
  1113. rm(zk.response2)
  1114. rm(zk.response0)
  1115. rm(zk.response1b)
  1116. rm(zk.response2b)
  1117. rm(zk.response0b)
  1118. rm(zk.response1c)
  1119. rm(zk.response2c)
  1120. rm(zk.response0c)
  1121. rm(zk.response1d)
  1122. rm(zk.response2d)
  1123. rm(zk.response0d)
  1124. rm(zk.response1e)
  1125. rm(zk.response2e)
  1126. rm(zk.response1f)
  1127. rm(zk.response2f)
  1128. gc()
  1129. }
  1130. names(up.list) <- cell.types
  1131. up.list2 <- t(plyr::ldply(up.list, rbind))
  1132. colnames(up.list2) <- up.list2[1,]
  1133. up.list2 <- up.list2[-c(1), ]
  1134. write.xlsx(as.data.frame(up.list2), rowNames = F,file="wilcox_celltype_D15xD0_converged_up_per.patient_DEGs.xlsx")
  1135. names(down.list) <- cell.types
  1136. down.list2 <- t(plyr::ldply(down.list, rbind))
  1137. colnames(down.list2) <- down.list2[1,]
  1138. down.list2 <- down.list2[-c(1), ]
  1139. write.xlsx(as.data.frame(down.list2), rowNames = F,file="wilcox_celltype_D15xD0_converged_down_per.patient_DEGs.xlsx")
  1140. cell.types <- c(
  1141. "Classical monocytes",
  1142. "Nonclassical monocytes",
  1143. "Intermediate monocytes",
  1144. "mo-DC"
  1145. )
  1146. for (i in 1:length(cell.types)) {
  1147. zk.response0 <- FindMarkers(prot.combined, ident.1 = c(paste0(cell.types[i], "_P12_D15"),
  1148. paste0(cell.types[i], "_P13_D15")
  1149. )
  1150. ,ident.2 =
  1151. c(#paste0(cell.types[i], "_P04_D15"),
  1152. #paste0(cell.types[i], "_P07_D15"),
  1153. paste0(cell.types[i], "_P12_D0"),
  1154. paste0(cell.types[i], "_P13_D0"),
  1155. #paste0(cell.types[i], "_P15_D0"),
  1156. #paste0(cell.types[i], "_P16_D0")
  1157. )
  1158. , slot = "data",
  1159. assay = "RNA",
  1160. features = NULL,
  1161. logfc.threshold = 0,
  1162. test.use = "wilcox",
  1163. min.pct = 0.1,
  1164. min.diff.pct = -Inf,
  1165. verbose = TRUE,
  1166. only.pos = FALSE,
  1167. max.cells.per.ident = Inf,
  1168. random.seed = 1,
  1169. latent.vars = NULL,
  1170. min.cells.feature = 3,
  1171. min.cells.group = 3,
  1172. pseudocount.use = 1,
  1173. mean.fxn = NULL,
  1174. fc.name = NULL,
  1175. base = 2,
  1176. densify = FALSE,
  1177. recorrect_umi = TRUE
  1178. )
  1179. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1180. zk.response0 <- zk.response0[order(zk.response0$avg_log2FC),]
  1181. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_P13_D15xD0_", cell.types[i], "_DEGs.xlsx"))
  1182. rm(zk.response0)
  1183. }
  1184. #### Wilcox
  1185. cell.types <- c(
  1186. "Classical monocytes",
  1187. "Intermediate monocytes",
  1188. "Nonclassical monocytes",
  1189. #"iNK",
  1190. #"iNKT",
  1191. "mNK",
  1192. "Treg",
  1193. "Memory B cells",
  1194. "Naive B cells",
  1195. #"mature B cells",
  1196. #"Plasma B cells",
  1197. "Platelets",
  1198. "mo-DC",
  1199. "pDC",
  1200. "CD8+ NKT-like",
  1201. "Memory T CD8+",
  1202. "Naive CD8+ T cells",
  1203. "Effector CD8+ T cells",
  1204. "Memory T CD4+",
  1205. "Naive CD4+ T cells"
  1206. )
  1207. Idents(prot.combined) <- "celltypes.patientday"
  1208. up.list <- c()
  1209. down.list <- c()
  1210. for (i in 1:length(cell.types)) {
  1211. zk.response0 <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_1")
  1212. ,ident.2 =
  1213. paste0(cell.types[i], "_0")
  1214. , slot = "data",
  1215. assay = "RNA",
  1216. features = NULL,
  1217. logfc.threshold = 0,
  1218. test.use = "wilcox",
  1219. min.pct = 0.1,
  1220. min.diff.pct = -Inf,
  1221. verbose = TRUE,
  1222. only.pos = FALSE,
  1223. max.cells.per.ident = Inf,
  1224. random.seed = 1,
  1225. latent.vars = NULL,
  1226. min.cells.feature = 3,
  1227. min.cells.group = 3,
  1228. pseudocount.use = 1,
  1229. mean.fxn = NULL,
  1230. fc.name = NULL,
  1231. base = 2,
  1232. densify = FALSE,
  1233. recorrect_umi = TRUE
  1234. )
  1235. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1236. zk.response1 <- zk.response0[zk.response0$avg_log2FC > 0.1,]
  1237. zk.response2 <- zk.response0[zk.response0$avg_log2FC < -0.1,]
  1238. zk.response0b <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_1.5")
  1239. ,ident.2 =
  1240. paste0(cell.types[i], "_0")
  1241. , slot = "data",
  1242. assay = "RNA",
  1243. features = NULL,
  1244. logfc.threshold = 0,
  1245. test.use = "wilcox",
  1246. min.pct = 0.1,
  1247. min.diff.pct = -Inf,
  1248. verbose = TRUE,
  1249. only.pos = FALSE,
  1250. max.cells.per.ident = Inf,
  1251. random.seed = 1,
  1252. latent.vars = NULL,
  1253. min.cells.feature = 3,
  1254. min.cells.group = 3,
  1255. pseudocount.use = 1,
  1256. mean.fxn = NULL,
  1257. fc.name = NULL,
  1258. base = 2,
  1259. densify = FALSE,
  1260. recorrect_umi = TRUE
  1261. )
  1262. zk.response0b <- zk.response0b[zk.response0b$p_val_adj < 0.1,]
  1263. zk.response1b <- zk.response0b[zk.response0b$avg_log2FC > 0.1,]
  1264. zk.response2b <- zk.response0b[zk.response0b$avg_log2FC < -0.1,]
  1265. zk.response1c <- zk.response1b[row.names(zk.response1b) %in% row.names(zk.response1),]
  1266. zk.response2c <- zk.response2b[row.names(zk.response2b) %in% row.names(zk.response2),]
  1267. up.list[[i]] <- row.names(zk.response1c)
  1268. down.list[[i]] <- row.names(zk.response2c)
  1269. rm(zk.response1)
  1270. rm(zk.response2)
  1271. rm(zk.response0)
  1272. rm(zk.response1b)
  1273. rm(zk.response2b)
  1274. rm(zk.response0b)
  1275. rm(zk.response1c)
  1276. rm(zk.response2c)
  1277. }
  1278. names(up.list) <- cell.types
  1279. up.list2 <- t(plyr::ldply(up.list, rbind))
  1280. colnames(up.list2) <- up.list2[1,]
  1281. up.list2 <- up.list2[-c(1), ]
  1282. write.xlsx(as.data.frame(up.list2), rowNames = F,file="wilcox_1.5-1x0_converged_up_FC0.1_DEGs.xlsx")
  1283. names(down.list) <- cell.types
  1284. down.list2 <- t(plyr::ldply(down.list, rbind))
  1285. colnames(down.list2) <- down.list2[1,]
  1286. down.list2 <- down.list2[-c(1), ]
  1287. write.xlsx(as.data.frame(down.list2), rowNames = F,file="wilcox_1.5-1x0_converged_down_FC0.1_DEGs.xlsx")
  1288. DotPlot(no.placebo, features = up.list[[15]],
  1289. col.max = 20,
  1290. idents = "Naive CD8+ T cells",
  1291. dot.scale = 10,
  1292. cluster.idents = F,
  1293. group.by = "patient_day",
  1294. #group.by = "dose",
  1295. #scale = F,
  1296. #split.by = "disease"
  1297. ) + RotatedAxis()
  1298. for (i in 1:length(cell.types)) {
  1299. zk.response0 <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_1.5")
  1300. ,ident.2 =
  1301. paste0(cell.types[i], "_0")
  1302. , slot = "data",
  1303. assay = "RNA",
  1304. features = NULL,
  1305. logfc.threshold = 0,
  1306. test.use = "wilcox",
  1307. min.pct = 0.1,
  1308. min.diff.pct = -Inf,
  1309. verbose = TRUE,
  1310. only.pos = FALSE,
  1311. max.cells.per.ident = Inf,
  1312. random.seed = 1,
  1313. latent.vars = NULL,
  1314. min.cells.feature = 3,
  1315. min.cells.group = 3,
  1316. pseudocount.use = 1,
  1317. mean.fxn = NULL,
  1318. fc.name = NULL,
  1319. base = 2,
  1320. densify = FALSE,
  1321. recorrect_umi = TRUE
  1322. )
  1323. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1324. zk.response1 <- zk.response0[zk.response0$avg_log2FC > 0,]
  1325. zk.response2 <- zk.response0[zk.response0$avg_log2FC < 0,]
  1326. write.xlsx(as.data.frame(zk.response1), rowNames = T,file=paste0("wilcox_1.5x0_", cell.types[i], "_up_DEGs.xlsx"))
  1327. rm(zk.response1)
  1328. write.xlsx(as.data.frame(zk.response2), rowNames = T,file=paste0("wilcox_1.5x0_", cell.types[i], "_down_DEGs.xlsx"))
  1329. rm(zk.response2)
  1330. rm(zk.response0)
  1331. }
  1332. for (i in 1:length(cell.types)) {
  1333. zk.response0 <- FindMarkers(prot.combined, ident.1 = paste0(cell.types[i], "_1")
  1334. ,ident.2 =
  1335. paste0(cell.types[i], "_0")
  1336. , slot = "data",
  1337. assay = "RNA",
  1338. features = NULL,
  1339. logfc.threshold = 0,
  1340. test.use = "wilcox",
  1341. min.pct = 0.1,
  1342. min.diff.pct = -Inf,
  1343. verbose = TRUE,
  1344. only.pos = FALSE,
  1345. max.cells.per.ident = Inf,
  1346. random.seed = 1,
  1347. latent.vars = NULL,
  1348. min.cells.feature = 3,
  1349. min.cells.group = 3,
  1350. pseudocount.use = 1,
  1351. mean.fxn = NULL,
  1352. fc.name = NULL,
  1353. base = 2,
  1354. densify = FALSE,
  1355. recorrect_umi = TRUE
  1356. )
  1357. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1358. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_Prot_1x0ug_", cell.types[i], "_DEGs.xlsx"))
  1359. rm(zk.response0)
  1360. }
  1361. numbers <- 0:41
  1362. numbers <- as.character(numbers)
  1363. numbers <- numbers[-grep("29",numbers)]
  1364. for (i in 1:length(numbers)) {
  1365. zk.response0 <- FindMarkers(prot.combined, ident.1 = paste0(numbers[i], "_1")
  1366. ,ident.2 =
  1367. paste0(numbers[i], "_0")
  1368. , slot = "data",
  1369. assay = "RNA",
  1370. features = NULL,
  1371. logfc.threshold = 0,
  1372. test.use = "wilcox",
  1373. min.pct = 0.1,
  1374. min.diff.pct = -Inf,
  1375. verbose = TRUE,
  1376. only.pos = FALSE,
  1377. max.cells.per.ident = Inf,
  1378. random.seed = 1,
  1379. latent.vars = NULL,
  1380. min.cells.feature = 3,
  1381. min.cells.group = 3,
  1382. pseudocount.use = 1,
  1383. mean.fxn = NULL,
  1384. fc.name = NULL,
  1385. base = 2,
  1386. densify = FALSE,
  1387. recorrect_umi = TRUE
  1388. )
  1389. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1390. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_Prot_1x0ug_clus_", numbers[i], "_DEGs.xlsx"))
  1391. rm(zk.response0)
  1392. }
  1393. FeaturePlot(prot.combined, features = "PDCD1",#c("CD14","FCGR3A"),
  1394. pt.size = 0.1,
  1395. #ncol = 3,
  1396. reduction = "umap", raster = F,
  1397. split.by = "dose"
  1398. )
  1399. VlnPlot(prot.combined, features = "TLR2",
  1400. #c("IL18","IL1B","NFKB1","NLRP3","PTGS2","CXCL8"),
  1401. pt.size = 0.1,
  1402. ncol = 1,
  1403. raster = F,
  1404. idents = "Classical monocytes",#c("0","8","4","13","11","7","12"),#c("CD4+ Tcm","CD4+ Naive"),
  1405. #c("mNK","CD8+ NKT-like","CD8+ Teff","CD4+ Tcm","Treg"),#c("0","5"),
  1406. split.by = "patient_day",
  1407. #group.by = "celltypes"
  1408. #, combine = F
  1409. )
  1410. phagocytosis <- c(
  1411. "FCN1",
  1412. "CD93",
  1413. "LYST",
  1414. "NCF2",
  1415. "ANXA1",
  1416. "BIN2",
  1417. "ITGAM",
  1418. "RAB14",
  1419. "CLCN3",
  1420. "PRKCD",
  1421. "CORO1A",
  1422. "RAC1",
  1423. "SPG11",
  1424. "ITGAL",
  1425. "P2RX7",
  1426. "IRF8",
  1427. "PECAM1",
  1428. "TICAM2",
  1429. "FCGR1A",
  1430. "VAV1",
  1431. "CCR2",
  1432. "NCF4",
  1433. "CD14",
  1434. "ICAM3",
  1435. "PAK1",
  1436. "ARHGAP25",
  1437. "ITGB2",
  1438. "HCK",
  1439. "CD36",
  1440. "ABL1"
  1441. )
  1442. phagocytosis2 <- c(
  1443. "CD93",
  1444. "LYST",
  1445. "CLCN3",
  1446. "CORO1A",
  1447. "ITGAL",
  1448. "P2RX7",
  1449. "PECAM1",
  1450. "FCGR1A",
  1451. "CCR2",
  1452. "ITGB2",
  1453. "HCK",
  1454. "CD36"
  1455. )
  1456. endocytosis <- c(
  1457. "CD93",
  1458. "LYST",
  1459. "SNX17",
  1460. "CLCN3",
  1461. "CORO1A",
  1462. "ITGAL",
  1463. "P2RX7",
  1464. "PECAM1",
  1465. "LIPA",
  1466. "DNAJC13",
  1467. "FCGR1A",
  1468. "CAP1",
  1469. "CCR2",
  1470. "HEATR5A",
  1471. "ASGR1",
  1472. "PYCARD",
  1473. "DENND1A",
  1474. "FKBP15",
  1475. "ITGB2",
  1476. "HCK",
  1477. "LRRK2",
  1478. "CD36",
  1479. "RIN2",
  1480. "SNX10"
  1481. )
  1482. ROS <- c(
  1483. "HVCN1",
  1484. "ATP6V0D1",
  1485. "NCF1",
  1486. "ATP6V1G1",
  1487. "ATP6V1B2",
  1488. "CYBB",
  1489. "RAC2"
  1490. )
  1491. classic.mono.up <- read.delim("classic.mono.up.txt",header = T)
  1492. classic.mono.up1 <- t(classic.mono.up[,1])
  1493. classic.mono.up1.5 <- t(classic.mono.up[,2])
  1494. classic.mono.up.f <- classic.mono.up1[classic.mono.up1 %in% classic.mono.up1.5]
  1495. write.xlsx(as.data.frame(classic.mono.up.f), rowNames = T, file="classic.mono_up_1n1.5x0_DEGs.xlsx")
  1496. toll.likes <- c("TLR1","TLR2","TLR4","TLR6","TLR7","TLR8","TLR9")
  1497. targets <- c("GZMA","GZMM","GZMH","PRF1","TYROBP","IRF1","GSDMB","IFNG","CD8A","BATF","TOX")
  1498. irf8_targets <- t(read.delim("irf8_targets.txt", header = F))
  1499. foxos <- c("FOXO1","FOXO3","FOXO4","FOXO6","FOXP2")
  1500. list2 <- t(read.delim("down-biomarkers_CD8.txt", header = F))
  1501. list1 <- t(read.csv("IL11.csv", header = F))
  1502. DotPlot(prot.combined, features = list2,#"IRF8",
  1503. #cols = c("blue", "red","yellow","green","pink"),
  1504. #col.max = 20,
  1505. #col.min = 5,
  1506. #dot.min = 3,
  1507. dot.scale = 12,
  1508. #cluster.idents = T,
  1509. group.by = "patient_day",
  1510. #scale = F,
  1511. #split.by = "disease.state",
  1512. idents = c(#"CD8+ Teff",
  1513. "CD8+ Tcm")#"mo-DC",
  1514. # c("mo-DC_HC","mo-DC_RRMS","mo-DC_Progressor","mo-DC_Nonprogressor"
  1515. # ,"mo-DC_PPMS"
  1516. # )
  1517. # c("Classical monocytes_P12_D15", "Classical monocytes_P12_D0", "Classical monocytes_P04_D15",
  1518. # "Classical monocytes_P07_D15", "Classical monocytes_P13_D0", "Classical monocytes_P15_D15",
  1519. # "Classical monocytes_P15_D0", "Classical monocytes_P16_D15", "Classical monocytes_P11_D15",
  1520. # "Classical monocytes_P16_D0", "Classical monocytes_P13_D15"
  1521. #"iNK_0", "iNK_1", "iNK_1.5"#,
  1522. #"mNK_0", "mNK_1", "mNK_1.5"#,
  1523. #"CD8+ NKT-like_0", "CD8+ NKT-like_1", "CD8+ NKT-like_1.5"#,
  1524. #"CD8+ Teff_0", "CD8+ Teff_1", "CD8+ Teff_1.5",
  1525. #"Classical monocytes_0", "Classical monocytes_1", "Classical monocytes_1.5"
  1526. #"Nonclassical monocytes_0", "Nonclassical monocytes_1", "Nonclassical monocytes_1.5"
  1527. #"CD4+ Tcm_0", "CD4+ Tcm_1", "CD4+ Tcm_1.5"#,
  1528. #"Treg_0", "Treg_1", "Treg_1.5"
  1529. #)
  1530. ) + RotatedAxis()
  1531. all.markers <- c("CD14","CCR2",#"CCR5",
  1532. "SELL","FCGR3A","CX3CR1","HLA-DRA",#"ITGAX","CD68",
  1533. "FCER1A","CD1C")
  1534. DoHeatmap(prot.combined, features = targets, group.by = "",
  1535. slot = "data",
  1536. cells = 1:30000,
  1537. size = 5,
  1538. disp.max = 2.5,
  1539. disp.min = 0
  1540. )
  1541. cell.types <- c(
  1542. "Classical monocytes",
  1543. "CD4+ Tcm",
  1544. "CD4+ Naive",
  1545. "mNK",
  1546. "CD8+ Teff",
  1547. "CD8+ Tcm",
  1548. "Nonclassical monocytes",
  1549. "B cells",
  1550. "Intermediate monocytes",
  1551. "mo-DC",
  1552. "CD8+ NKT-like",
  1553. "CD8+ Naive",
  1554. "Treg",
  1555. "pDC",
  1556. "iNK",
  1557. "Platelets"
  1558. )
  1559. ############################### OLeg P01
  1560. prot.combined <- readRDS("./obj_BP2_harmony_no.unk.Rds")
  1561. Idents(prot.combined) <- "patient"
  1562. prot.combined2 <- subset(prot.combined, idents = c("P12","P13","P15","P16"))
  1563. prot.combined3 <- subset(prot.combined, idents = c("P12","P13","P11","P04","P07","P16"))
  1564. prot.combined4 <- subset(prot.combined, idents = c("P12","P13"))
  1565. prot.combined5 <- subset(prot.combined, idents = c("P15","P16"))
  1566. prot.combined6 <- subset(prot.combined, idents = c("P12","P13","P11","P04","P07"))
  1567. prot.combined7 <- subset(prot.combined, idents = c("P15","P16","P04","P07"))
  1568. Idents(prot.combined) <- "celltypes"
  1569. Idents(prot.combined2) <- "celltypes"
  1570. Idents(prot.combined3) <- "celltypes"
  1571. Idents(prot.combined4) <- "celltypes"
  1572. Idents(prot.combined5) <- "celltypes"
  1573. Idents(prot.combined6) <- "celltypes"
  1574. Idents(prot.combined7) <- "celltypes"
  1575. # genes1 <- c("HLA-DRB1","CD33","GRN","MS4A6A","FCER1G","BIN1","TREM1","CCR2","PSEN1","HAVCR2","MAPT","APP","GSAP","BACE1" #,"RORA","APOE","TREM2"
  1576. # ) # classic Monocytes
  1577. genes1 <- c("HLA-DQB1","HLA-DRA","HLA-DRB1","HLA-DRB5","HLA-DQA1","FCER1G","CTSH","CTSB","CD33","GRN","ABI3","BCKDK","LILRB2","SPI1","PILRA","ZYX",
  1578. "NDUFS2","RIN3","MS4A6A","SCARB2","CCR2",
  1579. "PSEN1","APP","HAVCR2","SCIMP","SNX1","PICALM"
  1580. #"BIN1","TREM1","MAPT","GSAP","BACE1"#,"RORA","APOE","TREM2"
  1581. )
  1582. # genes1 <- c("HLA-DRA","HLA-DRB1","HLA-DRB5","FCER1G","CTSB","CD33","GRN","ABI3","BCKDK","LILRB2","SPI1","PILRA","ZYX",
  1583. # "NDUFS2","RIN3","MS4A6A","SCARB2","CCR2",
  1584. # "PSEN1","APP","HAVCR2","SCIMP","SNX1","PICALM"
  1585. # #"BIN1","TREM1","MAPT","GSAP","BACE1"#,"RORA","APOE","TREM2""HLA-DQB1","HLA-DQA1","CTSH",
  1586. # )
  1587. DotPlot(prot.combined6, features = rev(genes1),
  1588. cols = "RdBu",
  1589. col.max = 20,
  1590. dot.scale = 15,
  1591. # cluster.idents = T,
  1592. #scale = F,
  1593. group.by = "dose",
  1594. idents = "Classical monocytes",
  1595. ) + RotatedAxis() + coord_flip()
  1596. DotPlot(prot.combined6, features = phagocytosis,
  1597. #cols = "RdBu",
  1598. col.max = 20,
  1599. dot.scale = 15,
  1600. # cluster.idents = T,
  1601. # scale = F,
  1602. group.by = "dose",
  1603. idents = "Classical monocytes",
  1604. ) + RotatedAxis() + coord_flip()
  1605. my_comparisons <- c("P04_D15","P07_D15","P12_D0","P13_D0","P15_D0","P16_D0",
  1606. "P11_D15","P12_D15","P13_D15","P15_D15","P16_D15")
  1607. prot.combined$patient_day <- factor(prot.combined$patient_day, levels = my_comparisons)
  1608. DotPlot(prot.combined2, features = rev(genes1),
  1609. cols = "RdBu",
  1610. col.max = 20,
  1611. dot.scale = 15,
  1612. # cluster.idents = T,
  1613. #scale = F,
  1614. group.by = "patient_day",
  1615. idents = "Classical monocytes",
  1616. ) + RotatedAxis() + coord_flip()
  1617. my_comparisons <- c("P12_D0","P13_D0","P15_D0","P16_D0",
  1618. "P12_D15","P13_D15","P15_D15","P16_D15")
  1619. my_comparisons <- c("P12_D0","P12_D15","P13_D0","P13_D15",
  1620. "P15_D0","P15_D15","P16_D0","P16_D15")
  1621. prot.combined2$patient_day <- factor(prot.combined2$patient_day, levels = my_comparisons)
  1622. DotPlot(prot.combined2, features = rev(genes1),
  1623. cols = "RdBu",
  1624. col.max = 20,
  1625. dot.scale = 15,
  1626. # cluster.idents = T,
  1627. #scale = F,
  1628. group.by = "patient_day",
  1629. idents = "Intermediate monocytes",
  1630. ) + RotatedAxis() + coord_flip()
  1631. genes1 <- c("HLA-DRB1","CD33","GRN","MS4A6A","FCER1G","BIN1","TREM1","CCR2","PSEN1","HAVCR2","MAPT","APP","GSAP","BACE1" #,"RORA","APOE","TREM2"
  1632. ) # classic Monocytes
  1633. FeaturePlot(prot.combined2, features = #c("HLA-DRB1","CD33","GRN"),
  1634. c(#"MS4A6A","FCER1G","BIN1"#,
  1635. #"TREM1","CCR2","PSEN1"#,
  1636. #"HAVCR2","MAPT","APP"#,
  1637. #"GSAP","BACE1" #,"RORA","APOE","TREM2"
  1638. "CCR2"
  1639. ),
  1640. pt.size = 2,
  1641. #min.cutoff = 0.75,
  1642. #max.cutoff = 1,
  1643. #ncol = 3,
  1644. reduction = "umap", raster = T,
  1645. split.by = "dose"
  1646. ) + theme(legend.position = "right")
  1647. # zk.combined2$celltypes.condition <- paste(zk.combined2$celltypes, zk.combined2$condition, sep = "_")
  1648. # zk.combined2$celltypes.condition <- paste(zk.combined2$customclassif, zk.combined2$condition, sep = "_")
  1649. # T.cells2$cluster.condition <- paste(Idents(T.cells2), T.cells2$condition, sep = "_")
  1650. # zk.combined2$cluster.condition <- paste(zk.combined2$seurat_clusters, zk.combined2$condition, sep = "_")
  1651. # Idents(T.cells2) <- "seurat_clusters"
  1652. # Idents(zk.combined2) <- "celltypes"
  1653. # Idents(zk.combined2) <- "celltypes.condition"
  1654. # Idents(T.cells2) <- "cluster.condition"
  1655. # Idents(zk.combined2) <- "customclassif"
  1656. # zk.response0 <- FindMarkers(prot.combined, ident.1 = "26",
  1657. # ident.2 = NULL,#c("5_RRMS","5_Nonprogressor","5_HC"),#NULL,
  1658. # slot = "data",
  1659. # assay = "RNA",
  1660. # features = NULL,
  1661. # logfc.threshold = 0.4,
  1662. # test.use = "wilcox",
  1663. # min.pct = 0.5,
  1664. # min.diff.pct = -Inf,
  1665. # verbose = TRUE,
  1666. # only.pos = F,
  1667. # max.cells.per.ident = Inf,
  1668. # random.seed = 1,
  1669. # latent.vars = NULL,
  1670. # min.cells.feature = 3,
  1671. # min.cells.group = 3,
  1672. # pseudocount.use = 1,
  1673. # mean.fxn = NULL,
  1674. # fc.name = NULL,
  1675. # base = 2,
  1676. # densify = FALSE,
  1677. # recorrect_umi = TRUE
  1678. # )
  1679. # write.xlsx(as.data.frame(zk.response0), rowNames = T, file="wilcox_clus.26_markers_DEGs.xlsx")
  1680. # rm(zk.response0)
  1681. #
  1682. # prot.combined <- JoinLayers(prot.combined)
  1683. #
  1684. # prot.markers <- FindAllMarkers(prot.combined, assay = "RNA", slot = "data", only.pos = T,
  1685. # min.pct = 0.5,
  1686. # logfc.threshold = 0.4,
  1687. # ) %>% group_by(cluster)
  1688. # write.xlsx(as.data.frame(prot.markers), rowNames = T, file="All_clus_pos_markers.xlsx")
  1689. #
  1690. #
  1691. #
  1692. # mo.dcs <- subset(prot.combined, idents = "7")
  1693. # monocytes <- subset(prot.combined, idents = c("0","1","2","3","4","5","6"#,"12","22"
  1694. # )
  1695. # #subset = (CD14 > 2 | FCGR3A > 2)
  1696. # )
  1697. # monocytes <- RenameIdents(monocytes, `0` = "Classical", `1` = "Classical", `2` = "Classical",
  1698. # `3` = "Nonclassical", `4` = "Intermediate", `5` = "Classical",
  1699. # `6` = "Classical")
  1700. #
  1701. #
  1702. # myeloids <- subset(prot.combined, idents = c("0","1","2","3","4","5","6","7"))
  1703. # myeloids <- RenameIdents(myeloids, `0` = "Classical", `1` = "Classical", `2` = "Classical",
  1704. # `3` = "Nonclassical", `4` = "Intermediate", `5` = "Classical",
  1705. # `6` = "Classical", `7` = "mo-DC")
  1706. # myeloids$celltypes <- Idents(myeloids)
  1707. #
  1708. # ## Save and Load data
  1709. # saveRDS(object = monocytes, file = "mono_BP2_unintegrated_annotated.Rds")
  1710. # saveRDS(object = mo.dcs, file = "mo-dc_BP2_unintegrated_annotated.Rds")
  1711. # saveRDS(object = myeloids, file = "myeloid_BP2_unintegrated_annotated.Rds")
  1712. #
  1713. # monocytes <- readRDS("./mono_BP2_unintegrated_annotated.Rds")
  1714. # mo.dcs <- readRDS("./mo-dc_BP2_unintegrated_annotated.Rds")
  1715. # myeloids <- readRDS("./myeloid_BP2_unintegrated_annotated.Rds")
  1716. #
  1717. # myeloids2 <- subset(myeloids, subset = disease.state %in% c("RRMS","HC","Nonprogressor","Progressor"))
  1718. #
  1719. # DimPlot(myeloids, reduction = "umap.unintegrated", raster = F,
  1720. # #ncol = 2,
  1721. # label = T,
  1722. # #group.by = "celltypes"
  1723. # split.by = "disease.state"
  1724. # )#, combine = F)
  1725. #
  1726. # FeaturePlot(myeloids, features = "IL15",#c("CD14","FCGR3A"),
  1727. # pt.size = 0.1,
  1728. # #ncol = 2,
  1729. # reduction = "umap.unintegrated", raster = F,
  1730. # #split.by = "disease_sex"
  1731. # )
  1732. #
  1733. #
  1734. # VlnPlot(myeloids, features = #ptgs,
  1735. # "CD48",
  1736. # pt.size = 0.1,
  1737. # #ncol = 5,
  1738. # raster = F,
  1739. # idents = "Classical monocytes",#c("0","5"),
  1740. # split.by = "treatment",
  1741. # #group.by = "celltypes"
  1742. # #, combine = F
  1743. # )
  1744. #
  1745. # p2 <- VlnPlot(prot.combined, features = "IL15",#c("JUN","STAT1", "CCL3", "CCL3L1"),#c("IRF1","IFNG","IFNGR1","IFNGR2"),#c("CD8A","CD4","CD19"),#c("TMEM176A","TMEM176B"),
  1746. # #split.by = "disease",
  1747. # group.by = "dose",
  1748. # #group.by = "celltypes",
  1749. # pt.size = 0.05,
  1750. # raster = F,
  1751. # #ncol = 5,
  1752. # #slot = "counts",
  1753. # #add.noise = F,
  1754. # #log = T,
  1755. # #sort = "increasing",
  1756. # idents = c("Classical monocytes"),
  1757. # #"Intermediate monocytes"
  1758. # #"8", # moDC
  1759. # #"2", # Nonclassical
  1760. # #"6", # Intermediate
  1761. # # c("0","1","3","4","5","9","17"),#,"13","25"), # Classical monocytes
  1762. # ) + scale_y_continuous(limits = c(0.000, 5.5)) +
  1763. # stat_summary(fun = mean, geom = "point",size = 30, colour = "black", shape = 95)
  1764. # p2$layers[[2]]$aes_params$alpha <- 0.05
  1765. # p2
  1766. #
  1767. # irf8_targets <- t(read.delim("irf8_targets.txt", header = F))
  1768. # foxos <- c("FOXO1","FOXO3","FOXO4","FOXO6","FOXP2")
  1769. # list2 <- t(read.delim("5progxrrms-hc-nonprog.txt", header = F))
  1770. # list1 <- t(read.csv("IL11.csv", header = F))
  1771. # DotPlot(myeloids, features = modc.up,#"IRF8",
  1772. # #cols = c("blue", "red","yellow","green","pink"),
  1773. # #col.max = 20,
  1774. # #col.min = 5,
  1775. # #dot.min = 3,
  1776. # dot.scale = 12,
  1777. # cluster.idents = T,
  1778. # #scale = F,
  1779. # #split.by = "disease.state",
  1780. # idents = #"mo-DC",
  1781. # c("mo-DC_HC","mo-DC_RRMS","mo-DC_Progressor","mo-DC_Nonprogressor"
  1782. # # ,"mo-DC_PPMS"
  1783. # )
  1784. # ) + RotatedAxis()
  1785. #
  1786. # all.markers <- c("CD14","CCR2",#"CCR5",
  1787. # "SELL","FCGR3A","CX3CR1","HLA-DRA",#"ITGAX","CD68",
  1788. # "FCER1A","CD1C")
  1789. # DoHeatmap(myeloids, features = cell.markers,
  1790. # slot = "data",
  1791. # cells = 1:30000,
  1792. # size = 5,
  1793. # disp.max = 2.5,
  1794. # disp.min = 0
  1795. # )
  1796. # cell.markers <- c("CD14","FCGR3A","FCER1A","CD1C"#,"CD68"
  1797. # )
  1798. # DoHeatmap(myeloids, features = markers[,2][!markers[,2]==""], group.by = "patho", slot = "")
  1799. #
  1800. # #Idents(prot.combined) <- "seurat_clusters"
  1801. # #Idents(prot.combined) <- "disease.state"
  1802. # myeloids$celltypes <- Idents(myeloids)
  1803. # Idents(myeloids) <- "celltypes"
  1804. # Idents(myeloids) <- "seurat_clusters"
  1805. # myeloids$celltypes.disease <- paste(Idents(myeloids), myeloids$disease, sep = "_")
  1806. # Idents(myeloids) <- "celltypes.disease"
  1807. # myeloids$celltypes.prog <- paste(Idents(myeloids), myeloids$prog, sep = "_")
  1808. # Idents(myeloids) <- "celltypes.prog"
  1809. # myeloids$celltypes.disease.state <- paste(Idents(myeloids), myeloids$disease.state, sep = "_")
  1810. # Idents(myeloids) <- "celltypes.disease.state"
  1811. # myeloids$celltypes.disease.state_sex <- paste(myeloids$celltypes, myeloids$disease.state_sex, sep = "_")
  1812. # Idents(myeloids) <- "celltypes.disease.state_sex"
  1813. #myeloids$celltypes <- sub("(.*)_.*", "\\1", Idents(myeloids))
  1814. ptgs <- c("PTGS2","PTGES2","PTGES3")
  1815. prostaglandin <- c("ALOX5",
  1816. "PTGS2","PTGIS","EDN2",
  1817. "PTGES3","PTGES","EDN1",
  1818. "DAGLB","PLA2G4A","CBR1","PTGS1","PLA2G10",
  1819. "MIF","PLA2G4F", "AKR1C3",
  1820. "TBXAS1","PTGDS","PRXL2B",
  1821. "PNPLA8","PTGES2","HPGDS",
  1822. "CD74"
  1823. )
  1824. irfs <- c("IRF1","IRF2","IRF3", "IRF4","IRF5","IRF6","IRF7","IRF8","IRF9")
  1825. atfs <- c("ATF1","ATF2","ATF3","ATF4","ATF5","ATF6","ATF7")
  1826. foxo1 <- c(
  1827. "ADIPOR1",
  1828. "CDKN1B",
  1829. "CXCR4",
  1830. "FABP4",
  1831. "IGFBP1",
  1832. "IL6",
  1833. "TNFSF10",
  1834. "AR",
  1835. "EGR1",
  1836. "FSHB",
  1837. "TXNIP",
  1838. "ANGPT2",
  1839. "EDN1",
  1840. "HYOU1",
  1841. "IRS2",
  1842. "KLF2",
  1843. "LHB",
  1844. "NEUROG3",
  1845. "NKX6-1",
  1846. "NLK",
  1847. "PDGFA",
  1848. "PDGFB",
  1849. "PRL",
  1850. "RAG1"
  1851. )
  1852. fos.act <-c(
  1853. "CASP9",
  1854. "CCK",
  1855. "CREM",
  1856. "DDIT3",
  1857. "ERCC4",
  1858. "EZR",
  1859. "FAS",
  1860. "FMO4",
  1861. "HSPH1",
  1862. "MMP1",
  1863. "MMP9",
  1864. "NEFL",
  1865. "NOS2",
  1866. "PTGS2",
  1867. "SMAD7",
  1868. "SOX7",
  1869. "SRR"
  1870. )
  1871. fos.rep <- c(
  1872. "ACTA1",
  1873. "BATF3",
  1874. "BCL2L1",
  1875. "CCK",
  1876. "CD40LG",
  1877. "CRP",
  1878. "CSTA",
  1879. "CXCL8",
  1880. "CYP1A2",
  1881. "FGFBP1",
  1882. "VEGFD",
  1883. "FOXA1",
  1884. "GSTP1",
  1885. "IL1A",
  1886. "LRIG2",
  1887. "MELTF",
  1888. "MMP1",
  1889. "MMP3",
  1890. "MMP7",
  1891. "MMP9",
  1892. "NGF",
  1893. "NPPA",
  1894. "NPY",
  1895. "NQO1",
  1896. "NTF3",
  1897. "NTS",
  1898. "OXTR",
  1899. "PCK2",
  1900. "PDHA1",
  1901. "PGR",
  1902. "PLAU",
  1903. "PLAUR",
  1904. "PTGS2",
  1905. "SMAD4",
  1906. "SPRR3",
  1907. "STAR",
  1908. "TP53"
  1909. )
  1910. ### Diff exp analysis
  1911. cell.types <- c("Nonclassical","Intermediate","Classical","mo-DC")
  1912. #myeloids <- JoinLayers(myeloids)
  1913. for (i in 1:length(cell.types)) {
  1914. zk.response0 <- FindMarkers(myeloids, ident.1 = c(paste0(cell.types[i], "_Nonprogressor"),
  1915. paste0(cell.types[i], "_Progressor"))
  1916. ,ident.2 =
  1917. c(
  1918. paste0(cell.types[i], "_HC"),
  1919. paste0(cell.types[i], "_RRMS")#,
  1920. #paste0(cell.types[i], "_Nonprogressor")
  1921. )
  1922. , slot = "data",
  1923. assay = "RNA",
  1924. features = NULL,
  1925. logfc.threshold = 0,
  1926. test.use = "wilcox",
  1927. min.pct = 0.5,
  1928. min.diff.pct = -Inf,
  1929. verbose = TRUE,
  1930. only.pos = FALSE,
  1931. max.cells.per.ident = Inf,
  1932. random.seed = 1,
  1933. latent.vars = NULL,
  1934. min.cells.feature = 3,
  1935. min.cells.group = 3,
  1936. pseudocount.use = 1,
  1937. mean.fxn = NULL,
  1938. fc.name = NULL,
  1939. base = 2,
  1940. densify = FALSE,
  1941. recorrect_umi = TRUE
  1942. )
  1943. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  1944. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_Prog_NonprogxHC_RRMS_", cell.types[i], "_DEGs.xlsx"))
  1945. rm(zk.response0)
  1946. }
  1947. zk.response0 <- FindMarkers(myeloids, ident.1 = paste0(cell.types[i], "_MS"),
  1948. ident.2 = paste0(cell.types[i], "_HC"),
  1949. slot = "data",
  1950. assay = "RNA",
  1951. features = NULL,
  1952. logfc.threshold = 0,
  1953. test.use = "wilcox",
  1954. min.pct = 0.3,
  1955. min.diff.pct = -Inf,
  1956. verbose = TRUE,
  1957. only.pos = FALSE,
  1958. max.cells.per.ident = Inf,
  1959. random.seed = 1,
  1960. latent.vars = NULL,
  1961. min.cells.feature = 3,
  1962. min.cells.group = 3,
  1963. pseudocount.use = 1,
  1964. mean.fxn = NULL,
  1965. fc.name = NULL,
  1966. base = 2,
  1967. densify = FALSE,
  1968. recorrect_umi = TRUE
  1969. )
  1970. write.csv(as.data.frame(zk.response0), file=paste0("MAST_MSxHC_", cell.types[i], "_DEGs.csv"))
  1971. rm(zk.response0)
  1972. # ends here
  1973. ## Diff exp analysis
  1974. bulk <- AggregateExpression(prot.combined, return.seurat = T, slot = "counts", assays = "RNA",
  1975. group.by = c("sex", "disease.state"))
  1976. prot.combined <- JoinLayers(prot.combined)
  1977. prot.combined <- subset(prot.combined, downsample = 10000)
  1978. prot.combined[["RNA"]]$counts <- as(object = prot.combined[["RNA"]]$counts, Class = "dgCMatrix")
  1979. prot.combined <- RunUMAP(prot.combined, reduction = "pca", dims = 1:30, reduction.name = "umap.pca")
  1980. prot.combined <- RunUMAP(prot.combined, reduction = "integrated.cca", dims = 1:30, reduction.name = "umap.cca")
  1981. prot.combined <- RunUMAP(prot.combined, assay = "RNA", reduction = "harmony", dims = 1:30, reduction.name = "umap.harmony",
  1982. return.model = T)
  1983. prot.combined <- FindNeighbors(prot.combined, reduction = "integrated.cca", dims = 1:30)
  1984. prot.combined <- FindClusters(prot.combined, resolution = 2, cluster.name = "cca_clusters")
  1985. prot.combined <- RunUMAP(prot.combined, reduction = "integrated.cca", dims = 1:30, reduction.name = "umap.cca")
  1986. prot.combined <- DimPlot(prot.combined,reduction = "umap.cca", group.by = "GEM", combine = F)
  1987. gc()
  1988. ############################# Nichenet #########################
  1989. library(nichenetr)
  1990. library(tidyverse)
  1991. ### subset by highly variable genes
  1992. #DefaultAssay(prot.combined) <- "RNA"
  1993. #prot.combined <- FindVariableFeatures(prot.combined)
  1994. #prot.combined2 <- subset(prot.combined, features = prot.combined@assays[["RNA"]]@var.features)
  1995. ## Save V5 as V3
  1996. saveRDS(object = prot.combined, file = "obj_BP2_harmony_no.unk.Rds")
  1997. prot.combined[["RNA"]] <- JoinLayers(prot.combined[["RNA"]])
  1998. prot.combined[["RNA"]]$scale.data <- NULL
  1999. prot.combined[["RNA3"]] <- as(object = prot.combined[["RNA"]], Class = "Assay")
  2000. prot.combined2 <- prot.combined
  2001. prot.combined2[["RNA"]] <- prot.combined2[["RNA3"]]
  2002. prot.combined2[["RNA3"]] <- NULL
  2003. prot.combined2 <- ScaleData(prot.combined2)
  2004. ## Save and Load data
  2005. saveRDS(object = prot.combined, file = "obj_BP2_harmony_no.unk_v3.Rds")
  2006. #rm(prot.combined)
  2007. #prot.combined <- readRDS("./obj_harmony_patient_reg.out.mito.ncounts.v3.Rds")
  2008. gc()
  2009. ### start analysis
  2010. organism = "human"
  2011. #if(organism == "human"){
  2012. # lr_network = readRDS(url("https://zenodo.org/record/7074291/files/lr_network_human_21122021.rds"))
  2013. # ligand_target_matrix = readRDS(url("https://zenodo.org/record/7074291/files/ligand_target_matrix_nsga2r_final.rds"))
  2014. # weighted_networks = readRDS(url("https://zenodo.org/record/7074291/files/weighted_networks_nsga2r_final.rds"))
  2015. #} else if(organism == "mouse"){
  2016. # lr_network = readRDS(url("https://zenodo.org/record/7074291/files/lr_network_mouse_21122021.rds"))
  2017. # ligand_target_matrix = readRDS(url("https://zenodo.org/record/7074291/files/ligand_target_matrix_nsga2r_final_mouse.rds"))
  2018. # weighted_networks = readRDS(url("https://zenodo.org/record/7074291/files/weighted_networks_nsga2r_final_mouse.rds"))
  2019. #}
  2020. ## if connection does not work, add references by --->
  2021. setwd("/media/patrick/GERVAZIO/Bioinfo/ref_data/nichenet_ref/human/")
  2022. lr_network = readRDS("lr_network_human_21122021.rds")
  2023. ligand_target_matrix = readRDS("ligand_target_matrix_nsga2r_final.rds")
  2024. weighted_networks = readRDS("weighted_networks_nsga2r_final.rds")
  2025. setwd("/media/patrick/JAMBERT/Bioinfo/weiner_lab/yota/protollin/scRNAseq_clin_trial/Seurat/BPCells/")
  2026. lr_network = lr_network %>% distinct(from, to)
  2027. weighted_networks_lr = weighted_networks$lr_sig %>% inner_join(lr_network, by = c("from","to"))
  2028. ## NK ---> Classical Monocytes
  2029. ## regular pipe
  2030. nichenet_output = nichenet_seuratobj_aggregate(
  2031. seurat_obj = prot.combined2,
  2032. receiver = c("0","4","8","13"),#"27"),
  2033. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2034. sender = c("3","16","20","28","30"#,"31","32"
  2035. ),
  2036. ligand_target_matrix = ligand_target_matrix,
  2037. lr_network = lr_network,
  2038. weighted_networks = weighted_networks)
  2039. ## NK ---> intermediate Monocytes
  2040. ## regular pipe
  2041. nichenet_output = nichenet_seuratobj_aggregate(
  2042. seurat_obj = prot.combined2,
  2043. receiver = c("11"),
  2044. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2045. sender = c("3","16","20","28","30",#"31","32"
  2046. ),
  2047. ligand_target_matrix = ligand_target_matrix,
  2048. lr_network = lr_network,
  2049. weighted_networks = weighted_networks)
  2050. ## NK ---> Nonclassical Monocytes
  2051. ## regular pipe
  2052. nichenet_output = nichenet_seuratobj_aggregate(
  2053. seurat_obj = prot.combined2,
  2054. receiver = c("7","22"),#"34"),
  2055. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2056. sender = c("3","16","20","28","30",#"31","32"
  2057. ),
  2058. ligand_target_matrix = ligand_target_matrix,
  2059. lr_network = lr_network,
  2060. weighted_networks = weighted_networks)
  2061. ## NK ---> Monocytes
  2062. ## regular pipe
  2063. nichenet_output = nichenet_seuratobj_aggregate(
  2064. seurat_obj = prot.combined2,
  2065. receiver = c("7","22","11","0","4","8","13"),
  2066. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2067. sender = c("3","16","20","28","30"#,"31","32"
  2068. ),
  2069. ligand_target_matrix = ligand_target_matrix,
  2070. lr_network = lr_network,
  2071. weighted_networks = weighted_networks)
  2072. ## Monocytes ---> CD4+ T cells
  2073. ## regular pipe
  2074. nichenet_output = nichenet_seuratobj_aggregate(
  2075. seurat_obj = prot.combined2,
  2076. receiver = c("1","2"),
  2077. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2078. sender = c("7","22","11","0","4","8","13"
  2079. ),
  2080. ligand_target_matrix = ligand_target_matrix,
  2081. lr_network = lr_network,
  2082. weighted_networks = weighted_networks)
  2083. ## Monocytes ---> Treg
  2084. ## regular pipe
  2085. nichenet_output = nichenet_seuratobj_aggregate(
  2086. seurat_obj = prot.combined2,
  2087. receiver = c("18"),
  2088. condition_colname = "treatment", condition_oi = "Protollin", condition_reference = "Untreated",
  2089. sender = c("7","22","11","0","4","8","13"
  2090. ),
  2091. ligand_target_matrix = ligand_target_matrix,
  2092. lr_network = lr_network,
  2093. weighted_networks = weighted_networks)
  2094. #### By patient
  2095. ## Monocytes ---> CD8+ T cells
  2096. ## regular pipe
  2097. nichenet_output = nichenet_seuratobj_aggregate(
  2098. seurat_obj = prot.combined2,
  2099. receiver = c("5","6","17"),
  2100. condition_colname = "patient_day", condition_oi = "P12_D15", condition_reference = "P12_D0",
  2101. sender = c("7","22","11","0","4","8","13"
  2102. ),
  2103. ligand_target_matrix = ligand_target_matrix,
  2104. lr_network = lr_network,
  2105. weighted_networks = weighted_networks)
  2106. ## Myeloids ---> CD4+ T cells
  2107. ## regular pipe
  2108. nichenet_output = nichenet_seuratobj_aggregate(
  2109. seurat_obj = prot.combined2,
  2110. receiver = c("1","2","18"),
  2111. condition_colname = "patient_day", condition_oi = "P12_D15", condition_reference = "P12_D0",
  2112. sender = c("7","22","11","0","4","8","13","12","21"
  2113. ),
  2114. ligand_target_matrix = ligand_target_matrix,
  2115. lr_network = lr_network,
  2116. weighted_networks = weighted_networks)
  2117. ## Myeloids ---> CD8+ T cells
  2118. ## regular pipe
  2119. nichenet_output = nichenet_seuratobj_aggregate(
  2120. seurat_obj = prot.combined2,
  2121. receiver = c("5","6","17"),
  2122. condition_colname = "patient_day", condition_oi = "P12_D15", condition_reference = "P12_D0",
  2123. sender = c("7","22","11","0","4","8","13","12","21"
  2124. ),
  2125. ligand_target_matrix = ligand_target_matrix,
  2126. lr_network = lr_network,
  2127. weighted_networks = weighted_networks)
  2128. ## plots
  2129. nichenet_output$ligand_activities
  2130. write.xlsx(as.data.frame(nichenet_output$ligand_activities), rowNames = T, file="NK_mono.classical_nichenet_ligands.xlsx")
  2131. nichenet_output$top_ligands
  2132. nichenet_output$ligand_expression_dotplot
  2133. nichenet_output$ligand_differential_expression_heatmap
  2134. nichenet_output$ligand_target_heatmap
  2135. nichenet_output$ligand_target_heatmap + scale_fill_gradient2(low = "whitesmoke",
  2136. high = "royalblue", breaks = c(0,0.0045,0.009)) +
  2137. xlab("AD response genes in NK") + ylab("Prioritized immmune cell ligands")
  2138. DotPlot(prot.combined %>% subset(idents = c("10","23","38","30")), cols = c("royalblue","royalblue"),
  2139. features = nichenet_output$top_targets %>% rev(), split.by = "disease") + RotatedAxis()
  2140. nichenet_output$ligand_activity_target_heatmap
  2141. nichenet_output$ligand_receptor_heatmap
  2142. ####### Manual pipe
  2143. ## receiver
  2144. receiver = c("80","18","48") ## Monocytes
  2145. expressed_genes_receiver = get_expressed_genes(receiver, prot.combined2, pct = 0.10)
  2146. background_expressed_genes = expressed_genes_receiver %>% .[. %in% rownames(ligand_target_matrix)]
  2147. ## sender
  2148. sender_celltypes = c("21","41","1","2","62","20","28","67","57") ## NKs
  2149. list_expressed_genes_sender = sender_celltypes %>% unique() %>% lapply(get_expressed_genes, prot.combined2, 0.10) # lapply to get the expressed genes of every sender cell type separately here
  2150. expressed_genes_sender = list_expressed_genes_sender %>% unlist() %>% unique()
  2151. seurat_obj_receiver= subset(prot.combined2, idents = receiver)
  2152. seurat_obj_receiver = SetIdent(seurat_obj_receiver, value = seurat_obj_receiver[["disease", drop=TRUE]])
  2153. condition_oi = "AD"
  2154. condition_reference = "C"
  2155. DE_table_receiver = FindMarkers(object = seurat_obj_receiver, ident.1 = condition_oi, ident.2 = condition_reference, min.pct = 0.10) %>% rownames_to_column("gene")
  2156. geneset_oi = DE_table_receiver %>% dplyr::filter(p_val_adj <= 0.05 & abs(avg_log2FC) >= 0.25) %>% pull(gene)
  2157. geneset_oi = geneset_oi %>% .[. %in% rownames(ligand_target_matrix)]
  2158. ligands = lr_network %>% pull(from) %>% unique()
  2159. receptors = lr_network %>% pull(to) %>% unique()
  2160. expressed_ligands = intersect(ligands,expressed_genes_sender)
  2161. expressed_receptors = intersect(receptors,expressed_genes_receiver)
  2162. potential_ligands = lr_network %>% dplyr::filter(from %in% expressed_ligands & to %in% expressed_receptors) %>% pull(from) %>% unique()
  2163. ligand_activities = predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands)
  2164. ligand_activities = ligand_activities %>% arrange(-aupr_corrected) %>% dplyr::mutate(rank = rank(dplyr::desc(aupr_corrected)))
  2165. #write.xlsx(as.data.frame(ligand_activities), rowNames = T, file="NK_mono.classical_nichenet_ligands.xlsx")
  2166. best_upstream_ligands = ligand_activities %>% #top_n(-30, aupr_corrected) %>%
  2167. arrange(-aupr_corrected) %>% pull(test_ligand) %>% unique()
  2168. DotPlot(prot.combined2, features = best_upstream_ligands %>% rev(), cols = "RdYlBu") + RotatedAxis() ### Plot!!!!
  2169. active_ligand_target_links_df = best_upstream_ligands %>% lapply(get_weighted_ligand_target_links,geneset = geneset_oi,
  2170. ligand_target_matrix = ligand_target_matrix, n = 200) %>% bind_rows() %>% drop_na()
  2171. active_ligand_target_links = prepare_ligand_target_visualization(ligand_target_df = active_ligand_target_links_df, ligand_target_matrix = ligand_target_matrix,
  2172. cutoff = 0.33)
  2173. order_ligands = intersect(best_upstream_ligands, colnames(active_ligand_target_links)) %>% rev() %>% make.names()
  2174. order_targets = active_ligand_target_links_df$target %>% unique() %>% intersect(rownames(active_ligand_target_links)) %>% make.names()
  2175. rownames(active_ligand_target_links) = rownames(active_ligand_target_links) %>% make.names() # make.names() for heatmap visualization of genes like H2-T23
  2176. colnames(active_ligand_target_links) = colnames(active_ligand_target_links) %>% make.names() # make.names() for heatmap visualization of genes like H2-T23
  2177. vis_ligand_target = active_ligand_target_links[order_targets,order_ligands] %>% t()
  2178. p_ligand_target_network = vis_ligand_target %>% make_heatmap_ggplot("Prioritized ligands","Predicted target genes",
  2179. color = "purple",legend_position = "top",
  2180. x_axis_position = "top",legend_title = "Regulatory potential") +
  2181. theme(axis.text.x = element_text(face = "italic")) + scale_fill_gradient2(low = "whitesmoke", high = "purple", breaks = c(0,0.0045,0.0090))
  2182. p_ligand_target_network ### Plot!!!!
  2183. lr_network_top = lr_network %>% dplyr::filter(from %in% best_upstream_ligands & to %in% expressed_receptors) %>% distinct(from,to)
  2184. best_upstream_receptors = lr_network_top %>% pull(to) %>% unique()
  2185. lr_network_top_df_large = weighted_networks_lr %>% dplyr::filter(from %in% best_upstream_ligands & to %in% best_upstream_receptors)
  2186. lr_network_top_df = lr_network_top_df_large %>% spread("from","weight",fill = 0)
  2187. lr_network_top_matrix = lr_network_top_df %>% dplyr::select(-to) %>% as.matrix() %>% magrittr::set_rownames(lr_network_top_df$to)
  2188. dist_receptors = dist(lr_network_top_matrix, method = "binary")
  2189. hclust_receptors = hclust(dist_receptors, method = "ward.D2")
  2190. order_receptors = hclust_receptors$labels[hclust_receptors$order]
  2191. dist_ligands = dist(lr_network_top_matrix %>% t(), method = "binary")
  2192. hclust_ligands = hclust(dist_ligands, method = "ward.D2")
  2193. order_ligands_receptor = hclust_ligands$labels[hclust_ligands$order]
  2194. order_receptors = order_receptors %>% intersect(rownames(lr_network_top_matrix))
  2195. order_ligands_receptor = order_ligands_receptor %>% intersect(colnames(lr_network_top_matrix))
  2196. vis_ligand_receptor_network = lr_network_top_matrix[order_receptors, order_ligands_receptor]
  2197. rownames(vis_ligand_receptor_network) = order_receptors %>% make.names()
  2198. colnames(vis_ligand_receptor_network) = order_ligands_receptor %>% make.names()
  2199. p_ligand_receptor_network = vis_ligand_receptor_network %>% t() %>% make_heatmap_ggplot("Ligands","Receptors", color = "mediumvioletred",
  2200. x_axis_position = "top",legend_title = "Prior interaction potential")
  2201. p_ligand_receptor_network ### Plot!!!!
  2202. # DE analysis for each sender cell type
  2203. # this uses a new nichenetr function - reinstall nichenetr if necessary!
  2204. DE_table_all = Idents(prot.combined2) %>% levels() %>% intersect(sender_celltypes) %>%
  2205. lapply(get_lfc_celltype, seurat_obj = prot.combined2, condition_colname = "disease",
  2206. condition_oi = condition_oi, condition_reference = condition_reference, expression_pct = 0.10, celltype_col = NULL) %>%
  2207. reduce(full_join) # use this if cell type labels are the identities of your Seurat object -- if not: indicate the celltype_col properly
  2208. DE_table_all[is.na(DE_table_all)] = 0
  2209. # Combine ligand activities with DE information
  2210. ligand_activities_de = ligand_activities %>% dplyr::select(test_ligand, pearson) %>% dplyr::rename(ligand = test_ligand) %>% left_join(DE_table_all %>% dplyr::rename(ligand = gene))
  2211. ligand_activities_de[is.na(ligand_activities_de)] = 0
  2212. # make LFC heatmap
  2213. lfc_matrix = ligand_activities_de %>% dplyr::select(-ligand, -pearson) %>% as.matrix() %>% magrittr::set_rownames(ligand_activities_de$ligand)
  2214. rownames(lfc_matrix) = rownames(lfc_matrix) %>% make.names()
  2215. order_ligands = order_ligands[order_ligands %in% rownames(lfc_matrix)]
  2216. vis_ligand_lfc = lfc_matrix[order_ligands,]
  2217. colnames(vis_ligand_lfc) = vis_ligand_lfc %>% colnames() %>% make.names()
  2218. p_ligand_lfc = vis_ligand_lfc %>% make_threecolor_heatmap_ggplot("Prioritized ligands","LFC in Sender",
  2219. low_color = "midnightblue",mid_color = "white", mid = median(vis_ligand_lfc),
  2220. high_color = "red",legend_position = "top", x_axis_position = "top", legend_title = "LFC") +
  2221. theme(axis.text.y = element_text(face = "italic"))
  2222. p_ligand_lfc ### Plot!!!!
  2223. # change colors a bit to make them more stand out
  2224. #p_ligand_lfc = p_ligand_lfc + scale_fill_gradientn(colors = c("midnightblue","blue", "grey95", "grey99","firebrick1","red"),values = c(0,0.1,0.2,0.25, 0.40, 0.7,1), limits = c(vis_ligand_lfc %>% min() - 0.1, vis_ligand_lfc %>% max() + 0.1))
  2225. #p_ligand_lfc
  2226. # ligand activity heatmap
  2227. ligand_aupr_matrix = ligand_activities %>% dplyr::select(aupr_corrected) %>% as.matrix() %>% magrittr::set_rownames(ligand_activities$test_ligand)
  2228. rownames(ligand_aupr_matrix) = rownames(ligand_aupr_matrix) %>% make.names()
  2229. colnames(ligand_aupr_matrix) = colnames(ligand_aupr_matrix) %>% make.names()
  2230. vis_ligand_aupr = ligand_aupr_matrix[order_ligands, ] %>% as.matrix(ncol = 1) %>% magrittr::set_colnames("AUPR")
  2231. p_ligand_aupr = vis_ligand_aupr %>%
  2232. make_heatmap_ggplot("Prioritized ligands","Ligand activity", color = "darkorange",legend_position = "top",
  2233. x_axis_position = "top", legend_title = "AUPR\n(target gene prediction ability)") + theme(legend.text = element_text(size = 9))
  2234. #p_ligand_aupr ## Plot!!
  2235. # ligand expression Seurat dotplot
  2236. order_ligands_adapted <- str_replace_all(order_ligands, "\\.", "-")
  2237. rotated_dotplot = DotPlot(prot.combined2 %>% subset(seurat_clusters %in% sender_celltypes), features = order_ligands_adapted,
  2238. cols = "RdYlBu") + coord_flip() + theme(legend.text = element_text(size = 10), legend.title = element_text(size = 12)) # flip of coordinates necessary because we want to show ligands in the rows when combining all plots
  2239. figures_without_legend = cowplot::plot_grid(
  2240. p_ligand_aupr + theme(legend.position = "none", axis.ticks = element_blank()) + theme(axis.title.x = element_text()),
  2241. rotated_dotplot + theme(legend.position = "none", axis.ticks = element_blank(), axis.title.x = element_text(size = 12),
  2242. axis.text.y = element_text(face = "italic", size = 9),
  2243. axis.text.x = element_text(size = 9, angle = 90,hjust = 0)) + ylab("Expression in Sender") + xlab("") + scale_y_discrete(position = "right"),
  2244. p_ligand_lfc + theme(legend.position = "none", axis.ticks = element_blank()) + theme(axis.title.x = element_text()) + ylab(""),
  2245. p_ligand_target_network + theme(legend.position = "none", axis.ticks = element_blank()) + ylab(""),
  2246. align = "hv",
  2247. nrow = 1,
  2248. rel_widths = c(ncol(vis_ligand_aupr)+6, ncol(vis_ligand_lfc) + 7, ncol(vis_ligand_lfc) + 8, ncol(vis_ligand_target)))
  2249. legends = cowplot::plot_grid(
  2250. ggpubr::as_ggplot(ggpubr::get_legend(p_ligand_aupr)),
  2251. ggpubr::as_ggplot(ggpubr::get_legend(rotated_dotplot)),
  2252. ggpubr::as_ggplot(ggpubr::get_legend(p_ligand_lfc)),
  2253. ggpubr::as_ggplot(ggpubr::get_legend(p_ligand_target_network)),
  2254. nrow = 1,
  2255. align = "h", rel_widths = c(1.5, 1, 1, 1))
  2256. combined_plot = cowplot::plot_grid(figures_without_legend, legends, rel_heights = c(10,5), nrow = 2, align = "hv")
  2257. combined_plot
  2258. ############################################ Treated patients analysis
  2259. Idents(prot.combined) <- "patient"
  2260. prot.combined2 <- subset(prot.combined, idents = c("P12","P13","P15","P16"))
  2261. Idents(prot.combined2) <- "seurat_clusters"
  2262. prot.combined2 <- JoinLayers(prot.combined2)
  2263. ## Save and Load data
  2264. saveRDS(object = prot.combined2, file = "obj_BP2_unintegrated_P12.13.15.16.Rds")
  2265. prot.combined2 <- readRDS("./obj_BP2_unintegrated_P12.13.15.16.Rds")
  2266. ## Save V5 as V3
  2267. prot.combined2[["RNA"]] <- JoinLayers(prot.combined2[["RNA"]])
  2268. prot.combined2[["RNA"]]$scale.data <- NULL
  2269. prot.combined2[["RNA3"]] <- as(object = prot.combined2[["RNA"]], Class = "Assay")
  2270. #prot.combined2 <- prot.combined
  2271. prot.combined2[["RNA"]] <- prot.combined2[["RNA3"]]
  2272. prot.combined2[["RNA3"]] <- NULL
  2273. ## Save and Load data
  2274. saveRDS(object = prot.combined2, file = "obj_BP2_integrated_P12.13.15.16.v3.Rds")
  2275. #rm(prot.combined)
  2276. prot.combined <- readRDS("./obj_harmony_patient_reg.out.mito.ncounts.v3.Rds")
  2277. prot.combined2 <- ScaleData(prot.combined2)
  2278. gc()
  2279. Idents(prot.combined) <- "celltypes"
  2280. DimPlot(prot.combined2, reduction = "umap", raster = F,
  2281. #ncol = 4,
  2282. label = T,
  2283. repel = T,
  2284. #group.by = "seurat_clusters",
  2285. #split.by = "patient_day"
  2286. )#, combine = F)
  2287. FeaturePlot(prot.combined2, features = c("FAM13A","MEGF9","GIMAP7","S100Z"),#,"MX1","IFI44"),
  2288. pt.size = 0.1,
  2289. ncol = 2,
  2290. reduction = "umap", raster = F,
  2291. #split.by = "disease_sex"
  2292. )
  2293. DotPlot(prot.combined2, features = c("TNF","IFNG","KLRC1","NCAM1","IL2RB","IL7R","TBX21","EOMES",# iNKs
  2294. "PRF1","GZMM","GZMH","GZMA","GZMB", # mNKs
  2295. "LILRB1", "KLRB1", "ZBTB16", # NKT-like
  2296. "CD3E","CD3D", # T cells
  2297. "CD8A","CD8B","PTPRC","CCL5", #"CD244", # T cells
  2298. "CD4","S100A4","SELL", # T cells
  2299. "FOXP3", "IL2RA", # Tregs
  2300. "TRDC","TRDV1","TRDV2","TRGC2","TRGV9","TRGC1", #gamma delta
  2301. "ITGB2","PECAM1","IL3RA","LAMP1",#, #pDC
  2302. "CD64", "CD68", "CD71", "CCR5","ITGAM", # Macrophages
  2303. "CD1C","ITGAX","FCER1A","CCR7","NRP1", # DC
  2304. "CD14","FCGR3A", #monocytes
  2305. "PF4", # platelets
  2306. "CD19","IGKC","IGHM","CD27","CD1D","CD22","CD86","MS4A1","IGLC2","IGLC3","IGHD","CD79A","CD79B","AIM2", "BANK1","RALGPS2","TNFRSF13B", # B cells
  2307. "IL4R","CXCR4", "BTG1", "TCL1A", "YBX3", # Naive B cells
  2308. "COCH", "SSPN", "TEX9", "TNFRSF13C", "LINC01781", # Memory B cells
  2309. "LINC01857", # mature B cells
  2310. "IGHA2","MZB1","TNFRSF17","DERL3","TXNDC5","POU2AF1","CPNE5","NT5DC2"# plasma cells
  2311. # "IL10"#,"IL1B","IL15","IL7" #"IL2","IL3","IL6","IL4","IL22"
  2312. ),
  2313. #cols = c("blue","blue"),#"blue"),#"red"),#"green","yellow","gray","pink","brown","lightblue"),
  2314. col.max = 20, #idents = #c("Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C"),#"Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"),
  2315. #c("Classical Mono_1","Classical Mono_2","Intermediate Mono","Nonclassical Mono",
  2316. #"pDC_AD","pDC_C",
  2317. #"mo-DC_AD","mo-DC_C"
  2318. #),
  2319. #idents = "CD8+ TEM",
  2320. # c("NK_4_C","NK_4_AD","NK_8_C","NK_8_AD","NK_21_C","NK_21_AD",
  2321. # "CD8+ NKT-like_C", "CD8+ NKT-like_AD"#, "NK_AD", "NK_C"
  2322. # c("NK_AD","NK_C","Classical Mono_1_AD","Classical Mono_2_AD","Classical Mono_1_C","Classical Mono_2_C","Intermediate Mono_AD","Nonclassical Mono_AD","Intermediate Mono_C","Nonclassical Mono_C"
  2323. #c("62","67","49","47"),
  2324. dot.scale = 10,
  2325. cluster.idents = T, #group.by = "patho",
  2326. #scale = F,
  2327. #split.by = "disease"
  2328. ) + RotatedAxis()
  2329. prot.combined2 <- RenameIdents(prot.combined2,
  2330. `0` = "Classical monocytes_1",
  2331. `1` = "Naive CD4+ T cells_1",
  2332. `2` = "Memory T CD4+_1",
  2333. `3` = "mNK_1",
  2334. `4` = "Classical monocytes_2",
  2335. `5` = "Effector CD8+ T cells_1",
  2336. `6` = "Naive CD8+ T cells_1",
  2337. `7` = "Nonclassical monocytes_1",
  2338. `8` = "Classical monocytes_3",
  2339. `9` = "B cells_1",
  2340. `10` = "B cells_2",
  2341. `11` = "Intermediate monocytes",
  2342. `12` = "mo-DC_1",
  2343. `13` = "Classical monocytes_4",
  2344. `14` = "Unk_1",
  2345. `15` = "B cells_3",
  2346. `16` = "NKT-like CD8+_1",
  2347. `17` = "Memory T CD8+",
  2348. `18` = "Treg",
  2349. `19` = "Unk_2",
  2350. `20` = "NKT-like CD4+_1",
  2351. `21` = "pDC_1",
  2352. `22` = "Nonclassical monocytes_3",
  2353. `23` = "B cells_4",
  2354. `24` = "B cells_5",
  2355. `25` = "B cells_6",
  2356. `26` = "Unk_3",
  2357. `27` = "Classical monocytes_5",
  2358. `28` = "iNK_1",
  2359. `29` = "Memory T CD4+_2",
  2360. `30` = "NKT-like CD8+_2",
  2361. `31` = "iNK_2",
  2362. `32` = "mNK_4",
  2363. `33` = "Unk_4",
  2364. `34` = "Nonclassical monocytes_2",
  2365. `35` = "Unk_5",
  2366. `36` = "Platelets_1",
  2367. `38` = "B cells_8",
  2368. `40` = "Plasma B cells_1"
  2369. )
  2370. prot.combined2$celltypes <- sub("(.*)_.*", "\\1", Idents(prot.combined2))
  2371. Idents(prot.combined2) <- "celltypes"
  2372. cell.types <- c(
  2373. "Classical monocytes",
  2374. "Memory T CD4+",
  2375. "Naive CD4+ T cells",
  2376. "mNK",
  2377. "Effector CD8+ T cells",
  2378. "Memory T CD8+",
  2379. "Nonclassical monocytes",
  2380. "B cells",
  2381. "Intermediate monocytes",
  2382. "mo-DC",
  2383. "NKT-like CD8+",
  2384. "NKT-like CD4+",
  2385. "Naive CD8+ T cells",
  2386. "Treg",
  2387. "pDC",
  2388. "iNK",
  2389. "Platelets",
  2390. "Plasma B cells"
  2391. )
  2392. prot.combined <- subset(prot.combined2, idents = cell.types)
  2393. prot.combined2$celltypes.patient.day <- paste(Idents(prot.combined2), prot.combined2$patient_day, sep = "_")
  2394. Idents(prot.combined2) <- "celltypes.patient.day"
  2395. prot.combined2 <- JoinLayers(prot.combined2)
  2396. cell.types <- c("Nonclassical monocytes","Intermediate monocytes","Classical monocytes","mo-DC")
  2397. #myeloids <- JoinLayers(myeloids)
  2398. for (i in 1:length(cell.types)) {
  2399. zk.response0 <- FindMarkers(prot.combined2, ident.1 = paste0(cell.types[i], "_P16_D15"),
  2400. ident.2 = paste0(cell.types[i], "_P16_D0")
  2401. , slot = "data",
  2402. assay = "RNA",
  2403. features = NULL,
  2404. logfc.threshold = 0,
  2405. test.use = "wilcox",
  2406. min.pct = 0.25,
  2407. min.diff.pct = -Inf,
  2408. verbose = TRUE,
  2409. only.pos = FALSE,
  2410. max.cells.per.ident = Inf,
  2411. random.seed = 1,
  2412. latent.vars = NULL,
  2413. min.cells.feature = 3,
  2414. min.cells.group = 3,
  2415. pseudocount.use = 1,
  2416. mean.fxn = NULL,
  2417. fc.name = NULL,
  2418. base = 2,
  2419. densify = FALSE,
  2420. recorrect_umi = TRUE
  2421. )
  2422. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  2423. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_P16_D15xP16_D0_", cell.types[i], "_DEGs_pct0.25.xlsx"))
  2424. rm(zk.response0)
  2425. }
  2426. prot.combined2$cluster.patient.day <- paste(Idents(prot.combined2), prot.combined2$patient_day, sep = "_")
  2427. Idents(prot.combined2) <- "cluster.patient.day"
  2428. nums <- as.character(40:40)
  2429. #myeloids <- JoinLayers(myeloids)
  2430. for (i in 1:length(nums)) {
  2431. zk.response0 <- FindMarkers(prot.combined2, ident.1 = paste0(nums[i], "_P15_D15"),
  2432. ident.2 = paste0(nums[i], "_P15_D0")
  2433. , slot = "data",
  2434. assay = "RNA",
  2435. features = NULL,
  2436. logfc.threshold = 0,
  2437. test.use = "wilcox",
  2438. min.pct = 0.25,
  2439. min.diff.pct = -Inf,
  2440. verbose = TRUE,
  2441. only.pos = FALSE,
  2442. max.cells.per.ident = Inf,
  2443. random.seed = 1,
  2444. latent.vars = NULL,
  2445. min.cells.feature = 3,
  2446. min.cells.group = 3,
  2447. pseudocount.use = 1,
  2448. mean.fxn = NULL,
  2449. fc.name = NULL,
  2450. base = 2,
  2451. densify = FALSE,
  2452. recorrect_umi = TRUE
  2453. )
  2454. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  2455. write.xlsx(as.data.frame(zk.response0), rowNames = T,file=paste0("wilcox_P15_D15xP15_D0_clus.", nums[i], "_DEGs_pct0.25.xlsx"))
  2456. rm(zk.response0)
  2457. }
  2458. # Nonclassical <- subset(prot.combined2, idents = c("Nonclassical monocytes_P12_D0", "Nonclassical monocytes_P12_D15",
  2459. # "Nonclassical monocytes_P13_D0", "Nonclassical monocytes_P13_D15",
  2460. # "Nonclassical monocytes_P15_D0", "Nonclassical monocytes_P15_D15",
  2461. # "Nonclassical monocytes_P16_D0", "Nonclassical monocytes_P16_D15"))
  2462. # Idents(Nonclassical) <- factor(Idents(Nonclassical), levels = c("Nonclassical monocytes_P12_D0", "Nonclassical monocytes_P12_D15",
  2463. # "Nonclassical monocytes_P13_D0", "Nonclassical monocytes_P13_D15",
  2464. # "Nonclassical monocytes_P15_D0", "Nonclassical monocytes_P15_D15",
  2465. # "Nonclassical monocytes_P16_D0", "Nonclassical monocytes_P16_D15"
  2466. # ))
  2467. #
  2468. # DotPlot(Nonclassical, features = endocytosis,#"IRF8",
  2469. # #cols = c("blue", "red","yellow","green","pink"),
  2470. # #col.max = 20,
  2471. # #col.min = 5,
  2472. # #dot.min = 3,
  2473. # dot.scale = 12,
  2474. # #cluster.idents = T,
  2475. # #scale = F,
  2476. # #split.by = "disease.state",
  2477. # # idents =
  2478. # # c("Nonclassical monocytes_P12_D15", "Nonclassical monocytes_P12_D0", "Nonclassical monocytes_P13_D0", "Nonclassical monocytes_P15_D15",
  2479. # # "Nonclassical monocytes_P15_D0", "Nonclassical monocytes_P16_D15", "Nonclassical monocytes_P16_D0", "Nonclassical monocytes_P13_D15"
  2480. # # )
  2481. # ) + RotatedAxis()
  2482. ######### celltypes records
  2483. library(ggstatsplot)
  2484. myeloids <- subset(prot.combined2, idents = c("0","4","8","13","27","11","7","22","12"))
  2485. #prot.combined2$disease.patient <- paste(prot.combined2$disease.state, prot.combined2$GEM, sep = "_")
  2486. num.cells <- as.data.frame(table(myeloids$patient_day, myeloids$patient_day))
  2487. num.cells <- num.cells[num.cells[,3] !=0,][,2:3]
  2488. num.cells.celltype <- as.data.frame.matrix(table(myeloids$patient_day, myeloids$seurat_clusters))
  2489. freq.num.cells.celltype <- num.cells.celltype / num.cells[,2]*100
  2490. tfreq.num.cells.celltype <- t(freq.num.cells.celltype)
  2491. tfreq.num.cells.celltype <- tfreq.num.cells.celltype[rowSums(tfreq.num.cells.celltype) > 0,]
  2492. write.csv(as.data.frame(tfreq.num.cells.celltype), file="treated_tfreq.num.cells.cluster_myeloids_patient_day.csv")
  2493. #tfreq.num.cells.celltype <- read.csv("treated_tfreq.num.cells.cluster_myeloids_patient_day.csv", header = T, row.names = 1)
  2494. library(RColorBrewer)
  2495. paletteLength <- 40
  2496. colors <- colorRampPalette( rev(brewer.pal(11, "Set3")))(paletteLength)
  2497. n <- 60
  2498. qual_col_pals = brewer.pal.info[brewer.pal.info$category == 'qual',]
  2499. col_vector = unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals)))
  2500. #pie(rep(1,n), col=sample(col_vector, n))
  2501. barplot(tfreq.num.cells.celltype, col = sample(col_vector, n), legend.text = rownames(tfreq.num.cells.celltype),
  2502. xlim = c(0,12), main = "Cell types distribution")
  2503. num.cells <- as.data.frame(table(prot.combined2$patient_day, prot.combined2$patient_day))
  2504. num.cells <- num.cells[num.cells[,3] !=0,][,2:3]
  2505. num.cells.celltype <- as.data.frame.matrix(table(prot.combined2$patient_day, prot.combined2$seurat_clusters))
  2506. freq.num.cells.celltype <- num.cells.celltype / num.cells[,2]*100
  2507. tfreq.num.cells.celltype <- t(freq.num.cells.celltype)
  2508. tfreq.num.cells.celltype <- tfreq.num.cells.celltype[rowSums(tfreq.num.cells.celltype) > 0,]
  2509. write.csv(as.data.frame(freq.num.cells.celltype), file="treated_freq.num.cells.cluster_patient_day.csv")
  2510. num.cells <- as.data.frame(table(prot.combined$patient_day, prot.combined$patient_day))
  2511. num.cells <- num.cells[num.cells[,3] !=0,][,2:3]
  2512. num.cells.celltype <- as.data.frame.matrix(table(prot.combined$patient_day, prot.combined$celltypes))
  2513. freq.num.cells.celltype <- num.cells.celltype / num.cells[,2]*100
  2514. tfreq.num.cells.celltype <- t(freq.num.cells.celltype)
  2515. tfreq.num.cells.celltype <- tfreq.num.cells.celltype[rowSums(tfreq.num.cells.celltype) > 0,]
  2516. df_freqs <- read.csv("treated_freq.num.cells.cluster_patient_day.csv",header = T)
  2517. plt <- ggbetweenstats(data = df_freqs,
  2518. x = treatment,
  2519. y = X8,
  2520. var.equal = F,
  2521. #pairwise.comparisons = T,
  2522. p.adjust.method = "none",
  2523. type = "np"
  2524. )
  2525. ggsave(filename = "treated_clus8_freq-vlnplot_np_new.pdf",
  2526. plot = plt,
  2527. width = 4,
  2528. height = 8,
  2529. device = "pdf")
  2530. nums <- c("0","1","2","3","4","5","6","8","9","17")
  2531. ############# cluster markers
  2532. Idents(prot.combined2) <- "seurat_clusters"
  2533. myeloids <- subset(prot.combined2, idents = c("0","4","8","13",#"27",
  2534. "11","7","22","12"))
  2535. ## Save V5 as V3
  2536. myeloids[["RNA"]] <- JoinLayers(myeloids[["RNA"]])
  2537. myeloids[["RNA"]]$scale.data <- NULL
  2538. myeloids[["RNA3"]] <- as(object = myeloids[["RNA"]], Class = "Assay")
  2539. myeloids[["RNA"]] <- myeloids[["RNA3"]]
  2540. myeloids[["RNA3"]] <- NULL
  2541. sub_myeloids <- subset(myeloids, #cells = Cells(myeloids[["RNA"]]),
  2542. downsample = 5000)
  2543. sub_myeloids <- BuildClusterTree(sub_myeloids, reduction = "umap", reorder = T)
  2544. markers <- FindAllMarkers(sub_myeloids, only.pos = T) %>% group_by(cluster) %>% dplyr::filter(avg_log2FC >1)
  2545. write.xlsx(as.data.frame(markers), rowNames = T,file="wilcox_all.markers_monocyte_clusters.xlsx")
  2546. markers %>% group_by(cluster) %>% dplyr::filter(avg_log2FC >1) %>% slice_head(n = 10) %>%
  2547. ungroup() -> top5
  2548. sub_myeloids <- ScaleData(sub_myeloids, features = top5$gene)
  2549. p <- DoHeatmap(sub_myeloids, features = top5$gene, size = 3,
  2550. cells = 1:30000) + theme(axis.text = element_text(
  2551. size = 7
  2552. )) #+ NoLegend()
  2553. p
  2554. ########## Other plots
  2555. FeaturePlot(prot.combined, features = "CD48",
  2556. pt.size = 0.1,
  2557. #ncol = 2,
  2558. reduction = "umap", raster = F,
  2559. #split.by = "treatment"
  2560. )
  2561. Idents(prot.combined2) <- "seurat_clusters"
  2562. Idents(prot.combined2) <- "celltypes"
  2563. p2 <- VlnPlot(prot.combined, features = "CD244",#c("JUN","STAT1", "CCL3", "CCL3L1"),#c("IRF1","IFNG","IFNGR1","IFNGR2"),#c("CD8A","CD4","CD19"),#c("TMEM176A","TMEM176B"),
  2564. #split.by = "disease",
  2565. group.by = "patient_day",
  2566. #group.by = "celltypes",
  2567. pt.size = 0.05,
  2568. raster = F,
  2569. #ncol = 5,
  2570. #slot = "counts",
  2571. #add.noise = F,
  2572. #log = T,
  2573. #sort = "increasing",
  2574. idents = #c("5"),
  2575. "Nonclassical monocytes"
  2576. #"8", # moDC
  2577. #"2", # Nonclassical
  2578. #"6", # Intermediate
  2579. # c("0","1","3","4","5","9","17"),#,"13","25"), # Classical monocytes
  2580. ) + scale_y_continuous(limits = c(0.000, 5.2)) +
  2581. stat_summary(fun = mean, geom = "point",size = 30, colour = "black", shape = 95)
  2582. p2$layers[[2]]$aes_params$alpha <- 0.1
  2583. p2
  2584. p2 <- VlnPlot(prot.combined2, features = "TBXAS1",#c("JUN","STAT1", "CCL3", "CCL3L1"),#c("IRF1","IFNG","IFNGR1","IFNGR2"),#c("CD8A","CD4","CD19"),#c("TMEM176A","TMEM176B"),
  2585. #split.by = "disease",
  2586. group.by = "prog",
  2587. pt.size = 0.05,
  2588. raster = F,
  2589. #ncol = 5,
  2590. #slot = "counts",
  2591. #add.noise = F,
  2592. #log = T,
  2593. #sort = "increasing",
  2594. idents = #"4",
  2595. #"8", # moDC
  2596. "2", # Nonclassical
  2597. #"6", # Intermediate
  2598. #c("0","1","3","4","5","9","13","17","25"), # Classical monocytes
  2599. ) + scale_y_continuous(limits = c(0.000, 3.6)) +
  2600. stat_summary(fun = mean, geom = "point",size = 35, colour = "black", shape = 95)
  2601. p2$layers[[2]]$aes_params$alpha <- 0.2
  2602. p2
  2603. VlnPlot(prot.combined2, features = ccrs,
  2604. #"IRF8",
  2605. pt.size = 0.01,
  2606. ncol = 3,
  2607. raster = F,
  2608. #idents = "Classical",#c("0","5"),
  2609. split.by = "disease.state",
  2610. #group.by = "celltypes"
  2611. #, combine = F
  2612. ) + theme(legend.position = 'right')
  2613. zk.response0 <- FindMarkers(prot.combined2, ident.1 = c("0","4"),
  2614. ident.2 = c("8","13","27"),
  2615. slot = "data",
  2616. assay = "RNA",
  2617. features = NULL,
  2618. logfc.threshold = 0,
  2619. test.use = "wilcox",
  2620. min.pct = 0.25,
  2621. min.diff.pct = -Inf,
  2622. verbose = TRUE,
  2623. only.pos = FALSE,
  2624. max.cells.per.ident = Inf,
  2625. random.seed = 1,
  2626. latent.vars = NULL,
  2627. min.cells.feature = 3,
  2628. min.cells.group = 3,
  2629. pseudocount.use = 1,
  2630. mean.fxn = NULL,
  2631. fc.name = NULL,
  2632. base = 2,
  2633. densify = FALSE,
  2634. recorrect_umi = TRUE
  2635. )
  2636. zk.response0 <- zk.response0[zk.response0$p_val_adj < 0.1,]
  2637. write.xlsx(as.data.frame(zk.response0), rowNames = T,file="wilcox_clus_0.4x8.13.27_DEGs_pct0.25.xlsx")
  2638. rm(zk.response0)

V5_prot_clin_trial.R at commit f781e9a, no license · at the source

Overview

Authors: Panayota Kolypetri1, Patrick da Silva1, Ronaldo S. Francisco Jr1, Dan Frenkel2, Rachael R. Cecere1, Pien C. J. Kiliaan1, Federico Montini1, Shrishti Saxena1, William A. Clementi3, Xuejun Liu4, Cheng Sun5, Regan W. Bergmark6, Tarun Singhal1, Taylor J. Saraceno1, Joseph Zimmermann7, Seth A. Gale1, Dennis J. Selkoe1, Tanuja Chitnis1, Howard L. Weiner1
  1. Ann Romney Center for Neurologic Diseases, Brigham & Women’s Hospital, Harvard Medical School,Boston, MA USA
  2. Department of Neurobiology, George S. Wise Faculty of Life Sciences, and Sagol School of Neuroscience, Tel Aviv University,Tel Aviv, Israel
  3. Clementi Associates, Bryn Mawr, PA USA
  4. I-Mab Biopharma US Limited,Rockville, MD USA
  5. Jiangsu Nhwa Pharmaceutical Co. Ltd.,Xuzhou, Jiangsu China
  6. Center for Surgery and Public Health, Department of Surgery, Brigham and Women’s Hospital and Department of Otolaryngology-Head and Neck Surgery, Harvard Medical School,Boston, MA USA
  7. Inspirevax Inc. Montréal, Montréal, QC Canada
Journal: npj aging, volume 12, issue 1, article 126
Dates: received 18 September 2025; accepted 28 April 2026; published online 5 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41514-026-00397-3 · PMID 42248874 · PMCID PMC13558635 · OpenAlex W4415973101
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), Alzheimer's / dementia (population), clinical / translational (subfield)
Methods: Statistics, Smoothing, state filtering, decompositions, Machine learning, Connectivity
Keywords: Diseases, Immunology, Neurology, Neuroscience
Topic: Alzheimer's disease research and treatments (Cellular and Molecular Neuroscience, Neuroscience), according to OpenAlex
Funding: Jiangsu Nhwa Pharmaceutical Co., Ltd and IMab Pharmaceuticals; Davis Alzheimer Prevention Program; Ann Romney Center for Neurologic Diseases; National Institutes of Health (NIA R21AG072486)
Citations: cited by 2 papers (Europe PMC); 76 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 12 matches between paragraphs and lines of code.

ronaldosfjunior/Kolypetri-et-al-2025

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: f781e9af849a60352d89aba78551bbf4e920d484, 12 September 2025
Languages: R (5)
Size: 6 files, 5 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: ggplot2 (5 files), tidyverse (5 files), pheatmap (4 files), car (3 files), DESeq2 (3 files), ggpubr (3 files), limma (3 files), reticulate (3 files), data.table (2 files), Harmony (2 files), patchwork (2 files), reshape2 (2 files), Seurat (2 files), circlize (1 file), cowplot (1 file), Plotly (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
6 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41514-026-00397-3.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 5 scripts, each with its path and the digest of its content;
  • 12 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41514-026-00397-3.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 19 authors, 4 keywords, 4 funders, 75 references.

Cite

This paper

Kolypetri, P., da Silva, P., Francisco, R. S., Frenkel, D., Cecere, R. R., Kiliaan, P. C. J., Montini, F., Saxena, S., Clementi, W. A., Liu, X., Sun, C., Bergmark, R. W., Singhal, T., Saraceno, T. J., Zimmermann, J., Gale, S. A., Selkoe, D. J., Chitnis, T., & Weiner, H. L. (2026). Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8&lt;sup&gt;+&lt;/sup&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial. npj aging, 12(1), 126. https://doi.org/10.1038/s41514-026-00397-3

BibTeX

@article{kolypetri2026nasal,
author = {Kolypetri, Panayota and da Silva, Patrick and Francisco, Ronaldo S. and Frenkel, Dan and Cecere, Rachael R. and Kiliaan, Pien C. J. and Montini, Federico and Saxena, Shrishti and Clementi, William A. and Liu, Xuejun and Sun, Cheng and Bergmark, Regan W. and Singhal, Tarun and Saraceno, Taylor J. and Zimmermann, Joseph and Gale, Seth A. and Selkoe, Dennis J. and Chitnis, Tanuja and Weiner, Howard L.},
title = {{Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8\&lt;sup\&gt;+\&lt;/sup\&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial}},
journal = {npj aging},
year = {2026},
month = jun,
volume = {12},
number = {1},
pages = {126},
publisher = {Nature Publishing Group},
issn = {2731-6068},
doi = {10.1038/s41514-026-00397-3},
url = {https://doi.org/10.1038/s41514-026-00397-3},
pmid = {42248874},
pmcid = {PMC13558635}
}

RIS

TY - JOUR
AU - Kolypetri, Panayota
AU - da Silva, Patrick
AU - Francisco, Ronaldo S.
AU - Frenkel, Dan
AU - Cecere, Rachael R.
AU - Kiliaan, Pien C. J.
AU - Montini, Federico
AU - Saxena, Shrishti
AU - Clementi, William A.
AU - Liu, Xuejun
AU - Sun, Cheng
AU - Bergmark, Regan W.
AU - Singhal, Tarun
AU - Saraceno, Taylor J.
AU - Zimmermann, Joseph
AU - Gale, Seth A.
AU - Selkoe, Dennis J.
AU - Chitnis, Tanuja
AU - Weiner, Howard L.
TI - Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8&lt;sup&gt;+&lt;/sup&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial
T2 - npj aging
J2 - NPJ Aging
PY - 2026
DA - 2026/06/05
VL - 12
IS - 1
SP - 126
SN - 2731-6068
PB - Nature Publishing Group
DO - 10.1038/s41514-026-00397-3
UR - https://doi.org/10.1038/s41514-026-00397-3
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41514-026-00397-3",
"type": "article-journal",
"title": "Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8&lt;sup&gt;+&lt;/sup&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial",
"container-title": "npj aging",
"author": [
{
"family": "Kolypetri",
"given": "Panayota"
},
{
"family": "da Silva",
"given": "Patrick"
},
{
"family": "Francisco",
"given": "Ronaldo S."
},
{
"family": "Frenkel",
"given": "Dan"
},
{
"family": "Cecere",
"given": "Rachael R."
},
{
"family": "Kiliaan",
"given": "Pien C. J."
},
{
"family": "Montini",
"given": "Federico"
},
{
"family": "Saxena",
"given": "Shrishti"
},
{
"family": "Clementi",
"given": "William A."
},
{
"family": "Liu",
"given": "Xuejun"
},
{
"family": "Sun",
"given": "Cheng"
},
{
"family": "Bergmark",
"given": "Regan W."
},
{
"family": "Singhal",
"given": "Tarun"
},
{
"family": "Saraceno",
"given": "Taylor J."
},
{
"family": "Zimmermann",
"given": "Joseph"
},
{
"family": "Gale",
"given": "Seth A."
},
{
"family": "Selkoe",
"given": "Dennis J."
},
{
"family": "Chitnis",
"given": "Tanuja"
},
{
"family": "Weiner",
"given": "Howard L."
}
],
"container-title-short": "NPJ Aging",
"volume": "12",
"issue": "1",
"page": "126",
"DOI": "10.1038/s41514-026-00397-3",
"PMID": "42248874",
"PMCID": "PMC13558635",
"ISSN": "2731-6068",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41514-026-00397-3",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
5
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1016/j.celrep.2025.116877 [code]
Spatially resolved molecular sex differences at single-cell resolution in the adult human ventromedial and arcuate hypothalamus.
Journal: Cell reports
In common: Harmony, reticulate, limma, 12 other tools, 3 references
[2] doi:10.1038/s41467-024-48916-8 [code]
Spatially resolved multiomics on the neuronal effects induced by spaceflight in mice.
Journal: Nature communications
In common: Harmony, reticulate, car, 9 other tools, 4 references
[3] doi:10.1186/s13073-023-01155-w
The neuroimmune axis of Alzheimer's disease.
Journal: Genome medicine
In common: Alzheimer's / dementia, 12 references
[4] doi:10.1038/s41586-025-09662-z [code]
Lymphoid gene expression supports neuroprotective microglia function.
Journal: Nature
In common: reticulate, pheatmap, Seurat, 6 other tools, Alzheimer's / dementia, 6 references
[5] doi:10.7554/elife.98775 [code]
Chronic hyperactivation of midbrain dopamine neurons causes preferential dopamine neuron degeneration.
Journal: eLife
In common: Harmony, circlize, Plotly, 8 other tools, 4 references
[6] doi:10.1038/s41467-025-60747-9 [code]
FABP7 is increased in progressive multiple sclerosis and induces a pro-inflammatory phenotype in monocytes through a glycolytic switch.
Journal: Nature communications
In common: DESeq2, pheatmap, Seurat, 4 other tools, 3 references, author Shrishti Saxena
[7] doi:10.1186/s12974-025-03552-x [code]
Cytokine expression profile in the human brain of older adults.
Journal: Journal of neuroinflammation
In common: limma, circlize, Seurat, 6 other tools, Alzheimer's / dementia, 2 references
[8] doi:10.1038/s41467-024-46630-z [code]
A single nuclear transcriptomic characterisation of mechanisms responsible for impaired angiogenesis and blood-brain barrier function in Alzheimer's disease.
Journal: Nature communications
In common: limma, circlize, pheatmap, 6 other tools, Alzheimer's / dementia, 2 references
[9] doi:10.1016/j.cell.2026.05.047 [code]
An emergent disease-associated motor neuron state precedes cell death in ALS.
Journal: Cell
In common: DESeq2, pheatmap, Seurat, 4 other tools, 6 references
[10] doi:10.1242/dev.204591 [code]
An in vivo CRISPR screen in chick embryos reveals a role for MLLT3 in specification of neural cells from the caudal epiblast.
Journal: Development (Cambridge, England)
In common: pheatmap, Plotly, Seurat, 6 other tools, 3 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3.svg)](https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3"><img src="https://openscicode.org/badge/doi/10.1038/s41514-026-00397-3.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.