OSCR

Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming.

Code ↔ Paper

38 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 38 matches · 5 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Deconvolution of SP spots ↔ analysis_scripts/40.spatial_reference/40.4.train_ref_model.py, lines 1–81 · score 0.96 · cell_count_cutoff, cell_percentage_cutoff2, filter_genes, batch_key, max_epochs, train_size
  2. [2] § Methods › Deconvolution of SP spots ↔ analysis_scripts/40.spatial_reference/training.ipynb, lines 44–78 · score 0.96 · cell_count_cutoff, cell_percentage_cutoff2, filter_genes, batch_key, max_epochs, train_size
  3. [3] § Methods › scRNA-seq preprocessing ↔ analysis_scripts/04.integration_and_clustering/04.2.crispr_clean_sct_and_assign_labels.R, the whole file · a weak match · score 0.96 · FindTransferAnchors, TransferData, reference.reduction, vst.flavor, RunUMAP, RunPCA
  4. [4] § Methods › scRNA-seq preprocessing ↔ analysis_scripts/04.integration_and_clustering/04.4.immune_enriched_sct_and_assign_labels.R, the whole file · a weak match · score 0.96 · FindTransferAnchors, TransferData, reference.reduction, vst.flavor, RunUMAP, RunPCA
  5. [5] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ analysis_scripts/48.tdp43_analysis/48.3.gene_tdp43.Rmd, lines 287–369 · score 0.79 · stress responses, S100A9, CHI3L1, TREM2, lysosomal, metabolic
  6. [6] § Methods › scRNA-seq differential expression gene analysis ↔ analysis_scripts/43.downstream_analysis/43.8.MN_DE.Rmd, lines 599–745 · score 0.76 · PrepSCTFindMarkers, SCT model, fold change, C9orf72, variables, MAST
  7. [7] § Methods › scRNA-seq differential expression gene analysis ↔ analysis_scripts/48.tdp43_analysis/48.3.gene_tdp43.Rmd, lines 399–526 · score 0.70 · PrepSCTFindMarkers, SCT model, fold change, variables, MAST, sex
  8. [8] § Methods › SP DEP analysis ↔ analysis_scripts/47.protein_panel_analysis/47.1.protein_analysis.Rmd, lines 456–516 · score 0.70 · logfc.threshold, min.pct, negative binomial, FindMarkers, negbinom, subsetted
  9. [9] § Results › Gene expression changes and immune-cell dynamics in ALS CNS tissues ↔ correlation-with-disease-duration.Rmd, lines 173–269 · score 0.68 · disease duration, C1QC, C1QA, C1QB, CHIT1, LSP1
  10. [10] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ correlation-with-disease-duration.Rmd, lines 707–812 · score 0.68 · disease duration, C1QC, C1QA, C1QB, splicing, correlation
  11. [11] § Results › Peripheral immune dysregulation in sALS and C9-ALS ↔ analysis_scripts/43.downstream_analysis/43.8.MN_DE.Rmd, lines 1–137 · score 0.66 · IL1B, CCL3L1, innate immune, EGR3, downstream, EGR1
  12. [12] § Results › Peripheral immune dysregulation in sALS and C9-ALS ↔ figure_scripts/Fig6/Fig6D__MN_DE.Rmd, lines 3–139 · score 0.65 · IL1B, CCL3L1, innate immune, EGR3, EGR1, downstream
  13. [13] § Results › Gene expression changes and immune-cell dynamics in ALS CNS tissues ↔ correlation-with-disease-duration.Rmd, lines 173–269 · score 0.65 · disease duration, C1QC, C1QA, C1QB, CHIT1, LSP1
  14. [14] § Results › Regional specificity of inflammatory changes in ALS spinal cord ↔ analysis_scripts/43.downstream_analysis/43.8.MN_DE.Rmd, lines 287–427 · score 0.64 · C1QC, neurofilament, C1QA, C1QB, DNA, slides
  15. [15] § Methods › GSEA for scRNA-seq ↔ analysis_scripts/08.enrichment_analysis/08.4.fgsea.R, the whole file · a weak match · score 0.64 · minSize, maxSize, fgsea, log10, ranking, human
  16. [16] § Methods › SP ↔ analysis_scripts/41.space_ranger/41.3.manual_space_ranger.sh, lines 97–161 · score 0.64 · Visium Human Transcriptome, Probe, slides, Profiling, libraries, v2
  17. [17] § Methods › GSEA for scRNA-seq ↔ analysis_scripts/08.enrichment_analysis/08.4.gsea.Rmd, lines 1–79 · score 0.63 · minSize, maxSize, fgsea, log10, ranking, human
  18. [18] § Methods › Bulk RNA-seq analysis of NYGC ALS Consortium and Target ALS datasets › Differential expression ↔ Run-DESeq2-all-tissues.R, lines 176–222 · score 0.62 · design matrix, DESeq2, death, sva, FTD, tissue
  19. [19] § Methods › SP ↔ analysis_scripts/41.space_ranger/41.2.space_ranger_main.sh, lines 4–44 · score 0.62 · Visium Human Transcriptome, CytAssist, Probe, Profiling, v2, Immune
  20. [20] § Results › Peripheral immune dysregulation in sALS and C9-ALS ↔ analysis_scripts/05.DEG/DEG_plot/05.2.plot_pseudobulk.Rmd, lines 196–298 · score 0.61 · female HC, C1QA, C1QB, C9 ALS, pseudobulk, donor
  21. [21] § Methods › TDP-43 annotation and differential gene analysis ↔ analysis_scripts/48.tdp43_analysis/48.3.gene_tdp43.Rmd, lines 163–244 · score 0.60 · immediately adjacent spots, neuron enriched spots, anterior horn, TDP, threshold, signal
  22. [22] § Results › Gene expression changes and immune-cell dynamics in ALS CNS tissues ↔ correlation-with-disease-duration.Rmd, lines 423–481 · score 0.60 · disease duration, changes correlated, immune proportions, immune cell, months, macrophages
  23. [23] § Methods › Bulk RNA-seq analysis of NYGC ALS Consortium and Target ALS datasets › Quantification of truncated STMN2 ↔ analysis_scripts/21.short_reads_CE/21.1.extract_ALS_HC_target_genes.sh, lines 1–44 · score 0.60 · cryptic exon, E2, E1, STMN2
  24. [24] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ analysis_scripts/43.downstream_analysis/43.8.compare_C2L_and_manual_annotation_MN.Rmd, lines 1–137 · score 0.60 · Wilcoxon rank sum, neuron enriched, anterior horn, outside, IQR, median
  25. [25] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ figure_scripts/Fig6/Fig6E_MN_pseudobulk.Rmd, lines 1–53 · score 0.60 · C1QC, C1QA, C1QB, anterior horn, Pseudobulk, NEFL
  26. [26] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ figure_scripts/Fig6/Fig6E_MN_pseudobulk.Rmd, lines 1–53 · score 0.59 · C1QC, C1QA, C1QB, anterior horn, Pseudobulk, sALS
  27. [27] § Results › Immune dysregulation associates with ALS spinal cord pathology ↔ analysis_scripts/43.downstream_analysis/non_DE_scripts/49.6.pseudobulk.Rmd, lines 1–51 · score 0.59 · C1QC, C1QA, C1QB, anterior horn, Pseudobulk, NEFL
  28. [28] § Methods › SP data processing ↔ analysis_scripts/42.spatial_process/42.1.process.Rmd, lines 53–131 · score 0.58 · variable.features.n, SCTransform, SpaceRanger, tissue, spots
  29. [29] § Results › Peripheral immune dysregulation in sALS and C9-ALS ↔ figure_scripts/FigS1/FigS1K_pseudobulk.Rmd, lines 15–134 · score 0.57 · hollow points, C1QA, C1QB, pseudobulk, donor, CD16
  30. [30] § Results › Gene expression changes and immune-cell dynamics in ALS CNS tissues ↔ analysis_scripts/48.tdp43_analysis/48.3.gene_tdp43.Rmd, lines 287–369 · score 0.57 · lipid metabolism, C1QB, APOC1, protein, complement, inflammation
  31. [31] § Results › Regional specificity of inflammatory changes in ALS spinal cord ↔ analysis_scripts/43.downstream_analysis/43.8.compare_C2L_and_manual_annotation_MN.Rmd, lines 1–137 · score 0.56 · Wilcoxon rank sum, neuron enriched, anterior horns, IQR, median, C2L
  32. [32] § Results › Peripheral immune dysregulation in sALS and C9-ALS ↔ figure_scripts/Fig1/Fig1E_stacked_bar.Rmd, lines 45–174 · score 0.55 · Stacked bar, CRISPR clean, healthy control, TCM, memory, MAIT
  33. [33] § Results › Regional specificity of inflammatory changes in ALS spinal cord ↔ analysis_scripts/43.downstream_analysis/non_DE_scripts/49.2.zoom_volcano.Rmd, lines 356–485 · score 0.55 · posterior white matter, CHI3L1, anterior horns, sALS, overlap, APOC1
  34. [34] § Methods › Bulk RNA-seq analysis of NYGC ALS Consortium and Target ALS datasets › Cell-type enrichment ↔ correlation-with-disease-duration.Rmd, lines 271–420 · score 0.54 · FAN_EMBRYONIC_CTX, fgsea, ranked, enrichment, genes
  35. [35] § Methods › SP data processing ↔ analysis_scripts/41.space_ranger/41.1.batch_space_ranger.sh, the whole file · a weak match · score 0.53 · CytAssist images, Loupe, SpaceRanger, alignment, Genomics, slide
  36. [36] § Methods › Correlation of gene expression and cell-type changes in ALS with disease duration and age of onset ↔ correlation-with-disease-duration.Rmd, lines 44–171 · score 0.52 · disease duration, correlation, lm, FDR, onset, gene expression
  37. [37] § Methods › Bulk RNA-seq analysis of NYGC ALS Consortium and Target ALS datasets › Alignment ↔ analysis_scripts/25.reporter/25.1.reporter_expression.sh, the whole file · a weak match · score 0.52 · featureCounts, V38, Gencode, alignment, seq, ALS
  38. [38] § Results › Regional specificity of inflammatory changes in ALS spinal cord ↔ figure_scripts/Fig1/Fig1E_stacked_bar.Rmd, lines 45–174 · score 0.51 · Wilcoxon rank sum, Stacked bar, healthy controls, CD8, predicted, mapping

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 Markdown · 812 lines · 33 KB · no license · 6 matches

  1. ---
  2. title: "correlation-with-disease-duration"
  3. output: html_document
  4. date: "2025-01-23"
  5. ---
  6. ```{r setup, include=FALSE}
  7. knitr::opts_chunk$set(echo = TRUE)
  8. ```
  9. ```{R}
  10. library(tidyverse)
  11. ```
  12. ```{R}
  13. allMD<-read.table("../output/DESeq2/2023/2023-metadata-v2-fixed-filtered.txt", sep="\t", header=T, stringsAsFactors = F, quote="")
  14. cervMD<-allMD[which(allMD$Sample.Source=="Spinal_Cord_Cervical"),]
  15. thorMD<-allMD[which(allMD$Sample.Source=="Spinal_Cord_Thoracic"),]
  16. lumbMD<-allMD[which(allMD$Sample.Source=="Spinal_Cord_Lumbar"),]
  17. ### Disease Duration
  18. mdDD<-allMD[,c("ExternalSampleId", "ExternalSubjectId", "Subject.Group2", "Disease.Duration.in.Months")]
  19. mdDD$Disease.Duration.in.Months<-as.numeric(mdDD$Disease.Duration.in.Months)
  20. mdDD<-mdDD[!is.na(mdDD$Disease.Duration.in.Months),]
  21. cervDD<-mdDD[which(mdDD$ExternalSampleId %in% cervMD$ExternalSampleId),]
  22. thorDD<-mdDD[which(mdDD$ExternalSampleId %in% thorMD$ExternalSampleId),]
  23. lumbDD<-mdDD[which(mdDD$ExternalSampleId %in% lumbMD$ExternalSampleId),]
  24. ### Age of onset
  25. mdSO<-allMD[,c("ExternalSampleId", "ExternalSubjectId", "Subject.Group2", "Age.at.Symptom.Onset")]
  26. mdSO$Age.at.Symptom.Onset<-as.numeric(mdSO$Age.at.Symptom.Onset)
  27. mdSO<-mdSO[!is.na(mdSO$Age.at.Symptom.Onset),]
  28. cervSO<-mdSO[which(mdSO$ExternalSampleId %in% cervMD$ExternalSampleId),]
  29. ```
  30. ### Cervical spinal cord
  31. ```{R}
  32. ###
  33. cervCPM<-read.table("../output/DESeq2/2023/sva-vsd/noPrep/disease-groups/TMMCPM/Spinal_Cord_Cervical-AllGroups.vs.Healthy.txt", sep="\t", header=T, stringsAsFactors = F, quote="")
  34. cervCPM
  35. corList<-list()
  36. ddList<-list()
  37. soList<-list()
  38. for(i in 1:nrow(cervCPM)){
  39. thisRow<-cervCPM[i,]
  40. exprVals<-thisRow[,4:ncol(thisRow)]
  41. thisRow %>%
  42. dplyr::select(4:ncol(thisRow)) %>%
  43. t() %>%
  44. as.data.frame() %>%
  45. dplyr::rename(CPM=1) %>%
  46. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  47. rownames_to_column("Sample") %>%
  48. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  49. corVal<-cor(exprJoined$CPM, exprJoined$Disease.Duration.in.Months)
  50. corValLog<-cor(exprJoined$logCPM, exprJoined$Disease.Duration.in.Months)
  51. tmpDF<-data.frame(GeneID=thisRow$ensembl_gene_id, GeneName=thisRow$external_gene_name, corExprDuration=corVal, corLogExprDuration=corValLog)
  52. corList[[i]]<-tmpDF
  53. tmpLM<-lm(exprJoined$Disease.Duration.in.Months ~ exprJoined$logCPM)
  54. tmpLMSum<-summary(tmpLM)
  55. pVal<-tmpLMSum$coefficients[2,4]
  56. r2<-tmpLMSum$r.squared
  57. tmpDF<-data.frame(GeneID=thisRow$ensembl_gene_id, GeneName=thisRow$external_gene_name, corLogExpr=corValLog, R2=r2, pVal=pVal)
  58. ddList[[i]]<-tmpDF
  59. thisRow %>%
  60. dplyr::select(4:ncol(thisRow)) %>%
  61. t() %>%
  62. as.data.frame() %>%
  63. dplyr::rename(CPM=1) %>%
  64. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  65. rownames_to_column("Sample") %>%
  66. inner_join(mdSO, by=c("Sample"="ExternalSampleId")) -> exprJoined
  67. corValLog<-cor(exprJoined$logCPM, exprJoined$Age.at.Symptom.Onset)
  68. tmpLM<-lm(exprJoined$Age.at.Symptom.Onset ~ exprJoined$logCPM)
  69. tmpLMSum<-summary(tmpLM)
  70. pVal<-tmpLMSum$coefficients[2,4]
  71. r2<-tmpLMSum$r.squared
  72. tmpDF<-data.frame(GeneID=thisRow$ensembl_gene_id, GeneName=thisRow$external_gene_name, corLogExpr=corValLog, R2=r2, pVal=pVal)
  73. soList[[i]]<-tmpDF
  74. }
  75. corDF<-bind_rows(corList)
  76. write.table(corDF, "../output/expression-disease-correlation/Expression-DiseaseDuration-correlation-v1.txt", sep="\t", col.names = T, row.names = F, quote=F)
  77. ddDF<-bind_rows(ddList)
  78. ddDF$FDR<-p.adjust(ddDF$pVal, method = "fdr")
  79. write.table(ddDF, "../output/expression-disease-correlation/logExpression-DiseaseDuration-correlation-v2.txt", sep="\t", col.names = T, row.names = F, quote=F)
  80. ddDF %>%
  81. mutate(color=ifelse(FDR<0.05 & corLogExpr>0, "firebrick3",
  82. ifelse(FDR<0.05 & corLogExpr<0, "dodgerblue3", "black"))) %>%
  83. mutate(label=ifelse(FDR<0.05, GeneName, NA)) %>%
  84. ggplot(aes(x=corLogExpr, y = -log10(FDR), color=color, label=label))+
  85. #geom_point()+
  86. geom_point(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  87. ggrepel::geom_text_repel(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  88. theme_classic()+
  89. scale_color_identity()+
  90. labs(x="Correlation", y="-log10(FDR)")+
  91. theme(axis.text = element_text(size = 14),
  92. axis.title = element_text(size=16))
  93. ggsave("../plots/expression-disease-duration-correlation/Correlation-disease-duration-volcanoPlot.png", width = 8, height = 6)
  94. ggsave("../plots/expression-disease-duration-correlation/Correlation-disease-duration-volcanoPlot.pdf", width = 8, height = 6)
  95. ddDF %>%
  96. mutate(color=ifelse(FDR<0.05 & corLogExpr>0, "firebrick3",
  97. ifelse(FDR<0.05 & corLogExpr<0, "dodgerblue3", "black"))) %>%
  98. mutate(label=ifelse(FDR<0.05 & corLogExpr<0, GeneName, NA)) %>%
  99. ggplot(aes(x=corLogExpr, y = -log10(FDR), color=color, label=label))+
  100. #geom_point()+
  101. geom_point(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  102. ggrepel::geom_text_repel(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  103. theme_classic()+
  104. scale_color_identity()+
  105. labs(x="Correlation", y="-log10(FDR)")+
  106. theme(axis.text = element_text(size = 14),
  107. axis.title = element_text(size=16))
  108. ggsave("../plots/expression-disease-duration-correlation/Correlation-disease-duration-volcanoPlot-v2.png", width = 8, height = 6)
  109. ggsave("../plots/expression-disease-duration-correlation/Correlation-disease-duration-volcanoPlot-v2.pdf", width = 8, height = 6)
  110. ###
  111. soDF<-bind_rows(soList)
  112. soDF$FDR<-p.adjust(soDF$pVal, method = "fdr")
  113. write.table(soDF, "../output/expression-disease-correlation/logExpression-AgeOfOnset-correlation.txt", sep="\t", col.names = T, row.names = F, quote=F)
  114. soDF %>%
  115. mutate(color=ifelse(FDR<0.05 & corLogExpr>0, "firebrick3",
  116. ifelse(FDR<0.05 & corLogExpr<0, "dodgerblue3", "black"))) %>%
  117. mutate(label=ifelse(FDR<0.05, GeneName, NA)) %>%
  118. ggplot(aes(x=corLogExpr, y = -log10(FDR), color=color, label=label))+
  119. #geom_point()+
  120. geom_point(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  121. ggrepel::geom_text_repel(position = position_jitter(width = 0.025, height = 0.025, seed = 42))+
  122. theme_classic()+
  123. scale_color_identity()+
  124. labs(x="Correlation", y="-log10(FDR)")+
  125. theme(axis.text = element_text(size = 14),
  126. axis.title = element_text(size=16))
  127. ggsave("../plots/expression-disease-duration-correlation/Correlation-AgeOfOnset-volcanoPlot.png", width = 8, height = 6)
  128. png("../plots/expression-disease-duration-correlation/Cervical-correlation-with-CPM.png", width = 2400, height = 1600, res = 320)
  129. hist(corDF$corExprDuration, main = "Correlation of disease duration and gene expression (CPM)", xlab = "Correlation")
  130. dev.off()
  131. png("../plots/expression-disease-duration-correlation/Cervical-correlation-with-logCPM.png", width = 2400, height = 1600, res = 320)
  132. hist(corDF$corLogExprDuration, main = "Correlation of disease duration and gene expression (logCPM)", xlab = "Correlation")
  133. dev.off()
  134. ```
  135. ### Plot 6 genes together
  136. ```{R}
  137. ### Plot CHIT1 vs. disease duration
  138. cervCPM %>%
  139. dplyr::filter(external_gene_name=="CHIT1") %>%
  140. dplyr::select(4:ncol(cervCPM)) %>%
  141. t() %>%
  142. as.data.frame() %>%
  143. dplyr::rename(CPM=1) %>%
  144. dplyr::mutate(logCPM.CHIT1=log2(CPM+1)) %>%
  145. rownames_to_column("Sample") %>%
  146. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  147. chit.dd<-exprJoined
  148. ### APOC1
  149. cervCPM %>%
  150. dplyr::filter(external_gene_name=="APOC1") %>%
  151. dplyr::select(4:ncol(cervCPM)) %>%
  152. t() %>%
  153. as.data.frame() %>%
  154. dplyr::rename(CPM=1) %>%
  155. dplyr::mutate(logCPM.APOC1=log2(CPM+1)) %>%
  156. rownames_to_column("Sample") %>%
  157. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  158. apoc.dd<-exprJoined
  159. ### C1QC
  160. cervCPM %>%
  161. dplyr::filter(external_gene_name=="C1QC") %>%
  162. dplyr::select(4:ncol(cervCPM)) %>%
  163. t() %>%
  164. as.data.frame() %>%
  165. dplyr::rename(CPM=1) %>%
  166. dplyr::mutate(logCPM.C1QC=log2(CPM+1)) %>%
  167. rownames_to_column("Sample") %>%
  168. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  169. c1qc.dd<-exprJoined
  170. ### C1QB
  171. cervCPM %>%
  172. dplyr::filter(external_gene_name=="C1QB") %>%
  173. dplyr::select(4:ncol(cervCPM)) %>%
  174. t() %>%
  175. as.data.frame() %>%
  176. dplyr::rename(CPM=1) %>%
  177. dplyr::mutate(logCPM.C1QB=log2(CPM+1)) %>%
  178. rownames_to_column("Sample") %>%
  179. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  180. c1qb.dd<-exprJoined
  181. ### C1QA
  182. cervCPM %>%
  183. dplyr::filter(external_gene_name=="C1QA") %>%
  184. dplyr::select(4:ncol(cervCPM)) %>%
  185. t() %>%
  186. as.data.frame() %>%
  187. dplyr::rename(CPM=1) %>%
  188. dplyr::mutate(logCPM.C1QA=log2(CPM+1)) %>%
  189. rownames_to_column("Sample") %>%
  190. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  191. c1qa.dd<-exprJoined
  192. ### Add LSP1
  193. cervCPM %>%
  194. dplyr::filter(external_gene_name=="LSP1") %>%
  195. dplyr::select(4:ncol(cervCPM)) %>%
  196. t() %>%
  197. as.data.frame() %>%
  198. dplyr::rename(CPM=1) %>%
  199. dplyr::mutate(logCPM.LSP1=log2(CPM+1)) %>%
  200. rownames_to_column("Sample") %>%
  201. inner_join(mdDD, by=c("Sample"="ExternalSampleId")) -> exprJoined
  202. lsp.dd<-exprJoined
  203. cor.test(chit.dd$logCPM.CHIT1, chit.dd$Disease.Duration.in.Months)
  204. cor.test(lsp.dd$logCPM.LSP1, lsp.dd$Disease.Duration.in.Months)
  205. geneList<-list(chit.dd, apoc.dd, c1qa.dd, c1qb.dd, c1qc.dd, lsp.dd)
  206. geneList %>%
  207. purrr::reduce(inner_join, by=c("Sample", "ExternalSubjectId", "Subject.Group2", "Disease.Duration.in.Months")) -> sixGenes
  208. sixGenes %>%
  209. dplyr::select(c("Sample", "ExternalSubjectId", "Subject.Group2", "Disease.Duration.in.Months"), contains("logCPM")) %>%
  210. pivot_longer(cols = contains("logCPM"), names_to = "gene", values_to = "logCPM") %>%
  211. mutate(gene = str_sub(gene, start = 8)) %>%
  212. ggplot(aes(x=Disease.Duration.in.Months, y=logCPM, color=gene))+
  213. geom_point(size=2, alpha=0.5)+
  214. geom_smooth(method = "lm", se = F)+
  215. scale_color_discrete(type = RColorBrewer::brewer.pal(n = 9, name = "Set1"))+
  216. theme_classic()+
  217. theme(axis.text = element_text(size=14),
  218. axis.title = element_text(size = 16))+
  219. labs(x="Disease duration in months", y = "log2(CPM)", color="Gene")
  220. ggsave("../plots/expression-disease-duration-correlation/6Genes-and-diseaseDuration-v2.pdf", width = 8, height = 6)
  221. ```
  222. ### GSEA using correlation as ranking
  223. ```{R}
  224. library(fgsea)
  225. goAll<-gmtPathways("../../../gsea-dbs/c5.go.v2023.2.Hs.symbols.gmt")
  226. pathwaysAll<-gmtPathways("../../../gsea-dbs/c2.all.v2023.2.Hs.symbols.gmt")
  227. cts<-gmtPathways("../../../gsea-dbs/c8.all.v7.5.1.symbols.gmt")
  228. ranks<-corDF$corLogExprDuration
  229. names(ranks)<-corDF$GeneName
  230. ranks<-ranks[!duplicated(names(ranks))]
  231. gseaRes<-fgseaMultilevel(pathways = c(goAll, pathwaysAll, cts), stats = ranks, eps = 0)
  232. gseaResOut<-gseaRes
  233. gseaResOut$leadingEdge<-unlist(lapply(gseaResOut$leadingEdge, FUN = function(x){paste0(x, collapse = ", ")}))
  234. write.table(gseaResOut, "../output/expression-disease-correlation/logExpression-DiseaseDuration-correlation-GSEA.txt", sep="\t", col.names = T, row.names = F, quote=F)
  235. gseaRes2<-fgseaMultilevel(pathways = c(goAll, pathwaysAll), stats = ranks, eps = 0)
  236. gseaRes$forViz<-F
  237. gseaRes$forViz<-ifelse(grepl(gseaRes$pathway, pattern="^GOBP"), T, gseaRes$forViz)
  238. gseaRes$forViz<-ifelse(grepl(gseaRes$pathway, pattern="^REACTOME"), T, gseaRes$forViz)
  239. gseaRes$forViz<-ifelse(grepl(gseaRes$pathway, pattern="^FAN_EMBRYONIC_CTX_"), T, gseaRes$forViz)
  240. gseaRes$nameForPlot<-gseaRes$pathway
  241. gseaRes$nameForPlot<-ifelse(grepl(gseaRes$pathway, pattern="^FAN_EMBRYONIC_CTX_"), str_sub(gseaRes$pathway, start = 19), gseaRes$nameForPlot)
  242. gseaRes$nameForPlot<-ifelse(grepl(gseaRes$pathway, pattern="^GOBP|^REACTOME"), unlist(lapply(str_split(gseaRes$pathway, pattern = "_", n = 2), "[[", 2)), gseaRes$nameForPlot)
  243. gseaRes$nameForPlot<-str_replace_all(gseaRes$nameForPlot, pattern = "_", replacement = " ")
  244. gseaRes$type<-"black"
  245. gseaRes$type<-ifelse(grepl(gseaRes$pathway, pattern="^FAN_EMBRYONIC_CTX_"), "orange", gseaRes$type)
  246. gseaRes$type<-ifelse(grepl(gseaRes$pathway, pattern="^GOBP"), "red", gseaRes$type)
  247. gseaRes$type<-ifelse(grepl(gseaRes$pathway, pattern="^REACTOME"), "steelblue", gseaRes$type)
  248. gseaRes %>%
  249. dplyr::filter(forViz==T) %>%
  250. dplyr::filter(NES>0) %>%
  251. dplyr::arrange(padj) %>%
  252. dplyr::slice_head(n = 10) %>%
  253. ggplot(aes(x=NES, y=reorder(nameForPlot, -padj), fill= -log10(padj)))+
  254. geom_bar(stat = "identity")+
  255. scale_y_discrete(labels = function(x) str_wrap(x, width = 20))+
  256. theme_classic()+
  257. #theme(axis.text.y = element_text(color = type))+
  258. labs(x="NES", y="Term", fill="-log10(FDR)")
  259. ggsave("../plots/expression-disease-duration-correlation/terms-with-positive-disease-duration-correlation.pdf", width = 8, height = 6)
  260. gseaRes %>%
  261. dplyr::filter(forViz==T) %>%
  262. dplyr::filter(NES<0) %>%
  263. dplyr::arrange(padj) %>%
  264. dplyr::slice_head(n = 10) %>%
  265. ggplot(aes(x=NES, y=reorder(nameForPlot, -padj), fill= -log10(padj)))+
  266. geom_bar(stat = "identity")+
  267. scale_y_discrete(labels = function(x) str_wrap(x, width = 20))+
  268. theme_classic()+
  269. theme(axis.text = element_text(size=14), axis.title=element_text(size=16))+
  270. #theme(axis.text.y = element_text(color = type))+
  271. labs(x="NES", y="Term", fill="-log10(FDR)")
  272. ggsave("../plots/expression-disease-duration-correlation/terms-with-negative-disease-duration-correlation.pdf", width = 8, height = 6)
  273. gseaRes %>%
  274. dplyr::filter(forViz==T) %>%
  275. dplyr::filter(NES<0) %>%
  276. dplyr::arrange(padj) %>%
  277. dplyr::slice_head(n = 10) %>%
  278. ggplot(aes(x=NES, y=reorder(nameForPlot, -NES), fill= -log10(padj)))+
  279. geom_bar(stat = "identity")+
  280. geom_text(aes(label=signif(padj,3)), hjust = 0)+
  281. scale_y_discrete(labels = function(x) str_wrap(x, width = 30))+
  282. theme_classic()+
  283. scale_fill_distiller(palette = "YlOrRd", direction = 1)+
  284. theme(axis.text = element_text(size=14), axis.title=element_text(size=16))+
  285. #theme(axis.text.y = element_text(color = type))+
  286. labs(x="NES", y="Term", fill="-log10(FDR)")
  287. ggsave("../plots/expression-disease-duration-correlation/terms-with-negative-disease-duration-correlation-v2.pdf", width = 8, height = 6)
  288. plotEnrichment(pathway = cts$FAN_EMBRYONIC_CTX_BIG_GROUPS_MICROGLIA, stats = ranks)+
  289. labs(x="Rank", y="Enrichment score")
  290. ggsave("../plots/expression-disease-duration-correlation/GSEA-disease-duration-microglia.png", width = 6, height = 4)
  291. plotEnrichment(pathway = pathwaysAll$REACTOME_CHOLESTEROL_BIOSYNTHESIS, stats = ranks)+
  292. labs(x="Rank", y="Enrichment score")
  293. ggsave("../plots/expression-disease-duration-correlation/GSEA-disease-duration-cholesterol.png", width = 6, height = 4)
  294. plotEnrichment(pathway = goAll$GOBP_INNATE_IMMUNE_RESPONSE, stats = ranks)
  295. ###
  296. gseaRes %>%
  297. dplyr::filter(forViz==T) %>%
  298. dplyr::filter(NES>0) %>%
  299. dplyr::arrange(padj) %>%
  300. dplyr::slice_head(n = 10) %>%
  301. ggplot(aes(x=NES, y=reorder(nameForPlot, -NES), color= -log10(padj)))+
  302. #geom_bar(stat = "identity")+
  303. geom_point(size=3)+
  304. scale_y_discrete(labels = function(x) str_wrap(x, width = 20))+
  305. theme_bw()+
  306. #theme(axis.text.y = element_text(color = type))+
  307. labs(x="NES", y="Term", fill="-log10(FDR)")
  308. ### Combined
  309. gseaRes %>%
  310. dplyr::filter(forViz==T) %>%
  311. dplyr::filter(NES>0) %>%
  312. dplyr::arrange(padj) %>%
  313. dplyr::slice_head(n = 10) -> top10
  314. gseaRes %>%
  315. dplyr::filter(forViz==T) %>%
  316. dplyr::filter(NES<0) %>%
  317. dplyr::arrange(padj) %>%
  318. dplyr::slice_head(n = 10) -> bottom10
  319. top20<-rbind(top10, bottom10)
  320. top20 %>%
  321. ggplot(aes(x=NES, y=reorder(nameForPlot, NES), fill= -log10(padj)))+
  322. geom_bar(stat = "identity")+
  323. scale_y_discrete(labels = function(x) str_wrap(x, width = 30))+
  324. theme_classic()+
  325. theme(axis.text = element_text(size=14), axis.title=element_text(size=16))+
  326. scale_fill_distiller(palette = "YlOrRd")+
  327. #theme(axis.text.y = element_text(color = type))+
  328. labs(x="NES", y="Term", fill="-log10(FDR)")
  329. ggsave("../plots/expression-disease-duration-correlation/terms-with-both-disease-duration-correlation-v2.pdf", width = 12, height = 12)
  330. top20 %>%
  331. ggplot(aes(x=NES, y=reorder(nameForPlot, NES), fill= -log10(padj)))+
  332. geom_bar(stat = "identity")+
  333. geom_text(aes(label=signif(padj,3)), hjust = 1)+
  334. scale_y_discrete(labels = function(x) str_wrap(x, width = 30))+
  335. theme_classic()+
  336. theme(axis.text = element_text(size=14), axis.title=element_text(size=16))+
  337. scale_fill_distiller(palette = "YlOrRd")+
  338. #theme(axis.text.y = element_text(color = type))+
  339. labs(x="NES", y="Term", fill="-log10(FDR)")
  340. ggsave("../plots/expression-disease-duration-correlation/terms-with-both-disease-duration-correlation-v3.pdf", width = 12, height = 12)
  341. top20 %>%
  342. ggplot(aes(x=NES, y=reorder(nameForPlot, -NES), color= -log10(padj)))+
  343. geom_point()+
  344. scale_y_discrete(labels = function(x) str_wrap(x, width = 20))+
  345. theme_classic()+
  346. theme(axis.text = element_text(size=14), axis.title=element_text(size=16))+
  347. #theme(axis.text.y = element_text(color = type))+
  348. labs(x="NES", y="Term", fill="-log10(FDR)")
  349. ```
  350. ### Correlate proportion of immune proportion from figure 2i OR immune cell proportion changes
  351. ### Correlate proportion of macrophages from CIBERSORT
  352. ```{R}
  353. cbProp<-read.table("../output/CIBERSORT/2023/Spinal/CIBERSORTx_Job96_Adjusted_2024Samples_expr0.5-rep25_TMM.txt", sep="\t", header=T, stringsAsFactors = F, quote="")
  354. cbProp$P.value<-cbProp$Correlation<-cbProp$RMSE<-NULL
  355. cbProp$immuneCells<-cbProp$Macrophages+cbProp$Microglia+cbProp$ProliferatingMicroglia+cbProp$Lymphocytes
  356. cbProp %>%
  357. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) -> cbMerge
  358. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Macrophages)
  359. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Microglia)
  360. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Lymphocytes)
  361. cor(cbMerge$Disease.Duration.in.Months, cbMerge$immuneCells)
  362. cor(cbMerge$immuneCells, cbMerge$Disease.Duration.in.Months)
  363. cor(cbMerge$immuneCells2, cbMerge$Disease.Duration.in.Months)
  364. corVal<-signif(cor(cbMerge$immuneCells, cbMerge$Disease.Duration.in.Months), 3)
  365. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$immuneCells))$coefficients[2,4], 3)
  366. cbProp %>%
  367. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  368. ggplot(aes(y=immuneCells, x=Disease.Duration.in.Months))+
  369. geom_point()+
  370. geom_smooth(method="lm")+
  371. annotate("text", y = 0.4, x = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  372. labs(y="Proportion of immune cells", x="Disease duration in months", title = "Immune cell proportion and disease duration")+
  373. theme_classic()+
  374. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  375. ggsave("../plots/expression-disease-duration-correlation/immune-cells-and-disease-duration-v2.pdf", width = 8, height = 6)
  376. cbProp %>%
  377. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  378. ggplot(aes(y=immuneCells, x=Disease.Duration.in.Months))+
  379. geom_point()+
  380. geom_smooth(method="lm")+
  381. annotate("text", y = 0.4, x = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  382. labs(y="Proportion of immune cells", x="Disease duration in months", title = "Immune cell proportion and disease duration")+
  383. theme_classic()+
  384. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  385. corValAst<-signif(cor(cbMerge$Astrocytes, cbMerge$Disease.Duration.in.Months), 3)
  386. pValAst<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$Astrocytes))$coefficients[2,4], 3)
  387. cbProp %>%
  388. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  389. ggplot(aes(y=Astrocytes, x=Disease.Duration.in.Months))+
  390. geom_point()+
  391. geom_smooth(method="lm")+
  392. annotate("text", y = 0.4, x = 200, label = paste0("r=", corValAst, "\np=", pValAst), size=6)+
  393. labs(y="Proportion of sstrocytes", x="Disease duration in months", title = "Astrocyte proportion and disease duration")+
  394. theme_classic()+
  395. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  396. ### Age at symptom onset
  397. cbProp %>%
  398. inner_join(cervSO, by=c("Mixture"="ExternalSampleId")) -> cbMerge2
  399. corVal<-signif(cor(cbMerge2$immuneCells, cbMerge2$Age.at.Symptom.Onset), 3)
  400. pVal<-signif(summary(lm(cbMerge2$Age.at.Symptom.Onset ~ cbMerge2$immuneCells))$coefficients[2,4], 3)
  401. cbProp %>%
  402. inner_join(cervSO, by=c("Mixture"="ExternalSampleId")) %>%
  403. ggplot(aes(y=immuneCells, x=Age.at.Symptom.Onset))+
  404. geom_point()+
  405. geom_smooth(method="lm")+
  406. annotate("text", y = 0.4, x = 75, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  407. labs(y="Proportion of immune cells", x="Age at Symptom Onset", title = "Immune cell proportion and age of onset")+
  408. theme_classic()+
  409. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  410. ggsave("../plots/expression-disease-duration-correlation/immune-cells-and-age-at-symptom-onset.pdf", width = 8, height = 6)
  411. ggsave("../plots/expression-disease-duration-correlation/immune-cells-and-age-at-symptom-onset.png", width = 8, height = 6)
  412. ###
  413. corVal<-signif(cor(cbMerge$immuneCells, cbMerge$Disease.Duration.in.Months), 3)
  414. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$immuneCells))$coefficients[2,4], 3)
  415. cbProp %>%
  416. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  417. ggplot(aes(y=immuneCells, x=Disease.Duration.in.Months))+
  418. geom_point()+
  419. geom_smooth(method="lm")+
  420. annotate("text", y = 0.4, x = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  421. labs(x="Proportion of immune cells", y="Disease duration in months", title = "Immune cell proportion and disease duration")+
  422. theme_classic()+
  423. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  424. ### Macrophages
  425. corVal<-signif(cor(cbMerge$Macrophages, cbMerge$Disease.Duration.in.Months), 3)
  426. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$Macrophages))$coefficients[2,4], 3)
  427. cbProp %>%
  428. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  429. ggplot(aes(x=Macrophages, y=Disease.Duration.in.Months))+
  430. geom_point()+
  431. geom_smooth(method="lm")+
  432. annotate("text", x = 0.15, y = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  433. labs(x="Proportion of macrophages", y="Disease duration in months", title = "Macrophage proportion and disease duration")+
  434. theme_classic()+
  435. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  436. ggsave("../plots/expression-disease-duration-correlation/macrophages-and-disease-duration.pdf", width = 8, height = 6)
  437. ### microglia
  438. corVal<-signif(cor(cbMerge$Microglia, cbMerge$Disease.Duration.in.Months), 3)
  439. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$Microglia))$coefficients[2,4], 3)
  440. cbProp %>%
  441. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  442. ggplot(aes(y=Microglia, x=Disease.Duration.in.Months))+
  443. geom_point()+
  444. geom_smooth(method="lm")+
  445. annotate("text", y = 0.15, x = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  446. labs(y="Proportion of microglia", x="Disease duration in months", title = "Microglia proportion and disease duration")+
  447. theme_classic()+
  448. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  449. ggsave("../plots/expression-disease-duration-correlation/Microglia-and-disease-duration-v2.pdf", width = 8, height = 6)
  450. ### lymphocytes
  451. corVal<-signif(cor(cbMerge$Lymphocytes, cbMerge$Disease.Duration.in.Months), 3)
  452. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge$Lymphocytes))$coefficients[2,4], 3)
  453. cbProp %>%
  454. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) %>%
  455. ggplot(aes(x=Lymphocytes, y=Disease.Duration.in.Months))+
  456. geom_point()+
  457. geom_smooth(method="lm")+
  458. annotate("text", x = 0.05, y = 200, label = paste0("r=", corVal, "\np=", pVal), size=6)+
  459. labs(x="Proportion of lymphocytes", y="Disease duration in months", title = "Lymphocyte proportion and disease duration")+
  460. theme_classic()+
  461. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))
  462. ggsave("../plots/expression-disease-duration-correlation/Lymphocytes-and-disease-duration.pdf", width = 8, height = 6)
  463. ### ALso check age at symptom onset
  464. ### Check correlation for all cell types
  465. cbProp %>%
  466. inner_join(cervDD, by=c("Mixture"="ExternalSampleId")) -> cbMerge
  467. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Macrophages)
  468. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Microglia)
  469. cor(cbMerge$Disease.Duration.in.Months, cbMerge$Lymphocytes)
  470. cor(cbMerge$Disease.Duration.in.Months, cbMerge$immuneCells)
  471. cellTypes<-colnames(cbProp)[-1]
  472. corList<-list()
  473. for(i in 1:length(cellTypes)){
  474. thisCt<-cellTypes[i]
  475. corVal<-signif(cor(cbMerge[,thisCt], cbMerge$Disease.Duration.in.Months), 3)
  476. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge[,thisCt]))$coefficients[2,4], 3)
  477. corTmp<-data.frame(cellType=thisCt,
  478. correlationWithDiseaseDuration=corVal,
  479. pVal=pVal)
  480. corList[[i]]<-corTmp
  481. }
  482. #corDf<-bind_rows(corList)
  483. cervDf<-bind_rows(corList)
  484. ### Plot all cell types
  485. cbMerge %>%
  486. dplyr::select(-ExternalSubjectId, -Subject.Group2) %>%
  487. pivot_longer(-c(Mixture, Disease.Duration.in.Months), names_to = "cellType", values_to = "proportion") %>%
  488. ggplot(aes(x=Disease.Duration.in.Months, y=proportion, color=cellType))+
  489. geom_smooth(method = "lm")
  490. cbMerge %>%
  491. dplyr::select(-ExternalSubjectId, -Subject.Group2) %>%
  492. pivot_longer(-c(Mixture, Disease.Duration.in.Months), names_to = "cellType", values_to = "proportion") %>%
  493. ggplot(aes(x=Disease.Duration.in.Months, y=proportion, color=cellType))+
  494. geom_point(size=1, alpha=0.5)+
  495. geom_smooth(method = "lm", se = F)+
  496. scale_color_discrete(type = RColorBrewer::brewer.pal(n = 9, name = "Set1"))+
  497. theme_classic()+
  498. theme(axis.text = element_text(size=14),
  499. axis.title = element_text(size = 16))+
  500. labs(x="Disease duration in months", y = "log2(CPM)", color="Gene")
  501. ggsave("../plots/expression-disease-duration-correlation/cellTypes-and-diseaseDuration.pdf", width = 8, height = 6)
  502. ### Lumbar
  503. cbProp %>%
  504. inner_join(lumbDD, by=c("Mixture"="ExternalSampleId")) -> cbMerge
  505. corList<-list()
  506. for(i in 1:length(cellTypes)){
  507. thisCt<-cellTypes[i]
  508. corVal<-signif(cor(cbMerge[,thisCt], cbMerge$Disease.Duration.in.Months), 3)
  509. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge[,thisCt]))$coefficients[2,4], 3)
  510. corTmp<-data.frame(cellType=thisCt,
  511. correlationWithDiseaseDuration=corVal,
  512. pVal=pVal)
  513. corList[[i]]<-corTmp
  514. }
  515. lumbDf<-bind_rows(corList)
  516. ### thoracic
  517. cbProp %>%
  518. inner_join(thorDD, by=c("Mixture"="ExternalSampleId")) -> cbMerge
  519. corList<-list()
  520. for(i in 1:length(cellTypes)){
  521. thisCt<-cellTypes[i]
  522. corVal<-signif(cor(cbMerge[,thisCt], cbMerge$Disease.Duration.in.Months), 3)
  523. pVal<-signif(summary(lm(cbMerge$Disease.Duration.in.Months ~ cbMerge[,thisCt]))$coefficients[2,4], 3)
  524. corTmp<-data.frame(cellType=thisCt,
  525. correlationWithDiseaseDuration=corVal,
  526. pVal=pVal)
  527. corList[[i]]<-corTmp
  528. }
  529. thorDf<-bind_rows(corList)
  530. cervDf$tissue<-"Cervical"
  531. lumbDf$tissue<-"Lumbar"
  532. thorDf$tissue<-"Thoracic"
  533. cervDf %>%
  534. dplyr::mutate(label=paste0("r = ", correlationWithDiseaseDuration, "; p = ", signif(pVal, digits = 3))) %>%
  535. dplyr::mutate(logP= -log10(pVal)) %>%
  536. dplyr::mutate(color= logP * sign(correlationWithDiseaseDuration)) %>%
  537. ggplot(aes(x=1, y=reorder(cellType, correlationWithDiseaseDuration), fill=color, label=label))+
  538. geom_tile(show.legend = F)+
  539. geom_text(size = 4)+
  540. scale_fill_gradient2()+
  541. labs(y=NULL)+
  542. theme_classic()+
  543. theme(axis.title.x = element_blank(),
  544. axis.ticks.x = element_blank(),
  545. axis.text.x = element_blank(),
  546. axis.text.y = element_text(size = 12))
  547. ggsave("../plots/CIBERSORT/withNYGC/Spinal/Cervical-correlation-with-disease-duration-v2.pdf", width = 4, height = 6)
  548. ggsave("../plots/CIBERSORT/withNYGC/Spinal/Cervical-correlation-with-disease-duration.png", width = 4, height = 7)
  549. ggsave("../plots/CIBERSORT/withNYGC/Spinal/Cervical-correlation-with-disease-duration.tiff", width = 4, height = 7)
  550. ggsave("../plots/CIBERSORT/withNYGC/Spinal/Cervical-correlation-with-disease-duration.svg", width = 4, height = 7)
  551. ### Horizontal
  552. cervDf %>%
  553. dplyr::mutate(label=paste0("r = ", correlationWithDiseaseDuration, "\np = ", signif(pVal, digits = 3))) %>%
  554. dplyr::mutate(logP= -log10(pVal)) %>%
  555. dplyr::mutate(color= logP * sign(correlationWithDiseaseDuration)) %>%
  556. ggplot(aes(x=1, y=reorder(cellType, -correlationWithDiseaseDuration), fill=color, label=label))+
  557. geom_tile(show.legend = F)+
  558. geom_text(size = 4)+
  559. scale_fill_gradient2()+
  560. labs(y=NULL)+
  561. coord_flip()+
  562. theme_classic()+
  563. theme(axis.title.y = element_blank(),
  564. axis.ticks.y = element_blank(),
  565. axis.text.y = element_blank(),
  566. axis.text.x = element_text(size = 12, angle=30, hjust = 1))
  567. ggsave("../plots/CIBERSORT/withNYGC/Spinal/Cervical-correlation-with-disease-duration-horiz.pdf", width = 12, height = 2)
  568. ###
  569. allDF<-rbind(cervDf, lumbDf, thorDf)
  570. allDF$fdr<-p.adjust(allDF$pVal, method="fdr")
  571. allDF$logP<- -log10(allDF$fdr)
  572. allDF %>%
  573. dplyr::select(cellType, correlationWithDiseaseDuration, pVal, tissue) %>%
  574. pivot_wider(names_from = tissue, values_from = c(correlationWithDiseaseDuration, pVal))
  575. ```
  576. ### Correlate STMN2 with disease duration or immune cells
  577. ```{R}
  578. stmn<-read.table("../output/tdpCounts/junctions/cervical/STMN2-ENSG00000104435.14s79611117-79611214.txt", sep="\t", header=T, stringsAsFactors = F, quote="")
  579. stmnDF<-data.frame(sample=colnames(stmn)[10:ncol(stmn)],
  580. correctSplicing=as.numeric(stmn[2,10:ncol(stmn)]),
  581. incorrectSplicing=as.numeric(stmn[1,10:ncol(stmn)]))
  582. stmnDF$misspliceProportion<-stmnDF$incorrectSplicing/(stmnDF$incorrectSplicing+stmnDF$correctSplicing)
  583. stmnDF$tdp<-ifelse(stmnDF$misspliceProportion>0, T, F)
  584. write.table(stmnDF, "../output/TablesForManuscript/STMN2-missplicing.txt", sep="\t", col.names = T, row.names = F, quote=F)
  585. ### For Fig 6j
  586. ### Plot APOC1 vs. STMN
  587. cervCPM %>%
  588. dplyr::filter(external_gene_name=="APOC1") %>%
  589. dplyr::select(4:ncol(thisRow)) %>%
  590. t() %>%
  591. as.data.frame() %>%
  592. dplyr::rename(CPM=1) %>%
  593. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  594. rownames_to_column("Sample") %>%
  595. inner_join(stmnDF, by=c("Sample"="sample")) -> exprSTMN
  596. exprSTMN %>%
  597. dplyr::filter(!is.na(tdp)) %>%
  598. ggplot(aes(x=tdp, y=logCPM))+
  599. geom_boxplot()+
  600. theme_classic()+
  601. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))+
  602. ggpubr::stat_compare_means(label.x = 1.2, size=6)+
  603. labs(x="Has missplicing", y="APOC1 expression (logCPM)")
  604. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-APOC1-binary.png", width = 4, height = 6)
  605. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-APOC1-binary.pdf", width = 4, height = 6)
  606. ### Plot C1QC vs. STMN
  607. cervCPM %>%
  608. dplyr::filter(external_gene_name=="C1QC") %>%
  609. dplyr::select(4:ncol(thisRow)) %>%
  610. t() %>%
  611. as.data.frame() %>%
  612. dplyr::rename(CPM=1) %>%
  613. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  614. rownames_to_column("Sample") %>%
  615. inner_join(stmnDF, by=c("Sample"="sample")) -> exprSTMN
  616. exprSTMN %>%
  617. dplyr::filter(!is.na(tdp)) %>%
  618. ggplot(aes(x=tdp, y=logCPM))+
  619. geom_boxplot()+
  620. theme_classic()+
  621. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))+
  622. ggpubr::stat_compare_means(label.x = 1.2, size=6)+
  623. labs(x="Has missplicing", y="C1QC expression (logCPM)")
  624. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QC-binary.png", width = 4, height = 6)
  625. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QC-binary.pdf", width = 4, height = 6)
  626. ### Plot C1QB vs. STMN
  627. cervCPM %>%
  628. dplyr::filter(external_gene_name=="C1QB") %>%
  629. dplyr::select(4:ncol(thisRow)) %>%
  630. t() %>%
  631. as.data.frame() %>%
  632. dplyr::rename(CPM=1) %>%
  633. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  634. rownames_to_column("Sample") %>%
  635. inner_join(stmnDF, by=c("Sample"="sample")) -> exprSTMN
  636. exprSTMN %>%
  637. dplyr::filter(!is.na(tdp)) %>%
  638. ggplot(aes(x=tdp, y=logCPM))+
  639. geom_boxplot()+
  640. theme_classic()+
  641. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))+
  642. ggpubr::stat_compare_means(label.x = 1.2, size=6)+
  643. labs(x="Has missplicing", y="C1QB expression (logCPM)")
  644. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QB-binary.png", width = 4, height = 6)
  645. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QB-binary.pdf", width = 4, height = 6)
  646. ### Plot C1QA vs. STMN
  647. cervCPM %>%
  648. dplyr::filter(external_gene_name=="C1QA") %>%
  649. dplyr::select(4:ncol(thisRow)) %>%
  650. t() %>%
  651. as.data.frame() %>%
  652. dplyr::rename(CPM=1) %>%
  653. dplyr::mutate(logCPM=log2(CPM+1)) %>%
  654. rownames_to_column("Sample") %>%
  655. inner_join(stmnDF, by=c("Sample"="sample")) -> exprSTMN
  656. exprSTMN %>%
  657. dplyr::filter(!is.na(tdp)) %>%
  658. ggplot(aes(x=tdp, y=logCPM))+
  659. geom_boxplot()+
  660. theme_classic()+
  661. theme(axis.text = element_text(size=14), axis.title = element_text(size=16))+
  662. ggpubr::stat_compare_means(label.x = 1.2, size=6)+
  663. labs(x="Has missplicing", y="C1QA expression (logCPM)")
  664. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QA-binary.png", width = 4, height = 6)
  665. ggsave("../plots/expression-disease-duration-correlation/STMN-missplicing/STMN-proportion-vs-C1QA-binary.pdf", width = 4, height = 6)
  666. ```

correlation-with-disease-duration.Rmd at commit 2c3b477, no license · at the source

Overview

Authors: Ziyang Zhang1,2, Lynn van Olst1,2, Francesco Alessandrini2, Matthew Wright2, Alex J Edwards1,2, Jake Boles1,2, Anait Nalbandian1,2, Anne V Forsyth1,2, Nate Shepard2, Thomas Watson1,2, Evan Kaspi2, Angeli Mittal2, Joshua Kuruvilla1,2, Natalie Piehl1,2, Abhirami Ramakrishnan1,2, Stanley Appel3, Evangelos Kiskinis2, David Gate1,2
  1. Abrams Research Center on Neurogenomics, Feinberg School of Medicine, Northwestern University, Chicago, IL USA
  2. The Ken & Ruth Davee Department of Neurology, Feinberg School of Medicine, Northwestern University, Chicago, IL USA
  3. Houston Methodist Neurological Institute, Houston Methodist Research Institute, Stanley H. Appel Department of Neurology, Houston Methodist Hospital, Houston, TX USA
Institutions: Northwestern University (United States); Houston Methodist (United States)
Journal: Nature neuroscience, volume 29, issue 7, pages 1735-1748
Dates: received 7 October 2025; accepted 14 April 2026; published online 14 May 2026; in print 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41593-026-02300-5 · PMID 42135512 · PMCID PMC13337491 · OpenAlex W7161164514
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: genetics / omics (modality), human (organism), other condition (population), cellular / molecular (subfield)
Methods: Connectivity, Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions
Keywords: Neuroimmunology, Amyotrophic lateral sclerosis
MeSH: Amyotrophic Lateral Sclerosis*, C9orf72 Protein, CD8-Positive T-Lymphocytes, DNA-Binding Proteins, Gene Expression Profiling, Humans, Motor Neurons, Single-Cell Analysis, Single-Cell Gene Expression Analysis, Spatial Transcriptomics, Spinal Cord, Transcriptome (* major topic)
Topic: Amyotrophic Lateral Sclerosis Research (Neurology, Medicine), according to OpenAlex
Funding: U.S. Department of Health &amp; Human Services | National Institutes of Health (R01AG078713); U.S. Department of Health & Human Services | National Institutes of Health (NIH) (R01AG078713); Target ALS; BrightFocus Foundation; Les Turner ALS Foundation; New York Stem Cell Foundation
Citations: cited by 3 papers (Europe PMC); 84 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 38 matches between paragraphs and lines of code.

gatelabNW/als_immune_public

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 551577639288550b353df8f00e4cc84324020ffd, 13 May 2026
Languages: R (222), Shell (165), Python (12), Jupyter (8)
Size: 429 files, 407 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, 124 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (131 files), ggplot2 (32 files), ggpubr (28 files), Seurat (28 files), data.table (21 files), Matplotlib (20 files), NumPy (20 files), pandas (20 files), Scanpy (20 files), patchwork (17 files), PyTorch (16 files), SciPy (16 files), SAMtools (5 files), cowplot (4 files), Cell Ranger (3 files), pheatmap (3 files), ComplexHeatmap (2 files), FastQC (2 files), igraph (2 files), Plotly (2 files), anndata (1 file), car (1 file), edgeR (1 file), Harmony (1 file), reshape2 (1 file), scikit-learn (1 file), Squidpy (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
408 files

KiskinisLab/TargetALS-BulkAnalysis

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 2c3b47718aa1c3bf562dfd2a1edf61c765e5d84e, 13 March 2026
Languages: R (3)
Size: 4 files, 3 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, 2 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (3 files), ggpubr (2 files), circlize (1 file), ComplexHeatmap (1 file), DESeq2 (1 file), edgeR (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
4 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/s41593-026-02300-5.

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;
  • 410 scripts, each with its path and the digest of its content;
  • 38 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

Data availability statement

The paper has a 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/s41593-026-02300-5.

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 2, 28 September 2026

  • Publisher: n/a → Nature Portfolio

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 18 authors, 2 keywords, 12 MeSH terms, 6 funders, 84 references.

Cite

This paper

Zhang, Z., van Olst, L., Alessandrini, F., Wright, M., Edwards, A. J., Boles, J., Nalbandian, A., Forsyth, A. V., Shepard, N., Watson, T., Kaspi, E., Mittal, A., Kuruvilla, J., Piehl, N., Ramakrishnan, A., Appel, S., Kiskinis, E., & Gate, D. (2026). Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming. Nature neuroscience, 29(7), 1735-1748. https://doi.org/10.1038/s41593-026-02300-5

BibTeX

@article{zhang2026integrated,
author = {Zhang, Ziyang and van Olst, Lynn and Alessandrini, Francesco and Wright, Matthew and Edwards, Alex J and Boles, Jake and Nalbandian, Anait and Forsyth, Anne V and Shepard, Nate and Watson, Thomas and Kaspi, Evan and Mittal, Angeli and Kuruvilla, Joshua and Piehl, Natalie and Ramakrishnan, Abhirami and Appel, Stanley and Kiskinis, Evangelos and Gate, David},
title = {{Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming}},
journal = {Nature neuroscience},
year = {2026},
month = may,
volume = {29},
number = {7},
pages = {1735--1748},
publisher = {Nature Portfolio},
issn = {1097-6256},
doi = {10.1038/s41593-026-02300-5},
url = {https://doi.org/10.1038/s41593-026-02300-5},
pmid = {42135512},
pmcid = {PMC13337491}
}

RIS

TY - JOUR
AU - Zhang, Ziyang
AU - van Olst, Lynn
AU - Alessandrini, Francesco
AU - Wright, Matthew
AU - Edwards, Alex J
AU - Boles, Jake
AU - Nalbandian, Anait
AU - Forsyth, Anne V
AU - Shepard, Nate
AU - Watson, Thomas
AU - Kaspi, Evan
AU - Mittal, Angeli
AU - Kuruvilla, Joshua
AU - Piehl, Natalie
AU - Ramakrishnan, Abhirami
AU - Appel, Stanley
AU - Kiskinis, Evangelos
AU - Gate, David
TI - Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming
T2 - Nature neuroscience
J2 - Nat Neurosci
PY - 2026
DA - 2026/05/14
VL - 29
IS - 7
SP - 1735
EP - 1748
SN - 1097-6256
PB - Nature Portfolio
DO - 10.1038/s41593-026-02300-5
UR - https://doi.org/10.1038/s41593-026-02300-5
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41593-026-02300-5",
"type": "article-journal",
"title": "Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming",
"container-title": "Nature neuroscience",
"author": [
{
"family": "Zhang",
"given": "Ziyang"
},
{
"family": "van Olst",
"given": "Lynn"
},
{
"family": "Alessandrini",
"given": "Francesco"
},
{
"family": "Wright",
"given": "Matthew"
},
{
"family": "Edwards",
"given": "Alex J"
},
{
"family": "Boles",
"given": "Jake"
},
{
"family": "Nalbandian",
"given": "Anait"
},
{
"family": "Forsyth",
"given": "Anne V"
},
{
"family": "Shepard",
"given": "Nate"
},
{
"family": "Watson",
"given": "Thomas"
},
{
"family": "Kaspi",
"given": "Evan"
},
{
"family": "Mittal",
"given": "Angeli"
},
{
"family": "Kuruvilla",
"given": "Joshua"
},
{
"family": "Piehl",
"given": "Natalie"
},
{
"family": "Ramakrishnan",
"given": "Abhirami"
},
{
"family": "Appel",
"given": "Stanley"
},
{
"family": "Kiskinis",
"given": "Evangelos"
},
{
"family": "Gate",
"given": "David"
}
],
"container-title-short": "Nat Neurosci",
"volume": "29",
"issue": "7",
"page": "1735-1748",
"DOI": "10.1038/s41593-026-02300-5",
"PMID": "42135512",
"PMCID": "PMC13337491",
"ISSN": "1097-6256",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41593-026-02300-5",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
14
]
]
}
}

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/s41586-026-10214-2 [code]
Multidimensional profiling of heterogeneity in supratentorial ependymomas.
Journal: Nature
In common: Cell Ranger, Squidpy, Harmony, 22 other tools, genetics / omics, other condition
[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, edgeR, car, 21 other tools, genetics / omics, other condition, cellular / molecular, 1 reference
[3] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: Harmony, edgeR, anndata, 20 other tools, genetics / omics, cellular / molecular, 1 reference
[4] doi:10.1038/s41467-026-69944-6 [code]
Multi-modal dissection of cell-type specific TDP-43 pathology in the motor cortex.
Journal: Nature communications
In common: SAMtools, igraph, circlize, 15 other tools, genetics / omics, other condition, 6 references
[5] 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, anndata, igraph, 19 other tools, genetics / omics, other condition, cellular / molecular, 1 reference
[6] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: FastQC, SAMtools, edgeR, 19 other tools, genetics / omics, other condition
[7] doi:10.1038/s41467-026-73305-8 [code]
Comparative analysis of the cellular landscape in mammalian striatum.
Journal: Nature communications
In common: Cell Ranger, Harmony, SAMtools, 17 other tools, genetics / omics, cellular / molecular
[8] doi:10.1186/s13059-026-04177-w [code]
Genomic sequence evolution underlying human neocortical interareal diversification.
Journal: Genome biology
In common: Squidpy, SAMtools, anndata, 17 other tools, genetics / omics, cellular / molecular, 1 reference
[9] doi:10.1016/j.cell.2026.05.047 [code]
An emergent disease-associated motor neuron state precedes cell death in ALS.
Journal: Cell
In common: Squidpy, anndata, DESeq2, 11 other tools, genetics / omics, other condition, cellular / molecular, 6 references
[10] doi:10.3389/fnmol.2026.1844705 [code]
Risperidone regulates the expression of schizophrenia-related genes in the forebrain of adult male mice.
Journal: Frontiers in molecular neuroscience
In common: SAMtools, edgeR, anndata, 18 other tools, genetics / omics, cellular / molecular

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.