OSCR

Th17 effector cytokines induce shared and distinct microglial and endothelial cell responses in a mouse model for post-streptococcal encephalitis.

Code ↔ Paper

14 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.

The 14 matches
  1. [1] § Methods › Multiplexed error-robust in situ hybridization (MERFISH) ↔ 04_WayneEtAl_MERFISH-2.R, lines 283–338 · score 1.00 · Ap2m1, Baiap2l1, C1qa, C1qbp, C1qc, C3ar1
  2. [2] § Methods › Multiplexed error-robust in situ hybridization (MERFISH) ↔ 01_WayneEtAl_scRNAseq.R, lines 1116–1181 · score 1.00 · Csf1r, Il1a, Il1rn, Il2rg, Tnfsf13b, Csf2ra
  3. [3] § Methods › Quantification and statistical analysis › Analysis of scRNA-seq data ↔ 01_WayneEtAl_scRNAseq.R, lines 1116–1181 · score 0.99 · Oas1a, H2 Ab1, H2 Eb1, H2 K1, H2 D1, Cx3cr1
  4. [4] § Methods › Quantification and statistical analysis › Analysis of scRNA-seq data ↔ 01_WayneEtAl_scRNAseq.R, lines 323–399 · score 0.99 · Atp13a5, Cd209a, Col1a1, Klrb1c, dendritic cells, Ly6g
  5. [5] § Methods › Quantification and statistical analysis › Analysis of MERFISH data ↔ 04_WayneEtAl_MERFISH-2.R, lines 223–281 · score 0.92 · Cd3e, olfactory ensheathing cells, Cd8a, P2ry12, Cemip, Mmp9
  6. [6] § Methods › Quantification and statistical analysis › Analysis of scRNA-seq data ↔ 03_WayneEtAl_MERFISH-1.R, lines 166–216 · score 0.76 · linear dimensional reduction, batch correction, variable features, endothelial cells, PCA, resolution
  7. [7] § Results › Microglia upregulate inflammatory and antigen-presentation programs after GAS infections ↔ 01_WayneEtAl_scRNAseq.R, lines 978–1029 · score 0.71 · srMG2, hMG1, srMG1, srMG4, Ccl3, Ccl4
  8. [8] § Results › GAS infection alters predicted cell–cell communication networks in the OB ↔ 05_WayneEtAl_CellChat.R, lines 52–100 · score 0.69 · ligand receptor interactions, CellChat, Inferred, networks, signaling, pathways
  9. [9] § Results › BECs upregulate inflammatory programs and downregulate BBB-related transcripts after GAS infections ↔ 01_WayneEtAl_scRNAseq.R, lines 732–793 · score 0.68 · Mfsd2a, Itm2a, ECM, Cav1, Cavin1, junctions
  10. [10] § Methods › Quantification and statistical analysis › Analysis of MERFISH data ↔ 03_WayneEtAl_MERFISH-1.R, lines 218–256 · score 0.61 · python script, Nearest neighbor, Endothelial cell, distance, OB, MERFISH
  11. [11] § Results › Streptococcus-responsive microglia are enriched in the glomerular OB layer in close proximity to T cells ↔ 04_WayneEtAl_MERFISH-2.R, lines 421–486 · score 0.60 · granular layer, P2ry12, gene expression, Axl, Gpr34, Ifi30
  12. [12] § Methods › Quantification and statistical analysis › Analysis of scRNA-seq data ↔ 01_WayneEtAl_scRNAseq.R, lines 795–860 · score 0.60 · batch correction, variable features, Elbow, Harmony, UMAP, PCA
  13. [13] § Results › Microglia and BECs show major transcriptional shifts after multiple GAS infections ↔ 02_WayneEtAl_CrossEntropy.R, lines 1–43 · score 0.55 · scRNAseq, cross entropy, olfactory bulb, GAS infection, UMAP, mice
  14. [14] § Results › Microglia and BECs show major transcriptional shifts after multiple GAS infections ↔ 02_WayneEtAl_CrossEntropy.R, lines 244–274 · score 0.55 · cross entropy, olfactory ensheathing cells, OECs, filtering, astrocytes, UMAP

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 1,477 lines · 72 KB · no license · 6 matches

  1. # code for scRNAseq analysis of mouse olfactory bulb after GAS infection
  2. # analysis run with R v 4.4.1 and Seurat v 5.1.0
  3. .rs.restartR() # restart R
  4. rm(list=ls()) # clear environment
  5. # load programs
  6. library(Seurat) # version 5.1.0
  7. library(dplyr) # version 1.1.4
  8. library(tibble) # version 3.2.1
  9. library(ggplot2) # version 3.5.1
  10. library(harmony) # version 1.2.0
  11. library(SeuratExtend) # version 1.0.0
  12. ## data processing and OB clustering ----
  13. ## importing & merging data, adding meta data & removing dead cell
  14. # import data files & merge
  15. ds004.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW004/raw_feature_bc_matrix")
  16. ds005.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW005/raw_feature_bc_matrix")
  17. ds008.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW008/raw_feature_bc_matrix")
  18. ds009.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW009/raw_feature_bc_matrix")
  19. ds010.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW010/raw_feature_bc_matrix")
  20. ds011.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW011/raw_feature_bc_matrix")
  21. ds012.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW012/raw_feature_bc_matrix")
  22. ds013.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW013/raw_feature_bc_matrix")
  23. ds014.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW014/raw_feature_bc_matrix")
  24. ds015.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW015/raw_feature_bc_matrix")
  25. ds016.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW016/raw_feature_bc_matrix")
  26. ds017.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW017/raw_feature_bc_matrix")
  27. ds018.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW018/raw_feature_bc_matrix")
  28. ds021.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW021/raw_feature_bc_matrix")
  29. ds022.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW022/raw_feature_bc_matrix")
  30. ds023.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW023/raw_feature_bc_matrix")
  31. ds024.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW024/raw_feature_bc_matrix")
  32. ds025.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW025/raw_feature_bc_matrix")
  33. ds026.data <- Read10X(data.dir = "Data/Raw data for Seurat/CW026/raw_feature_bc_matrix")
  34. ds004 <- CreateSeuratObject(counts = ds004.data, project = "PBS", min.cells = 3, min.features = 200)
  35. ds005 <- CreateSeuratObject(counts = ds005.data, project = "GAS", min.cells = 3, min.features = 200)
  36. ds008 <- CreateSeuratObject(counts = ds008.data, project = "GAS", min.cells = 3, min.features = 200)
  37. ds009 <- CreateSeuratObject(counts = ds009.data, project = "GAS", min.cells = 3, min.features = 200)
  38. ds010 <- CreateSeuratObject(counts = ds010.data, project = "RORg", min.cells = 3, min.features = 200)
  39. ds011 <- CreateSeuratObject(counts = ds011.data, project = "GAS", min.cells = 3, min.features = 200) # Setting orig.ident on CW011 as "GAS" but condition as "Isotype_mAb"
  40. ds012 <- CreateSeuratObject(counts = ds012.data, project = "IL-17A_mAb", min.cells = 3, min.features = 200)
  41. ds013 <- CreateSeuratObject(counts = ds013.data, project = "RORg", min.cells = 3, min.features = 200)
  42. ds014 <- CreateSeuratObject(counts = ds014.data, project = "PBS", min.cells = 3, min.features = 200)
  43. ds015 <- CreateSeuratObject(counts = ds015.data, project = "GAS", min.cells = 3, min.features = 200) # Setting orig.ident on CW015 as "GAS" but condition as "Isotype_mAb"
  44. ds016 <- CreateSeuratObject(counts = ds016.data, project = "IL-17A_mAb", min.cells = 3, min.features = 200)
  45. ds017 <- CreateSeuratObject(counts = ds017.data, project = "IL-17A_mAb", min.cells = 3, min.features = 200)
  46. ds018 <- CreateSeuratObject(counts = ds018.data, project = "RORg", min.cells = 3, min.features = 200)
  47. ds021 <- CreateSeuratObject(counts = ds021.data, project = "GAS", min.cells = 3, min.features = 200) # Setting orig.ident on CW021 as "GAS" but condition as "Csf2flox"
  48. ds022 <- CreateSeuratObject(counts = ds022.data, project = "Csf2_CD4ko", min.cells = 3, min.features = 200)
  49. ds023 <- CreateSeuratObject(counts = ds023.data, project = "PBS", min.cells = 3, min.features = 200)
  50. ds024 <- CreateSeuratObject(counts = ds024.data, project = "GAS", min.cells = 3, min.features = 200)
  51. ds025 <- CreateSeuratObject(counts = ds025.data, project = "GAS", min.cells = 3, min.features = 200) # Setting orig.ident on CW025 as "GAS" but condition as "Csf2flox"
  52. ds026 <- CreateSeuratObject(counts = ds026.data, project = "Csf2_CD4ko", min.cells = 3, min.features = 200)
  53. dsmerged <- merge(ds004, y = c(ds005, ds008, ds009, ds010, ds011, ds012, ds013, ds014, ds015, ds016, ds017, ds018, ds021, ds022, ds023, ds024, ds025, ds026), add.cell.ids = c("CW_004", "CW_005", "CW_008", "CW_009", "CW_010", "CW_011", "CW_012", "CW_013", "CW_014", "CW_015", "CW_016", "CW_017", "CW_018", "CW_021", "CW_022", "CW_023", "CW_024", "CW_025", "CW_026"))
  54. rm(ds004, ds004.data, ds005, ds005.data, ds008, ds008.data, ds009, ds009.data, ds010, ds010.data, ds011, ds011.data, ds012, ds012.data, ds013, ds013.data, ds014, ds014.data, ds015, ds015.data, ds016, ds016.data, ds017, ds017.data, ds018, ds018.data, ds021, ds021.data, ds022, ds022.data, ds023, ds023.data, ds024, ds024.data, ds025, ds025.data, ds026, ds026.data)
  55. # add meta data
  56. # add sample to meta data
  57. samplevec <- rep("CW004",nrow([email hidden]))
  58. samplevec[grep("CW_005",rownames([email hidden]))] <- "CW005"
  59. samplevec[grep("CW_008",rownames([email hidden]))] <- "CW008"
  60. samplevec[grep("CW_009",rownames([email hidden]))] <- "CW009"
  61. samplevec[grep("CW_010",rownames([email hidden]))] <- "CW010"
  62. samplevec[grep("CW_011",rownames([email hidden]))] <- "CW011"
  63. samplevec[grep("CW_012",rownames([email hidden]))] <- "CW012"
  64. samplevec[grep("CW_013",rownames([email hidden]))] <- "CW013"
  65. samplevec[grep("CW_014",rownames([email hidden]))] <- "CW014"
  66. samplevec[grep("CW_015",rownames([email hidden]))] <- "CW015"
  67. samplevec[grep("CW_016",rownames([email hidden]))] <- "CW016"
  68. samplevec[grep("CW_017",rownames([email hidden]))] <- "CW017"
  69. samplevec[grep("CW_018",rownames([email hidden]))] <- "CW018"
  70. samplevec[grep("CW_021",rownames([email hidden]))] <- "CW021"
  71. samplevec[grep("CW_022",rownames([email hidden]))] <- "CW022"
  72. samplevec[grep("CW_023",rownames([email hidden]))] <- "CW023"
  73. samplevec[grep("CW_024",rownames([email hidden]))] <- "CW024"
  74. samplevec[grep("CW_025",rownames([email hidden]))] <- "CW025"
  75. samplevec[grep("CW_026",rownames([email hidden]))] <- "CW026"
  76. table(samplevec)
  77. [email hidden]$sample=samplevec
  78. # add batch to meta data
  79. batchvec <- rep("batch A",nrow([email hidden]))
  80. batchvec[grep("CW_008",rownames([email hidden]))] <- "batch B"
  81. batchvec[grep("CW_009",rownames([email hidden]))] <- "batch C"
  82. batchvec[grep("CW_010",rownames([email hidden]))] <- "batch C"
  83. batchvec[grep("CW_011",rownames([email hidden]))] <- "batch D"
  84. batchvec[grep("CW_012",rownames([email hidden]))] <- "batch D"
  85. batchvec[grep("CW_013",rownames([email hidden]))] <- "batch E"
  86. batchvec[grep("CW_014",rownames([email hidden]))] <- "batch F"
  87. batchvec[grep("CW_015",rownames([email hidden]))] <- "batch F"
  88. batchvec[grep("CW_016",rownames([email hidden]))] <- "batch F"
  89. batchvec[grep("CW_017",rownames([email hidden]))] <- "batch G"
  90. batchvec[grep("CW_021",rownames([email hidden]))] <- "batch H"
  91. batchvec[grep("CW_022",rownames([email hidden]))] <- "batch H"
  92. batchvec[grep("CW_023",rownames([email hidden]))] <- "batch I"
  93. batchvec[grep("CW_024",rownames([email hidden]))] <- "batch I"
  94. batchvec[grep("CW_018",rownames([email hidden]))] <- "batch J"
  95. batchvec[grep("CW_025",rownames([email hidden]))] <- "batch K"
  96. batchvec[grep("CW_026",rownames([email hidden]))] <- "batch K"
  97. table(batchvec)
  98. [email hidden]$batch=batchvec
  99. # add enrichment to meta data
  100. enrichmentvec <- rep("cd31_cd11b_FACS",nrow([email hidden]))
  101. enrichmentvec[grep("CW_008",rownames([email hidden]))] <- "live_FACS"
  102. enrichmentvec[grep("CW_023",rownames([email hidden]))] <- "live_FACS"
  103. enrichmentvec[grep("CW_024",rownames([email hidden]))] <- "live_FACS"
  104. table(enrichmentvec)
  105. [email hidden]$enrichment=enrichmentvec
  106. # add inoculate to meta data
  107. inoculatevec <- rep("GAS",nrow([email hidden]))
  108. inoculatevec[grep("CW_004",rownames([email hidden]))] <- "PBS"
  109. inoculatevec[grep("CW_014",rownames([email hidden]))] <- "PBS"
  110. inoculatevec[grep("CW_023",rownames([email hidden]))] <- "PBS"
  111. table(inoculatevec)
  112. [email hidden]$inoculate=inoculatevec
  113. # add tissue to meta data
  114. tissuevec <- rep("OB",nrow([email hidden]))
  115. table(tissuevec)
  116. [email hidden]$tissue=tissuevec
  117. # add genotype to meta data
  118. genotypevec <- rep("WT",nrow([email hidden]))
  119. genotypevec[grep("CW_010",rownames([email hidden]))] <- "RORg"
  120. genotypevec[grep("CW_013",rownames([email hidden]))] <- "RORg"
  121. genotypevec[grep("CW_018",rownames([email hidden]))] <- "RORg"
  122. genotypevec[grep("CW_021",rownames([email hidden]))] <- "Csf2flox"
  123. genotypevec[grep("CW_022",rownames([email hidden]))] <- "Csf2floxCD4Cre"
  124. genotypevec[grep("CW_025",rownames([email hidden]))] <- "Csf2flox"
  125. genotypevec[grep("CW_026",rownames([email hidden]))] <- "Csf2floxCD4Cre"
  126. table(genotypevec)
  127. [email hidden]$genotype=genotypevec
  128. # add drug to meta data
  129. drugvec <- rep("none",nrow([email hidden]))
  130. drugvec[grep("CW_011",rownames([email hidden]))] <- "Isotype_mAb"
  131. drugvec[grep("CW_012",rownames([email hidden]))] <- "IL-17A_mAb"
  132. drugvec[grep("CW_015",rownames([email hidden]))] <- "Isotype_mAb"
  133. drugvec[grep("CW_016",rownames([email hidden]))] <- "IL-17A_mAb"
  134. drugvec[grep("CW_017",rownames([email hidden]))] <- "IL-17A_mAb"
  135. drugvec[grep("CW_021",rownames([email hidden]))] <- "4-OH-tamoxifen"
  136. drugvec[grep("CW_022",rownames([email hidden]))] <- "4-OH-tamoxifen"
  137. drugvec[grep("CW_025",rownames([email hidden]))] <- "4-OH-tamoxifen"
  138. drugvec[grep("CW_026",rownames([email hidden]))] <- "4-OH-tamoxifen"
  139. table(drugvec)
  140. [email hidden]$drug=drugvec
  141. # add condition to meta data
  142. conditionvec <- rep("GAS",nrow([email hidden]))
  143. conditionvec[grep("CW_004",rownames([email hidden]))] <- "PBS"
  144. conditionvec[grep("CW_010",rownames([email hidden]))] <- "RORg"
  145. conditionvec[grep("CW_011",rownames([email hidden]))] <- "Isotype_mAb"
  146. conditionvec[grep("CW_012",rownames([email hidden]))] <- "IL-17A_mAb"
  147. conditionvec[grep("CW_013",rownames([email hidden]))] <- "RORg"
  148. conditionvec[grep("CW_014",rownames([email hidden]))] <- "PBS"
  149. conditionvec[grep("CW_015",rownames([email hidden]))] <- "Isotype_mAb"
  150. conditionvec[grep("CW_016",rownames([email hidden]))] <- "IL-17A_mAb"
  151. conditionvec[grep("CW_017",rownames([email hidden]))] <- "IL-17A_mAb"
  152. conditionvec[grep("CW_018",rownames([email hidden]))] <- "RORg"
  153. conditionvec[grep("CW_021",rownames([email hidden]))] <- "Csf2flox"
  154. conditionvec[grep("CW_022",rownames([email hidden]))] <- "Csf2_CD4ko"
  155. conditionvec[grep("CW_023",rownames([email hidden]))] <- "PBS"
  156. conditionvec[grep("CW_025",rownames([email hidden]))] <- "Csf2flox"
  157. conditionvec[grep("CW_026",rownames([email hidden]))] <- "Csf2_CD4ko"
  158. table(conditionvec)
  159. [email hidden]$condition=conditionvec
  160. # add timepoint to meta data
  161. timepointvec <- rep("18hrs",nrow([email hidden]))
  162. table(timepointvec)
  163. [email hidden]$timepoint=timepointvec
  164. # add sex to meta data
  165. sexvec <- rep("female",nrow([email hidden]))
  166. table(sexvec)
  167. [email hidden]$sex=sexvec
  168. # add strain to meta data
  169. strainvec <- rep("C57BL6J",nrow([email hidden]))
  170. table(strainvec)
  171. [email hidden]$strain=strainvec
  172. # add age to meta data
  173. agevec <- rep("P56",nrow([email hidden])) #CW005, 008, 025 and 026 were also P56
  174. agevec[grep("CW_004",rownames([email hidden]))] <- "P53"
  175. agevec[grep("CW_009",rownames([email hidden]))] <- "P60"
  176. agevec[grep("CW_010",rownames([email hidden]))] <- "P59"
  177. agevec[grep("CW_011",rownames([email hidden]))] <- "P59"
  178. agevec[grep("CW_012",rownames([email hidden]))] <- "P58"
  179. agevec[grep("CW_013",rownames([email hidden]))] <- "P60"
  180. agevec[grep("CW_014",rownames([email hidden]))] <- "P53"
  181. agevec[grep("CW_015",rownames([email hidden]))] <- "P57"
  182. agevec[grep("CW_016",rownames([email hidden]))] <- "P57"
  183. agevec[grep("CW_017",rownames([email hidden]))] <- "P60"
  184. agevec[grep("CW_018",rownames([email hidden]))] <- "P57"
  185. agevec[grep("CW_021",rownames([email hidden]))] <- "P57"
  186. agevec[grep("CW_022",rownames([email hidden]))] <- "P58"
  187. agevec[grep("CW_023",rownames([email hidden]))] <- "P60"
  188. agevec[grep("CW_024",rownames([email hidden]))] <- "P60"
  189. table(agevec)
  190. [email hidden]$age=agevec
  191. # add pooled animal number to meta data
  192. pooledvec <- rep("n=3",nrow([email hidden]))
  193. pooledvec[grep("CW_012",rownames([email hidden]))] <- "n=2"
  194. pooledvec[grep("CW_015",rownames([email hidden]))] <- "n=2"
  195. pooledvec[grep("CW_016",rownames([email hidden]))] <- "n=2"
  196. pooledvec[grep("CW_021",rownames([email hidden]))] <- "n=2"
  197. pooledvec[grep("CW_022",rownames([email hidden]))] <- "n=2"
  198. table(pooledvec)
  199. [email hidden]$pooled=pooledvec
  200. rm(samplevec, batchvec, enrichmentvec, tissuevec, genotypevec, drugvec, inoculatevec, conditionvec, timepointvec, sexvec, strainvec, agevec, pooledvec)
  201. # remove dead cells
  202. dsmerged[["percent.mt"]] <- PercentageFeatureSet(dsmerged, pattern = "^mt-")
  203. Idents(object=dsmerged) <- [email hidden]$sample
  204. VlnPlot(dsmerged, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), pt.size = 0)
  205. dsmerged <- subset(dsmerged, subset = nCount_RNA > 1000 & nCount_RNA < 50000 & percent.mt < 20)
  206. VlnPlot(dsmerged, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), pt.size = 0)
  207. ## clustering and batch correction
  208. # normalize & generate PCA
  209. dsmerged <- NormalizeData(dsmerged)
  210. dsmerged <- FindVariableFeatures(dsmerged, selection.method = "vst", nfeatures = 3000)
  211. top10 <- head(VariableFeatures(dsmerged), 10)
  212. plot1 <- VariableFeaturePlot(dsmerged)
  213. plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE, xnudge = 0, ynudge = 0)
  214. plot2
  215. all.genes <- rownames(dsmerged)
  216. dsmerged <- ScaleData(dsmerged, features = all.genes)
  217. dsmerged <- RunPCA(dsmerged, features = VariableFeatures(object = dsmerged))
  218. print(dsmerged[["pca"]], dims = 1:5, nfeatures = 5)
  219. VizDimLoadings(dsmerged, dims = 1:5, reduction = "pca")
  220. ElbowPlot(dsmerged,ndims=50)
  221. dsmerged <- FindNeighbors(dsmerged, dims = 1:39)
  222. dsmerged <- FindClusters(dsmerged, resolution = 1)
  223. dsmerged <- RunUMAP(dsmerged, dims = 1:39)
  224. DimPlot(dsmerged, reduction = "umap",label=T)
  225. DimPlot(dsmerged, reduction = "umap",group.by="orig.ident")
  226. dsmerged <- RunTSNE(dsmerged, dims = 1:39)
  227. DimPlot(dsmerged, reduction = "tsne",label=T)
  228. DimPlot(dsmerged, reduction = "tsne",group.by="orig.ident")
  229. rm(plot1, plot2, all.genes, top10)
  230. # run harmony to reduce batch effects
  231. pre.harmony.umap <- DimPlot(dsmerged, reduction = "umap",group.by="batch")
  232. pre.harmony.tsne <- DimPlot(dsmerged, reduction = "tsne",group.by="batch")
  233. dsmerged <- dsmerged %>%
  234. RunHarmony("batch", plot_convergence = TRUE)
  235. harmony_embeddings <- Embeddings(dsmerged, 'harmony')
  236. harmony_embeddings[1:5, 1:5]
  237. dsmerged <- dsmerged %>%
  238. RunUMAP(reduction = "harmony", dims = 1:39) %>%
  239. FindNeighbors(reduction = "harmony", dims = 1:39) %>%
  240. FindClusters(resolution = 1) %>%
  241. identity()
  242. print(pre.harmony.umap)
  243. DimPlot(dsmerged, reduction = "umap",label=F)
  244. DimPlot(dsmerged, reduction = "umap",label=F, split.by ="batch")
  245. dsmerged <- dsmerged %>%
  246. RunTSNE(reduction = "harmony", dims = 1:39) %>%
  247. FindNeighbors(reduction = "harmony", dims = 1:39) %>%
  248. FindClusters(resolution = 1) %>%
  249. identity()
  250. print(pre.harmony.tsne)
  251. DimPlot(dsmerged, reduction = "tsne",label=T)
  252. DimPlot(dsmerged, reduction = "tsne",group.by="condition")
  253. saveRDS(dsmerged, file = "02_RDS files/dsmerged_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  254. rm(pre.harmony.umap, pre.harmony.tsne, harmony_embeddings)
  255. ## assign cell type identities
  256. # identify cell types
  257. genes <- VariableFeatures(dsmerged)
  258. toplot <- CalcStats(dsmerged, features = genes, method = "zscore", order = "p", n = 5)
  259. Heatmap(toplot, lab_fill = "zscore")
  260. neuroglial.markers <- c("Snap25", "Dcx", "Gfap","Aqp4", "Frzb","Cldn5", "Pecam1", "Pdgfra","Pdgfrb", "Atp13a5", "Col1a1", "Fbln1")
  261. lymphoid.markers <- c("Ptprc", "Cd3e", "Cd4", "Cd8a", "Cd163l1", "Klrb1c", "Cd19", "Ms4a1")
  262. myeloid.markers <- c("Ptprc", "Tmem119", "Aif1", "Itgam", "Ly6g", "Camp", "Ly6c2", "Itgax", "Xcr1", "Cd209a", "Ccr9", "Nudt17")
  263. macrophage.vs.microglia.markers <- c("Ptprc", "Tmem119", "Cx3cr1", "P2ry12", "Itgam", "Aif1", "Hexb", "Plac8", "Mrc1", "Cd163")
  264. DotPlot(dsmerged, features = neuroglial.markers)
  265. # assign cluster identities
  266. Idents(object=dsmerged) <- [email hidden]$RNA_snn_res.1
  267. DimPlot(dsmerged, reduction = "umap",label=T)
  268. new.cluster.ids <- c( "Macrophages", "Microglia", "Microglia", "Endothelial cells", "Olfactory ensheathing cells", "Neutrophils", "Endothelial cells", "CD4 T cells", "Microglia", "Astrocytes", "Mixed signature: Macrophages/Microglia", "Neutrophils", "Macrophages", "Dendritic cells", "Neurons", "Neurons", "Mixed signature: Macrophages/Microglia", "Pericytes", "Mixed signature: Microglia/Dendritic cells", "CD8 T cells & NK cells", "Astrocytes", "Mixed signature: Proliferating cells/CD4 T cells/Macrophages", "Dendritic cells", "Microglia/Neutrophils", "Mixed signature: Pericytes/Endothelial cells", "Macrophages", "B cells", "Olfactory ensheathing cells", "Mixed signature: Neutrophils/Macrophages", "Mixed signature: Proliferating cells/Neutrophils", "Mixed signature: Endothelial cells/Microglia", "Oligos/OPCs", "Mixed signature: Olfactory ensheathing cells/Microglia", "Fibroblasts", "Mixed signature: CD4 T cells/CD8 T cells & NK cells", "Mixed signature: Endothelial cells/Astrocytes", "Mixed signature: Astrocytes/Olfactory ensheathing cells", "Mixed signature: Astrocytes/Microglia", "Mixed signature: Endothelial cells/Neutrophils", "Mixed signature: Endothelial cells/CD4 T cells", "Mixed signature: CD4 T cells/Dendritic cells")
  269. names(new.cluster.ids) <- levels(dsmerged)
  270. dsmerged <- RenameIdents(dsmerged, new.cluster.ids)
  271. DimPlot(dsmerged, reduction = "umap",label=T)+ NoLegend()
  272. dsmerged[["cluster.names_all.cells"]] <- Idents(object = dsmerged) # stash identity
  273. saveRDS(dsmerged, file = "02_RDS files/dsmerged_includes_mixed_signatures_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  274. # remove mixed signature clusters
  275. dsmerged <- subset(x = dsmerged, idents = c("Neurons", "Astrocytes", "Olfactory ensheathing cells", "Oligos/OPCs", "Microglia", "Endothelial cells", "Pericytes", "Fibroblasts", "Macrophages", "Dendritic cells", "Neutrophils", "CD4 T cells", "CD8 T cells & NK cells", "B cells"),invert = FALSE)
  276. DimPlot(dsmerged, reduction = "umap",label=T)
  277. # re-order data sets for display
  278. Idents(object=dsmerged) <- [email hidden]$cluster.names_all.cells
  279. [email hidden]$cluster.names_all.cells <- factor(x = [email hidden]$cluster.names_all.cells, levels(dsmerged) <- c("Neurons", "Astrocytes", "Microglia", "Olfactory ensheathing cells", "Oligos/OPCs", "Endothelial cells", "Pericytes", "Fibroblasts", "Macrophages", "Neutrophils", "Dendritic cells", "CD4 T cells", "CD8 T cells & NK cells", "B cells"))
  280. DimPlot(dsmerged, reduction = "umap",label=T, group.by = "cluster.names_all.cells") + NoLegend() ##Figure 1B##
  281. DimPlot(dsmerged, reduction = "umap",label=T, group.by = "condition") + NoLegend() ##Figure 1C##
  282. DimPlot(dsmerged, reduction = "umap",label=T, split.by = "enrichment") + NoLegend() ##Extended Data Figure 1D##
  283. DimPlot(dsmerged, reduction = "umap",label=T, group.by = "batch") ##Extended Data Figure 1E##
  284. write.csv(table(dsmerged$sample, dsmerged$cluster.names_all.cells), file = "03_quantification/CellTypeDistrBySample.csv") ##Extended Data Table 1##
  285. saveRDS(dsmerged, file = "02_RDS files/dsmerged_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  286. rm(genes, toplot, neuroglial.markers, lymphoid.markers, myeloid.markers, macrophage.vs.microglia.markers, new.cluster.ids)
  287. ## PBS vs GAS plots and differential expression ----
  288. # subset on WT PBS and GAS samples only
  289. Idents(object=dsmerged) <- [email hidden]$condition
  290. DimPlot(dsmerged, reduction = "umap")
  291. dsmerged_PBS_GAS <- subset(x = dsmerged, idents = c("PBS", "GAS"),invert = FALSE)
  292. saveRDS(dsmerged_PBS_GAS, file = "02_RDS files/dsmerged_004_005_008_009_014_023_024.rds")
  293. Idents(object=dsmerged_PBS_GAS) <- [email hidden]$cluster.names_all.cells
  294. [email hidden]$cluster.names_all.cells <- factor(x = [email hidden]$cluster.names_all.cells, levels(dsmerged_PBS_GAS) <- c("B cells", "CD8 T cells & NK cells", "CD4 T cells", "Dendritic cells", "Neutrophils", "Macrophages", "Fibroblasts", "Pericytes", "Endothelial cells", "Oligos/OPCs", "Olfactory ensheathing cells", "Microglia", "Astrocytes", "Neurons"))
  295. cell.type.markers <- c("Snap25", "Dcx", "Gfap", "Aqp4", "Frzb", "Pdgfra", "Cldn5", "Pecam1", "Pdgfrb", "Atp13a5", "Col1a1", "Fbln1", "Ptprc", "Tmem119", "Aif1", "Itgam", "Ly6g", "Camp", "Itgax", "Xcr1", "Cd209a", "Ccr9", "Cd3e", "Cd4", "Cd8a", "Klrb1c", "Cd19")
  296. DotPlot(dsmerged_PBS_GAS, features = cell.type.markers, dot.min = .05) ##Extended Data Figure 1A##
  297. [email hidden]$cluster.names_all.cells <- factor(x = [email hidden]$cluster.names_all.cells, levels(dsmerged) <- c("Neurons", "Astrocytes", "Microglia", "Olfactory ensheathing cells", "Oligos/OPCs", "Endothelial cells", "Pericytes", "Fibroblasts", "Macrophages", "Neutrophils", "Dendritic cells", "CD4 T cells", "CD8 T cells & NK cells", "B cells"))
  298. write.csv(table(dsmerged_PBS_GAS$cluster.names_all.cells, dsmerged_PBS_GAS$enrichment), file = "03_quantification/CellTypeDistrByEnrichment.csv") ##Extended Data Figure 1C##
  299. ## cytokine-responsive by cell type
  300. Idents(object=dsmerged_PBS_GAS) <- [email hidden]$cluster.names_all.cells
  301. [email hidden]$cluster.names_all.cells <- factor(x = [email hidden]$cluster.names_all.cells, levels(dsmerged_PBS_GAS) <- c("Neurons", "Astrocytes", "Microglia", "Olfactory ensheathing cells", "Oligos/OPCs", "Endothelial cells", "Pericytes", "Fibroblasts", "Macrophages", "Neutrophils", "Dendritic cells", "CD4 T cells", "CD8 T cells & NK cells", "B cells"))
  302. cytokine.receptors <- c("Csf2rb", "Csf2ra", "Il17rc", "Il17ra", "Ifngr2", "Ifngr1")
  303. DotPlot(dsmerged_PBS_GAS, features = cytokine.receptors, dot.min = 0.05) + ##Extended Data Figure 3D##
  304. coord_flip() +
  305. theme(
  306. axis.text.x.bottom = element_text(angle = 55, hjust = 1, vjust = 0.5),
  307. axis.text.y = element_text(hjust = 1))
  308. rm(cell.type.markers, cytokine.receptors)
  309. ## perform differential expression by mixed effects analysis using MAST
  310. dsmerged_PBS_GAS <- readRDS(file = "02_RDS files/dsmerged_004_005_008_009_014_023_024.rds")
  311. library(openxlsx) # version 4.2.8
  312. library(tibble) # version 3.3.0
  313. cell_types <- c("Neurons", "Astrocytes", "Olfactory ensheathing cells", "Oligos/OPCs", "Microglia", "Endothelial cells", "Pericytes", "Fibroblasts", "Macrophages", "Dendritic cells", "Neutrophils", "CD4 T cells", "CD8 T cells & NK cells", "B cells")
  314. dsmerged_PBS_GAS <- JoinLayers(dsmerged_PBS_GAS)
  315. Idents(object = dsmerged_PBS_GAS) <- [email hidden]$cluster.names_all.cells
  316. compare.conditions <- list(
  317. list(ident1 = "GAS", ident2 = "PBS", result_name = "GASvsPBS")
  318. )
  319. run_DE <- function(object, comparisons_list, test_method = "MAST", include_sd = TRUE,
  320. save_results = FALSE, output_file = NULL, skip_cell_subsetting = FALSE) {
  321. results_list <- list()
  322. if (save_results) {
  323. if (is.null(output_file)) {
  324. stop("Please provide a file name when save_results is TRUE.")
  325. }
  326. wb <- createWorkbook()
  327. }
  328. for (condition in comparisons_list) {
  329. ident1 <- condition$ident1
  330. ident2 <- condition$ident2
  331. result_name <- condition$result_name
  332. if (skip_cell_subsetting) {
  333. cell_types_to_analyze <- "CellType"
  334. } else {
  335. cell_types_to_analyze <- cell_types
  336. }
  337. for (cell_type in cell_types_to_analyze) {
  338. if (skip_cell_subsetting) { # skip subsetting - use the object directly
  339. cell_type_object <- object
  340. cat("Using pre-subset object for:", cell_type, "\n")
  341. } else {
  342. cell_type_object <- subset(x = object, idents = c(cell_type), invert = FALSE)
  343. cat("Subsetting for cell type:", cell_type, "\n")
  344. }
  345. cell_type_object <- JoinLayers(cell_type_object)
  346. Idents(object = cell_type_object) <- [email hidden]$condition
  347. tryCatch({
  348. cell_type_DEGs <- FindMarkers(
  349. object = cell_type_object,
  350. ident.1 = ident1,
  351. ident.2 = ident2,
  352. test.use = test_method
  353. )
  354. result <- rownames_to_column(cell_type_DEGs, var = "gene")
  355. if (include_sd) { # calculate standard deviations if requested
  356. genes_to_analyze <- result$gene
  357. cells_ident1 <- WhichCells(cell_type_object, idents = ident1)
  358. cells_ident2 <- WhichCells(cell_type_object, idents = ident2)
  359. expr_data <- GetAssayData(cell_type_object, assay = "RNA", layer = "data")
  360. mean_ident1 <- apply(expr_data[genes_to_analyze, cells_ident1, drop = FALSE], 1, mean, na.rm = TRUE)
  361. mean_ident2 <- apply(expr_data[genes_to_analyze, cells_ident2, drop = FALSE], 1, mean, na.rm = TRUE)
  362. sd_ident1 <- apply(expr_data[genes_to_analyze, cells_ident1, drop = FALSE], 1, sd, na.rm = TRUE)
  363. sd_ident2 <- apply(expr_data[genes_to_analyze, cells_ident2, drop = FALSE], 1, sd, na.rm = TRUE)
  364. result$mean_group1 <- mean_ident1[result$gene]
  365. result$mean_group2 <- mean_ident2[result$gene]
  366. result$sd_group1 <- sd_ident1[result$gene]
  367. result$sd_group2 <- sd_ident2[result$gene]
  368. result$group1_name <- ident1
  369. result$group2_name <- ident2
  370. }
  371. result_key <- paste(result_name, cell_type, sep = "_")
  372. results_list[[result_key]] <- result
  373. if (save_results) {
  374. sheet_name <- result_key
  375. if (nchar(sheet_name) > 31) {
  376. sheet_name <- substr(sheet_name, 1, 31) # excel sheet names have a 31 character limit
  377. }
  378. addWorksheet(wb, sheetName = sheet_name)
  379. writeData(wb, sheet = sheet_name, x = result)
  380. }
  381. cat("Completed analysis for", cell_type, ":", result_name, "\n")
  382. }, error = function(e) { # proper error handling
  383. cat("Error in analysis for", cell_type, ":", result_name, "\n")
  384. cat("Error message:", e$message, "\n")
  385. })
  386. }
  387. }
  388. if (save_results) {
  389. saveWorkbook(wb, file = output_file, overwrite = TRUE)
  390. cat("Results saved to:", output_file, "\n")
  391. }
  392. return(results_list)
  393. }
  394. DE_MAST_dsmerged <- run_DE(
  395. object = dsmerged_PBS_GAS,
  396. comparisons_list = compare.conditions,
  397. save_results = TRUE,
  398. test_method = "MAST",
  399. output_file = "03_quantification/GASvsPBS_AllCellTypes_MAST_DE.xlsx",
  400. include_sd = FALSE,
  401. skip_cell_subsetting = FALSE
  402. )
  403. ## Endothelial cell subclustering and analysis ----
  404. # open merged data file and subset on ECs
  405. dsmerged <- readRDS(file = "02_RDS files/dsmerged_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  406. Idents(object=dsmerged) <- [email hidden]$cluster.names_all.cells
  407. dsmerged_ECs <- subset(x = dsmerged, idents = c("Endothelial cells"),invert = FALSE)
  408. ## clustering, batch correction, removing mixed signature
  409. # normalize & generate PCA
  410. dsmerged_ECs <- NormalizeData(dsmerged_ECs)
  411. dsmerged_ECs <- FindVariableFeatures(dsmerged_ECs, selection.method = "vst", nfeatures = 3000)
  412. top10 <- head(VariableFeatures(dsmerged_ECs), 10)
  413. plot1 <- VariableFeaturePlot(dsmerged_ECs)
  414. plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE, xnudge = 0, ynudge = 0)
  415. plot2
  416. all.genes <- rownames(dsmerged_ECs)
  417. dsmerged_ECs <- ScaleData(dsmerged_ECs, features = all.genes)
  418. dsmerged_ECs <- RunPCA(dsmerged_ECs, features = VariableFeatures(object = dsmerged_ECs))
  419. print(dsmerged_ECs[["pca"]], dims = 1:5, nfeatures = 5)
  420. VizDimLoadings(dsmerged_ECs, dims = 1:5, reduction = "pca")
  421. ElbowPlot(dsmerged_ECs,ndims=50)
  422. dsmerged_ECs <- FindNeighbors(dsmerged_ECs, dims = 1:38)
  423. dsmerged_ECs <- FindClusters(dsmerged_ECs, resolution = 0.4)
  424. dsmerged_ECs <- RunUMAP(dsmerged_ECs, dims = 1:38)
  425. DimPlot(dsmerged_ECs, reduction = "umap",label=T)
  426. DimPlot(dsmerged_ECs, reduction = "umap",group.by="orig.ident")
  427. dsmerged_ECs <- RunTSNE(dsmerged_ECs, dims = 1:38)
  428. DimPlot(dsmerged_ECs, reduction = "tsne",label=T)
  429. DimPlot(dsmerged_ECs, reduction = "tsne",group.by="orig.ident")
  430. rm(plot1, plot2, all.genes, top10)
  431. # run harmony to reduce batch effects
  432. pre.harmony.umap <- DimPlot(dsmerged_ECs, reduction = "umap",group.by="batch")
  433. pre.harmony.tsne <- DimPlot(dsmerged_ECs, reduction = "tsne",group.by="batch")
  434. dsmerged_ECs <- dsmerged_ECs %>%
  435. RunHarmony("batch", plot_convergence = TRUE)
  436. harmony_embeddings <- Embeddings(dsmerged_ECs, 'harmony')
  437. harmony_embeddings[1:5, 1:5]
  438. dsmerged_ECs <- dsmerged_ECs %>%
  439. RunUMAP(reduction = "harmony", dims = 1:38) %>%
  440. FindNeighbors(reduction = "harmony", dims = 1:38) %>%
  441. FindClusters(resolution = 0.4) %>%
  442. identity()
  443. print(pre.harmony.umap)
  444. DimPlot(dsmerged_ECs, reduction = "umap",label=F)
  445. DimPlot(dsmerged_ECs, reduction = "umap",label=F, group.by ="batch")
  446. dsmerged_ECs <- dsmerged_ECs %>%
  447. RunTSNE(reduction = "harmony", dims = 1:38) %>%
  448. FindNeighbors(reduction = "harmony", dims = 1:38) %>%
  449. FindClusters(resolution = 0.4) %>%
  450. identity()
  451. print(pre.harmony.tsne)
  452. DimPlot(dsmerged_ECs, reduction = "tsne",label=T)
  453. DimPlot(dsmerged_ECs, reduction = "tsne",group.by="condition")
  454. # remove mixed signature clusters
  455. genes <- VariableFeatures(dsmerged_ECs)
  456. toplot <- CalcStats(dsmerged_ECs, features = genes, method = "zscore", order = "p", n = 5)
  457. Heatmap(toplot, lab_fill = "zscore")
  458. neuroglial.markers <- c("Snap25", "Dcx", "Gfap","Aqp4", "Frzb","Cldn5", "Pecam1", "Pdgfra","Pdgfrb", "Atp13a5", "Col1a1", "Fbln1")
  459. lymphoid.markers <- c("Ptprc", "Cd3e", "Cd4", "Cd8a", "Cd163l1", "Klrb1c", "Cd19", "Ms4a1")
  460. myeloid.markers <- c("Ptprc", "Tmem119", "Aif1", "Itgam", "Ly6g", "Camp", "Ly6c2", "Itgax", "Xcr1", "Cd209a", "Ccr9", "Nudt17")
  461. DotPlot(dsmerged_ECs, features = neuroglial.markers)
  462. FeaturePlot(dsmerged_ECs, c("nCount_RNA", "nFeature_RNA", "percent.mt")) # cluster 4 is low viability
  463. FeaturePlot(dsmerged_ECs, c("Aqp4", "Gfap", "Cspg5", "Olig1")) # cluster 6 has mixed signature: astrocytes/oligos/endothelial cells
  464. FeaturePlot(dsmerged_ECs, c("Pdgfrb", "Atp13a5")) # cluster 7 has mixed signature: pericytes/endothelial cells
  465. FeaturePlot(dsmerged_ECs, c("Cx3cr1", "Ptprc", "Cd3e")) # cluster 8 has mixed signature: microglia/endothelial cells; also a couple T cells
  466. FeaturePlot(dsmerged_ECs, c("Frzb", "Plp1", "Col1a1", "Fbln1", "Pdgfra")) # cluster 9 has mixed signature: olfactory ensheathing cells/fibroblasts/endothelial cells
  467. FeaturePlot(dsmerged_ECs, c("Top2a")) # cluster 9 has mixed signature: olfactory ensheathing cells/fibroblasts/endothelial cells
  468. Idents(object=dsmerged_ECs) <- [email hidden]$RNA_snn_res.0.4
  469. dsmerged_ECs <- subset(x = dsmerged_ECs, idents = c(4, 6, 7, 8, 9),invert = TRUE)
  470. DimPlot(dsmerged_ECs, reduction = "umap",label=T)
  471. DimPlot(dsmerged_ECs, reduction = "umap", split.by = "inoculate")
  472. saveRDS(dsmerged_ECs, file = "02_RDS files/dsmerged_ECs_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  473. ## subset on PBS and GAS ECs only
  474. Idents(object=dsmerged_ECs) <- [email hidden]$condition
  475. DimPlot(dsmerged_ECs, reduction = "umap")
  476. dsmerged_ECs_PBS_GAS <- subset(x = dsmerged_ECs, idents = c("PBS", "GAS"),invert = FALSE)
  477. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap")
  478. # recluster
  479. dsmerged_ECs_PBS_GAS <- NormalizeData(dsmerged_ECs_PBS_GAS)
  480. dsmerged_ECs_PBS_GAS <- FindVariableFeatures(dsmerged_ECs_PBS_GAS, selection.method = "vst", nfeatures = 3000)
  481. top10 <- head(VariableFeatures(dsmerged_ECs_PBS_GAS), 10)
  482. plot1 <- VariableFeaturePlot(dsmerged_ECs_PBS_GAS)
  483. plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE, xnudge = 0, ynudge = 0)
  484. plot2
  485. all.genes <- rownames(dsmerged_ECs_PBS_GAS)
  486. dsmerged_ECs_PBS_GAS <- ScaleData(dsmerged_ECs_PBS_GAS, features = all.genes)
  487. dsmerged_ECs_PBS_GAS <- RunPCA(dsmerged_ECs_PBS_GAS, features = VariableFeatures(object = dsmerged_ECs_PBS_GAS))
  488. print(dsmerged_ECs_PBS_GAS[["pca"]], dims = 1:5, nfeatures = 5)
  489. VizDimLoadings(dsmerged_ECs_PBS_GAS, dims = 1:5, reduction = "pca")
  490. ElbowPlot(dsmerged_ECs_PBS_GAS,ndims=50)
  491. dsmerged_ECs_PBS_GAS <- FindNeighbors(dsmerged_ECs_PBS_GAS, dims = 1:32)
  492. dsmerged_ECs_PBS_GAS <- FindClusters(dsmerged_ECs_PBS_GAS, resolution = 0.4)
  493. dsmerged_ECs_PBS_GAS <- RunUMAP(dsmerged_ECs_PBS_GAS, dims = 1:32)
  494. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap",label=T)
  495. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap", group.by="condition") ##Extended Data Figure 1F##
  496. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap", group.by="batch") ##Extended Data Figure 1G##
  497. dsmerged_ECs_PBS_GAS <- RunTSNE(dsmerged_ECs_PBS_GAS, dims = 1:32)
  498. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "tsne",label=T)
  499. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "tsne",group.by="condition")
  500. rm(plot1, plot2, all.genes, top10)
  501. # run harmony
  502. pre.harmony.umap <- DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap",group.by="batch", label = F)
  503. pre.harmony.tsne <- DimPlot(dsmerged_ECs_PBS_GAS, reduction = "tsne",group.by="batch", label = F)
  504. dsmerged_ECs_PBS_GAS <- dsmerged_ECs_PBS_GAS %>%
  505. RunHarmony("batch", plot_convergence = TRUE)
  506. harmony_embeddings <- Embeddings(dsmerged_ECs_PBS_GAS, 'harmony')
  507. harmony_embeddings[1:5, 1:5]
  508. dsmerged_ECs_PBS_GAS <- dsmerged_ECs_PBS_GAS %>%
  509. RunUMAP(reduction = "harmony", dims = 1:32) %>%
  510. FindNeighbors(reduction = "harmony", dims = 1:32) %>%
  511. FindClusters(resolution = 1) %>%
  512. identity()
  513. print(pre.harmony.umap)
  514. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap",label=T)
  515. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "umap",label=F, group.by="inoculate")
  516. dsmerged_ECs_PBS_GAS <- dsmerged_ECs_PBS_GAS %>%
  517. RunTSNE(reduction = "harmony", dims = 1:32) %>%
  518. FindNeighbors(reduction = "harmony", dims = 1:32) %>%
  519. FindClusters(resolution = 1) %>%
  520. identity()
  521. print(pre.harmony.tsne)
  522. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "tsne",label=T)
  523. DimPlot(dsmerged_ECs_PBS_GAS, reduction = "tsne",label=F, group.by="inoculate")
  524. saveRDS(dsmerged_ECs_PBS_GAS, file = "02_RDS files/dsmerged_ECs_004_005_008_009_014_023_024.rds")
  525. ## Differential expression on endothelial cells by MAST
  526. dsmerged_ECs <- readRDS(file = "02_RDS files/dsmerged_ECs_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  527. cell_types <- c("Endothelial cells")
  528. dsmerged_ECs <- JoinLayers(dsmerged_ECs)
  529. Idents(object = dsmerged_ECs) <- [email hidden]$condition
  530. compare.conditions <- list(
  531. list(ident1 = "GAS", ident2 = "PBS", result_name = "GASvsPBS"),
  532. list(ident1 = "RORg", ident2 = "GAS", result_name = "RORgvsGAS"),
  533. list(ident1 = "IL-17A_mAb", ident2 = "Isotype_mAb", result_name = "IL17A.mAb.vs.Isotype"),
  534. list(ident1 = "Csf2_CD4ko", ident2 = "Csf2flox", result_name = "Csf2.CD4ko.vs.Csf2fl"))
  535. DE_MAST_dsmerged_ECs <- run_DE(
  536. object = dsmerged_ECs,
  537. comparisons_list = compare.conditions,
  538. test_method = "MAST",
  539. output_file = "03_quantification/ECs_AllConditions_MAST_DE.xlsx",
  540. include_sd = FALSE,
  541. save_results = TRUE,
  542. skip_cell_subsetting = TRUE)
  543. ## EC PBS vs GAS aggregate heat maps
  544. dsmerged_ECs_PBS_GAS <- readRDS(file = "02_RDS files/dsmerged_ECs_004_005_008_009_014_023_024.rds")
  545. Idents(object=dsmerged_ECs_PBS_GAS) <- [email hidden]$condition
  546. generate_heatmap <- function(seurat_object,
  547. marker_set,
  548. sample_levels = c("CW004", "CW014", "CW023", "CW005", "CW008", "CW009", "CW024"),
  549. output_path = "04_plots/Figure 1",
  550. plot_width = 3.6115,
  551. plot_height = 4.66,
  552. color_min = -2,
  553. color_max = 2) {
  554. seurat_object_name <- deparse(substitute(seurat_object))
  555. marker_set_name <- deparse(substitute(marker_set))
  556. heatmap_filename_pdf <- paste0("Heatmap_", seurat_object_name, "_", marker_set_name, ".pdf")
  557. Idents(object = seurat_object) <- [email hidden]$sample
  558. sample_aggregates <- AggregateExpression(seurat_object, return.seurat = TRUE)
  559. levels(x = sample_aggregates) <- sample_levels
  560. # Create heatmap with labels and save as PDF
  561. heatmap_pdf <- DoHeatmap(sample_aggregates, features = marker_set, draw.lines = FALSE) +
  562. scale_fill_gradient2(low = "blue", high = "red", limits = c(color_min, color_max))
  563. ggsave(
  564. filename = heatmap_filename_pdf,
  565. plot = heatmap_pdf,
  566. device = "pdf",
  567. path = output_path,
  568. scale = 1,
  569. width = plot_width,
  570. height = plot_height,
  571. units = "in",
  572. dpi = 300,
  573. bg = "transparent"
  574. )
  575. }
  576. sample.levels <- c("CW004", "CW014", "CW023", "CW005", "CW008", "CW009", "CW024")
  577. type_I_interferon <- c("Irf7", "Isg15", "Isg20", "Ifit1", "Ifit2", "Ifit3", "Ifitm1", "Ifitm2", "Ifitm3", "Ifi44", "Ifi47", "Ifi204")
  578. antigen_presentation <- c("B2m", "Cd74", "H2-Aa", "H2-Ab1", "H2-Eb1", "H2-K1", "H2-D1", "H2-Q4", "H2-Q7", "H2-T22", "Tap1", "Tap2")
  579. EC_response_to_LPS <- c("Lcn2", "Ch25h", "Tmem252", "Apod", "Litaf", "Ctla2a", "Pltp", "Ptn", "Tspan13", "Cxcl12", "Utrn", "Fcgrt")
  580. ECM_markers <- c("Hmcn1", "Ltbp4", "Cst3", "Ptn", "Itga4", "Mmp15", "Itga1", "Adamts10", "Adamts5", "Lamc3", "Col4a3", "Col14a1")
  581. generate_heatmap(dsmerged_ECs_PBS_GAS, type_I_interferon, ##Figure 1F##
  582. sample_levels = sample.levels,
  583. output_path = "04_plots/Figure 1",
  584. color_min = -1.75,
  585. color_max = 2.2)
  586. generate_heatmap(dsmerged_ECs_PBS_GAS, antigen_presentation, ##Figure 1G##
  587. sample_levels = sample.levels,
  588. output_path = "04_plots/Figure 1",
  589. color_min = -1.75,
  590. color_max = 2.2)
  591. generate_heatmap(dsmerged_ECs_PBS_GAS, EC_response_to_LPS, ##Figure 1H##
  592. sample_levels = sample.levels,
  593. output_path = "04_plots/Figure 1",
  594. color_min = -1.75,
  595. color_max = 2.2)
  596. generate_heatmap(dsmerged_ECs_PBS_GAS, ECM_markers, ##Figure 1I##
  597. sample_levels = sample.levels,
  598. output_path = "04_plots/Figure 1",
  599. color_min = -1.75,
  600. color_max = 2.2)
  601. junctional_adhesion_markers <- c("Amot", "Amotl1", "Amotl2", "Arhgap17", "Ash1l", "Cdh5", "Cgnl1", "Cldn12", "Cldn5", "Ctnna1", "Ctnnb1", "Dlg1", "Dlgap4", "F11r", "Jam2", "Lin7c", "Magi3", "Marveld2", "Ocln", "Pard3", "Pard6g", "Scrib", "Tjap1", "Tjp1", "Tjp2", "Wnk1", "Icam1", "Vcam1")
  602. transporters <- c("Abcb1a", "Abcc4", "Abcg2", "Atp10a", "Slc16a1", "Slc16a2", "Slc16a4", "Slc19a3", "Slc1a1", "Slc22a8", "Slc25a20", "Slc25a32", "Slc25a33", "Slc30a1", "Slc31a1", "Slc35f2", "Slc38a3", "Slc38a5", "Slc39a10", "Slc40a1", "Slc46a3", "Slc6a17", "Slc6a6", "Slc7a1", "Slc7a3", "Slco1a4", "Slco1c1", "Slco2b1")
  603. RMT_vs_bulk_trancytosis <- c("Bsg", "Igf1r", "Insr", "Ldlr", "Ldlrad3", "Lrp10", "Lrp8", "Scarb1", "Slc2a1", "Slc3a2", "Slc7a5", "Tfrc", "Ap2a1", "Ap2a2", "Ap2b1", "Cav1", "Cav2", "Cavin1", "Cavin2", "Cavin3", "Cltb", "Cltc", "Epn1", "Eps15", "Fcho2", "Hip1", "Picalm", "Rin3")
  604. other_CNS_EC_markers <- c("Apcdd1", "Car4", "Clic5", "Cobll1", "Ddc", "Degs2", "Ebf1", "Foxq1", "Itih5", "Itm2a", "Jag2", "Kitl", "Mfsd2a", "Nebl", "Pcdh19", "Pglyrp1", "Prom1", "Rad54b", "Sema3c", "Sema7a", "Sgpp2", "Spock2", "Tbx1", "Tbx3", "Tnfrsf19", "Tpd52l1", "Vwa1", "Zic3")
  605. generate_heatmap(dsmerged_ECs_PBS_GAS, junctional_adhesion_markers, ##Extended Figure 1H##
  606. sample_levels = sample.levels,
  607. output_path = "04_plots/Figure 1",
  608. color_min = -2.1,
  609. color_max = 2.5)
  610. generate_heatmap(dsmerged_ECs_PBS_GAS, transporters, ##Extended Figure 1I##
  611. sample_levels = sample.levels,
  612. output_path = "04_plots/Figure 1",
  613. color_min = -2.1,
  614. color_max = 2.5)
  615. generate_heatmap(dsmerged_ECs_PBS_GAS, RMT_vs_bulk_trancytosis, ##Extended Figure 1J##
  616. sample_levels = sample.levels,
  617. output_path = "04_plots/Figure 1",
  618. color_min = -2.1,
  619. color_max = 2.5)
  620. generate_heatmap(dsmerged_ECs_PBS_GAS, other_CNS_EC_markers, ##Extended Figure 1K##
  621. sample_levels = sample.levels,
  622. output_path = "04_plots/Figure 1",
  623. color_min = -2.1,
  624. color_max = 2.5)
  625. rm(sample.levels, type_I_interferon, antigen_presentation, EC_response_to_LPS, ECM_markers, junctional_adhesion_markers, transporters, RMT_vs_bulk_trancytosis, other_CNS_EC_markers)
  626. ## Microglia clustering and analysis ----
  627. dsmerged <- readRDS(file = "02_RDS files/dsmerged_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  628. Idents(object=dsmerged) <- [email hidden]$cluster.names_all.cells
  629. dsmerged_microglia <- subset(x = dsmerged, idents = c("Microglia"),invert = FALSE)
  630. ## clustering, batch correction, removing mixed signature
  631. # normalize & generate PCA
  632. dsmerged_microglia <- NormalizeData(dsmerged_microglia)
  633. dsmerged_microglia <- FindVariableFeatures(dsmerged_microglia, selection.method = "vst", nfeatures = 3000)
  634. top10 <- head(VariableFeatures(dsmerged_microglia), 10)
  635. plot1 <- VariableFeaturePlot(dsmerged_microglia)
  636. plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE, xnudge = 0, ynudge = 0)
  637. plot2
  638. all.genes <- rownames(dsmerged_microglia)
  639. dsmerged_microglia <- ScaleData(dsmerged_microglia, features = all.genes)
  640. dsmerged_microglia <- RunPCA(dsmerged_microglia, features = VariableFeatures(object = dsmerged_microglia))
  641. print(dsmerged_microglia[["pca"]], dims = 1:5, nfeatures = 5)
  642. VizDimLoadings(dsmerged_microglia, dims = 1:5, reduction = "pca")
  643. ElbowPlot(dsmerged_microglia,ndims=50)
  644. dsmerged_microglia <- FindNeighbors(dsmerged_microglia, dims = 1:42)
  645. dsmerged_microglia <- FindClusters(dsmerged_microglia, resolution = 0.4)
  646. dsmerged_microglia <- RunUMAP(dsmerged_microglia, dims = 1:42)
  647. DimPlot(dsmerged_microglia, reduction = "umap",label=T)
  648. DimPlot(dsmerged_microglia, reduction = "umap",group.by="orig.ident")
  649. dsmerged_microglia <- RunTSNE(dsmerged_microglia, dims = 1:42)
  650. DimPlot(dsmerged_microglia, reduction = "tsne",label=T)
  651. DimPlot(dsmerged_microglia, reduction = "tsne",group.by="orig.ident")
  652. rm(plot1, plot2, all.genes, top10)
  653. # run harmony to reduce batch effects
  654. pre.harmony.umap <- DimPlot(dsmerged_microglia, reduction = "umap",group.by="batch")
  655. pre.harmony.tsne <- DimPlot(dsmerged_microglia, reduction = "tsne",group.by="batch")
  656. dsmerged_microglia <- dsmerged_microglia %>%
  657. RunHarmony("batch", plot_convergence = TRUE)
  658. harmony_embeddings <- Embeddings(dsmerged_microglia, 'harmony')
  659. harmony_embeddings[1:5, 1:5]
  660. dsmerged_microglia <- dsmerged_microglia %>%
  661. RunUMAP(reduction = "harmony", dims = 1:42) %>%
  662. FindNeighbors(reduction = "harmony", dims = 1:42) %>%
  663. FindClusters(resolution = 0.4) %>%
  664. identity()
  665. print(pre.harmony.umap)
  666. DimPlot(dsmerged_microglia, reduction = "umap",label=F)
  667. DimPlot(dsmerged_microglia, reduction = "umap",label=F, group.by = "batch")
  668. dsmerged_microglia <- dsmerged_microglia %>%
  669. RunTSNE(reduction = "harmony", dims = 1:42) %>%
  670. FindNeighbors(reduction = "harmony", dims = 1:42) %>%
  671. FindClusters(resolution = 0.4) %>%
  672. identity()
  673. print(pre.harmony.tsne)
  674. DimPlot(dsmerged_microglia, reduction = "tsne",label=T)
  675. DimPlot(dsmerged_microglia, reduction = "tsne", group.by = "batch")
  676. rm(pre.harmony.umap, pre.harmony.tsne, harmony_embeddings)
  677. # remove mixed signature clusters
  678. genes <- VariableFeatures(dsmerged_microglia)
  679. toplot <- CalcStats(dsmerged_microglia, features = genes, method = "zscore", order = "p", n = 5)
  680. Heatmap(toplot, lab_fill = "zscore")
  681. neuroglial.markers <- c("Snap25", "Dcx", "Gfap","Aqp4", "Frzb","Cldn5", "Pecam1", "Pdgfra","Pdgfrb", "Atp13a5", "Col1a1", "Fbln1")
  682. lymphoid.markers <- c("Ptprc", "Cd3e", "Cd4", "Cd8a", "Cd163l1", "Klrb1c", "Cd19", "Ms4a1")
  683. myeloid.markers <- c("Ptprc", "Tmem119", "Aif1", "Itgam", "Ly6g", "Camp", "Ly6c2", "Itgax", "Xcr1", "Cd209a", "Ccr9", "Nudt17")
  684. macrophage.vs.microglia.markers <- c("Ptprc", "Tmem119", "Cx3cr1", "P2ry12", "Itgam", "Aif1", "Hexb", "Plac8", "Mrc1", "Cd163")
  685. DotPlot(dsmerged_microglia, features = neuroglial.markers)
  686. FeaturePlot(dsmerged_microglia, features = c("Snap25", "Dcx")) # cluster 6 has mixed signature: microglia/neurons
  687. FeaturePlot(dsmerged_microglia, features = c("Gfap", "Aqp4", "Pecam1")) # cluster 7 has mixed signature: microglia/astrocytes/neutrophils
  688. Idents(object=dsmerged_microglia) <- [email hidden]$RNA_snn_res.0.4
  689. dsmerged_microglia <- subset(x = dsmerged_microglia, idents = c(6, 7),invert = TRUE)
  690. DimPlot(dsmerged_microglia, reduction = "umap",label=T)
  691. DimPlot(dsmerged_microglia, reduction = "umap", split.by = "condition")
  692. dsmerged_microglia[["microglia.cluster"]] <- Idents(object = dsmerged_microglia) # stash identity
  693. genes <- VariableFeatures(dsmerged_microglia)
  694. toplot <- CalcStats(dsmerged_microglia, features = genes, method = "zscore", order = "p", n = 5)
  695. Heatmap(toplot, lab_fill = "zscore")
  696. # assign cluster identities
  697. genes <- VariableFeatures(dsmerged_microglia)
  698. toplot <- CalcStats(dsmerged_microglia, features = genes, method = "zscore", order = "p", n = 5)
  699. Heatmap(toplot, lab_fill = "zscore")
  700. Idents(object=dsmerged_microglia) <- [email hidden]$microglia.cluster
  701. DimPlot(dsmerged_microglia, reduction = "umap", label=T)
  702. new.cluster.ids <- c("hMG1", "srMG1", "srMG2", "srMG3", "srMG4", "hMG2")
  703. names(new.cluster.ids) <- levels(dsmerged_microglia)
  704. dsmerged_microglia <- RenameIdents(dsmerged_microglia, new.cluster.ids)
  705. DimPlot(dsmerged_microglia, reduction = "umap",label=T)+ NoLegend()
  706. dsmerged_microglia[["microglia.type"]] <- Idents(object = dsmerged_microglia) # stash identity
  707. Idents(object=dsmerged_microglia) <- [email hidden]$microglia.type
  708. [email hidden]$microglia.type <- factor(x = [email hidden]$microglia.type, levels(dsmerged_microglia) <- c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"))
  709. DimPlot(dsmerged_microglia, reduction = "umap",label=T, split.by = "microglia.type")
  710. rm(genes, toplot, lymphoid.markers, macrophage.vs.microglia.markers, myeloid.markers, neuroglial.markers)
  711. saveRDS(dsmerged_microglia, file = "02_RDS files/dsmerged_microglia_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  712. ## subset on PBS and GAS microglia only
  713. Idents(object=dsmerged_microglia) <- [email hidden]$condition
  714. DimPlot(dsmerged_microglia, reduction = "umap")
  715. dsmerged_microglia_PBS_GAS <- subset(x = dsmerged_microglia, idents = c("PBS", "GAS"),invert = FALSE)
  716. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap")
  717. # re-cluster and run harmony
  718. dsmerged_microglia_PBS_GAS <- NormalizeData(dsmerged_microglia_PBS_GAS)
  719. dsmerged_microglia_PBS_GAS <- FindVariableFeatures(dsmerged_microglia_PBS_GAS, selection.method = "vst", nfeatures = 3000)
  720. top10 <- head(VariableFeatures(dsmerged_microglia_PBS_GAS), 10)
  721. plot1 <- VariableFeaturePlot(dsmerged_microglia_PBS_GAS)
  722. plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE, xnudge = 0, ynudge = 0)
  723. plot2
  724. all.genes <- rownames(dsmerged_microglia_PBS_GAS)
  725. dsmerged_microglia_PBS_GAS <- ScaleData(dsmerged_microglia_PBS_GAS, features = all.genes)
  726. dsmerged_microglia_PBS_GAS <- RunPCA(dsmerged_microglia_PBS_GAS, features = VariableFeatures(object = dsmerged_microglia_PBS_GAS))
  727. print(dsmerged_microglia_PBS_GAS[["pca"]], dims = 1:5, nfeatures = 5)
  728. VizDimLoadings(dsmerged_microglia_PBS_GAS, dims = 1:5, reduction = "pca")
  729. ElbowPlot(dsmerged_microglia_PBS_GAS,ndims=50)
  730. dsmerged_microglia_PBS_GAS <- FindNeighbors(dsmerged_microglia_PBS_GAS, dims = 1:28)
  731. dsmerged_microglia_PBS_GAS <- FindClusters(dsmerged_microglia_PBS_GAS, resolution = 1)
  732. dsmerged_microglia_PBS_GAS <- RunUMAP(dsmerged_microglia_PBS_GAS, dims = 1:28)
  733. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=T)
  734. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",group.by="orig.ident")
  735. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",group.by="batch")
  736. dsmerged_microglia_PBS_GAS <- RunTSNE(dsmerged_microglia_PBS_GAS, dims = 1:28)
  737. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "tsne",label=T)
  738. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "tsne",group.by="orig.ident")
  739. rm(plot1, plot2, all.genes, top10)
  740. pre.harmony.umap <- DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap", group.by="batch", label = F)
  741. pre.harmony.tsne <- DimPlot(dsmerged_microglia_PBS_GAS, reduction = "tsne", group.by="batch", label = F)
  742. dsmerged_microglia_PBS_GAS <- dsmerged_microglia_PBS_GAS %>%
  743. RunHarmony("batch", plot_convergence = TRUE)
  744. harmony_embeddings <- Embeddings(dsmerged_microglia_PBS_GAS, 'harmony')
  745. harmony_embeddings[1:5, 1:5]
  746. dsmerged_microglia_PBS_GAS <- dsmerged_microglia_PBS_GAS %>%
  747. RunUMAP(reduction = "harmony", dims = 1:28) %>%
  748. FindNeighbors(reduction = "harmony", dims = 1:28) %>%
  749. FindClusters(resolution = 1) %>%
  750. identity()
  751. print(pre.harmony.umap)
  752. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=T)
  753. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=F, group.by = "batch") ##Extended Data Figure S2A##
  754. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=F, group.by = "inoculate") ##Figure 2A##
  755. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=F, split.by = "microglia.type") ##Figure 2A##
  756. dsmerged_microglia_PBS_GAS <- dsmerged_microglia_PBS_GAS %>%
  757. RunTSNE(reduction = "harmony", dims = 1:28) %>%
  758. FindNeighbors(reduction = "harmony", dims = 1:28) %>%
  759. FindClusters(resolution = 1) %>%
  760. identity()
  761. print(pre.harmony.tsne)
  762. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "tsne",label=T)
  763. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "tsne",label=F, group.by="clust")
  764. dsmerged_microglia_PBS_GAS[["clusters.res0.4_PBS.GAS.microglia"]] <- Idents(object = dsmerged_microglia_PBS_GAS) # stash identity
  765. rm(pre.harmony.umap, pre.harmony.tsne, harmony_embeddings)
  766. # assign cluster identities
  767. genes <- VariableFeatures(dsmerged_microglia_PBS_GAS)
  768. toplot <- CalcStats(dsmerged_microglia_PBS_GAS, features = genes, method = "zscore", order = "p", n = 5)
  769. Heatmap(toplot, lab_fill = "zscore")
  770. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$clusters.res0.4_PBS.GAS.microglia
  771. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=T)
  772. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=F, split.by="microglia.type")
  773. new.cluster.ids <- c("hMG1", "hMG1", "hMG1", "hMG1", "srMG1", "srMG2", "srMG3", "srMG4", "hMG2", "srMG1", "srMG3")
  774. names(new.cluster.ids) <- levels(dsmerged_microglia_PBS_GAS)
  775. dsmerged_microglia_PBS_GAS <- RenameIdents(dsmerged_microglia_PBS_GAS, new.cluster.ids)
  776. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=T)+ NoLegend()
  777. dsmerged_microglia_PBS_GAS[["microglia.type_PBS.GAS"]] <- Idents(object = dsmerged_microglia_PBS_GAS) # stash identity
  778. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$microglia.type_PBS.GAS
  779. [email hidden]$microglia.type_PBS.GAS <- factor(x = [email hidden]$microglia.type_PBS.GAS, levels(dsmerged_microglia_PBS_GAS) <- c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"))
  780. DimPlot(dsmerged_microglia_PBS_GAS, reduction = "umap",label=T, split.by = "microglia.type_PBS.GAS")
  781. table(dsmerged_microglia_PBS_GAS$microglia.type, dsmerged_microglia_PBS_GAS$inoculate) ##Extended Data Figure 2B##
  782. exAM.score.list <- c("Fos", "Jun", "Dusp1", "Hspa1a", "Hist1h1d", "Hist1h2ac", "Nfkbid", "Nfkbiz")
  783. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$condition
  784. Dotplot.exAM <- DotPlot(dsmerged_microglia_PBS_GAS, exAM.score.list) + coord_flip() ##Extended Data Figure 2D##
  785. ggsave("04_plots/Figure 2/Dotplot_exAM_dsmerged_microglia.pdf",
  786. plot = Dotplot.exAM,
  787. width = 4, height = 6,
  788. units = "in")
  789. dsmerged_microglia_PBS_GAS <- AddModuleScore(dsmerged_microglia_PBS_GAS,
  790. features = list(exAM.score.list),
  791. name = "exAM.score")
  792. [email hidden]$exAM.score <- [email hidden]$exAM.score1
  793. [email hidden]$exAM.score1 <- NULL
  794. head(x=dsmerged_microglia_PBS_GAS)
  795. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$condition
  796. p1 <- FeatureScatter(dsmerged_microglia_PBS_GAS, feature1 = "Ccl3", feature2 = "Ccl4") + scale_color_manual(values = c('gray40','skyblue'))
  797. p2 <- FeatureScatter(dsmerged_microglia_PBS_GAS, feature1 = "Ccl3", feature2 = "exAM.score") + scale_color_manual(values = c('gray40','skyblue'))
  798. p3 <- FeatureScatter(dsmerged_microglia_PBS_GAS, feature1 = "Ccl4", feature2 = "exAM.score") + scale_color_manual(values = c('gray40','skyblue'))
  799. library(cowplot) # version 1.1.3
  800. exAM_plots <- plot_grid(p1, p2, p3, nrow = 3)
  801. ggsave("04_plots/Figure 2/Scatter_exAM_plots.pdf",
  802. plot = exAM_plots,
  803. width = 4, height = 10,
  804. units = "in")
  805. rm(genes, toplot, lymphoid.markers, macrophage.vs.microglia.markers, myeloid.markers, neuroglial.markers, p1, p2, p3, exAM.score.list, exAM_plots)
  806. saveRDS(dsmerged_microglia_PBS_GAS, file = "02_RDS files/dsmerged_microglia_004_005_008_009_014_023_024.rds")
  807. ## Differential expression on microglia by MAST
  808. dsmerged_microglia <- readRDS(file = "02_RDS files/dsmerged_microglia_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  809. cell_types <- c("Microglia")
  810. dsmerged_microglia <- JoinLayers(dsmerged_microglia)
  811. Idents(object = dsmerged_microglia) <- [email hidden]$condition
  812. compare.conditions <- list(
  813. list(ident1 = "GAS", ident2 = "PBS", result_name = "GASvsPBS"),
  814. list(ident1 = "RORg", ident2 = "GAS", result_name = "RORgvsGAS"),
  815. list(ident1 = "IL-17A_mAb", ident2 = "Isotype_mAb", result_name = "IL17A.mAb.vs.Isotype"),
  816. list(ident1 = "Csf2_CD4ko", ident2 = "Csf2flox", result_name = "Csf2.CD4ko.vs.Csf2fl"))
  817. DE_MAST_dsmerged_microglia <- run_DE(
  818. object = dsmerged_microglia,
  819. comparisons_list = compare.conditions,
  820. test_method = "MAST",
  821. output_file = "03_quantification/Microglia_AllConditions_MAST_DE.xlsx",
  822. include_sd = FALSE,
  823. save_results = TRUE,
  824. skip_cell_subsetting = TRUE)
  825. ## Microglia PBS vs GAS aggregate heat maps
  826. dsmerged_microglia_PBS_GAS <- readRDS(file = "02_RDS files/dsmerged_microglia_004_005_008_009_014_023_024.rds")
  827. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$condition
  828. sample.levels <- c("CW004", "CW014", "CW023", "CW005", "CW008", "CW009", "CW024")
  829. microglial.genes <- c("B2m", "H2-D1", "H2-K1", "Tap1", "Cd74", "H2-Aa", "H2-Ab1", "H2-Eb1", "Ccl2", "Ccl3", "Ccl4", "Ccl5", "Ccl12", "Cxcl10", "Il1b", "Tnf", "Stat1", "Stat2", "Irf1", "Irf7", "Isg15", "Ifi30", "Ifi204", "Ifi211", "Ifitm3", "Oas1a")
  830. generate_heatmap(dsmerged_microglia_PBS_GAS, microglial.genes, ##Figure 2C##
  831. sample_levels = sample.levels,
  832. output_path = "04_plots/Figure 2",
  833. color_min = -2,
  834. color_max = 2)
  835. ## Microglia PBS vs GAS heatmaps by subcluster
  836. generate_heatmap_Z <- function(seurat_object,
  837. marker_set,
  838. cluster_levels = NULL,
  839. output_path = "04_plots/Figure 1",
  840. plot_width = 3.6115,
  841. plot_height = 4.66,
  842. color_min = -2,
  843. color_max = 2) {
  844. seurat_object_name <- deparse(substitute(seurat_object))
  845. marker_set_name <- deparse(substitute(marker_set))
  846. heatmap_filename_pdf <- paste0("Heatmap_", seurat_object_name, "_", marker_set_name, "_zscore.pdf")
  847. cluster_aggregates <- AggregateExpression(seurat_object, return.seurat = TRUE)
  848. cluster_aggregates <- ScaleData(cluster_aggregates, features = marker_set)
  849. heatmap_pdf <- DoHeatmap(cluster_aggregates,
  850. features = marker_set,
  851. slot = "scale.data", # Use z-scored data
  852. draw.lines = FALSE,
  853. raster = FALSE) +
  854. scale_fill_gradient2(low = "blue", high = "red", limits = c(color_min, color_max)) +
  855. labs(fill = "Z-score") +
  856. theme(
  857. axis.text.y.left = element_blank(),
  858. axis.text.y.right = element_text(size = 8),
  859. axis.text.x.top = element_blank(),
  860. axis.text.x.bottom = element_text(angle = 45, hjust = 1, size = 8)
  861. ) +
  862. scale_y_discrete(position = "right") +
  863. scale_x_discrete(position = "bottom")
  864. ggsave(
  865. filename = heatmap_filename_pdf,
  866. plot = heatmap_pdf,
  867. device = "pdf",
  868. path = output_path,
  869. scale = 1,
  870. width = plot_width,
  871. height = plot_height,
  872. units = "in",
  873. dpi = 300,
  874. bg = "transparent"
  875. )
  876. }
  877. Idents(object=dsmerged_microglia_PBS_GAS) <- [email hidden]$microglia.type
  878. cytokine.signaling <- c("Csf2ra", "Ccl5", "Cxcl9", "Ccl7", "Il1rn", "Cxcl10", "Cxcl16", "Ccl12", "Ccl2", "Cxcl13", "Il2rg", "Il1b", "Mif", "Tnfsf13b", "Il1a", "Tnf", "Il4ra", "Csf2rb2", "Ccl4", "Csf2rb", "Ccl3", "Osm", "Csf1")
  879. homeostatic <- c("Serinc3", "Tgfrb1", "P2ry12", "Sall1", "Siglech", "Mef2a", "Cd33", "Smad3", "Tgfb1", "Gpr34", "Adgrg1", "Csf1r", "Fcrls", "Ccr5", "Bin1", "Tmem119", "Cx3cr1", "Olfml3", "Glul", "Jun", "Mafb", "Egr1", "Spi1")
  880. disease.associated <- c("Ctsl", "Lpl", "Ctsb", "Cd63", "Lyz2", "Apoe", "Spp1", "Msr1", "Axl", "Il1b", "Itgax", "Cst7", "Fth1", "Nos2", "Cybb", "Lgals3", "Grn", "Bhlhe40", "Vegfa", "Fabp5", "Csf1", "Timp2", "Gnas", "Cd9", "Mertk", "Ccl6", "Ctsd", "Trem2", "Tyrobp")
  881. IFN <- c("Stat2", "Oasl2", "Iigp1", "Ifi206", "Irf7", "Igtp", "Ifi211", "Ifit1", "Oasl1", "Oas3", "Ifi47", "Ifi205", "Ifi209", "Ifit3", "Ifit2", "Ifi213", "Isg20", "Stat1", "Cxcl9", "Ifitm3", "Ifi35", "Ifi204", "Ifi207", "Isg15", "Cxcl10", "Oas1a", "Ifitm2", "Ifitm1", "Irf1")
  882. generate_heatmap_Z(dsmerged_microglia_PBS_GAS, cytokine.signaling, ##Figure 2K##
  883. cluster_levels = c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"),
  884. output_path = "04_plots/Figure 2",
  885. color_min = -2.2,
  886. color_max = 2.2)
  887. generate_heatmap_Z(dsmerged_microglia_PBS_GAS, homeostatic, ##Figure 2L##
  888. cluster_levels = c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"),
  889. output_path = "04_plots/Figure 2",
  890. color_min = -2.2,
  891. color_max = 2.2)
  892. generate_heatmap_Z(dsmerged_microglia_PBS_GAS, disease.associated, ##Figure 2M##
  893. cluster_levels = c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"),
  894. output_path = "04_plots/Figure 2",
  895. color_min = -2.2,
  896. color_max = 2.2)
  897. generate_heatmap_Z(dsmerged_microglia_PBS_GAS, IFN, ##Figure 2N##
  898. cluster_levels = c("hMG1", "hMG2", "srMG1", "srMG2", "srMG3", "srMG4"),
  899. output_path = "04_plots/Figure 2",
  900. color_min = -2.2,
  901. color_max = 2.2)
  902. rm(generate_heatmap_Z, cytokine.signaling, homeostatic, disease.associated, IFN)
  903. ## RORgt heatmaps and GO analysis ----
  904. dsmerged_ECs <- readRDS(file = "02_RDS files/dsmerged_ECs_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  905. Idents(object=dsmerged_ECs) <- [email hidden]$condition
  906. dsmerged_ECs_RORg_WT_GAS <- subset(x = dsmerged_ECs, idents = c("GAS", "RORg"),invert = FALSE)
  907. dsmerged_ECs_RORg_WT_GAS <- JoinLayers(dsmerged_ECs_RORg_WT_GAS)
  908. Idents(object=dsmerged_ECs_RORg_WT_GAS) <- [email hidden]$sample
  909. sample.levels <- c("CW005", "CW008", "CW009", "CW024", "CW010", "CW013", "CW018")
  910. genelist.ECs <-c("Itih5", "Tjp1", "Slc16a1", "Mfsd2a", "Bsg", "Ch25h", "Icam1", "Lcn2", "Lrg1", "B2m", "Cd74", "H2-D1", "H2-K1", "Tap1", "Ifi208", "Ifitm2", "Ifitm3", "Ifi47", "Iigp1", "Igtp", "Irgm1", "Gbp2")
  911. generate_heatmap(dsmerged_ECs_RORg_WT_GAS, genelist.ECs, ##Figure 4B##
  912. sample_levels = sample.levels,
  913. output_path = "04_plots/Figure 4",
  914. color_min = -2,
  915. color_max = 2.2)
  916. dsmerged_microglia <- readRDS(file = "02_RDS files/dsmerged_microglia_004_005_008_009_010_011_012_013_014_015_016_017_018_021_022_023_024_025_026.rds")
  917. Idents(object=dsmerged_microglia) <- [email hidden]$condition
  918. dsmerged_microglia_RORg_WT_GAS <- subset(x = dsmerged_microglia, idents = c("GAS", "RORg"),invert = FALSE)
  919. dsmerged_microglia_RORg_WT_GAS <- JoinLayers(dsmerged_microglia_RORg_WT_GAS)
  920. Idents(object=dsmerged_microglia_RORg_WT_GAS) <- [email hidden]$sample
  921. sample.levels <- c("CW005", "CW008", "CW009", "CW024", "CW010", "CW013", "CW018")
  922. genelist.microglia <-c("B2m", "Cd74", "H2-D1", "H2-K1", "Tap1", "Tap2", "H2-Ab1", "H2-Eb1", "Cx3cr1", "Gpr34", "P2ry12", "Bhlhe40", "Cd63", "Cst7", "Spp1", "Ccl2", "Ccl3", "Ccl4", "Ccl5", "Cxcl10", "Il1b", "Tnf")
  923. generate_heatmap(dsmerged_microglia_RORg_WT_GAS, RORvsWT_microglia, ##Figure 4E##
  924. sample_levels = sample.levels,
  925. output_path = "04_plots/Figure 4",
  926. color_min = -2,
  927. color_max = 2.2)
  928. ## Run DE with standard deviation for GSEA Signal2Noise parameter
  929. compare.conditions <- list(
  930. list(ident1 = "RORg", ident2 = "GAS", result_name = "RORgvsGAS")
  931. )
  932. DE.MAST.RORg.ECs <- run_DE(
  933. object = dsmerged_ECs_RORg_WT_GAS,
  934. comparisons_list = compare.conditions,
  935. save_results = TRUE,
  936. test_method = "MAST",
  937. output_file = "03_quantification/RORgvsGAS_ECs_MAST_DE_withSD.xlsx",
  938. include_sd = TRUE,
  939. skip_cell_subsetting = TRUE
  940. )
  941. DE.MAST.RORg.microglia <- run_DE(
  942. object = dsmerged_microglia_RORg_WT_GAS,
  943. comparisons_list = compare.conditions,
  944. save_results = TRUE,
  945. test_method = "MAST",
  946. output_file = "03_quantification/RORgvsGAS_Microglia_MAST_DE_withSD.xlsx",
  947. include_sd = TRUE,
  948. skip_cell_subsetting = TRUE
  949. )
  950. ## GSEA using GO pathway lists
  951. library(readxl) # version 1.4.5
  952. library(clusterProfiler) # version 4.12.6
  953. library(enrichplot) # version 1.24.4
  954. library(org.Mm.eg.db) # version 3.19.1
  955. run_gsea_analysis <- function(cell_type,
  956. input_file,
  957. compare_conditions,
  958. sheet_name = "RORgvsGAS",
  959. p_cutoff = 0.05,
  960. show_categories = 5,
  961. manual_go_terms = NULL,
  962. plot_width = 5,
  963. plot_height = 6) {
  964. cat("Running GSEA analysis for", cell_type, "\n")
  965. de_data <- read_excel(input_file, sheet = sheet_name)
  966. excluded_patterns <- c("^mt-", "^Rps", "^Rpl", "^Mrps", "^Mrpl")
  967. clean_data <- de_data[!is.na(de_data$gene) &
  968. !is.na(de_data$Signal2Noise) &
  969. !grepl(paste(excluded_patterns, collapse = "|"), de_data$gene), ]
  970. gene_list <- setNames(clean_data$Signal2Noise, clean_data$gene)
  971. gene_list <- sort(gene_list, decreasing = TRUE)
  972. gse_results <- gseGO(geneList = gene_list,
  973. OrgDb = org.Mm.eg.db,
  974. ont = "BP",
  975. keyType = "SYMBOL",
  976. minGSSize = 10,
  977. maxGSSize = 800,
  978. pvalueCutoff = p_cutoff)
  979. table_output <- paste0("03_quantification/GSEA_", cell_type, "_", compare_conditions, ".csv")
  980. plot_output <- paste0("04_plots/Figure 4/GSEA_dotplot_", cell_type, "_", compare_conditions, ".pdf")
  981. write.csv(as.data.frame(gse_results), table_output, row.names = FALSE)
  982. gse_plot <- gse_results # prepare data for plotting
  983. if (!is.null(manual_go_terms)) { # filter for manual go terms if provided
  984. gse_plot@result <- gse_plot@result[
  985. gse_plot@result$ID %in% manual_go_terms |
  986. gse_plot@result$Description %in% manual_go_terms, ]
  987. cat("Plotting", nrow(gse_plot@result), "manually selected GO terms\n")
  988. }
  989. plot_categories <- ifelse(!is.null(manual_go_terms), nrow(gse_plot@result), show_categories)
  990. gse_plot@result$qvalue <- -gse_plot@result$enrichmentScore # replace qvalue after selection
  991. p <- dotplot(gse_plot,
  992. color = "qvalue",
  993. x = "NES",
  994. showCategory = plot_categories,
  995. split = ".sign") +
  996. scale_color_gradient2(low = "blue", mid = "white", high = "red",
  997. midpoint = 0, name = "enrichmentScore") +
  998. xlim(-3.5, 3.5) +
  999. ggtitle(paste("GSEA:", cell_type, compare_conditions))
  1000. ggsave(plot_output, plot = p, width = plot_width, height = plot_height, dpi = 300)
  1001. print(p)
  1002. cat("Complete! Files saved:", table_output, "and", plot_output, "\n")
  1003. return(gse_results)
  1004. }
  1005. # Note: manually added "Signal2Noise" column in Excel and removed "_CellType" from sheet name
  1006. EC_results <- run_gsea_analysis( ##Figure 4B##
  1007. cell_type = "ECs",
  1008. manual_go_terms = c("GO:0035458", "GO:0001568", "GO:0019882", "GO:0034341", "GO:0016477", "GO:0007155", "GO:0001568", "GO:0050671", "GO:0030334"),
  1009. input_file = "03_quantification/RORgvsGAS_ECs_MAST_DE_withSD.xlsx",
  1010. compare_conditions = "RORg_vs_GAS"
  1011. )
  1012. microglia_results <- run_gsea_analysis( ##Figure 4E##
  1013. cell_type = "Microglia",
  1014. manual_go_terms = c("GO:0019882", "GO:0006119", "GO:0034341", "GO:0016477", "GO:0001817", "GO:0042129", "GO:0035458", "GO:0097396"),
  1015. input_file = "03_quantification/RORgvsGAS_Microglia_MAST_DE_withSD.xlsx",
  1016. compare_conditions = "RORg_vs_GAS"
  1017. )
  1018. ## Csf2-CD4KO heatmaps ----
  1019. Idents(object=dsmerged_ECs) <- [email hidden]$condition
  1020. dsmerged_ECs_Csf2CD4 <- subset(x = dsmerged_ECs, idents = c("Csf2_CD4ko", "Csf2flox"),invert = FALSE)
  1021. dsmerged_ECs_Csf2CD4 <- JoinLayers(dsmerged_ECs_Csf2CD4)
  1022. Idents(object=dsmerged_ECs_Csf2CD4) <- [email hidden]$sample
  1023. sample.levels <- c("CW021", "CW025", "CW022", "CW026")
  1024. generate_heatmap(dsmerged_ECs_Csf2CD4, genelist.ECs, ##Extended Data Figure 4I##
  1025. sample_levels = sample.levels,
  1026. output_path = "04_plots/Figure 4",
  1027. color_min = -2,
  1028. color_max = 2.2)
  1029. Idents(object=dsmerged_microglia) <- [email hidden]$condition
  1030. dsmerged_microglia_Csf2CD4 <- subset(x = dsmerged_microglia, idents = c("Csf2_CD4ko", "Csf2flox"),invert = FALSE)
  1031. dsmerged_microglia_Csf2CD4 <- JoinLayers(dsmerged_microglia_Csf2CD4)
  1032. Idents(object=dsmerged_microglia_Csf2CD4) <- [email hidden]$sample
  1033. generate_heatmap(dsmerged_microglia_Csf2CD4, genelist.microglia, ##Extended Data Figure 4J##
  1034. sample_levels = sample.levels,
  1035. output_path = "04_plots/Figure 4",
  1036. color_min = -2,
  1037. color_max = 2.2)
  1038. compare.conditions <- list(
  1039. list(ident1 = "Csf2_CD4ko", ident2 = "Csf2flox", result_name = "Csf2_CD4kovsFlox")
  1040. )
  1041. DE.MAST.Csf2CD4ko.ECs <- run_DE(
  1042. object = dsmerged_ECs_Csf2CD4,
  1043. comparisons_list = compare.conditions,
  1044. save_results = TRUE,
  1045. test_method = "MAST",
  1046. output_file = "03_quantification/Csf2_CD4kovsFlox_ECs_MAST_DE_withSD.xlsx",
  1047. include_sd = TRUE,
  1048. skip_cell_subsetting = TRUE
  1049. )
  1050. DE.MAST.Csf2CD4ko.microglia <- run_DE(
  1051. object = dsmerged_microglia_Csf2CD4,
  1052. comparisons_list = compare.conditions,
  1053. save_results = TRUE,
  1054. test_method = "MAST",
  1055. output_file = "03_quantification/Csf2_CD4kovsFlox_microglia_MAST_DE_withSD.xlsx",
  1056. include_sd = TRUE,
  1057. skip_cell_subsetting = TRUE
  1058. )
  1059. EC_results <- run_gsea_analysis( ##Extended Data Figure 4J##
  1060. cell_type = "ECs",
  1061. sheet_name = "Csf2_CD4kovsFlox",
  1062. manual_go_terms = c("GO:0035456", "GO:0009617", "GO:0019883", "GO:0034341", "GO:1990868"),
  1063. input_file = "03_quantification/Csf2_CD4kovsFlox_ECs_MAST_DE_withSD.xlsx",
  1064. compare_conditions = "Csf2_CD4kovsFlox"
  1065. )
  1066. microglia_results <- run_gsea_analysis( ##Extended Data Figure 4J##
  1067. cell_type = "Microglia",
  1068. sheet_name = "Csf2_CD4kovsFlox",
  1069. manual_go_terms = c("GO:0034097", "GO:0034341", "GO:0034097"),
  1070. input_file = "03_quantification/Csf2_CD4kovsFlox_microglia_MAST_DE_withSD.xlsx",
  1071. compare_conditions = "Csf2_CD4kovsFlox"
  1072. )
  1073. ## IL-17A mAb heatmaps and ridge plots ----
  1074. Idents(object=dsmerged_ECs) <- [email hidden]$condition
  1075. dsmerged_ECs_IL17A.mAb.Isotype <- subset(x = dsmerged_ECs, idents = c("IL-17A_mAb", "Isotype_mAb"),invert = FALSE)
  1076. dsmerged_ECs_IL17A.mAb.Isotype <- JoinLayers(dsmerged_ECs_IL17A.mAb.Isotype)
  1077. Idents(object=dsmerged_ECs_IL17A.mAb.Isotype) <- [email hidden]$sample
  1078. sample.levels <- c("CW011", "CW015", "CW012", "CW016", "CW017")
  1079. generate_heatmap(dsmerged_ECs_IL17A.mAb.Isotype, genelist.ECs, ##Figure 5B##
  1080. sample_levels = sample.levels,
  1081. output_path = "04_plots/Figure 5",
  1082. color_min = -2,
  1083. color_max = 2.2)
  1084. Idents(object=dsmerged_microglia) <- [email hidden]$condition
  1085. dsmerged_microglia_IL17A.mAb.Isotype <- subset(x = dsmerged_microglia, idents = c("IL-17A_mAb", "Isotype_mAb"),invert = FALSE)
  1086. dsmerged_microglia_IL17A.mAb.Isotype <- JoinLayers(dsmerged_microglia_IL17A.mAb.Isotype)
  1087. Idents(object=dsmerged_microglia_IL17A.mAb.Isotype) <- [email hidden]$sample
  1088. generate_heatmap(dsmerged_microglia_IL17A.mAb.Isotype, genelist.microglia, ##Extended Data Figure 5D##
  1089. sample_levels = sample.levels,
  1090. output_path = "04_plots/Figure 5",
  1091. color_min = -2,
  1092. color_max = 2.2)
  1093. compare.conditions <- list(
  1094. list(ident1 = "IL-17A_mAb", ident2 = "Isotype_mAb", result_name = "IL17AmAbvsIsotype")
  1095. )
  1096. DE.MAST.IL17A_mAb.ECs <- run_DE(
  1097. object = dsmerged_ECs_IL17A.mAb.Isotype,
  1098. comparisons_list = compare.conditions,
  1099. save_results = TRUE,
  1100. test_method = "MAST",
  1101. output_file = "03_quantification/IL17AmAbvsIsotype_ECs_MAST_DE_withSD.xlsx",
  1102. include_sd = TRUE,
  1103. skip_cell_subsetting = TRUE
  1104. )
  1105. DE.MAST.IL17A_mAb.microglia <- run_DE(
  1106. object = dsmerged_microglia_IL17A.mAb.Isotype,
  1107. comparisons_list = compare.conditions,
  1108. save_results = TRUE,
  1109. test_method = "MAST",
  1110. output_file = "03_quantification/IL17AmAbvsIsotype_microglia_MAST_DE_withSD.xlsx",
  1111. include_sd = TRUE,
  1112. skip_cell_subsetting = TRUE
  1113. )
  1114. EC_results <- run_gsea_analysis( ##Figure 5C##
  1115. cell_type = "ECs",
  1116. sheet_name = "IL17AmAbvsIsotype",
  1117. manual_go_terms = c("GO:0002396", "GO:0001959", "GO:0019221", "GO:0032496", "GO:0006119", "GO:0045333", "GO:0000902", "GO:0009615", "GO:0009617"),
  1118. input_file = "03_quantification/IL17AmAbvsIsotype_ECs_MAST_DE_withSD.xlsx",
  1119. compare_conditions = "IL-17A mAb vs Isotype"
  1120. )
  1121. microglia_results <- run_gsea_analysis( ##Extended Data Figure 5E##
  1122. cell_type = "Microglia",
  1123. sheet_name = "IL17AmAbvsIsotype",
  1124. manual_go_terms = c("GO:0006119", "GO:0019882", "GO:0001816", "GO:0034341", "GO:0032728"),
  1125. input_file = "03_quantification/IL17AmAbvsIsotype_Microglia_MAST_DE_withSD.xlsx",
  1126. compare_conditions = "IL-17A mAb vs Isotype"
  1127. )
  1128. # Ridge plots for MHC I antigen presentation
  1129. Idents(object=dsmerged_ECs) <- [email hidden]$condition
  1130. dsmerged_ECs_antigen <- subset(x = dsmerged_ECs, idents = c("Csf2_CD4ko", "Csf2flox"), invert = TRUE)
  1131. Idents(object=dsmerged_microglia) <- [email hidden]$condition
  1132. dsmerged_microglia_antigen <- subset(x = dsmerged_microglia, idents = c("Csf2_CD4ko", "Csf2flox"), invert = TRUE)
  1133. Idents(object=dsmerged) <- [email hidden]$condition
  1134. dsmerged_antigen <- subset(x = dsmerged, idents = c("Csf2_CD4ko", "Csf2flox"), invert = TRUE)
  1135. Idents(object=dsmerged_antigen) <- [email hidden]$cluster.names_all.cells
  1136. dsmerged_astrocytes_antigen <- subset(x = dsmerged_antigen, idents = c("Astrocytes"), invert = FALSE)
  1137. Idents(object=dsmerged_astrocytes_antigen) <- [email hidden]$condition
  1138. dsmerged_OECs_antigen <- subset(x = dsmerged_antigen, idents = c("Olfactory ensheathing cells"), invert = FALSE)
  1139. Idents(object=dsmerged_OECs_antigen) <- [email hidden]$condition
  1140. make_ridge_plot <- function(data, feature) {
  1141. RidgePlot(data, features = feature) +
  1142. scale_fill_manual(values = c("gray80", "skyblue", "mediumseagreen", "wheat", "goldenrod1")) +
  1143. xlim(-0.45, 5) +
  1144. theme_minimal() +
  1145. NoLegend() +
  1146. theme(
  1147. plot.title = element_text(size = 14, face = "italic", hjust = 0.5),
  1148. axis.text.y = element_blank(),
  1149. axis.title = element_blank(),
  1150. panel.grid.major = element_line(color = "gray90", size = 0.5),
  1151. panel.grid.minor = element_blank()
  1152. )
  1153. }
  1154. # Now create your plots with one line each:
  1155. p1 <- make_ridge_plot(dsmerged_astrocytes_antigen, "B2m")
  1156. p2 <- make_ridge_plot(dsmerged_astrocytes_antigen, "H2-D1")
  1157. p3 <- make_ridge_plot(dsmerged_astrocytes_antigen, "H2-K1")
  1158. p4 <- make_ridge_plot(dsmerged_OECs_antigen, "B2m")
  1159. p5 <- make_ridge_plot(dsmerged_OECs_antigen, "H2-D1")
  1160. p6 <- make_ridge_plot(dsmerged_OECs_antigen, "H2-K1")
  1161. p7 <- make_ridge_plot(dsmerged_ECs_antigen, "B2m")
  1162. p8 <- make_ridge_plot(dsmerged_ECs_antigen, "H2-D1")
  1163. p9 <- make_ridge_plot(dsmerged_ECs_antigen, "H2-K1")
  1164. p10 <- make_ridge_plot(dsmerged_microglia_antigen, "B2m")
  1165. p11 <- make_ridge_plot(dsmerged_microglia_antigen, "H2-D1")
  1166. p12 <- make_ridge_plot(dsmerged_microglia_antigen, "H2-K1")
  1167. combined_ridge_plot <- plot_grid(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
  1168. nrow = 4)
  1169. ggsave("04_plots/Figure 5/AntigenPresentation_Ridgeplots.pdf", ##Extended Data Figure 5F##
  1170. plot = combined_ridge_plot,
  1171. width = 8, height = 10,
  1172. units = "in")

01_WayneEtAl_scRNAseq.R at commit 28b8a8e, no license · at the source

Overview

Authors: Charlotte R. Wayne1, Uğur Akcan1, Travis E. Faust2, Violeta Durán-Laforet2, Danny Jamoul1, Luca Bremner1, Nicole Ampatey1, Büşra T. Akcan1, Sarah J. Ho1, Bogoljub Ciric3, Shannon L. Delaney4, Wendy S. Vargas1, Susan Swedo5, Vilas Menon1, Dorothy P. Schafer2, Tyler Cutforth1, Dritan Agalliu1,6
  1. Department of Neurology, Columbia University Irving Medical Center,New York, NY USA
  2. Department of Neurobiology, Brudnick Neuropsychiatric Research Institute, University of Massachusetts Chan Medical School,Worcester, MA USA
  3. Department of Neurology, Thomas Jefferson University,Philadelphia, PA USA
  4. Lyme and Tick-Borne Diseases Research Center, Department of Psychiatry, Columbia University Irving Medical Center,New York, NY USA
  5. Section of Behavioral Pediatrics, National Institute of Mental Health,Bethesda, MD USA
  6. Department of Pathology and Cell Biology, Columbia University Irving Medical Center,New York, NY USA
Journal: Nature communications, volume 17, issue 1, article 9658
Dates: received 13 April 2023; accepted 13 July 2026; published online 11 August 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-76232-w · PMID 42717209 · PMCID PMC13558752 · OpenAlex W7202203061
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: genetics / omics (modality), human (organism), mouse (organism), other condition (population), cellular / molecular (subfield)
Methods: Statistics, Smoothing, state filtering, decompositions, Evoked potentials, Machine learning, fMRI & imaging
Keywords: Neuroimmunology, Infection, Paediatric neurological disorders
MeSH: Cytokines*, Encephalitis*, Endothelial Cells*, Microglia*, Streptococcal Infections*, Th17 Cells*, Animals, Blood-Brain Barrier, Brain, Chemokines, Disease Models, Animal, Female, Granulocyte-Macrophage Colony-Stimulating Factor, Humans, Interleukin-17, Mice, Mice, Inbred C57BL, Mice, Knockout, Receptors, Interleukin-17, Signal Transduction (* major topic)
Topic: Neuroinflammation and Neurodegeneration Mechanisms (Neurology, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 103 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 14 matches between paragraphs and lines of code.

AgalliuLab/s-pyogenes-scRNAseq

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 28b8a8e8ac4fdf7fb9e078ef138eb37f4cb856c6, 27 October 2025
Languages: R (5)
Size: 5 files, 5 scripts
Software Heritage: not archived
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Seurat (5 files), tidyverse (5 files), ggplot2 (4 files), patchwork (2 files), circlize (1 file), clusterProfiler (1 file), ComplexHeatmap (1 file), cowplot (1 file), ggpubr (1 file), Harmony (1 file), reshape2 (1 file), reticulate (1 file), rstatix (1 file), SingleCellExperiment (1 file), UMAP (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
5 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/s41467-026-76232-w.

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;
  • 14 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

Datasets cited

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/s41467-026-76232-w.

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, 17 authors, 3 keywords, 20 MeSH terms, 9 funders, 103 references.

Cite

This paper

Wayne, C. R., Akcan, U., Faust, T. E., Durán-Laforet, V., Jamoul, D., Bremner, L., Ampatey, N., Akcan, B. T., Ho, S. J., Ciric, B., Delaney, S. L., Vargas, W. S., Swedo, S., Menon, V., Schafer, D. P., Cutforth, T., & Agalliu, D. (2026). Th17 effector cytokines induce shared and distinct microglial and endothelial cell responses in a mouse model for post-streptococcal encephalitis. Nature communications, 17(1), 9658. https://doi.org/10.1038/s41467-026-76232-w

BibTeX

@article{wayne2026th17,
author = {Wayne, Charlotte R. and Akcan, Uğur and Faust, Travis E. and Durán-Laforet, Violeta and Jamoul, Danny and Bremner, Luca and Ampatey, Nicole and Akcan, Büşra T. and Ho, Sarah J. and Ciric, Bogoljub and Delaney, Shannon L. and Vargas, Wendy S. and Swedo, Susan and Menon, Vilas and Schafer, Dorothy P. and Cutforth, Tyler and Agalliu, Dritan},
title = {{Th17 effector cytokines induce shared and distinct microglial and endothelial cell responses in a mouse model for post-streptococcal encephalitis}},
journal = {Nature communications},
year = {2026},
month = aug,
volume = {17},
number = {1},
pages = {9658},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-76232-w},
url = {https://doi.org/10.1038/s41467-026-76232-w},
pmid = {42717209},
pmcid = {PMC13558752}
}

RIS

TY - JOUR
AU - Wayne, Charlotte R.
AU - Akcan, Uğur
AU - Faust, Travis E.
AU - Durán-Laforet, Violeta
AU - Jamoul, Danny
AU - Bremner, Luca
AU - Ampatey, Nicole
AU - Akcan, Büşra T.
AU - Ho, Sarah J.
AU - Ciric, Bogoljub
AU - Delaney, Shannon L.
AU - Vargas, Wendy S.
AU - Swedo, Susan
AU - Menon, Vilas
AU - Schafer, Dorothy P.
AU - Cutforth, Tyler
AU - Agalliu, Dritan
TI - Th17 effector cytokines induce shared and distinct microglial and endothelial cell responses in a mouse model for post-streptococcal encephalitis
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/08/11
VL - 17
IS - 1
SP - 9658
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-76232-w
UR - https://doi.org/10.1038/s41467-026-76232-w
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-76232-w",
"type": "article-journal",
"title": "Th17 effector cytokines induce shared and distinct microglial and endothelial cell responses in a mouse model for post-streptococcal encephalitis",
"container-title": "Nature communications",
"author": [
{
"family": "Wayne",
"given": "Charlotte R."
},
{
"family": "Akcan",
"given": "Uğur"
},
{
"family": "Faust",
"given": "Travis E."
},
{
"family": "Durán-Laforet",
"given": "Violeta"
},
{
"family": "Jamoul",
"given": "Danny"
},
{
"family": "Bremner",
"given": "Luca"
},
{
"family": "Ampatey",
"given": "Nicole"
},
{
"family": "Akcan",
"given": "Büşra T."
},
{
"family": "Ho",
"given": "Sarah J."
},
{
"family": "Ciric",
"given": "Bogoljub"
},
{
"family": "Delaney",
"given": "Shannon L."
},
{
"family": "Vargas",
"given": "Wendy S."
},
{
"family": "Swedo",
"given": "Susan"
},
{
"family": "Menon",
"given": "Vilas"
},
{
"family": "Schafer",
"given": "Dorothy P."
},
{
"family": "Cutforth",
"given": "Tyler"
},
{
"family": "Agalliu",
"given": "Dritan"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "9658",
"DOI": "10.1038/s41467-026-76232-w",
"PMID": "42717209",
"PMCID": "PMC13558752",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-76232-w",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
11
]
]
}
}

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.1038/s41593-026-02367-0 [code]
A reproducible three-dimensional model of human brain tissue to investigate physiological and disease-associated microglia phenotypes.
Journal: Nature neuroscience
In common: Harmony, SingleCellExperiment, reticulate, 10 other tools, cellular / molecular, 4 references
[2] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: Harmony, SingleCellExperiment, UMAP, 10 other tools, genetics / omics, other condition, cellular / molecular, 2 references
[3] doi:10.1038/s41586-026-10629-x [code]
Whole-genome duplication shaped cell-type evolution in the vertebrate brain.
Journal: Nature
In common: Harmony, reticulate, rstatix, 10 other tools, genetics / omics, mouse, cellular / molecular, 1 reference
[4] doi:10.1016/j.xcrm.2026.102651 [code]
Integrative CSF profiling identifies disease-specific immune responses in leptomeningeal disease.
Journal: Cell reports. Medicine
In common: Harmony, SingleCellExperiment, reticulate, 10 other tools, genetics / omics, other condition, cellular / molecular, 1 reference
[5] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: Harmony, SingleCellExperiment, rstatix, 10 other tools, genetics / omics, mouse, cellular / molecular, 1 reference
[6] doi:10.1038/s41586-026-10214-2 [code]
Multidimensional profiling of heterogeneity in supratentorial ependymomas.
Journal: Nature
In common: Harmony, SingleCellExperiment, reticulate, 10 other tools, genetics / omics, other condition, mouse, 1 reference
[7] doi:10.1038/s41398-026-04200-5 [code]
Postmortem brain single-nucleus and bulk gene expression analyses identify shared and distinct abnormalities in bipolar disorder and major depressive disorder.
Journal: Translational psychiatry
In common: Harmony, SingleCellExperiment, rstatix, 9 other tools, genetics / omics, cellular / molecular, 2 references
[8] doi:10.1016/j.celrep.2026.117500 [code]
Spatio-molecular gene expression reflects dorsal anterior cingulate cortex structure and function in the human brain.
Journal: Cell reports
In common: Harmony, SingleCellExperiment, reticulate, 9 other tools, genetics / omics, cellular / molecular, 2 references
[9] doi:10.1126/sciadv.aeb4265 [code]
Single-nucleus profiling reveals a core disease signature and cell type-specific vulnerabilities in early Rett syndrome.
Journal: Science advances
In common: Harmony, SingleCellExperiment, rstatix, 8 other tools, genetics / omics, other condition, mouse, 1 other category, 2 references
[10] doi:10.1038/s42003-026-10034-0 [code]
Region- and cell type-specific changes in gene expression in the cerebellum after classical fear conditioning.
Journal: Communications biology
In common: SingleCellExperiment, reticulate, rstatix, 9 other tools, genetics / omics, mouse, cellular / molecular, 1 reference

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.

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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

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