OSCR

Response dynamics of discrete subiculum→retrosplenial cortex projections underlying trace fear conditioning.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

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 · 605 lines · 24 KB · no license

  1. options(stringsAsFactors = FALSE)
  2. Sys.getenv('R_MAX_VSIZE')
  3. library(Seurat)
  4. library(dplyr)
  5. library(cowplot)
  6. library(ggplot2)
  7. library(SeuratWrappers)
  8. library(doBy)
  9. library(fgsea)
  10. library(data.table)
  11. library(pheatmap)
  12. library(gprofiler2)
  13. library(scDblFinder)
  14. library(SoupX)
  15. library(lsa)
  16. library(msigdbr)
  17. ###functions to use###############
  18. pc_select <- function(seu){
  19. .seu <- seu
  20. .pct <- .seu[["pca"]]@stdev / sum(.seu[["pca"]]@stdev) * 100
  21. .cumu <- cumsum(.pct)
  22. .co1 <- which(.cumu > 90 & .pct < 5)[1]
  23. .co2 <- sort(which((.pct[1:length(.pct) - 1] - .pct[2:length(.pct)]) > 0.1), decreasing = T)[1] + 1
  24. .pc_num <- min(.co1, .co2)
  25. return(.pc_num)
  26. }
  27. #####Integration with soupX decontamination########################
  28. soupx_lib1 <- load10X("cellranger_output_for_soupX/lib1_outs/")
  29. soupx_lib1 <- autoEstCont(soupx_lib1)
  30. soupx_lib1 <- adjustCounts(soupx_lib1)
  31. set.seed(1234)
  32. lib1 <- CreateSeuratObject(counts = soupx_lib1, project = "lib1")
  33. dblet <- scDblFinder(GetAssayData(lib1, slot="counts"))
  34. lib1$scDblFinder.class <- dblet$scDblFinder.class
  35. lib1##13102 cells
  36. lib1$condition <- "GFP_CFC"
  37. lib1[["percent.mt"]] <- PercentageFeatureSet(lib1, pattern = "^mt-")
  38. lib1 <- RenameCells(lib1, add.cell.id = "lib1")
  39. soupx_lib2 <- load10X("cellranger_output_for_soupX/lib2_outs/")
  40. soupx_lib2 <- autoEstCont(soupx_lib2)
  41. soupx_lib2 <- adjustCounts(soupx_lib2)
  42. set.seed(1234)
  43. lib2 <- CreateSeuratObject(counts = soupx_lib2, project = "lib2")
  44. dblet <- scDblFinder(GetAssayData(lib2, slot="counts"))
  45. lib2$scDblFinder.class <- dblet$scDblFinder.class
  46. lib2##11792 cells
  47. lib2$condition <- "CRE_CFC"
  48. lib2[["percent.mt"]] <- PercentageFeatureSet(lib2, pattern = "^mt-")
  49. lib2 <- RenameCells(lib2, add.cell.id = "lib2")
  50. soupx_lib3 <- load10X("cellranger_output_for_soupX/lib3_outs/")
  51. soupx_lib3 <- autoEstCont(soupx_lib3)
  52. soupx_lib3 <- adjustCounts(soupx_lib3)
  53. set.seed(1234)
  54. lib3 <- CreateSeuratObject(counts = soupx_lib3, project = "lib3")
  55. dblet <- scDblFinder(GetAssayData(lib3, slot="counts"))
  56. lib3$scDblFinder.class <- dblet$scDblFinder.class
  57. lib3##11197 cells
  58. lib3$condition <- "GFP_none"
  59. lib3[["percent.mt"]] <- PercentageFeatureSet(lib3, pattern = "^mt-")
  60. lib3 <- RenameCells(lib3, add.cell.id = "lib3")
  61. soupx_lib4 <- load10X("cellranger_output_for_soupX/lib4_outs/")
  62. soupx_lib4 <- autoEstCont(soupx_lib4)
  63. soupx_lib4 <- adjustCounts(soupx_lib4)
  64. set.seed(1234)
  65. lib4 <- CreateSeuratObject(counts = soupx_lib4, project = "lib4")
  66. dblet <- scDblFinder(GetAssayData(lib4, slot="counts"))
  67. lib4$scDblFinder.class <- dblet$scDblFinder.class
  68. lib4##16301 cells
  69. lib4$condition <- "CRE_none"
  70. lib4[["percent.mt"]] <- PercentageFeatureSet(lib4, pattern = "^mt-")
  71. lib4 <- RenameCells(lib4, add.cell.id = "lib4")
  72. soupx_lib5 <- load10X("cellranger_output_for_soupX/lib5_outs/")
  73. #soupx_lib5 <- autoEstCont(soupx_lib5)
  74. soupx_lib5 = setContaminationFraction(soupx_lib5, 0.2)
  75. soupx_lib5 <- adjustCounts(soupx_lib5)
  76. set.seed(1234)
  77. lib5 <- CreateSeuratObject(counts = soupx_lib5, project = "lib5")
  78. dblet <- scDblFinder(GetAssayData(lib5, slot="counts"))
  79. lib5$scDblFinder.class <- dblet$scDblFinder.class
  80. lib5##9950 cells
  81. lib5$condition <- "CRE_none"
  82. lib5[["percent.mt"]] <- PercentageFeatureSet(lib5, pattern = "^mt-")
  83. lib5 <- RenameCells(lib5, add.cell.id = "lib5")
  84. ####filtration############################
  85. lib1 <- subset(lib1, subset = nFeature_RNA > 1000 & nFeature_RNA < 4000 &percent.mt < 5 & scDblFinder.class == "singlet")##8254
  86. lib2 <- subset(lib2, subset = nFeature_RNA > 1000 & nFeature_RNA < 4000 & percent.mt < 5 & scDblFinder.class == "singlet")##7568
  87. lib2
  88. lib3 <- subset(lib3, subset = nFeature_RNA > 1000 & nFeature_RNA < 4000 & percent.mt < 5 & scDblFinder.class == "singlet")##8147
  89. lib3
  90. lib4 <- subset(lib4, subset = nFeature_RNA > 1000 & nFeature_RNA < 4000 & percent.mt < 5 & scDblFinder.class == "singlet")##12210
  91. lib4
  92. lib5 <- subset(lib5, subset = nFeature_RNA > 1000 & nFeature_RNA < 4000 & percent.mt < 5 & scDblFinder.class == "singlet")##7962
  93. lib5
  94. list3 <- c(lib1,lib2,lib3,lib4,lib5)
  95. list3 <- lapply(X = list3, FUN = function(x) {
  96. x <- NormalizeData(x, normalization.method = "LogNormalize", scale.factor = 10000)
  97. x <- FindVariableFeatures(x, verbose = FALSE)
  98. x <- SCTransform(x, vst.flavor = "v2", verbose = TRUE) %>% RunPCA(npcs = 50, verbose = TRUE)
  99. })
  100. features <- SelectIntegrationFeatures(object.list = list3, nfeatures = 3000)
  101. list3 <- PrepSCTIntegration(object.list = list3, anchor.features = features)
  102. TLR9.fourSamples.withDbltRemoved.withSoupX.anchors <- FindIntegrationAnchors(object.list = list3, normalization.method = "SCT",
  103. anchor.features = features)
  104. TLR9.fourSamples.withDbltRemoved.withSoupX.sct <- IntegrateData(anchorset = TLR9.fourSamples.withDbltRemoved.withSoupX.anchors, normalization.method = "SCT")
  105. TLR9.fourSamples.withDbltRemoved.withSoupX.sct <- RunPCA(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, npcs = 50, verbose = FALSE)
  106. pc_num <- pc_select(TLR9.fourSamples.withDbltRemoved.withSoupX.sct)
  107. TLR9.fourSamples.withDbltRemoved.withSoupX.sct <- TLR9.fourSamples.withDbltRemoved.withSoupX.sct %>%
  108. RunUMAP(reduction = "pca", dims = 1:pc_num, verbose = FALSE) %>%
  109. FindNeighbors(reduction = "pca", dims = 1:pc_num) %>%
  110. FindClusters(resolution = 0.5)
  111. ####Cluster markers######################################
  112. cluster.ALLmarkers <- FindAllMarkers(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, assay = "RNA", only.pos = TRUE, min.pct = 0.1, logfc.threshold = 0.25)
  113. ordered.ALLmarkers <- cluster.ALLmarkers %>%
  114. group_by(cluster) %>%
  115. arrange(desc(avg_log2FC), .by_group = TRUE)
  116. filtered.markers <- cluster.ALLmarkers %>%
  117. group_by(cluster) %>%
  118. slice_max(n = 25, order_by = avg_log2FC)
  119. ####Differential analysis#######################################
  120. DefaultAssay(TLR9.fourSamples.withDbltRemoved.withSoupX.sct) <- "RNA"
  121. TLR9.fourSamples.withDbltRemoved.withSoupX.sct.GFPpos <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset= `EGFP-gn` > 0)
  122. for (clst in c(0:4,6:8,10:29)) {
  123. std.combined.cluster <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct,ident=clst)
  124. Idents(std.combined.cluster) <- "orig.ident"
  125. if (sum(std.combined.cluster$orig.ident == "lib1") > 3 & sum(std.combined.cluster$orig.ident == "lib3") > 3){
  126. cluster.marker.by.condition1 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib1", ident.2 = "lib3",verbose = TRUE,
  127. logfc.threshold = 0,min.pct = 0.01)
  128. }
  129. if (sum(std.combined.cluster$orig.ident == "lib2") > 3 & sum(std.combined.cluster$orig.ident == "lib1") > 3){
  130. cluster.marker.by.condition2 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib2", ident.2 = "lib1",verbose = TRUE,
  131. logfc.threshold = 0,min.pct = 0.01)
  132. }
  133. if (sum(std.combined.cluster$orig.ident == "lib4") > 3 & sum(std.combined.cluster$orig.ident == "lib3") > 3){
  134. cluster.marker.by.condition3 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib4", ident.2 = "lib3",verbose = TRUE,
  135. logfc.threshold = 0,min.pct = 0.01)
  136. }
  137. write.csv(cluster.marker.by.condition1, paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib1vsLib3_full_diff.csv"))
  138. write.csv(cluster.marker.by.condition2, paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib2vsLib1_full_diff.csv"))
  139. write.csv(cluster.marker.by.condition3, paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib4vsLib3_full_diff.csv"))
  140. diff_sig1 <- cluster.marker.by.condition1 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.01)
  141. diff_sig2 <- cluster.marker.by.condition2 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.01)
  142. diff_sig3 <- cluster.marker.by.condition3 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.01)
  143. if (length(diff_sig1$p_val) != 0){
  144. write.csv(diff_sig1,paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib1vsLib3_SIG_diff.csv"),row.names = T)
  145. }
  146. if (length(diff_sig2$p_val) != 0){
  147. write.csv(diff_sig2,paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib2vsLib1_SIG_diff.csv"),row.names = T)
  148. }
  149. if (length(diff_sig3$p_val) != 0){
  150. write.csv(diff_sig3,paste0("soupX_corrected_analysis/differential_analysis/cluster_",clst,"_Lib4vsLib3_SIG_diff.csv"),row.names = T)
  151. }
  152. print(paste0("Finished for cluster ",clst))
  153. }
  154. for (clst in c(0:4,6:8,10:29)) {
  155. std.combined.cluster <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct.GFPpos,ident=clst)
  156. Idents(std.combined.cluster) <- "orig.ident"
  157. if (sum(std.combined.cluster$orig.ident == "lib1") > 3 & sum(std.combined.cluster$orig.ident == "lib3") > 3){
  158. cluster.marker.by.condition1 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib1", ident.2 = "lib3",verbose = TRUE,
  159. logfc.threshold = 0,min.pct = 0.01)
  160. }
  161. if (sum(std.combined.cluster$orig.ident == "lib2") > 3 & sum(std.combined.cluster$orig.ident == "lib1") > 3){
  162. cluster.marker.by.condition2 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib2", ident.2 = "lib1",verbose = TRUE,
  163. logfc.threshold = 0,min.pct = 0.01)
  164. }
  165. if (sum(std.combined.cluster$orig.ident == "lib4") > 3 & sum(std.combined.cluster$orig.ident == "lib3") > 3){
  166. cluster.marker.by.condition3 <- FindMarkers(std.combined.cluster, assay = "RNA",ident.1 = "lib4", ident.2 = "lib3",verbose = TRUE,
  167. logfc.threshold = 0,min.pct = 0.01)
  168. }
  169. write.csv(cluster.marker.by.condition1, paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib1vsLib3_full_diff.csv"))
  170. write.csv(cluster.marker.by.condition2, paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib2vsLib1_full_diff.csv"))
  171. write.csv(cluster.marker.by.condition3, paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib4vsLib3_full_diff.csv"))
  172. diff_sig1 <- cluster.marker.by.condition1 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.1)
  173. diff_sig2 <- cluster.marker.by.condition2 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.1)
  174. diff_sig3 <- cluster.marker.by.condition3 %>% filter(abs(avg_log2FC) > 0.585 & p_val_adj < 0.1)
  175. if (length(diff_sig1$p_val) != 0){
  176. write.csv(diff_sig1,paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib1vsLib3_SIG_diff.csv"),row.names = T)
  177. }
  178. if (length(diff_sig2$p_val) != 0){
  179. write.csv(diff_sig2,paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib2vsLib1_SIG_diff.csv"),row.names = T)
  180. }
  181. if (length(diff_sig3$p_val) != 0){
  182. write.csv(diff_sig3,paste0("soupX_corrected_analysis/differential_analysis_GFPpos/cluster_",clst,"_Lib4vsLib3_SIG_diff.csv"),row.names = T)
  183. }
  184. print(paste0("Finished for cluster ",clst))
  185. }
  186. ####Pathway analysis#####################################
  187. ######GO#####
  188. msigdbr_go <- msigdbr("Mus musculus", "C5")
  189. msigdbr_go <- msigdbr_go %>% filter(gs_subcat %in% c("GO:BP","GO:CC","GO:MF"))
  190. msigdbr_list2 = split(x = msigdbr_go$gene_symbol, f = msigdbr_go$gs_name)
  191. for (path in c(1:length(msigdbr_list2))){
  192. msigdbr_list2[[path]] <- unique(msigdbr_list2[[path]])
  193. }
  194. for (clst in c(0:4,6:8,10:29)) {
  195. diff_table_combined <- read.csv(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib2vsLib1_full_diff.csv"))
  196. ##GESA pathway analysis
  197. ranks <- diff_table_combined$avg_log2FC
  198. names(ranks) <- diff_table_combined$X
  199. fgseaRes1 <- fgsea(msigdbr_list2, ranks, minSize=15, maxSize = 500)
  200. for (n in c(1:nrow(fgseaRes1))){
  201. fgseaRes1$leadingEdgeSize[n] <- length(fgseaRes1[,8][[1]][[n]])
  202. }
  203. fgseaRes1<- fgseaRes1[,c(1:7,9,8)] %>% arrange(pval)
  204. fwrite(fgseaRes1,file = paste0("soupX_corrected_analysis/pathway_analysis_allCells/cluster_",clst,"_Lib2vsLib1_GSEA_FULL_GO_pathway.csv"),sep = ",",sep2 = c(""," ",""))
  205. gsea_output1 <- fgseaRes1[which(fgseaRes1$padj < 0.05)][order(pval, -abs(NES)), ]
  206. ##print out significant regulated pathways
  207. if (length(gsea_output1$pathway) != 0){
  208. fwrite(gsea_output1, paste0("soupX_corrected_analysis/pathway_analysis_allCells/cluster_",clst,"_Lib2vsLib1_GSEA_SIG_GO_pathway.csv"),sep = ",",sep2 = c(""," ",""))
  209. }
  210. print(paste0("Finished for cluster ",clst))
  211. }
  212. for (clst in c(0:4,6:8,10:29)) {
  213. diff_table_combined <- read.csv(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib1vsLib3_full_diff.csv"))
  214. ##GESA pathway analysis
  215. ranks <- diff_table_combined$avg_log2FC
  216. names(ranks) <- diff_table_combined$X
  217. fgseaRes1 <- fgsea(msigdbr_list2, ranks, minSize=15, maxSize = 500)
  218. for (n in c(1:nrow(fgseaRes1))){
  219. fgseaRes1$leadingEdgeSize[n] <- length(fgseaRes1[,8][[1]][[n]])
  220. }
  221. fgseaRes1<- fgseaRes1[,c(1:7,9,8)] %>% arrange(pval)
  222. fwrite(fgseaRes1,file = paste0("soupX_corrected_analysis/pathway_analysis_allCells/cluster_",clst,"_Lib1vsLib3_GSEA_FULL_GO_pathway.csv"),sep = ",",sep2 = c(""," ",""))
  223. gsea_output1 <- fgseaRes1[which(fgseaRes1$padj < 0.05)][order(pval, -abs(NES)), ]
  224. ##print out significant regulated pathways
  225. if (length(gsea_output1$pathway) != 0){
  226. fwrite(gsea_output1, paste0("soupX_corrected_analysis/pathway_analysis_allCells/cluster_",clst,"_Lib1vsLib3_GSEA_SIG_GO_pathway.csv"),sep = ",",sep2 = c(""," ",""))
  227. }
  228. print(paste0("Finished for cluster ",clst))
  229. }
  230. ####plots and tables#########
  231. ######Stats for up/down regulated genes per cluster###################################
  232. table <- data.frame()
  233. for (clst in c(0:4,6:8,10:29)) {
  234. if(file.exists(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib1vsLib3_SIG_diff.csv"))){
  235. diff1 <- read.csv(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib1vsLib3_SIG_diff.csv"))
  236. up1 <- length(diff1 %>% filter(avg_log2FC > 0) %>% pull(X))
  237. down1 <- length(diff1 %>% filter(avg_log2FC < 0) %>% pull(X))
  238. table <- rbind(table,c(clst,up1,down1))
  239. }
  240. else{
  241. table <- rbind(table,c(clst,0,0))
  242. }
  243. print(paste0("Finished for cluster ",clst))
  244. }
  245. table2 <- data.frame()
  246. for (clst in c(0:4,6:8,10:29)) {
  247. if(file.exists(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib2vsLib1_SIG_diff.csv"))){
  248. diff1 <- read.csv(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib2vsLib1_SIG_diff.csv"))
  249. up1 <- length(diff1 %>% filter(avg_log2FC > 0) %>% pull(X))
  250. down1 <- length(diff1 %>% filter(avg_log2FC < 0) %>% pull(X))
  251. table2 <- rbind(table2,c(clst,up1,down1))
  252. }
  253. else{
  254. table2 <- rbind(table2,c(clst,0,0))
  255. }
  256. print(paste0("Finished for cluster ",clst))
  257. }
  258. colnames(table) <- c("cluster","up", "down")
  259. colnames(table2) <- c("cluster","up", "down")
  260. write.csv(table,"soupX_corrected_analysis/lib1vs3_significant_diff_stats.csv")
  261. write.csv(table2,"soupX_corrected_analysis/lib2vs1_significant_diff_stats.csv")
  262. ######Violin plots of Hsp90b1################################
  263. lib1 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=orig.ident == "lib1")
  264. lib2 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=orig.ident == "lib2")
  265. lib3 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=orig.ident == "lib3")
  266. lib1 <- subset(lib1, subset=seurat_clusters != "9")
  267. lib2 <- subset(lib2, subset=seurat_clusters != "9")
  268. lib3 <- subset(lib3, subset=seurat_clusters != "9")
  269. p1 <- VlnPlot(lib3, features = c("Hsp90b1"), pt.size = 0) + BoldTitle() + ylab("lib3") + ggtitle("Hsp90b1") + SeuratAxes() +
  270. theme(legend.position = "none",axis.title.y=element_text(angle=0,vjust=0.5), axis.title.x = element_blank(),axis.text.x=element_blank())
  271. p2 <- VlnPlot(lib1, features = c("Hsp90b1"), pt.size = 0) + BoldTitle() + ylab("lib1") + SeuratAxes() +
  272. theme(legend.position = "none",axis.title.x = element_blank(),axis.text.x=element_blank(),axis.title.y=element_text(angle=0,vjust=0.5),plot.title = element_blank())
  273. p3 <- VlnPlot(lib2, features = c("Hsp90b1"), pt.size = 0) + SeuratAxes() + ylab("lib2") +
  274. theme(legend.position = "none",axis.title.x = element_blank(),axis.title.y=element_text(angle=0,vjust=0.5),plot.title = element_blank())
  275. pdf("soupX_corrected_analysis/Vlnplot_Hsp90b1.pdf",width = 12, height = 8)
  276. wrap_plots(p1,p2,p3,ncol=1)
  277. dev.off()
  278. z1 <- FeaturePlot(lib1, features = "Hsp90b1") + ggtitle("Lib1")
  279. z2 <- FeaturePlot(lib2, features = "Hsp90b1")+ ggtitle("Lib2")
  280. z3 <- FeaturePlot(lib3, features = "Hsp90b1")+ ggtitle("Lib3")
  281. pdf("soupX_corrected_analysis/FeaturePlot_Hsp90b1.pdf",width = 12, height = 8)
  282. wrap_plots(z3,z1,z2,ncol=3)
  283. dev.off()
  284. ###split violinplots
  285. cluster19 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=seurat_clusters == "19")
  286. cluster20 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=seurat_clusters == "20")
  287. cluster19_sample123 <- subset(cluster19, subset=orig.ident %in% c("lib1","lib2","lib3"))
  288. cluster20_sample123 <- subset(cluster20, subset=orig.ident %in% c("lib1","lib2","lib3"))
  289. table(cluster19$seurat_clusters)
  290. table(cluster19$orig.ident)
  291. table(cluster19_sample123$orig.ident)
  292. table(cluster20_sample123$orig.ident)
  293. cluster19_sample123$orig.ident <- factor(cluster19_sample123$orig.ident,levels = c("lib3","lib1","lib2"))
  294. cluster20_sample123$orig.ident <- factor(cluster20_sample123$orig.ident,levels = c("lib3","lib1","lib2"))
  295. pdf("soupX_corrected_analysis/Hsp90b1_plots/cluster19_vlnPlot_Hsp90b1.pdf",width = 8, height = 6)
  296. VlnPlot(cluster19_sample123, group.by = "orig.ident",features = c("Hsp90b1"), pt.size = 0.5)
  297. dev.off()
  298. pdf("soupX_corrected_analysis/Hsp90b1_plots/cluster20_vlnPlot_Hsp90b1.pdf",width = 8, height = 6)
  299. VlnPlot(cluster20_sample123, group.by = "orig.ident",features = c("Hsp90b1"), pt.size = 0.5)
  300. dev.off()
  301. dittoPlot(cluster19_sample123, "Hsp90b1", group.by = "orig.ident",
  302. plots = c("vlnplot", "jitter"))
  303. dittoBoxPlot(cluster19_sample123, "Hsp90b1", group.by = "orig.ident")
  304. ###heatmap on selected genes
  305. if (!requireNamespace("BiocManager", quietly = TRUE))
  306. install.packages("BiocManager")
  307. # Install dittoSeq
  308. BiocManager::install("dittoSeq")
  309. library(dittoSeq)
  310. gelist <- c("Hsp90b1","Hspa5","Atp6v0c","Bsg","Cck","Itm2b","Grina","Pcsk1n","Ly6h","Apoe","Ttr","Cdh13","Galntl6","Unc5d","Nrg1","Pcdh15","Sorcs1")
  311. pdf("soupX_corrected_analysis/Hsp90b1_plots/cluster19_heatmap.pdf",width = 8, height = 6)
  312. dittoHeatmap(cluster19_sample123, assay = "RNA", slot = "data", gelist,group.by = "orig.ident",annot.by = "orig.ident")
  313. dev.off()
  314. pdf("soupX_corrected_analysis/Hsp90b1_plots/cluster20_heatmap.pdf",width = 8, height = 6)
  315. dittoHeatmap(cluster20_sample123, assay = "RNA", slot = "data", gelist,group.by = "orig.ident",annot.by = "orig.ident")
  316. dev.off()
  317. ######correlation between Hsp90b1 and Atp6v0c########################
  318. cluster19_sample123$Hsp90b1 <- cluster19_sample123@assays$RNA@data["Hsp90b1",]
  319. cluster19_sample123$Atp6v0c <- cluster19_sample123@assays$RNA@data["Atp6v0c",]
  320. cluster20_sample123$Hsp90b1 <- cluster20_sample123@assays$RNA@data["Hsp90b1",]
  321. cluster20_sample123$Atp6v0c <- cluster20_sample123@assays$RNA@data["Atp6v0c",]
  322. test <- data.frame(cluster19_sample123$Hsp90b1,cluster19_sample123$Atp6v0c)
  323. cosine(cluster19_sample123$Hsp90b1,cluster19_sample123$Atp6v0c)##0.608
  324. cosine(cluster20_sample123$Hsp90b1,cluster20_sample123$Atp6v0c)##0.591
  325. ###cosine similarity and permutation test
  326. cs_list <- c()
  327. gene_pool <- read.csv("soupX_corrected_analysis/differential_analysis_allCells/cluster_19_Lib1vsLib3_full_diff.csv")
  328. gene_pool <- data.frame(gene_pool$X)
  329. for (i in c(1:10000)){
  330. rand <- sample(1:15745,2)
  331. rand1 <- rand[1]
  332. rand2 <- rand[2]
  333. cs <- cosine(cluster19_sample123@assays$RNA@data[gene_pool[rand1,],],cluster19_sample123@assays$RNA@data[gene_pool[rand2,],])
  334. cs_list <- c(cs_list, cs)
  335. }
  336. table(cs_list > 0.608)
  337. cs_list <- c()
  338. gene_pool <- read.csv("soupX_corrected_analysis/differential_analysis_allCells/cluster_20_Lib1vsLib3_full_diff.csv")
  339. gene_pool <- data.frame(gene_pool$X)
  340. for (i in c(1:10000)){
  341. rand <- sample(1:15745,2)
  342. rand1 <- rand[1]
  343. rand2 <- rand[2]
  344. cs <- cosine(cluster20_sample123@assays$RNA@data[gene_pool[rand1,],],cluster20_sample123@assays$RNA@data[gene_pool[rand2,],])
  345. cs_list <- c(cs_list, cs)
  346. }
  347. table(cs_list > 0.591)#0.008
  348. table(cluster19_sample123$Hsp90b1 > 0)##0.45
  349. table(cluster19_sample123$Atp6v0c > 0)##0.41
  350. table(cluster19_sample123$Hsp90b1 > 0 & cluster19_sample123$Atp6v0c > 0)##0.26
  351. table(cluster20_sample123$Hsp90b1 > 0)##0.44
  352. table(cluster20_sample123$Atp6v0c > 0)##0.39
  353. table(cluster20_sample123$Hsp90b1 > 0 & cluster20_sample123$Atp6v0c > 0)##0.23
  354. cosine(cluster20_sample123$Hsp90b1,cluster20_sample123$Atp6v0c)##0.59
  355. ######Rad51,Trp53bp1,Cetn2#####################################
  356. #########lib4 vs lib3##################
  357. lib3_4 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=orig.ident %in% c("lib3","lib4"))
  358. ##Rad51, Trp53BP1, and centrin2
  359. lib3_4$Rad51 <- lib3_4@assays$RNA@data["Rad51",]
  360. lib3_4$Trp53bp1 <- lib3_4@assays$RNA@data["Trp53bp1",]
  361. lib3_4$Cetn2 <- lib3_4@assays$RNA@data["Cetn2",]
  362. data.summary <- [email hidden] %>%
  363. group_by(orig.ident) %>%
  364. summarise(
  365. Rad51 = mean(Rad51),
  366. Trp53bp1 = mean(Trp53bp1),
  367. Cetn2 = mean(Cetn2)
  368. )
  369. DefaultAssay(lib3_4) <- "RNA"
  370. z1 <- VlnPlot(lib3_4, features = ("Rad51"), split.by = "orig.ident")
  371. z2 <- VlnPlot(lib3_4, features = ("Trp53bp1"), split.by = "orig.ident")
  372. z3 <- VlnPlot(lib3_4, features = ("Cetn2"), split.by = "orig.ident")
  373. pdf("soupX_corrected_analysis/libr3_vs_lib4/VlnPlot_Rad51_Trp53bp1_Cetn2.pdf",width = 12, height = 6)
  374. wrap_plots(z1,z2,z3,ncol=1)
  375. dev.off()
  376. #######lib2 vs lib1##################
  377. lib1_2 <- subset(TLR9.fourSamples.withDbltRemoved.withSoupX.sct, subset=orig.ident %in% c("lib1","lib2"))
  378. ##Rad51, Trp53BP1, and centrin2
  379. lib1_2$Rad51 <- lib1_2@assays$RNA@data["Rad51",]
  380. lib1_2$Trp53bp1 <- lib1_2@assays$RNA@data["Trp53bp1",]
  381. lib1_2$Cetn2 <- lib1_2@assays$RNA@data["Cetn2",]
  382. data.summary <- [email hidden] %>%
  383. group_by(seurat_clusters,orig.ident) %>%
  384. summarise(
  385. Rad51 = mean(Rad51),
  386. Trp53bp1 = mean(Trp53bp1),
  387. Cetn2 = mean(Cetn2)
  388. )
  389. z1 <- VlnPlot(lib1_2, features = ("Rad51"), split.by = "orig.ident") + ylim(-0.1,2.5)
  390. z2 <- VlnPlot(lib1_2, features = ("Trp53bp1"), split.by = "orig.ident")+ ylim(-0.1,2.5)
  391. z3 <- VlnPlot(lib1_2, features = ("Cetn2"), split.by = "orig.ident")+ ylim(-0.1,2.5)
  392. p1 <- VlnPlot(lib1_2, features = c("Rad51"),split.by = "orig.ident") + BoldTitle() + ylab("Rad51") + SeuratAxes() + ylim(-0.1,2.5) +
  393. theme(legend.position = "top",axis.title.x = element_blank(),axis.title.y=element_text(angle=0,vjust=0.5),plot.title = element_blank())+ scale_fill_manual(values=c("blue", "green3"))
  394. p2 <- VlnPlot(lib1_2, features = c("Trp53bp1"),split.by = "orig.ident") + BoldTitle() + ylab("Trp53bp1") + SeuratAxes() + ylim(-0.1,2.5) +
  395. theme(legend.position = "none",axis.title.x = element_blank(),axis.title.y=element_text(angle=0,vjust=0.5),plot.title = element_blank())+ scale_fill_manual(values=c("blue", "green3"))
  396. p3 <- VlnPlot(lib1_2, features = c("Cetn2"),split.by = "orig.ident") + BoldTitle() + ylab("Cetn2") + SeuratAxes() + ylim(-0.1,2.5) +
  397. theme(legend.position = "none",axis.title.x = element_blank(),axis.title.y=element_text(angle=0,vjust=0.5),plot.title = element_blank())+ scale_fill_manual(values=c("blue", "green3"))
  398. pdf("soupX_corrected_analysis/libr3_vs_lib4/lib1vs2_VlnPlot_Rad51_Trp53bp1_Cetn2_v2.pdf",width = 12, height = 6)
  399. wrap_plots(p1,p2,p3,ncol=1)
  400. dev.off()
  401. my_table <- data.frame()
  402. for (clst in c(0:4,6:8,10:29)) {
  403. diff_table <- read.csv(paste0("soupX_corrected_analysis/differential_analysis_allCells/cluster_",clst,"_Lib2vsLib1_full_diff.csv"))
  404. diff_table <- diff_table %>% filter(X %in% c("Rad51","Trp53bp1","Cetn2"))
  405. diff_table$cluster <- clst
  406. my_table <- rbind(my_table,diff_table)
  407. }
  408. write.csv(my_table, "soupX_corrected_analysis/libr3_vs_lib4/Lib2vsLib1_Rad51_Trp53bp1_Cetn2_diff.csv")

code_scRNAseq_analysis.R at commit a80f1ab, no license · at the source

Overview

Authors: Thomas E. Bassett1, Yi-Zhi Wang2, Elizabeth M. Wood1, Hui Zhang1, Zorica Petrovic1, Vivien Prifti1, Vladimir Jovasevic3, Naoki Yamawaki4,5,6, Lynn Ren7, Natalia Khalatyan2, Viktoriya Grayson7, Jeffrey N. Savas2, Jelena Radulovic1,4,5,6, Ana Cicvaric1
  1. Dominick P. Purpura Department of Neuroscience, Albert Einstein College of Medicine, Bronx, NY, USA
  2. Department of Neurology, Feinberg School of Medicine, Northwestern University, Chicago, IL, USA
  3. Department of Pharmacology, Feinberg School of Medicine, Northwestern University, Chicago, IL, USA
  4. Department of Biomedicine, Aarhus University, Aarhus, Denmark
  5. PROMEMO, Aarhus University, Aarhus, Denmark
  6. DANDRITE, Aarhus University, Aarhus, Denmark
  7. Department of Psychiatry and Behavioral Sciences, Feinberg School of Medicine, Northwestern University, Chicago, IL, USA
Institutions: Albert Einstein College of Medicine (United States); Northwestern University (United States); Aarhus University (Denmark)
Journal: iScience, volume 29, issue 4, article 115317
Dates: received 24 July 2025; accepted 6 March 2026; published online 13 March 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1016/j.isci.2026.115317 · PMID 41971990 · PMCID PMC13068534 · OpenAlex W7135212675
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: behavior only (modality)
Methods: Preprocessing, Statistics, Smoothing, state filtering, decompositions, Evoked potentials, Connectivity, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: neuroscience, omics, sensory neuroscience
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: National Institute of Mental Health (MH108837, MH078064); FWF; Austrian Science Fund; NARSAD; Individual Biomedical Research Award; Hartwell Foundation; NIH (S10OD032464); Albert Einstein College of Medicine
Citations: cited by 2 papers (Europe PMC); 79 references in the paper
Research resources: Rabbit anti-mCherry RRID:AB_2571870, Chicken anti-GFP RRID:AB_300798, AAV8-EF1a-Nuc-flox(mCherry)-EGFP RRID:Addgene_112677, AAVrg-EF1a-DO_DIO-TdTomato_EGFP-WPRE-pA RRID:Addgene_37120, AAV8-hSyn-HA-hM4D(Gi)-mCherry RRID:Addgene_44362, AAV8-hSyn-DIO-hM4D(Gi)-mCherry RRID:Addgene_50475, Vglut2-Cre mice RRID:IMSR_JAX:016963, Vglut1-Cre mice RRID:IMSR_JAX:037512

Abstract

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

Repository

Its files are read in the Code ↔ Paper reader above.

RadulovicLab/Nature-2024

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: a80f1abfe4458e10102c5ddfbf8a9b84df98dc0e, 5 February 2024
Languages: R (1)
Size: 2 files, 1 script
Software Heritage: not archived
Found in: “Data and code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: cowplot (1 file), data.table (1 file), ggplot2 (1 file), pheatmap (1 file), Seurat (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
2 files

The paper's code and data availability statement is in the Data section.

Tracing map

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

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

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

Data

Datasets cited

Code and data availability statement

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

Read it in the paper: doi.org/10.1016/j.isci.2026.115317.

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

Recorded: type, language, journal, volume, issue, pages, dates, 14 authors, 3 keywords, 8 funders, 77 references, 8 RRIDs.

Cite

This paper

Bassett, T. E., Wang, Y.-Z., Wood, E. M., Zhang, H., Petrovic, Z., Prifti, V., Jovasevic, V., Yamawaki, N., Ren, L., Khalatyan, N., Grayson, V., Savas, J. N., Radulovic, J., & Cicvaric, A. (2026). Response dynamics of discrete subiculum→retrosplenial cortex projections underlying trace fear conditioning. iScience, 29(4), 115317. https://doi.org/10.1016/j.isci.2026.115317

BibTeX

@article{bassett2026response,
author = {Bassett, Thomas E. and Wang, Yi-Zhi and Wood, Elizabeth M. and Zhang, Hui and Petrovic, Zorica and Prifti, Vivien and Jovasevic, Vladimir and Yamawaki, Naoki and Ren, Lynn and Khalatyan, Natalia and Grayson, Viktoriya and Savas, Jeffrey N. and Radulovic, Jelena and Cicvaric, Ana},
title = {{Response dynamics of discrete subiculum→retrosplenial cortex projections underlying trace fear conditioning}},
journal = {iScience},
year = {2026},
month = mar,
volume = {29},
number = {4},
pages = {115317},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/j.isci.2026.115317},
url = {https://doi.org/10.1016/j.isci.2026.115317},
pmid = {41971990},
pmcid = {PMC13068534}
}

RIS

TY - JOUR
AU - Bassett, Thomas E.
AU - Wang, Yi-Zhi
AU - Wood, Elizabeth M.
AU - Zhang, Hui
AU - Petrovic, Zorica
AU - Prifti, Vivien
AU - Jovasevic, Vladimir
AU - Yamawaki, Naoki
AU - Ren, Lynn
AU - Khalatyan, Natalia
AU - Grayson, Viktoriya
AU - Savas, Jeffrey N.
AU - Radulovic, Jelena
AU - Cicvaric, Ana
TI - Response dynamics of discrete subiculum→retrosplenial cortex projections underlying trace fear conditioning
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/03/13
VL - 29
IS - 4
SP - 115317
SN - 2589-0042
PB - Elsevier
DO - 10.1016/j.isci.2026.115317
UR - https://doi.org/10.1016/j.isci.2026.115317
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.isci.2026.115317",
"type": "article-journal",
"title": "Response dynamics of discrete subiculum→retrosplenial cortex projections underlying trace fear conditioning",
"container-title": "iScience",
"author": [
{
"family": "Bassett",
"given": "Thomas E."
},
{
"family": "Wang",
"given": "Yi-Zhi"
},
{
"family": "Wood",
"given": "Elizabeth M."
},
{
"family": "Zhang",
"given": "Hui"
},
{
"family": "Petrovic",
"given": "Zorica"
},
{
"family": "Prifti",
"given": "Vivien"
},
{
"family": "Jovasevic",
"given": "Vladimir"
},
{
"family": "Yamawaki",
"given": "Naoki"
},
{
"family": "Ren",
"given": "Lynn"
},
{
"family": "Khalatyan",
"given": "Natalia"
},
{
"family": "Grayson",
"given": "Viktoriya"
},
{
"family": "Savas",
"given": "Jeffrey N."
},
{
"family": "Radulovic",
"given": "Jelena"
},
{
"family": "Cicvaric",
"given": "Ana"
}
],
"container-title-short": "iScience",
"volume": "29",
"issue": "4",
"page": "115317",
"DOI": "10.1016/j.isci.2026.115317",
"PMID": "41971990",
"PMCID": "PMC13068534",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.isci.2026.115317",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
13
]
]
}
}

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.2026.117073 [code]
Single-cell epigenomics uncovers heterochromatin instability and transcription factor dysfunction during mouse brain aging.
Journal: Cell reports
In common: pheatmap, Seurat, cowplot, 3 other tools, 3 references
[2] doi:10.1038/s41467-026-70232-6 [code]
Gene expression dynamics of human and mouse craniofacial development at the single-cell level.
Journal: Nature communications
In common: pheatmap, Seurat, cowplot, 3 other tools, 3 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: pheatmap, Seurat, cowplot, 3 other tools, 2 references
[4] doi:10.1038/s41467-026-71919-6 [code]
Suppression of astrocyte BMP signaling improves molecular signatures and functional deficits in a fragile X syndrome mouse model.
Journal: Nature communications
In common: pheatmap, ggplot2, tidyverse, 4 references
[5] doi:10.1038/s41586-026-10612-6 [code]
Acquired genetic and cell-state changes in IDH-mutant glioma progression.
Journal: Nature
In common: pheatmap, Seurat, cowplot, 3 other tools, 2 references
[6] 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: pheatmap, Seurat, cowplot, 3 other tools, 2 references
[7] doi:10.1016/j.isci.2026.117228 [code]
Single-nucleus transcriptomics reveals cell type-specific remodeling and epilepsy-associated microglia.
Journal: iScience
In common: pheatmap, Seurat, cowplot, 2 other tools, 3 references
[8] doi:10.1038/s12276-026-01801-4 [code]
Putative glioblastoma origin-like cells in the subventricular zone: isolation and characterization.
Journal: Experimental & molecular medicine
In common: pheatmap, Seurat, data.table, 2 other tools, 3 references
[9] doi:10.1038/s41514-026-00397-3 [code]
Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8&lt;sup&gt;+&lt;/sup&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial.
Journal: npj aging
In common: pheatmap, Seurat, cowplot, 3 other tools, 2 references
[10] doi:10.1038/s41593-026-02384-z [code]
cGAS-mediated type I IFN signaling contributes to disease progression in drug-refractory epilepsy.
Journal: Nature neuroscience
In common: pheatmap, Seurat, cowplot, 3 other tools, 1 reference

Contribute

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

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

Request its removal

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

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

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

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