OSCR

Iba1 deficiency impairs microglial synaptic remodeling and neuronal survival after axonal injury.

Code ↔ Paper

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

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

The 7 matches
  1. [1] § Materials and methods › GO enrichment analysis ↔ go_enrichment_cluster_degs.R, lines 1 to 50 · score 0.74 · GO enrichment, clusterProfiler, gene symbols, db, mm, DEGs · block oscr:b:G9XK3K6V8W986-R · Report a mismatch
  2. [2] § Results › Iba1 loss diverts microglial signaling from adhesion to inflammation ↔ nichenet_microglia_to_chat.R, lines 85 to 117 · score 0.67 · H2 D1, H2 K1, Anxa2, Mmp2, Tgfbi, Aplp2 · block oscr:b:96AYPGKJ4KK2R-U · Report a mismatch
  3. [3] § Materials and methods › Volcano plot analysis ↔ volcano_highlight_validation_genes.R, lines 44 to 98 · score 0.60 · log2 fold change, log2fc, Volcano, gene · block oscr:b:VQQRJNZHDR6S1-C · Report a mismatch
  4. [4] § Results › Iba1 loss skews axotomy-evoked microglial states toward interferon-responsive programs ↔ violin_microglia_cytokines.R, lines 89 to 133 · score 0.60 · Aif1l, growth factor, cytokine, chemokine, microglia · block oscr:b:1C4KBG0GTNFF8-U · Report a mismatch
  5. [5] § Results › Iba1 loss diverts microglial signaling from adhesion to inflammation ↔ nichenet_microglia_to_chat.R, lines 85 to 117 · score 0.54 · NicheNet, Itga3, Itgav, Itgb1, Itgb4, Aplp2 · block oscr:b:96AYPGKJ4KK2R-U · Report a mismatch
  6. [6] § Results › Microglial contact and synapse number ↔ microglia_reclustering_ad_state_annotation.R, lines 576 to 639 · score 0.53 · odds ratio, pairwise Fisher, CL, Microglial, cell · block oscr:b:X4YK9XSK45TGF-Q · Report a mismatch
  7. [7] § Results › Iba1 loss diverts microglial signaling from adhesion to inflammation ↔ microglia_reclustering_ad_state_annotation.R, lines 356 to 422 · score 0.53 · H2 D1, H2 K1, microglial · block oscr:b:E46CVXGBYPATJ-7 · Report a mismatch

Paper

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

The paper is loaded when this pane is shown.

The authors' code

R · 629 lines · 23 KB · no license · 2 matches

  1. ################################################################################
  2. # NicheNet pipeline (Receiver: ChAT; Sender: Microglia)
  3. #
  4. # Comparisons (default):
  5. # 1) KO-axotomy vs KO-sham
  6. # 2) WT-axotomy vs WT-sham
  7. #
  8. # Main outputs (per comparison):
  9. # - DEG tables (receiver)
  10. # - Ligand activity (AUPR corrected)
  11. # - Ligand→target links (top)
  12. # - Ligand–receptor candidates (filtered by expression)
  13. # - Barplot / Heatmap / Chord / Sankey / DotPlot (receptors)
  14. #
  15. # Cross-comparison outputs:
  16. # - WT vs KO ligand activity scatter
  17. # - Top15 overlap CSV + barplot + UpSet
  18. #
  19. # Usage:
  20. # Rscript nichenet_chat_from_mgl_public_safe.R \
  21. # --chat_rds path/to/seurat_ChAT_4groups.rds \
  22. # --mgl_rds path/to/seurat_Microglia_4groups.rds \
  23. # --group_col group \
  24. # --out results/NicheNet_ChAT_from_MGL
  25. #
  26. # Notes (public safety):
  27. # - No absolute paths are hard-coded or printed.
  28. # - Output filenames do not include local paths.
  29. ################################################################################
  30. set.seed(1)
  31. #-----------------------------#
  32. # 0) Dependencies #
  33. #-----------------------------#
  34. need <- c(
  35. "Seurat","dplyr","tibble","readr","stringr","tidyr","purrr","Matrix",
  36. "nichenetr","AnnotationDbi","org.Mm.eg.db","babelgene",
  37. "ggplot2","ggrepel","ggalluvial","ComplexUpset","pheatmap",
  38. "circlize","networkD3","htmlwidgets"
  39. )
  40. miss <- need[!vapply(need, requireNamespace, logical(1), quietly = TRUE)]
  41. if (length(miss)) {
  42. message("Missing packages detected (names only): ", paste(miss, collapse = ", "))
  43. stop("Please install the missing packages, then rerun this script.")
  44. }
  45. suppressPackageStartupMessages({
  46. library(Seurat)
  47. library(dplyr)
  48. library(tibble)
  49. library(readr)
  50. library(stringr)
  51. library(tidyr)
  52. library(purrr)
  53. library(Matrix)
  54. library(nichenetr)
  55. library(AnnotationDbi)
  56. library(org.Mm.eg.db)
  57. library(babelgene)
  58. library(ggplot2)
  59. library(ggrepel)
  60. library(ggalluvial)
  61. library(ComplexUpset)
  62. library(pheatmap)
  63. library(circlize)
  64. library(networkD3)
  65. library(htmlwidgets)
  66. })
  67. #-----------------------------#
  68. # 1) Argument parsing #
  69. #-----------------------------#
  70. args <- commandArgs(trailingOnly = TRUE)
  71. get_arg <- function(flag, default = NULL) {
  72. hit <- which(args == flag)
  73. if (length(hit) == 1 && length(args) >= hit + 1) return(args[hit + 1])
  74. default
  75. }
  76. path_chat <- get_arg("--chat_rds")
  77. path_mgl <- get_arg("--mgl_rds")
  78. group_col <- get_arg("--group_col", default = "group")
  79. out_dir <- get_arg("--out", default = file.path("results", "NicheNet_ChAT_from_MGL"))
  80. if (is.null(path_chat)) stop("Missing required argument: --chat_rds <path_to_receiver_seurat_rds>")
  81. if (is.null(path_mgl)) stop("Missing required argument: --mgl_rds <path_to_sender_seurat_rds>")
  82. if (!file.exists(path_chat)) stop("Receiver RDS not found (path not printed).")
  83. if (!file.exists(path_mgl)) stop("Sender RDS not found (path not printed).")
  84. dir.create(out_dir, showWarnings = FALSE, recursive = TRUE)
  85. message("Starting NicheNet pipeline (paths are not printed).")
  86. message("Outputs will be written under the specified output directory.")
  87. #-----------------------------#
  88. # 2) User-configurable values #
  89. #-----------------------------#
  90. cmp_list <- list(
  91. KO = list(case = "KO-axotomy", ctrl = "KO-sham", tag = "KO_axotomy_vs_KO_sham"),
  92. WT = list(case = "WT-axotomy", ctrl = "WT-sham", tag = "WT_axotomy_vs_WT_sham")
  93. )
  94. # Optional: UMAP FeaturePlot targets (only for WT comparison in this script)
  95. genes_umap_chat <- c(
  96. "Aplp2","Ddr1","Dysf","Egfr","F2r","Fgfr1","Igsf11",
  97. "Itga3","Itga6","Itga7","Itga9","Itgav","Itgb1","Itgb4","Itgb5",
  98. "Plat","Sdc2"
  99. )
  100. genes_umap_mgl <- c(
  101. "Anxa2","F13a1","H2-D1","H2-K1","H2-Q4","H2-Q6","H2-Q7",
  102. "Mmp2","Tgfbi","Vsir"
  103. )
  104. #-----------------------------#
  105. # 3) Utilities #
  106. #-----------------------------#
  107. normalize_symbol <- function(x) {
  108. x <- as.character(x)
  109. x <- trimws(x)
  110. x[nchar(x) == 0] <- NA_character_
  111. x
  112. }
  113. extract_symbolish <- function(x) {
  114. x <- as.character(x)
  115. x <- gsub("\\.[0-9]+$", "", x) # strip trailing ".1" etc
  116. x <- gsub("(?i)^(gene|symbol|target|geneid|ensembl)[:_ -]*", "", x, perl = TRUE)
  117. x <- gsub("(?i)[:_ -]*(gene|symbol|target)$", "", x, perl = TRUE)
  118. x <- gsub("\\s+", "", x)
  119. x
  120. }
  121. expressed_genes <- function(seu, pct = 0.05, assay = NULL) {
  122. if (!is.null(assay)) DefaultAssay(seu) <- assay
  123. mat <- GetAssayData(seu, slot = "data")
  124. frac <- Matrix::rowMeans(mat > 0)
  125. names(frac)[frac >= pct]
  126. }
  127. # Convert NicheNet extdata (human symbols) to mouse symbols via babelgene orthologs
  128. # Returns: list(ltm = ligand_target_matrix_mouse, lr = lr_network_mouse)
  129. relabel_to_mouse <- function(ltm, lr) {
  130. mapL <- babelgene::orthologs(colnames(ltm), species = "mouse")
  131. mapR <- babelgene::orthologs(rownames(ltm), species = "mouse")
  132. mapL <- mapL[!is.na(mapL$mouse_symbol) & nzchar(mapL$mouse_symbol),
  133. c("human_symbol","mouse_symbol")] %>% distinct()
  134. mapR <- mapR[!is.na(mapR$mouse_symbol) & nzchar(mapR$mouse_symbol),
  135. c("human_symbol","mouse_symbol")] %>% distinct()
  136. col_new <- setNames(mapL$mouse_symbol, mapL$human_symbol)[colnames(ltm)]
  137. row_new <- setNames(mapR$mouse_symbol, mapR$human_symbol)[rownames(ltm)]
  138. ltm_m <- as.matrix(ltm)
  139. # Collapse duplicated ligands (columns)
  140. col_dup <- split(seq_along(col_new), col_new)
  141. ltm2 <- do.call(cbind, lapply(col_dup, function(idx) Matrix::rowSums(ltm_m[, idx, drop = FALSE])))
  142. # Apply receptor renaming
  143. rownames(ltm2) <- row_new
  144. # Collapse duplicated receptors (rows)
  145. row_dup <- split(seq_len(nrow(ltm2)), rownames(ltm2))
  146. ltm3 <- do.call(rbind, lapply(row_dup, function(idx) Matrix::colSums(ltm2[idx, , drop = FALSE])))
  147. # LR network renaming
  148. lr_m <- lr %>%
  149. mutate(ligand_h = ligand, receptor_h = receiver) %>%
  150. left_join(rename(mapL, ligand_h = human_symbol, ligand = mouse_symbol), by = "ligand_h") %>%
  151. left_join(rename(mapL, receptor_h = human_symbol, receiver = mouse_symbol), by = "receptor_h") %>%
  152. transmute(
  153. ligand = coalesce(ligand, ligand_h),
  154. receiver = coalesce(receiver, receptor_h)
  155. ) %>%
  156. distinct()
  157. list(ltm = ltm3, lr = lr_m)
  158. }
  159. get_links_top <- function(ligands, ligand_target_matrix, n = 100) {
  160. if (missing(ligands) || !length(ligands)) {
  161. return(tibble(ligand = character(), target = character(), weight = numeric()))
  162. }
  163. lig_all <- colnames(ligand_target_matrix)
  164. map_col <- setNames(lig_all, normalize_symbol(lig_all))
  165. lig_use <- intersect(normalize_symbol(ligands), names(map_col))
  166. if (!length(lig_use)) {
  167. return(tibble(ligand = character(), target = character(), weight = numeric()))
  168. }
  169. cols <- unname(map_col[lig_use])
  170. bind_rows(lapply(cols, function(cx) {
  171. sc <- ligand_target_matrix[, cx, drop = FALSE]
  172. ord <- order(sc[, 1], decreasing = TRUE)
  173. take <- head(ord, n = min(n, length(ord)))
  174. tibble(
  175. ligand = colnames(sc)[1],
  176. target = rownames(sc)[take],
  177. weight = as.numeric(sc[take, 1])
  178. )
  179. }))
  180. }
  181. build_node_colors <- function(ligands, receptors) {
  182. col_lig <- "#4477AA"
  183. col_rec <- "#AA7733"
  184. nodes <- unique(c(ligands, receptors))
  185. side <- ifelse(nodes %in% ligands, "ligand", "receptor")
  186. setNames(ifelse(side == "ligand", col_lig, col_rec), nodes)
  187. }
  188. save_dual <- function(p, base, w = 8, h = 5, dpi = 400) {
  189. ggsave(paste0(base, ".pdf"), p, width = w, height = h, units = "in", device = "pdf", useDingbats = FALSE)
  190. ggsave(paste0(base, ".tiff"), p, width = w, height = h, units = "in", dpi = dpi, device = "tiff", compression = "lzw")
  191. }
  192. save_heatmap_dual <- function(mat, base, ann_col = NULL, w = 8, h = 10, dpi = 400) {
  193. grDevices::pdf(paste0(base, ".pdf"), width = w, height = h)
  194. pheatmap::pheatmap(mat, cluster_rows = TRUE, cluster_cols = TRUE,
  195. annotation_col = ann_col, show_rownames = FALSE)
  196. grDevices::dev.off()
  197. grDevices::tiff(paste0(base, ".tiff"), width = w, height = h, units = "in", res = dpi, compression = "lzw")
  198. pheatmap::pheatmap(mat, cluster_rows = TRUE, cluster_cols = TRUE,
  199. annotation_col = ann_col, show_rownames = FALSE)
  200. grDevices::dev.off()
  201. }
  202. make_chord <- function(df_pairs, outbase, top_links = 60, dpi = 400, size_in = 10) {
  203. if (nrow(df_pairs) == 0) return(invisible(NULL))
  204. wcol <- if ("sumscore" %in% names(df_pairs)) "sumscore" else if ("count" %in% names(df_pairs)) "count" else names(df_pairs)[3]
  205. df_top <- df_pairs %>% arrange(desc(.data[[wcol]])) %>% slice_head(n = min(top_links, n()))
  206. ligands <- unique(df_top$ligand)
  207. receptors <- unique(df_top$receptor)
  208. grid.col <- build_node_colors(ligands, receptors)
  209. draw_chord <- function(device_fun) {
  210. circos.clear()
  211. circos.par(
  212. gap.after = c(rep(2, max(0, length(ligands) - 1)), 8, rep(2, max(0, length(receptors) - 1)), 8),
  213. start.degree = 90,
  214. track.margin = c(0.01, 0.01)
  215. )
  216. device_fun()
  217. chordDiagram(
  218. df_top %>% select(ligand, receptor, !!wcol),
  219. grid.col = grid.col,
  220. order = c(ligands, receptors),
  221. directional = 0,
  222. transparency = 0.25,
  223. annotationTrack = "grid",
  224. preAllocateTracks = list(track.height = 0.08)
  225. )
  226. circos.trackPlotRegion(track.index = 1, panel.fun = function(x, y) {
  227. circos.text(CELL_META$xcenter, CELL_META$ycenter, CELL_META$sector.index,
  228. facing = "bending", niceFacing = TRUE, cex = 0.6)
  229. }, bg.border = NA)
  230. grDevices::dev.off()
  231. circos.clear()
  232. }
  233. draw_chord(function() grDevices::pdf(paste0(outbase, ".pdf"), width = size_in, height = size_in))
  234. draw_chord(function() grDevices::tiff(paste0(outbase, ".tiff"), width = size_in, height = size_in, units = "in",
  235. res = dpi, compression = "lzw"))
  236. }
  237. dotplot_receptors <- function(seu, receptors, base, group_col, order_groups = NULL, ordered = FALSE, dpi = 400) {
  238. receptors <- intersect(receptors, rownames(seu))
  239. if (!length(receptors)) return(invisible(NULL))
  240. if (!group_col %in% colnames([email hidden])) return(invisible(NULL))
  241. if (!is.null(order_groups)) {
  242. seu[[group_col]] <- factor(seu[[group_col]][, 1], levels = order_groups)
  243. }
  244. Idents(seu) <- seu[[group_col]][, 1]
  245. feats <- receptors
  246. if (ordered) {
  247. avg <- AverageExpression(seu, features = feats, assays = DefaultAssay(seu), group.by = group_col)$RNA
  248. ord <- order(rowMeans(avg), decreasing = TRUE)
  249. feats <- rownames(avg)[ord]
  250. }
  251. p <- DotPlot(seu, features = feats, cols = c("#BBBBBB", "#4477AA")) +
  252. theme_minimal(base_size = 10) +
  253. theme(axis.text.x = element_text(angle = 60, hjust = 1))
  254. save_dual(p, base, w = 10, h = 6, dpi = dpi)
  255. }
  256. feature_umap <- function(seu, genes, out_dir, prefix, dpi = 400, tiff_only_for = NULL) {
  257. if (!"umap" %in% Reductions(seu)) {
  258. seu <- RunPCA(seu, verbose = FALSE)
  259. seu <- RunUMAP(seu, dims = 1:30, verbose = FALSE)
  260. }
  261. for (g in genes) {
  262. if (!g %in% rownames(seu)) next
  263. p <- FeaturePlot(seu, features = g, reduction = "umap") + theme_void() + ggtitle(g)
  264. pdf_path <- file.path(out_dir, sprintf("%s_%s.pdf", prefix, g))
  265. ggsave(pdf_path, p, width = 5, height = 4, units = "in", device = "pdf", useDingbats = FALSE)
  266. if (is.null(tiff_only_for) || g %in% tiff_only_for) {
  267. tiff_path <- file.path(out_dir, sprintf("%s_%s.tiff", prefix, g))
  268. ggsave(tiff_path, p, width = 5, height = 4, units = "in", dpi = dpi, device = "tiff", compression = "lzw")
  269. }
  270. }
  271. }
  272. sankey_alluvial <- function(df_pairs, base, top_links = 60, dpi = 400) {
  273. if (nrow(df_pairs) == 0) return(invisible(NULL))
  274. if (!"sumscore" %in% names(df_pairs)) return(invisible(NULL))
  275. df_top <- df_pairs %>% arrange(desc(sumscore)) %>% slice_head(n = min(top_links, n()))
  276. # Static (ggalluvial)
  277. p <- ggplot(df_top, aes(axis1 = ligand, axis2 = receptor, y = sumscore)) +
  278. scale_x_discrete(limits = c("Ligand", "Receptor"), expand = c(.1, .1)) +
  279. geom_alluvium(aes(fill = ligand), alpha = .6) +
  280. geom_stratum(width = 1/10) +
  281. geom_text(stat = "stratum", aes(label = after_stat(stratum)), size = 3) +
  282. theme_minimal(base_size = 10) +
  283. theme(legend.position = "none")
  284. save_dual(p, base, w = 12, h = 6, dpi = dpi)
  285. # Interactive HTML (networkD3)
  286. try({
  287. ligs <- unique(df_top$ligand)
  288. recs <- unique(df_top$receptor)
  289. nodes <- data.frame(name = c(ligs, recs))
  290. links <- df_top %>%
  291. mutate(
  292. source = match(ligand, nodes$name) - 1,
  293. target = match(receptor, nodes$name) - 1,
  294. value = sumscore
  295. ) %>%
  296. select(source, target, value)
  297. sn <- sankeyNetwork(
  298. Links = links, Nodes = nodes,
  299. Source = "source", Target = "target",
  300. Value = "value", NodeID = "name",
  301. fontSize = 12, nodeWidth = 20
  302. )
  303. htmlwidgets::saveWidget(sn, file = paste0(base, ".html"), selfcontained = TRUE)
  304. }, silent = TRUE)
  305. }
  306. #-----------------------------#
  307. # 4) Load input data #
  308. #-----------------------------#
  309. chat0 <- readRDS(path_chat)
  310. mgl0 <- readRDS(path_mgl)
  311. if (!inherits(chat0, "Seurat")) stop("Receiver object is not a Seurat object.")
  312. if (!inherits(mgl0, "Seurat")) stop("Sender object is not a Seurat object.")
  313. if (!group_col %in% colnames([email hidden])) stop("group_col not found in receiver meta.data.")
  314. if (!group_col %in% colnames([email hidden])) stop("group_col not found in sender meta.data.")
  315. #-----------------------------#
  316. # 5) NicheNet networks (mouse)#
  317. #-----------------------------#
  318. ligand_target_matrix_h <- readRDS(system.file("extdata", "ligand_target_matrix.rds", package = "nichenetr"))
  319. lr_network_h <- readRDS(system.file("extdata", "lr_network.rds", package = "nichenetr"))
  320. mm <- relabel_to_mouse(ligand_target_matrix_h, lr_network_h)
  321. ligand_target_matrix_m <- mm$ltm
  322. lr_network_m <- mm$lr
  323. rm(mm, ligand_target_matrix_h, lr_network_h)
  324. #-----------------------------#
  325. # 6) Core runner per compare #
  326. #-----------------------------#
  327. run_cmp <- function(tag, case_label, ctrl_label,
  328. chat0, mgl0, group_col, out_dir,
  329. ligand_target_matrix_m, lr_network_m) {
  330. message("=== Running comparison: ", tag, " ===")
  331. # Receiver (ChAT): restrict to 2 groups
  332. chat <- subset(chat0, subset = !!as.name(group_col) %in% c(case_label, ctrl_label))
  333. Idents(chat) <- chat[[group_col]][, 1]
  334. # Sender (Microglia): restrict to same 2 groups for expression filters
  335. mgl <- subset(mgl0, subset = !!as.name(group_col) %in% c(case_label, ctrl_label))
  336. # DEG in receiver
  337. deg <- FindMarkers(
  338. chat, ident.1 = case_label, ident.2 = ctrl_label,
  339. logfc.threshold = 0.1, min.pct = 0.05, test.use = "wilcox",
  340. verbose = FALSE
  341. ) %>%
  342. rownames_to_column("gene") %>%
  343. mutate(gene = extract_symbolish(gene))
  344. write_csv(deg, file.path(out_dir, sprintf("DEG_receiver_%s.csv", tag)))
  345. geneset_up <- deg %>%
  346. filter(p_val_adj < 0.05, avg_log2FC > 0.15) %>%
  347. arrange(desc(avg_log2FC)) %>%
  348. pull(gene) %>%
  349. unique()
  350. background_expressed <- expressed_genes(chat, pct = 0.05)
  351. # Expression-constrained LR network
  352. sender_expressed <- expressed_genes(mgl, pct = 0.05)
  353. receiver_expressed <- expressed_genes(chat, pct = 0.05)
  354. lr_expressed <- lr_network_m %>%
  355. filter(ligand %in% sender_expressed, receiver %in% receiver_expressed) %>%
  356. distinct()
  357. potential_ligands <- intersect(lr_expressed$ligand, colnames(ligand_target_matrix_m))
  358. ligand_activities <- get_ligand_activities(
  359. geneset = geneset_up,
  360. background_expressed_genes = background_expressed,
  361. ligand_target_matrix = ligand_target_matrix_m,
  362. potential_ligands = potential_ligands
  363. )
  364. write_csv(ligand_activities, file.path(out_dir, sprintf("LigandActivity_mouse_%s.csv", tag)))
  365. # Top ligands
  366. topN <- 30
  367. top_ligands <- ligand_activities %>%
  368. arrange(desc(aupr_corrected)) %>%
  369. slice_head(n = min(topN, n())) %>%
  370. pull(test_ligand)
  371. summary10 <- ligand_activities %>%
  372. arrange(desc(aupr_corrected)) %>%
  373. mutate(rank = row_number()) %>%
  374. slice_head(n = min(10, n()))
  375. write_csv(summary10, file.path(out_dir, sprintf("Summary_top10_ligands_%s.csv", tag)))
  376. # Ligand→target links (top per ligand)
  377. links_top <- get_links_top(top_ligands, ligand_target_matrix_m, n = 100)
  378. write_csv(links_top, file.path(out_dir, sprintf("LigandTargetLinks_mouse_%s.csv", tag)))
  379. # Aggregate to LR candidates
  380. ligand_score <- links_top %>%
  381. group_by(ligand) %>%
  382. summarise(sumscore = sum(weight), count = dplyr::n(), .groups = "drop")
  383. lr_pairs <- lr_expressed %>%
  384. inner_join(ligand_score, by = "ligand") %>%
  385. transmute(ligand, receptor = receiver, sumscore, count) %>%
  386. arrange(desc(sumscore))
  387. write_csv(lr_pairs, file.path(out_dir, sprintf("LR_candidates_mouse_%s.csv", tag)))
  388. # Barplot: top ligands
  389. p_bar <- ligand_activities %>%
  390. arrange(desc(aupr_corrected)) %>%
  391. slice_head(n = 20) %>%
  392. mutate(test_ligand = factor(test_ligand, levels = rev(test_ligand))) %>%
  393. ggplot(aes(x = test_ligand, y = aupr_corrected)) +
  394. geom_col() +
  395. coord_flip() +
  396. labs(x = "Ligand", y = "AUPR (corrected)", title = tag) +
  397. theme_minimal(base_size = 11)
  398. save_dual(p_bar, file.path(out_dir, sprintf("Barplot_TopLigands_%s", tag)), w = 6, h = 6)
  399. # Heatmap: ligand-target (top links)
  400. top_targets <- links_top %>%
  401. arrange(desc(weight)) %>%
  402. slice_head(n = 200) %>%
  403. pull(target) %>%
  404. unique()
  405. mat_ht <- ligand_target_matrix_m[
  406. intersect(top_targets, rownames(ligand_target_matrix_m)),
  407. intersect(top_ligands, colnames(ligand_target_matrix_m)),
  408. drop = FALSE
  409. ]
  410. if (nrow(mat_ht) > 1 && ncol(mat_ht) > 1) {
  411. save_heatmap_dual(mat = mat_ht,
  412. base = file.path(out_dir, sprintf("Heatmap_LigandTarget_mouse_%s", tag)),
  413. w = 8, h = 10)
  414. }
  415. # Chord + Sankey for LR candidates
  416. make_chord(lr_pairs, outbase = file.path(out_dir, sprintf("Chord_LR_%s", tag)), top_links = 60)
  417. sankey_alluvial(lr_pairs, base = file.path(out_dir, sprintf("Sankey_LR_%s", tag)), top_links = 60)
  418. # DotPlot: receptor expression in receiver
  419. rec_all <- unique(lr_expressed$receiver)
  420. rec_top <- lr_pairs %>% arrange(desc(sumscore)) %>% pull(receptor) %>% unique() %>% head(50)
  421. dotplot_receptors(chat, rec_all,
  422. base = file.path(out_dir, sprintf("DotPlot_receiver_receptors_%s", tag)),
  423. group_col = group_col, order_groups = NULL, ordered = FALSE)
  424. dotplot_receptors(chat, rec_all,
  425. base = file.path(out_dir, sprintf("DotPlot_receiver_receptors_%s_ordered", tag)),
  426. group_col = group_col, order_groups = NULL, ordered = TRUE)
  427. # Optional canonical ordering (useful when plotting all groups together in a shared object)
  428. canonical_order <- c("WT-sham","WT-axotomy","KO-sham","KO-axotomy")
  429. dotplot_receptors(chat, rec_all,
  430. base = file.path(out_dir, sprintf("DotPlot_receiver_receptors_canonical_order_%s", tag)),
  431. group_col = group_col, order_groups = canonical_order, ordered = TRUE)
  432. dotplot_receptors(chat, rec_top,
  433. base = file.path(out_dir, sprintf("DotPlot_receiver_receptors_topLigands_%s", tag)),
  434. group_col = group_col, order_groups = NULL, ordered = TRUE)
  435. list(
  436. tag = tag,
  437. activities = ligand_activities %>%
  438. select(test_ligand, aupr_corrected) %>%
  439. rename(!!tag := aupr_corrected),
  440. top15 = ligand_activities %>% arrange(desc(aupr_corrected)) %>% slice_head(n = 15) %>% pull(test_ligand)
  441. )
  442. }
  443. #-----------------------------#
  444. # 7) Run comparisons #
  445. #-----------------------------#
  446. res_KO <- run_cmp(
  447. tag = cmp_list$KO$tag, case_label = cmp_list$KO$case, ctrl_label = cmp_list$KO$ctrl,
  448. chat0 = chat0, mgl0 = mgl0, group_col = group_col, out_dir = out_dir,
  449. ligand_target_matrix_m = ligand_target_matrix_m, lr_network_m = lr_network_m
  450. )
  451. res_WT <- run_cmp(
  452. tag = cmp_list$WT$tag, case_label = cmp_list$WT$case, ctrl_label = cmp_list$WT$ctrl,
  453. chat0 = chat0, mgl0 = mgl0, group_col = group_col, out_dir = out_dir,
  454. ligand_target_matrix_m = ligand_target_matrix_m, lr_network_m = lr_network_m
  455. )
  456. #-----------------------------#
  457. # 8) WT vs KO summary #
  458. #-----------------------------#
  459. act_join <- full_join(res_WT$activities, res_KO$activities, by = "test_ligand") %>%
  460. replace_na(setNames(as.list(rep(0, 2)), c(cmp_list$WT$tag, cmp_list$KO$tag)))
  461. write_csv(act_join, file.path(out_dir, "LigandActivity_WT_vs_KO.csv"))
  462. p_sc <- ggplot(act_join, aes(x = .data[[cmp_list$WT$tag]], y = .data[[cmp_list$KO$tag]], label = test_ligand)) +
  463. geom_point() +
  464. geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
  465. ggrepel::geom_text_repel(size = 3, max.overlaps = 20) +
  466. labs(
  467. x = paste0("AUPR: ", cmp_list$WT$tag),
  468. y = paste0("AUPR: ", cmp_list$KO$tag),
  469. title = "Ligand activities: WT vs KO"
  470. ) +
  471. theme_minimal(base_size = 11)
  472. save_dual(p_sc, file.path(out_dir, "Scatter_LigandActivity_WT_vs_KO"), w = 6, h = 6)
  473. # Top15 overlap
  474. top15_WT <- res_WT$top15
  475. top15_KO <- res_KO$top15
  476. ovl <- intersect(top15_WT, top15_KO)
  477. only_WT <- setdiff(top15_WT, top15_KO)
  478. only_KO <- setdiff(top15_KO, top15_WT)
  479. write_csv(tibble(ligand = ovl), file.path(out_dir, "TopLigandOverlap_WTvsKO_top15.csv"))
  480. write_csv(tibble(ligand = only_WT), file.path(out_dir, "TopLigands_WTminusKO.csv"))
  481. write_csv(tibble(ligand = only_KO), file.path(out_dir, "TopLigands_KOminusWT.csv"))
  482. # Overlap barplot for shared ligands
  483. if (length(ovl) > 0) {
  484. act_for_bar <- act_join %>%
  485. filter(test_ligand %in% ovl) %>%
  486. pivot_longer(cols = -test_ligand, names_to = "comparison", values_to = "AUPR")
  487. p_bar_ovl <- ggplot(act_for_bar, aes(x = reorder(test_ligand, AUPR, FUN = median), y = AUPR, fill = comparison)) +
  488. geom_col(position = "dodge") +
  489. coord_flip() +
  490. labs(x = "Ligands (overlap in top15)", y = "AUPR", title = "WT vs KO overlap (top15)") +
  491. theme_minimal(base_size = 11)
  492. save_dual(p_bar_ovl, file.path(out_dir, "Bar_OverlapTopLigands_WTvsKO_top15"), w = 7, h = 6)
  493. }
  494. # UpSet (ComplexUpset)
  495. sets_df <- tibble(
  496. ligand = unique(c(top15_WT, top15_KO)),
  497. WT = ligand %in% top15_WT,
  498. KO = ligand %in% top15_KO
  499. )
  500. p_up <- ComplexUpset::upset(
  501. sets_df,
  502. sets = c("WT", "KO"),
  503. name = "Top15 ligands",
  504. base_annotations = list("Intersection size" = intersection_size())
  505. ) +
  506. ggtitle("Overlap of Top15 ligands (WT vs KO)")
  507. save_dual(p_up, file.path(out_dir, "UpSet_TopLigands_WTvsKO_top15"), w = 8, h = 5)
  508. #-----------------------------#
  509. # 9) Optional UMAP plots (WT) #
  510. #-----------------------------#
  511. # Receiver (ChAT)
  512. chat_WT <- subset(chat0, subset = !!as.name(group_col) %in% c("WT-sham", "WT-axotomy"))
  513. feature_umap(chat_WT, genes_umap_chat, out_dir = out_dir,
  514. prefix = "UMAP_receiver_WT_axotomy_vs_WT_sham", tiff_only_for = c("Itga9"))
  515. # Sender (Microglia)
  516. mgl_WT <- subset(mgl0, subset = !!as.name(group_col) %in% c("WT-sham", "WT-axotomy"))
  517. feature_umap(mgl_WT, genes_umap_mgl, out_dir = out_dir,
  518. prefix = "UMAP_sender_WT_axotomy_vs_WT_sham", tiff_only_for = c("F13a1"))
  519. #-----------------------------#
  520. # 10) Reproducibility #
  521. #-----------------------------#
  522. writeLines(capture.output(sessionInfo()), file.path(out_dir, "sessionInfo.txt"))
  523. message("All outputs completed.")

nichenet_microglia_to_chat.R at commit c14569a, no license · at the source

Overview

Authors: Koji Sekiguchi1, Hirotaka Shoji2, Tomoko Shindo3, Jumpei Sasabe3, Daiki Tokuyasu1, Jin Nakahara1, Tsuyoshi Miyakawa2, Daisuke Ito1,4
  1. Department of Neurology, Keio University School of Medicine,35 Shinanomachi, Shinjuku-ku, Tokyo, 160-8582 Japan
  2. Division of Systems Medical Science, Center for Medical Science, Fujita Health University,Toyoake, Aichi 470-1192 Japan
  3. Electron Microscope Laboratory, Keio University School of Medicine,Tokyo, 160-8582 Japan
  4. Memory Center, Keio University School of Medicine,Tokyo, 160-8582 Japan
Institutions: Keio University (Japan); Fujita Health University (Japan)
Journal: Journal of neuroinflammation, volume 23, issue 1, article 223
Dates: received 21 February 2026; accepted 27 April 2026; published online 7 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1186/s12974-026-03848-6 · PMID 42098744 · PMCID PMC13321657 · OpenAlex W7160513941
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: genetics / omics (modality), mouse (organism), cellular / molecular (subfield)
Methods: Statistics, fMRI & imaging
Keywords: Microglia, Facial nerve axotomy, Synaptic stripping, Synaptic remodeling, Integrated analysis, Microglia–neuron interaction, Neuronal survival
MeSH: Axons*, Calcium-Binding Proteins*, Facial Nerve Injuries*, Microfilament Proteins*, Microglia*, Motor Neurons*, Synapses*, Animals, Axotomy, Cell Survival, Male, Mice, Mice, Inbred C57BL, Mice, Knockout (* major topic)
Topic: Neuroinflammation and Neurodegeneration Mechanisms (Neurology, Neuroscience), according to OpenAlex
Funding: Japan Society for the Promotion of Science (21H02812 and JP22H04922); MEXT Promotion of the Distinctive Joint Research Center Program (FY2021–2023 and JPMXP0621467949)
Citations: not cited yet (Europe PMC); 57 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.

Repositories

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

sekikoji54-crypto/single-nucleus-RNA-seq-code

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: c14569a8692b96dd9f5bbebfc0647dfcad6959a8, 3 May 2026
Languages: R (9)
Size: 10 files, 9 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: ggplot2 (9 files), tidyverse (8 files), Seurat (6 files), patchwork (2 files), pheatmap (2 files), circlize (1 file), clusterProfiler (1 file), igraph (1 file), SingleCellExperiment (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
10 files

Zenodo 19996424

License: CC-BY-4.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: ggplot2 (9 files), tidyverse (8 files), Seurat (6 files), patchwork (2 files), pheatmap (2 files), circlize (1 file), clusterProfiler (1 file), igraph (1 file), SingleCellExperiment (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
10 files
At the source:

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.1186/s12974-026-03848-6.

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:

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

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

Data

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

Availability statements

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

Read them in the paper: doi.org/10.1186/s12974-026-03848-6.

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, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 7 keywords, 14 MeSH terms, 2 funders, 57 references.

Cite

This paper

Sekiguchi, K., Shoji, H., Shindo, T., Sasabe, J., Tokuyasu, D., Nakahara, J., Miyakawa, T., & Ito, D. (2026). Iba1 deficiency impairs microglial synaptic remodeling and neuronal survival after axonal injury. Journal of neuroinflammation, 23(1), 223. https://doi.org/10.1186/s12974-026-03848-6

BibTeX

@article{sekiguchi2026iba1,
author = {Sekiguchi, Koji and Shoji, Hirotaka and Shindo, Tomoko and Sasabe, Jumpei and Tokuyasu, Daiki and Nakahara, Jin and Miyakawa, Tsuyoshi and Ito, Daisuke},
title = {{Iba1 deficiency impairs microglial synaptic remodeling and neuronal survival after axonal injury}},
journal = {Journal of neuroinflammation},
year = {2026},
month = may,
volume = {23},
number = {1},
pages = {223},
publisher = {BMC},
issn = {1742-2094},
doi = {10.1186/s12974-026-03848-6},
url = {https://doi.org/10.1186/s12974-026-03848-6},
pmid = {42098744},
pmcid = {PMC13321657}
}

RIS

TY - JOUR
AU - Sekiguchi, Koji
AU - Shoji, Hirotaka
AU - Shindo, Tomoko
AU - Sasabe, Jumpei
AU - Tokuyasu, Daiki
AU - Nakahara, Jin
AU - Miyakawa, Tsuyoshi
AU - Ito, Daisuke
TI - Iba1 deficiency impairs microglial synaptic remodeling and neuronal survival after axonal injury
T2 - Journal of neuroinflammation
J2 - J Neuroinflammation
PY - 2026
DA - 2026/05/07
VL - 23
IS - 1
SP - 223
SN - 1742-2094
PB - BMC
DO - 10.1186/s12974-026-03848-6
UR - https://doi.org/10.1186/s12974-026-03848-6
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s12974-026-03848-6",
"type": "article-journal",
"title": "Iba1 deficiency impairs microglial synaptic remodeling and neuronal survival after axonal injury",
"container-title": "Journal of neuroinflammation",
"author": [
{
"family": "Sekiguchi",
"given": "Koji"
},
{
"family": "Shoji",
"given": "Hirotaka"
},
{
"family": "Shindo",
"given": "Tomoko"
},
{
"family": "Sasabe",
"given": "Jumpei"
},
{
"family": "Tokuyasu",
"given": "Daiki"
},
{
"family": "Nakahara",
"given": "Jin"
},
{
"family": "Miyakawa",
"given": "Tsuyoshi"
},
{
"family": "Ito",
"given": "Daisuke"
}
],
"container-title-short": "J Neuroinflammation",
"volume": "23",
"issue": "1",
"page": "223",
"DOI": "10.1186/s12974-026-03848-6",
"PMID": "42098744",
"PMCID": "PMC13321657",
"ISSN": "1742-2094",
"publisher": "BMC",
"URL": "https://doi.org/10.1186/s12974-026-03848-6",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
7
]
]
}
}

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

Similar papers

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

[1] doi:10.1016/j.celrep.2024.114326 [code]
Hofbauer cells and fetal brain microglia share transcriptional profiles and responses to maternal diet-induced obesity.
Journal: Cell reports
In common: SingleCellExperiment, circlize, clusterProfiler, 5 other tools, genetics / omics, mouse, cellular / molecular, 3 references
[2] doi:10.1186/s13073-025-01519-4 [code]
Single-nucleus transcriptomics reveals a distinct microglial state and increased MSR1-mediated phagocytosis as common features across dementia subtypes.
Journal: Genome medicine
In common: circlize, clusterProfiler, igraph, 5 other tools, genetics / omics, mouse, cellular / molecular, 2 references
[3] doi:10.1038/s41586-026-10414-w [code]
Focal white matter lesions drive grey matter inflammation and synapse loss.
Journal: Nature
In common: SingleCellExperiment, circlize, igraph, 5 other tools, mouse, cellular / molecular, 2 references
[4] doi:10.1038/s41386-026-02406-1 [code]
Functional genomic profiling of schizophrenia-associated genes reveals key microglial regulators.
Journal: Neuropsychopharmacology : official publication of the American College of Neuropsychopharmacology
In common: circlize, clusterProfiler, igraph, 4 other tools, genetics / omics, cellular / molecular, 3 references
[5] doi:10.1038/s41467-025-66521-1 [code]
Human oligodendrocyte progenitor cells mediate synapse elimination through TAM receptor activation.
Journal: Nature communications
In common: SingleCellExperiment, Seurat, patchwork, 2 other tools, cellular / molecular, 4 references
[6] doi:10.1016/j.celrep.2022.110961 [code]
Absence of microglia promotes diverse pathologies and early lethality in Alzheimer's disease mice.
Journal: Cell reports
In common: circlize, igraph, Seurat, 2 other tools, mouse, cellular / molecular, 3 references
[7] doi:10.1038/s41380-022-01786-2 [code]
SARS-CoV-2 promotes microglial synapse elimination in human brain organoids.
Journal: Molecular psychiatry
In common: SingleCellExperiment, igraph, pheatmap, 4 other tools, cellular / molecular, 1 reference
[8] doi:10.1038/s41593-022-01167-6 [code]
A tool for mapping microglial morphology, morphOMICs, reveals brain-region and sex-dependent phenotypes.
Journal: Nature neuroscience
In common: SingleCellExperiment, igraph, pheatmap, 3 other tools, mouse, cellular / molecular, 2 references
[9] doi:10.1016/j.ebiom.2025.105769 [code]
Impact of Y chromosome loss on the risk of Parkinson's disease and progression.
Journal: EBioMedicine
In common: circlize, pheatmap, Seurat, 3 other tools, genetics / omics, 1 reference
[10] doi:10.1038/s42003-026-09948-6 [code]
A scalable human-zebrafish xenotransplantation model reveals gastrosome-mediated processing of dying neurons by human microglia.
Journal: Communications biology
In common: SingleCellExperiment, circlize, ggplot2, 1 other tool, cellular / molecular, 3 references

Contribute

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

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

Add the badge to the code's README

OSCR: the badge of this paper

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

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6.svg)](https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6.svg
   :target: https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6"><img src="https://openscicode.org/badge/doi/10.1186/s12974-026-03848-6.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

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

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

Request its removal

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

Discussion, reproductions, activity

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

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

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

Report a reproduction failure (signed in)

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

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