Diurnal choroid plexus function in mice depends on sex, age, and amyloid-β status.
6 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 9 matches
- [1] § Results › Diurnal regulation of Aqp1 and NKCC1 at the transcript level in the aged ChP ↔ deseq2 feb 2023.Rmd, lines 1088 to 1113 · score 1.00 · carbonic anhydrases, ATP synthase, Atp5b, Slc12a4, Slc12a7, Slc25a28 · block
oscr:b:MZ2T6VDW0YN4P-Q· Report a mismatch - [2] § Results › Comparison of gene expression across different datasets ↔ deseq2 feb 2023.Rmd, lines 1088 to 1113 · score 0.72 · Slc22a8, Nr1d2, Nr1d1, Bhlhe41, Ciart, Per3 · block
oscr:b:MZ2T6VDW0YN4P-Q· Report a mismatch - [3] § Methods › Transcriptomic analysis ↔ deseq2 feb 2023.Rmd, lines 49 to 163 · score 0.68 · AnnotationDbi, DESeq2, log2 fold change, pheatmap, threshold, dplyr · block
oscr:b:6ESJPXBQSEXJZ-Q· Report a mismatch - [4] § Results › Aged mice exhibit altered diurnal transcriptional profile ↔ CP circadian gene validation.Rmd, lines 491 to 555 · score 0.67 · circadian related genes, nr1d2, nr1d1, Cry, amplitude, mesor · block
oscr:b:0CG6769YP1D4P-N· Report a mismatch - [5] § Methods › Statistics and reproducibility ↔ CP circadian gene validation.Rmd, lines 84 to 215 · score 0.65 · Kruskall Wallis, Shapiro Wilk · block
oscr:b:FTFB2P98APAB5-8· Report a mismatch - [6] § Results › Young mice exhibit diurnal, transcriptional regulation of the ChP, that is not significantly impacted by acute sleep disruption ↔ CP circadian gene validation.Rmd, lines 491 to 555 · score 0.60 · nr1d2, nr1d1, related genes, Cry, validated, Dbp · block
oscr:b:0CG6769YP1D4P-N· Report a mismatch - [7] § Results › Comparison of gene expression across different datasets ↔ genecompare.R, lines 891 to 976 · score 0.54 · biological processes, Molecular function, downregulated, pseudotime, ZT, compartment · block
oscr:b:QGVW6Q59A4EYV-Z· Report a mismatch - [8] § Results › Diurnal regulation of Aqp1 and NKCC1 at the transcript level in the aged ChP ↔ deseq2 feb 2023.Rmd, lines 1190 to 1317 · score 0.54 · slc12a2, log2 fold change, related genes, junctional, amyloid, proteins · block
oscr:b:5P5J8NKPG1ZJ6-4· Report a mismatch - [9] § Results › Comparison of gene expression across different datasets ↔ genecompare.R, lines 891 to 976 · score 0.53 · cellular compartment, biological processes, molecular function, Pathway, clusterProfiler, young · block
oscr:b:QGVW6Q59A4EYV-Z· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R Markdown · 1,396 lines · 58 KB · CC-BY-4.0 · 4 matches
- ---
- title: "DESEQ CP circadian data"
- output: html_document
- date: "2023-02-22"
- editor_options:
- chunk_output_type: console
- ---
- #Analysis of RNAseq data from sleep/circadian choroid plexus
- ###There are several different ways to analyze this data as there are 3 conditions, awake, asleep and sleep disrupted. Previous analysis showed no significant difference between sleep and sleep disrupted although there was a difference in the sig genes that were changed compared to awake state. So will explore all these options.
- ###Note: Awake (AW) is Night, sleep (SL) and sleep disrupted (SD) are Day. comparison will be done Awake vs SL or SD, OR Night vs Day
- Install required packages
- if (!require("BiocManager", quietly = TRUE))
- install.packages("BiocManager")
- BiocManager::install("DESeq2")
- BiocManager::install("org.Mm.eg.db")
- install.packages()
- install.packages("Hmisc")
- BiocManager::install("ComplexHeatmap")
- if (!require("BiocManager", quietly = TRUE))
- install.packages("BiocManager")
- BiocManager::install("EnhancedVolcano")
- install.packages("vsn")
- setwd("~/Documents/Iliff lab /Experiments/Expt 13 sleep study mouse choroid plexus/Circadian R folder/deseq2 feb2023 r markdown file output")
- ```{r setup, include=FALSE}
- knitr::opts_chunk$set(echo = TRUE)
- library(ComplexHeatmap)
- library(pheatmap)
- library(tidyverse)
- library(dplyr)
- library(DESeq2)
- library(RColorBrewer)
- library(AnnotationDbi)
- library(org.Mm.eg.db)
- library(reshape)
- library(viridis)
- library(Hmisc)
- library(EnhancedVolcano)
- ```
- #QC of the samples
- ```{r }
- dds_raw<-read.csv("3mocounts.csv", row.names = 1)
- metadata<-read.csv("3mometadata.csv", row.names = 1)
- metadata$Condition<-factor(metadata$Condition, levels=c("AW", "SL", "SD"))
- metadata$TimeOfDay<-factor(metadata$TimeOfDay, levels=c("Night", "Day"))
- View(metadata)
- #explore
- rownames(metadata)
- colnames(dds_raw)
- #make sure the rows and columns match
- all(rownames(metadata) == colnames(dds_raw))
- #creating the DESeq2 object, using sleep/wake state
- dds_raw<-DESeqDataSetFromMatrix(countData = dds_raw, colData = metadata, design = ~ Condition )
- #pre-filtering
- #smallestGroupSize<-4
- #keep<-rowSums(counts(dds_raw) >= smallestGroupSize)
- #dds_raw<-dds_raw[keep,]
- #cuts from 29179 genes to 17701- this is too strict as circadian differences are subtle. if using this cutoff no sig DEGs
- #run DESeq2
- dds_raw<-DESeq(dds_raw)
- res_raw<-results(dds_raw)
- res_raw
- #determine size factors to use for normalization
- dds_raw <- estimateSizeFactors(dds_raw)
- dds_raw <- estimateDispersions(dds_raw)
- dds_raw <- nbinomWaldTest(dds_raw)
- sizeFactors(dds_raw)
- #extract the normalized counts
- normalized_counts <-counts(dds_raw, normalized = TRUE)
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts <- data.frame(ENTREZID=row.names(normalized_counts), normalized_counts)
- View(normalized_counts)
- write.csv(normalized_counts, file="normalized_counts_3mo_all.csv")
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_raw)
- vsd_dds_raw <- vst(dds_raw, blind = TRUE)
- vsd_mat_dds_raw <- assay(vsd_dds_raw)
- vsd_cor_dds_raw <- cor(vsd_mat_dds_raw)
- View(vsd_cor_dds_raw)
- pheatmap(vsd_cor_dds_raw, cluster_rows = TRUE, cluster_cols = TRUE)
- pheatmap(vsd_cor_dds_raw, annotation = dplyr::select(metadata, TimeOfDay))
- pheatmap(vsd_cor_dds_raw, annotation = dplyr::select(metadata, Condition))
- plotPCA(vsd_dds_raw, intgroup = "Condition")
- plotPCA(vsd_dds_raw, intgroup=c("Condition", "TimeOfDay"))
- ###############################################################
- padj.cutoff <- 0.05
- log2FoldChange.cutoff <- 0.58
- dds_raw_AW_SL<-dds_raw
- design(dds_raw_AW_SL)<-formula(~Condition)
- dds_raw_AW_SL$Condition<-factor(dds_raw_AW_SL$Condition, levels=c("AW", "SL", "SD"))
- dds_raw_AW_SL<-DESeq(dds_raw_AW_SL)
- res_rawAWvsSL<-results(dds_raw_AW_SL, contrast = c("Condition", "SL", "AW"))
- res_rawAWvsSL_df <- as.data.frame(res_rawAWvsSL)
- res_rawAWvsSL_df<-tibble::rownames_to_column(res_rawAWvsSL_df, "ENTREZID")
- res_rawAWvsSL_df$ENTREZID<- as.character(res_rawAWvsSL_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_rawAWvsSL_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_rawAWvsSL_df <- left_join(res_rawAWvsSL_df,anno,by="ENTREZID")
- #for some reason the annotation put gene ID 11865 to Bmal instead of Arntl so need to replace this gene and make consistent with the old/AD datasets
- res_rawAWvsSL_df$SYMBOL[res_rawAWvsSL_df$ENTREZID == "11865"]<-"Arntl"
- res_rawAWvsSL_df$GENENAME[res_rawAWvsSL_df$ENTREZID == "11865"]<-"aryl hydrocarbon receptor nuclear translocator-like"
- save(res_rawAWvsSL_df, file="raw_AWvsSL_3mo.Rdata")
- threshold <- res_rawAWvsSL_df$padj < padj.cutoff & abs(res_rawAWvsSL_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_rawAWvsSL_df$threshold <- threshold
- sig_res_rawAWvsSL <- data.frame(subset(res_rawAWvsSL_df, threshold==TRUE), row.names = 1)
- dim(sig_res_rawAWvsSL)
- sig_res_rawAWvsSL<-na.omit(sig_res_rawAWvsSL)
- dim(sig_res_rawAWvsSL)
- write.csv(sig_res_rawAWvsSL, file="sig_res_rawAWvsSL.csv")
- #save(sig_res_3moAWvsSL, file="sigrawAWvsSL_3mo.Rdata")
- par(mfrow=c(2,3))
- plotCounts(dds_raw_AW_SL, "217166", intgroup = "TimeOfDay", main = "Nr1d1")
- plotCounts(dds_raw_AW_SL, "11865", intgroup = "TimeOfDay", main = "Arntl")
- plotCounts(dds_raw_AW_SL, "12952", intgroup = "TimeOfDay", main = "Cry1")
- plotCounts(dds_raw_AW_SL, "233908", intgroup = "TimeOfDay", main = "Fus")
- plotCounts(dds_raw_AW_SL, "74840", intgroup = "TimeOfDay", main = "Manf")
- plotCounts(dds_raw_AW_SL, "18030", intgroup = "TimeOfDay", main = "Nfil3")
- plotCounts(dds_raw_AW_SL, "217166", intgroup = "Condition", main = "Nr1d1")
- plotCounts(dds_raw_AW_SL, "11865", intgroup = "Condition", main = "Arntl")
- plotCounts(dds_raw_AW_SL, "12952", intgroup = "Condition", main = "Cry1")
- plotCounts(dds_raw_AW_SL, "233908", intgroup = "Condition", main = "Fus")
- plotCounts(dds_raw_AW_SL, "74840", intgroup = "Condition", main = "Manf")
- plotCounts(dds_raw_AW_SL, "18030", intgroup = "Condition", main = "Nfil3")
- assays(dds_raw)[["cooks"]]
- summary(res_raw)
- par(mar=c(8,5,2,2))
- boxplot(log10(assays(dds_raw)[["cooks"]]), range=0, las=2)
- #removing sample #12 going forward as it is an outlier by PCA, and failed RNAseq QC
- ```
- ```{r running DESEQ2 on count data obtained from galaxy alignment}
- #make a dds file from galaxy generated normalized counts (rlog)
- #sample 12 is an outlier so remove from anlaysis (from previous analysis)
- dds_3mo<-read.csv("3mocounts.csv", row.names = 1)
- dds_3mo<-dds_3mo[ , c(-7)]
- View(dds_3mo)
- metadata<-read.csv("3mometadata.csv", row.names = 1)
- metadata<-metadata[c(-7), ]
- metadata$Condition<-factor(metadata$Condition, levels=c("AW", "SL", "SD"))
- metadata$TimeOfDay<-factor(metadata$TimeOfDay, levels=c("Night", "Day"))
- View(metadata)
- #explore
- rownames(metadata)
- colnames(dds_3mo)
- #make sure the rows and columns match
- all(rownames(metadata) == colnames(dds_3mo))
- ```
- #Comparing the AW vs SL or SD, including all 3 conditions for now
- ```{r}
- #creating the DESeq2 object, using *sleep condition as condition
- dds_3mo_cond<-DESeqDataSetFromMatrix(countData = dds_3mo, colData = metadata, design = ~ Condition)
- #determine size factors to use for normalization
- dds_3mo_cond <- estimateSizeFactors(dds_3mo_cond)
- sizeFactors(dds_3mo_cond)
- #extract the normalized counts
- normalized_counts_3mo_cond <-counts(dds_3mo_cond, normalized = TRUE)
- View(normalized_counts_3mo)
- write.csv(normalized_counts_3mo_cond, file="normalized_counts_3mo_cond_no12.csv")
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts_3mo_cond_df <- data.frame(ENTREZID=row.names(normalized_counts_3mo_cond), normalized_counts_3mo_cond)
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_3mo_cond)
- vsd_3mo_cond <- vst(dds_3mo_cond, blind = TRUE)
- vsd_mat_3mo_cond <- assay(vsd_3mo_cond)
- vsd_cor_3mo_cond <- cor(vsd_mat_3mo_cond)
- View(vsd_cor_3mo_cond)
- ```
- ```{r}
- #DEG
- dds_3mo_cond<-DESeq(dds_3mo_cond)
- res<-results(dds_3mo_cond, contrast = c("Condition", "SD", "SL")) #this should give AW vs SL AW vs SD and SD vs SL
- ```
- Time of Day analysis comparing the AW animals to the grouped SL and SD animals together
- ```{r}
- #creating the DESeq2 object, using *TimeOfDay as condition
- dds_3mo<-DESeqDataSetFromMatrix(countData = dds_3mo, colData = metadata, design = ~ TimeOfDay)
- #determine size factors to use for normalization
- dds_3mo <- estimateSizeFactors(dds_3mo)
- sizeFactors(dds_3mo)
- #extract the normalized counts
- normalized_counts_3mo <-counts(dds_3mo, normalized = TRUE)
- View(normalized_counts_3mo)
- write.csv(normalized_counts_3mo, file="normalized_counts_3mo_ToD_no12.csv")
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts_3mo_df <- data.frame(ENTREZID=row.names(normalized_counts_3mo), normalized_counts_3mo)
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_3mo)
- vsd_3mo <- vst(dds_3mo, blind = TRUE)
- vsd_mat_3mo <- assay(vsd_3mo)
- vsd_cor_3mo <- cor(vsd_mat_3mo)
- View(vsd_cor_3mo)
- ```
- #Running the DESEQ2 with multifactorial effect of timeofday with condition as covariate
- ```{r}
- #create a copy of the DESeqDataSet to run the multi-factor design
- ddsMFtime<-dds_3mo
- levels(ddsMFtime$Condition)
- #make SD to AW (as this is their sleep state) to be able to have both condition and time of day as factors (no samples can be have unique factors for each variable)
- levels(ddsMFtime$Condition)<-sub("SD", "AW", levels(ddsMFtime$Condition))
- design(ddsMFtime)<-formula(~ Condition + TimeOfDay)
- ddsMFtime<-DESeq(ddsMFtime)
- resMFtime<-results(ddsMFtime)
- head(ddsMFtime)
- par(mfrow=c(2,3))
- plotCounts(ddsMFtime, "217166", intgroup = "TimeOfDay", main = "Nr1d1")
- plotCounts(ddsMFtime, "11865", intgroup = "TimeOfDay", main = "Arntl")
- plotCounts(ddsMFtime, "12952", intgroup = "TimeOfDay", main = "Cry1")
- plotCounts(ddsMFtime, "233908", intgroup = "TimeOfDay", main = "Fus")
- plotCounts(ddsMFtime, "74840", intgroup = "TimeOfDay", main = "Manf")
- plotCounts(ddsMFtime, "18030", intgroup = "TimeOfDay", main = "Nfil3")
- ```
- #Running the DESEQ2 with multifactorial effect of condition with time of day as covariate
- ```{r}
- #create a copy of the DESeqDataSet to run the multi-factor design
- ddsMFcond<-dds_3mo
- levels(ddsMFcond$Condition)
- levels(ddsMFcond$Condition)<-sub("SD", "AW", levels(ddsMFcond$Condition))
- #this one is doing the comparison of timeofday taking into account the condition.
- #later we'll do the other way around
- design(ddsMFcond)<-formula(~TimeOfDay + Condition)
- ddsMFcond<-DESeq(ddsMFcond)
- resMFcond<-results(ddsMFcond)
- head(resMFcond)
- par(mfrow=c(2,3))
- plotCounts(ddsMFcond, "217166", intgroup = "Condition", main = "Nr1d1")
- plotCounts(ddsMFcond, "11865", intgroup = "Condition", main = "Arntl")
- plotCounts(ddsMFcond, "12952", intgroup = "Condition", main = "Cry1")
- plotCounts(ddsMFcond, "233908", intgroup = "Condition", main = "Fus")
- plotCounts(ddsMFcond, "74840", intgroup = "Condition", main = "Manf")
- plotCounts(ddsMFcond, "18030", intgroup = "Condition", main = "Nfil3")
- ```
- ## Visualizing sample distribution
- ```{r pressure, echo=FALSE}
- pheatmap(vsd_cor_3mo, cluster_rows = TRUE, cluster_cols = TRUE)
- pheatmap(vsd_cor_3mo, annotation = dplyr::select(metadata, TimeOfDay))
- plotPCA(vsd_3mo, intgroup = "Condition")
- plotPCA(vsd_3mo, intgroup=c("Condition", "TimeOfDay"))
- ```
- ###Visualizing the data with norm counts and heatmaps from top genes
- ```{r}
- ### Set thresholds
- padj.cutoff <- 0.05
- log2FoldChange.cutoff <- 0.58
- #need to make into data frame to get gene symbols
- library(tibble)
- resMF_df <- as.data.frame(resMFtime)
- resMF_df<-tibble::rownames_to_column(resMF_df, "ENTREZID")
- resMF_df$ENTREZID<- as.character(resMF_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=resMF_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- resMF_df <- left_join(resMF_df,anno,by="ENTREZID")
- threshold <- resMF_df$padj < padj.cutoff & abs(resMF_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- resMF_df$threshold <- threshold
- sig_resMF <- data.frame(subset(resMF_df, threshold==TRUE), row.names = 1)
- dim(sig_resMF)
- write.csv(sig_resMF, file="sig_resMF.csv")
- save(sig_resMF, file="sigToDMF_3mo.Rdata")
- ###For condition accounting for ToD
- resMFcond_df <- as.data.frame(resMFcond)
- resMFcond_df<-tibble::rownames_to_column(resMFcond_df, "ENTREZID")
- resMFcond_df$ENTREZID<- as.character(resMFcond_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=resMFcond_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- resMFcond_df <- left_join(resMFcond_df,anno,by="ENTREZID")
- threshold <- resMFcond_df$padj < padj.cutoff & abs(resMFcond_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- resMFcond_df$threshold <- threshold
- sig_resMFcond <- data.frame(subset(resMFcond_df, threshold==TRUE), row.names = 1)
- dim(sig_resMFcond)
- save(sig_resMFcond, file="sigcondMF_3mo.Rdata")
- #actually nothing is significant so it gives 0 results
- ```
- ```{r volcano plot}
- #looking at timeofday differences accounting for condition
- sig_resMF %>% drop_na("SYMBOL")
- EnhancedVolcano(resMF_df,
- lab = resMF_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Night vs Day (accounting for sleep condition)",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black','purple' , 'orange1'),
- pCutoff = 10e-6,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 3,
- axisLabSize=10)
- #saved as 7x7 pdf "Enhanced_volcano_young_timeofday_accounting_for_condition
- ```
- #This would be to run the samples ignoring the Condition, since when comparing condition accounting for time of day there are no significant differences
- ```{r}
- #DEG
- dds_3mo<-DESeq(dds_3mo)
- res<-results(dds_3mo, contrast = c("TimeOfDay", "Night", "Day"))
- ```
- ```{r}
- res_df <- as.data.frame(res)
- res_df<-tibble::rownames_to_column(res_df, "ENTREZID")
- res_df$ENTREZID<- as.character(res_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_df <- left_join(res_df,anno,by="ENTREZID")
- threshold <- res_df$padj < padj.cutoff & abs(res_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_df$threshold <- threshold
- sig_res <- data.frame(subset(res_df, threshold==TRUE), row.names = 1)
- dim(sig_res)
- save(sig_res, file="sigToD_3mo.Rdata")
- ```
- ```{r volcano plot}
- #plot ignoring the condition variable and just comparing time of day effects
- EnhancedVolcano(res_df,
- lab = res_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Night vs Day (ignoring sleep condition)",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black','purple' , 'orange1'),
- pCutoff = 10e-6,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 3,
- axisLabSize=10)
- #saved as pdf 7x7 "Enhanced_volcano_young_timeofday_ignoring_for_condition"
- ```
- #DEG analysis of SL vs AW and SD vs AW
- ```{r}
- dds_3mo_AW_SL<-dds_3mo
- design(dds_3mo_AW_SL)<-formula(~Condition)
- dds_3mo_AW_SL$Condition<-factor(dds_3mo_AW_SL$Condition, levels=c("AW", "SL", "SD"))
- dds_3mo_AW_SL<-DESeq(dds_3mo_AW_SL)
- res_3moAWvsSL<-results(dds_3mo_AW_SL, contrast = c("Condition", "SL", "AW"))
- res_3moAWvsSL_df <- as.data.frame(res_3moAWvsSL)
- res_3moAWvsSL_df<-tibble::rownames_to_column(res_3moAWvsSL_df, "ENTREZID")
- res_3moAWvsSL_df$ENTREZID<- as.character(res_3moAWvsSL_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_3moAWvsSL_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_3moAWvsSL_df <- left_join(res_3moAWvsSL_df,anno,by="ENTREZID")
- #for some reason the annotation put gene ID 11865 to Bmal instead of Arntl so need to replace this gene and make consistent with the old/AD datasets
- res_3moAWvsSL_df$SYMBOL[res_3moAWvsSL_df$ENTREZID == "11865"]<-"Arntl"
- res_3moAWvsSL_df$GENENAME[res_3moAWvsSL_df$ENTREZID == "11865"]<-"aryl hydrocarbon receptor nuclear translocator-like"
- save(res_3moAWvsSL_df, file="allAWvsSL_3mo.Rdata")
- threshold <- res_3moAWvsSL_df$padj < padj.cutoff & abs(res_3moAWvsSL_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_3moAWvsSL_df$threshold <- threshold
- sig_res_3moAWvsSL <- data.frame(subset(res_3moAWvsSL_df, threshold==TRUE), row.names = 1)
- dim(sig_res_3moAWvsSL)
- sig_res_3moAWvsSL<-na.omit(sig_res_3moAWvsSL)
- dim(sig_res_3moAWvsSL)
- write.csv(sig_res_3moAWvsSL, file="sig_res_3moAWvsSL.csv")
- save(sig_res_3moAWvsSL, file="sigAWvsSL_3mo.Rdata")
- ```
- #SD vs AW
- ```{r}
- dds_3mo_AW_SD<-dds_3mo
- design(dds_3mo_AW_SD)<-formula(~Condition)
- dds_3mo_AW_SD$Condition<-factor(dds_3mo_AW_SD$Condition, levels=c("AW", "SL", "SD"))
- dds_3mo_AW_SD<-DESeq(dds_3mo_AW_SD)
- res_3moAWvsSD<-results(dds_3mo_AW_SD, contrast = c("Condition", "SD", "AW"))
- res_3moAWvsSD_df <- as.data.frame(res_3moAWvsSD)
- res_3moAWvsSD_df<-tibble::rownames_to_column(res_3moAWvsSD_df, "ENTREZID")
- res_3moAWvsSD_df$ENTREZID<- as.character(res_3moAWvsSD_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_3moAWvsSD_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_3moAWvsSD_df <- left_join(res_3moAWvsSD_df,anno,by="ENTREZID")
- #for some reason the annotation put gene ID 11865 to Bmal instead of Arntl so need to replace this gene and make consistent with the old/AD datasets
- res_3moAWvsSD_df$SYMBOL[res_3moAWvsSD_df$ENTREZID == "11865"]<-"Arntl"
- res_3moAWvsSD_df$GENENAME[res_3moAWvsSD_df$ENTREZID == "11865"]<-"aryl hydrocarbon receptor nuclear translocator-like"
- save(res_3moAWvsSD_df, file="allAWvsSD_3mo.Rdata")
- threshold <- res_3moAWvsSD_df$padj < padj.cutoff & abs(res_3moAWvsSD_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_3moAWvsSD_df$threshold <- threshold
- sig_res_3moAWvsSD <- data.frame(subset(res_3moAWvsSD_df, threshold==TRUE), row.names = 1)
- dim(sig_res_3moAWvsSD)
- sig_res_3moAWvsSD<-na.omit(sig_res_3moAWvsSD)
- dim(sig_res_3moAWvsSD)
- write.csv(sig_res_3moAWvsSD, file="sig_res_3moAWvsSD.csv")
- save(sig_res_3moAWvsSD, file="sigAWvsSD_3mo.Rdata")
- ```
- #SD vs SL
- ```{r}
- dds_3mo_SL_SD<-dds_3mo
- design(dds_3mo_SL_SD)<-formula(~Condition)
- dds_3mo_SL_SD$Condition<-factor(dds_3mo_SL_SD$Condition, levels=c("AW", "SL", "SD"))
- dds_3mo_SL_SD<-DESeq(dds_3mo_SL_SD)
- res_3moSLvsSD<-results(dds_3mo_SL_SD, contrast = c("Condition", "SD", "SL"))
- res_3moSLvsSD_df <- as.data.frame(res_3moSLvsSD)
- res_3moSLvsSD_df<-tibble::rownames_to_column(res_3moSLvsSD_df, "ENTREZID")
- res_3moSLvsSD_df$ENTREZID<- as.character(res_3moSLvsSD_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_3moSLvsSD_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_3moSLvsSD_df <- left_join(res_3moSLvsSD_df,anno,by="ENTREZID")
- #for some reason the annotation put gene ID 11865 to Bmal instead of Arntl so need to replace this gene and make consistent with the old/AD datasets
- res_3moSLvsSD_df$SYMBOL[res_3moSLvsSD_df$ENTREZID == "11865"]<-"Arntl"
- res_3moSLvsSD_df$GENENAME[res_3moSLvsSD_df$ENTREZID == "11865"]<-"aryl hydrocarbon receptor nuclear translocator-like"
- save(res_3moSLvsSD_df, file="allSLvsSD_3mo.Rdata")
- threshold <- res_3moSLvsSD_df$padj < padj.cutoff & abs(res_3moSLvsSD_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_3moSLvsSD_df$threshold <- threshold
- sig_res_3moSLvsSD_df <- data.frame(subset(res_3moSLvsSD_df, threshold==TRUE), row.names = 1)
- dim(sig_res_3moSLvsSD_df)
- sig_res_3moSLvsSD_df<-na.omit(sig_res_3moSLvsSD_df)
- dim(sig_res_3moSLvsSD_df)
- save(sig_res_3moSLvsSD_df, file="sigSLvsSD_3mo.Rdata")
- ```
- #Volcano plots of Aw vs SL or AW vs SD
- ```{r volcano plot}
- #plot ignoring the condition variable and just comparing time of day effects
- EnhancedVolcano(res_3moAWvsSL_df,
- lab = res_3moAWvsSL_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Aw vs SL",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black', 'orange1' , 'red2'),
- pCutoff = 0.05,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 3,
- axisLabSize=10)
- #saved as pdf 7x7 "Enhanced_volcano_young_AWvsSL"
- EnhancedVolcano(res_3moAWvsSD_df,
- lab = res_3moAWvsSD_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Aw vs SD",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black', 'orange1' , 'red2'),
- pCutoff = 0.05,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 3,
- axisLabSize=10)
- #saved as pdf 7x7 "Enhanced_volcano_young_AWvsSD"
- ```
- ```{r}
- # identifying genes unique to either AW vs SL or AW vs SD or overlapping
- only_AWvsSL<- subset(sig_res_3moAWvsSL, !SYMBOL %in% sig_res_3moAWvsSD$SYMBOL)
- save(only_AWvsSL, file="unique_AWvsSL.Rdata")
- only_AWvsSD<- subset(sig_res_3moAWvsSD, !SYMBOL %in% sig_res_3moAWvsSL$SYMBOL)
- save(only_AWvsSD, file="unique_AWvsSD.Rdata")
- both_AWvsSL_AWvsSD<-subset(sig_res_3moAWvsSL, SYMBOL %in% sig_res_3moAWvsSD$SYMBOL)
- save(both_AWvsSL_AWvsSD, file="common_AWvsSLandAWvsSD.Rdata")
- ```
- #Bar plots of RNAseq data young animals AW vs SD, AW vs SL
- ```{r bar plots of SL and SD data}
- #plotting the DS and SL changes by circadian genes
- #join the fold changes from each results dataframe
- #subset the data to get just Fc and padj
- sd<-res_3moAWvsSD_df[, c("SYMBOL", "padj", "log2FoldChange")] %>% na.omit()
- sd<-sd %>% dplyr::rename(
- padj_sd = padj,
- log2FC_sd = log2FoldChange)
- sl<-res_3moAWvsSL_df[, c("SYMBOL", "padj", "log2FoldChange")] %>% na.omit()
- sl<-sl %>% dplyr::rename(
- padj_sl = padj,
- log2FC_sl = log2FoldChange)
- #put the data together
- SDandSL_DEGs<-inner_join(sd, sl, by= "SYMBOL")
- #Add row that has *s or ns for significance
- SDandSL_DEGs_symbol<-SDandSL_DEGs %>%
- mutate(p_symbol_sd=case_when(padj_sd<0.001 ~ "***"
- , padj_sd<0.01 ~ "**"
- , padj_sd<0.05 ~ "*"
- , TRUE ~ "ns")) %>%
- mutate(p_symbol_sl=case_when(padj_sl<0.001 ~ "***"
- , padj_sl<0.01 ~ "**"
- , padj_sl<0.05 ~ "*"
- , TRUE ~ "ns"))
- #just getting log2FC data
- SDandSL_DEGs_FC<-SDandSL_DEGs[, c("SYMBOL", "log2FC_sd", "log2FC_sl")] %>% pivot_longer(col=!SYMBOL, names_to = "sleep_group", names_prefix="log2FC_", values_to = "log2FC")
- #getting log2FC and padj values
- SDandSL_DEGs_FC_padj<-SDandSL_DEGs %>%
- pivot_longer(col=!SYMBOL,
- names_to = c("measure", "sleep_group"),
- names_sep= "_",
- values_to = "value")
- SDandSL_DEGs_FC_padj %>% pivot_wider(names_from = "measure", values_from = "value") %>% ggplot(aes(x=SYMBOL, y=log2FC, fill=sleep_group)) + geom_bar(stat="identity")
- circadian_genes<-c("Nr1d1", "Nr1d2", "Manf", "Fus", "Ciart", "Dbp", "Arntl", "Clock", "Bhlhe41", "Nfil3", "Cry1", "Rorg", "Xbp1", "Per3")
- SDandSL_DEGs_FC_padj[SDandSL_DEGs_FC_padj$SYMBOL %in% circadian_genes, ] %>%
- pivot_wider(names_from = "measure", values_from = "value") %>%
- ggplot(aes(x=reorder(SYMBOL,-log2FC), y=log2FC, fill=sleep_group)) +
- geom_bar(stat="identity", position="dodge", color="black") +
- #geom_text(aes(label=sprintf(fmt="%0.2e", round(padj, digits = 2)))) +
- scale_fill_manual(values = alpha(c("white", "royalblue4"), 0.8)) +
- theme_classic()
- #saved as "barplot_SLandSD_circgenes.pdf" 6.5x4
- ```
- #Wild-type aged mouse samples, day vs night
- ```{r}
- #make a dds file from galaxy generated normalized counts (rlog)
- dds_12moWT<-read.csv("12mo_counts.csv", row.names = 1)
- View(dds_12moWT)
- #but this is all the samples
- #need to get only the WT
- metadata<-read.csv("12mo_metadata.csv", row.names = 1)
- metadata$Genotype<-factor(metadata$Genotype, levels=c("WT", "AD"))
- metadata_WT <- dplyr::filter(metadata, Genotype == "WT")
- metadata_WT$TimeOfDay<-factor(metadata_WT$TimeOfDay, levels=c("Night", "Day"))
- View(metadata_WT)
- #explore
- rownames(metadata_WT)
- colnames(dds_12moWT)
- #filter dds file by metadata rownames
- dds_12moWT<-dds_12moWT[, rownames(metadata_WT)]
- #make sure the rows and columns match
- all(rownames(metadata_WT) == colnames(dds_12moWT))
- ```
- #Normalizing Old Wt samples day vs night
- ```{r}
- #creating the DESeq2 object, using *TimeOfDay as condition
- dds_12moWT<-DESeqDataSetFromMatrix(countData = dds_12moWT, colData = metadata_WT, design = ~ TimeOfDay)
- #determine size factors to use for normalization
- dds_12moWT <- estimateSizeFactors(dds_12moWT)
- sizeFactors(dds_12moWT)
- #extract the normalized counts
- normalized_counts_12moWT <-counts(dds_12moWT, normalized = TRUE)
- View(normalized_counts_12moWT)
- write.csv(normalized_counts_12moWT, file="normalized_counts_12moWT.csv")
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts_12moWT_df <- data.frame(ENTREZID=row.names(normalized_counts_12moWT), normalized_counts_12moWT)
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_12moWT)
- vsd_12moWT <- vst(dds_12moWT, blind = TRUE)
- vsd_mat_12moWT <- assay(vsd_12moWT)
- vsd_cor_12moWT <- cor(vsd_mat_12moWT)
- View(vsd_cor_12moWT)
- ```
- #DEG of wild-type day vs night
- ```{r}
- dds_12moWT<-DESeq(dds_12moWT)
- res_12moWT<-results(dds_12moWT, contrast = c("TimeOfDay","Night", "Day"))
- res_12moWT_df <- as.data.frame(res_12moWT)
- res_12moWT_df<-tibble::rownames_to_column(res_12moWT_df, "ENTREZID")
- res_12moWT_df$ENTREZID<- as.character(res_12moWT_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_12moWT_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_12moWT_df <- left_join(res_12moWT_df,anno,by="ENTREZID")
- threshold <- res_12moWT_df$padj < padj.cutoff & abs(res_12moWT_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_12moWT_df$threshold <- threshold
- sig_res_12moWT_df <- data.frame(subset(res_12moWT_df, threshold==TRUE), row.names = 1)
- dim(sig_res_12moWT_df)
- sig_res_12moWT_df<-na.omit(sig_res_12moWT_df)
- dim(sig_res_12moWT_df)
- #save files
- save(res_12moWT_df, file="res_12moWT_df.Rdata")
- write.csv(res_12moWT_df, file= "res_12moWT_df.csv")
- save(sig_res_12moWT_df, file="sig_12moWT_df.Rdata")
- write.csv(sig_res_12moWT_df, file= "sig_res_12moWT_df.csv")
- ```
- #AD samples
- ```{r}
- #make a dds file from galaxy generated normalized counts (rlog)
- dds_12moAD<-read.csv("12mo_counts.csv", row.names = 1)
- View(dds_12moAD)
- #but this is all the samples
- #need to get only the AD
- metadata<-read.csv("12mo_metadata.csv", row.names = 1)
- metadata$Genotype<-factor(metadata$Genotype, levels=c("WT", "AD"))
- metadata_AD <- dplyr::filter(metadata, Genotype == "AD")
- metadata_AD$TimeOfDay<-factor(metadata_AD$TimeOfDay, levels=c("Night", "Day"))
- View(metadata_AD)
- #explore
- rownames(metadata_AD)
- colnames(dds_12moAD)
- #filter dds file by metadata ronames
- dds_12moAD<-dds_12moAD[, rownames(metadata_AD)]
- #make sure the rows and columns match
- all(rownames(metadata_AD) == colnames(dds_12moAD))
- ```
- #Normalizing Old AD samples day vs night
- ```{r}
- #creating the DESeq2 object, using *TimeOfDay as condition
- dds_12moAD<-DESeqDataSetFromMatrix(countData = dds_12moAD, colData = metadata_AD, design = ~ TimeOfDay)
- #determine size factors to use for normalization
- dds_12moAD <- estimateSizeFactors(dds_12moAD)
- sizeFactors(dds_12moAD)
- #extract the normalized counts
- normalized_counts_12moAD <-counts(dds_12moAD, normalized = TRUE)
- View(normalized_counts_12moAD)
- write.csv(normalized_counts_12moAD, file="normalized_counts_12moAD.csv")
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts_12moAD_df <- data.frame(ENTREZID=row.names(normalized_counts_12moAD), normalized_counts_12moAD)
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_12moAD)
- vsd_12moAD <- vst(dds_12moAD, blind = TRUE)
- vsd_mat_12moAD <- assay(vsd_12moAD)
- vsd_cor_12moAD <- cor(vsd_mat_12moAD)
- View(vsd_cor_12moAD)
- ```
- #DEG of AD day vs night
- ```{r}
- dds_12moAD<-DESeq(dds_12moAD)
- res_12moAD<-results(dds_12moAD, contrast = c("TimeOfDay", "Night", "Day"))
- res_12moAD_df <- as.data.frame(res_12moAD)
- res_12moAD_df<-tibble::rownames_to_column(res_12moAD_df, "ENTREZID")
- res_12moAD_df$ENTREZID<- as.character(res_12moAD_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_12moAD_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_12moAD_df <- left_join(res_12moAD_df,anno,by="ENTREZID")
- threshold <- res_12moAD_df$padj < padj.cutoff & abs(res_12moAD_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_12moAD_df$threshold <- threshold
- sig_res_12moAD_df <- data.frame(subset(res_12moAD_df, threshold==TRUE), row.names = 1)
- dim(sig_res_12moAD_df)
- sig_res_12moAD_df<-na.omit(sig_res_12moAD_df)
- dim(sig_res_12moAD_df)
- save(res_12moAD_df, file="res_12moAD_df.Rdata")
- write.csv(res_12moAD_df, file="res_12moAD_df.csv")
- save(sig_res_12moAD_df, file="sig_12moAD_df.Rdata")
- write.csv(sig_res_12moAD_df, file= "sig_res_12moAD_df.csv")
- ```
- #Including the comparison of the WT vs AD group as this is an obvious question even though it has been done already (daMesquita et al)
- ```{r }
- dds_12mo<-read.csv("12mo_counts.csv", row.names = 1)
- View(dds_12mo)
- metadata_WTAD<-read.csv("12mo_metadata.csv", row.names = 1)
- metadata_WTAD$Genotype<-factor(metadata_WTAD$Genotype, levels=c("WT", "AD"))
- metadata_WTAD$TimeOfDay<-factor(metadata_WTAD$TimeOfDay, levels=c("Night", "Day"))
- View(metadata_WTAD)
- #explore
- rownames(metadata_WTAD)
- colnames(dds_12mo)
- #filter dds file by metadata ronames
- dds_12mo<-dds_12mo[, rownames(metadata_WTAD)]
- #make sure the rows and columns match
- all(rownames(metadata_WTAD) == colnames(dds_12mo))
- ```
- #Normalizing all samples together
- ```{r }
- #creating the DESeq2 object, using *TimeOfDay and Genotype as condition
- dds_12mo<-DESeqDataSetFromMatrix(countData = dds_12mo, colData = metadata_WTAD, design = ~ TimeOfDay + Genotype)
- #determine size factors to use for normalization
- dds_12mo <- estimateSizeFactors(dds_12mo)
- sizeFactors(dds_12mo)
- #extract the normalized counts
- normalized_counts_12mo <-counts(dds_12mo, normalized = TRUE)
- View(normalized_counts_12mo)
- write.csv(normalized_counts_12mo, file="normalized_counts_12mo_all.csv")
- ###Getting the ENTREZID as rownames for the damn dataframe.
- normalized_counts_12mo_df <- data.frame(ENTREZID=row.names(normalized_counts_12mo), normalized_counts_12mo)
- #perform unsupervised clustering analysis:log transformation
- nrow(dds_12mo)
- vsd_12mo <- vst(dds_12mo, blind = TRUE)
- vsd_mat_12mo <- assay(vsd_12mo)
- vsd_cor_12mo <- cor(vsd_mat_12mo)
- View(vsd_cor_12mo)
- ```
- #Plots of variation
- ```{r pressure, echo=FALSE}
- pheatmap(vsd_cor_12mo, cluster_rows = TRUE, cluster_cols = TRUE)
- pheatmap(vsd_cor_12mo, annotation = dplyr::select(metadata_WTAD, c(TimeOfDay, Genotype)))
- plotPCA(vsd_3mo, intgroup = "Genotype")
- plotPCA(vsd_3mo, intgroup=c("Genotype", "TimeOfDay"))
- ```
- #Degs for all old samples night vs day correcting for genotype, then genotype correcting for night vs day
- ```{r}
- #time of day accounting for genotype
- design(dds_12mo)<-formula(~ Genotype + TimeOfDay)
- dds_12mo<-DESeq(dds_12mo)
- res_12moToD<-results(dds_12mo, contrast = c("TimeOfDay", "Night", "Day"))
- res_12moToD_df <- as.data.frame(res_12moToD)
- res_12moToD_df<-tibble::rownames_to_column(res_12moToD_df, "ENTREZID")
- res_12moToD_df$ENTREZID<- as.character(res_12moToD_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_12moToD_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_12moToD_df <- left_join(res_12moToD_df,anno,by="ENTREZID")
- threshold <- res_12moToD_df$padj < padj.cutoff & abs(res_12moToD_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_12moToD_df$threshold <- threshold
- sig_res_12moToD_df <- data.frame(subset(res_12moToD_df, threshold==TRUE), row.names = 1)
- dim(sig_res_12moToD_df)
- sig_res_12moToD_df<-na.omit(sig_res_12moToD_df)
- dim(sig_res_12moToD_df)
- save(sig_res_12moToD_df, file="sig_12moToD_df.Rdata")
- write.csv(sig_res_12moToD_df, file="sig_res_12moToD_df.csv")
- #Genotype accounting for time of day
- design(dds_12mo)<-formula(~ TimeOfDay + Genotype)
- dds_12mo<-DESeq(dds_12mo)
- res_12moGT<-results(dds_12mo, contrast = c("Genotype", "AD", "WT"))
- res_12moGT_df <- as.data.frame(res_12moGT)
- res_12moGT_df<-tibble::rownames_to_column(res_12moGT_df, "ENTREZID")
- res_12moGT_df$ENTREZID<- as.character(res_12moGT_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,keys=res_12moGT_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- res_12moGT_df <- left_join(res_12moGT_df,anno,by="ENTREZID")
- threshold <- res_12moGT_df$padj < padj.cutoff & abs(res_12moGT_df$log2FoldChange) > log2FoldChange.cutoff
- length(which(threshold))
- res_12moGT_df$threshold <- threshold
- sig_res_12moGT_df <- data.frame(subset(res_12moGT_df, threshold==TRUE), row.names = 1)
- dim(sig_res_12moGT_df)
- sig_res_12moGT_df<-na.omit(sig_res_12moGT_df)
- dim(sig_res_12moGT_df)
- save(sig_res_12moGT_df, file="sig_12moGT_df.Rdata")
- write.csv(sig_res_12moGT_df, file="sig_res_12moGT_df.csv")
- ```
- #Volcano plots of old WT or AD samples
- ```{r volcano plot}
- #plot comparing time of day effects
- EnhancedVolcano(res_12moWT_df,
- lab = res_12moWT_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Night vs Day",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black', 'orange1' , 'red2'),
- pCutoff = 0.05,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 5,
- axisLabSize=10)
- #saved as pdf 7x7 "Enhanced_volcano_Old_WT_NightvsDay.pdf"
- EnhancedVolcano(res_3moAWvsSD_df,
- lab = res_3moAWvsSD_df$SYMBOL,
- x = 'log2FoldChange',
- y = 'padj',
- title="Aw vs SD",
- subtitle = NULL,
- xlim = c(-2.5,2.5),
- col=c('grey','black', 'orange1' , 'red2'),
- pCutoff = 0.05,
- FCcutoff = 0.58,
- pointSize = 2.0,
- labSize = 3,
- axisLabSize=10)
- #saved as pdf 7x7 "Enhanced_volcano_young_AWvsSD"
- ```
- #Plotting the normalized counts from the DEG lists of young, old and AD groups
- #using 3mo data that has 3 condition metadata
- ```{r heatmaps of normalized counts}
- # normalized_counts_3mo_cond_df
- #have to annotate each dataset to get gene SYMBOLS
- class(normalized_counts_3mo_cond_df$ENTREZID) #character
- normalized_counts_3mo_cond_df$ENTREZID<-as.character(normalized_counts_3mo_cond_df$ENTREZID)
- keys(org.Mm.eg.db, keytype="ENTREZID")[1:10]
- anno <- AnnotationDbi::select(org.Mm.eg.db,
- keys=normalized_counts_3mo_cond_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- head(anno)
- dim(anno)
- dim(normalized_counts_3mo_cond_df)
- #they match!
- normalized_counts_3mo_cond_df_annotated <- left_join(normalized_counts_3mo_cond_df,anno,by="ENTREZID")
- head(normalized_counts_3mo_cond_df_annotated)
- #Extract the normalized count data for the DEGs of the AWvsSL comparison
- ##For AWvsSL
- col_order<-c("SYMBOL", "M1", "M2", "M3", "M4", "M9", "M10", "M11")
- norm_SYMBOL_AWvsSL<-normalized_counts_3mo_cond_df_annotated[ ,col_order]
- norm_SYMBOL_AWvsSL<-norm_SYMBOL_AWvsSL %>% drop_na(SYMBOL)
- norm_SYMBOL_AWvsSL<-data.frame(norm_SYMBOL_AWvsSL, row.names = 1)
- norm_sigAWvsSL <- norm_SYMBOL_AWvsSL[sig_res_3moAWvsSL$SYMBOL, ]
- norm_sigAWvsSL<-na.omit(norm_sigAWvsSL)
- dim(norm_sigAWvsSL)
- #need this for the complex heatmap
- norm_sigAWvsSL_mat<-as.matrix(norm_sigAWvsSL)
- #For AWvsSD
- col_order2<-c("SYMBOL", "M5", "M6", "M7", "M8", "M9", "M10", "M11")
- norm_SYMBOL_AWvsSD<-normalized_counts_3mo_cond_df_annotated[ ,col_order2]
- norm_SYMBOL_AWvsSD<-norm_SYMBOL_AWvsSD %>% drop_na(SYMBOL)
- norm_SYMBOL_AWvsSD<-data.frame(norm_SYMBOL_AWvsSD, row.names = 1)
- norm_sigAWvsSD <- norm_SYMBOL_AWvsSD[sig_res_3moAWvsSD$SYMBOL, ]
- norm_sigAWvsSD<-na.omit(norm_sigAWvsSD)
- dim(norm_sigAWvsSD)
- norm_sigAWvsSD_mat<-as.matrix(norm_sigAWvsSD)
- #Annotate our heatmap (optional)
- #annotation_SL <- data.frame(sampletype=metadata_SL[, "Condition"],
- #row.names=rownames(metadata_SL))
- # normalized_counts_12moWT_df
- class(normalized_counts_12moWT_df$ENTREZID) #character
- normalized_counts_12moWT_df$ENTREZID<-as.character(normalized_counts_12moWT_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,
- keys=normalized_counts_12moWT_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- head(anno)
- dim(anno)
- dim(normalized_counts_12moWT_df)
- #they match!
- # normalized_counts_12moWT_df
- normalized_counts_12moWT_df_annotated <- left_join(normalized_counts_12moWT_df,anno,by="ENTREZID")
- head(normalized_counts_12moWT_df_annotated)
- col_order_old<-c("SYMBOL", "M13", "M14", "M15", "M16", "M21", "M22", "M23", "M24")
- norm_SYMBOL_12moWT<-normalized_counts_12moWT_df_annotated[ ,col_order_old]
- norm_SYMBOL_12moWT<-norm_SYMBOL_12moWT %>% drop_na(SYMBOL)
- norm_SYMBOL_12moWT<-data.frame(norm_SYMBOL_12moWT, row.names = 1)
- #to get only the sig genes from the 3mo AWvsSL list
- norm_sig12moWT <- norm_SYMBOL_12moWT[sig_res_3moAWvsSL$SYMBOL, ]
- norm_sig12moWT<-na.omit(norm_sig12moWT)
- dim(norm_sig12moWT)
- norm_sig12moWT_mat<-as.matrix(norm_sig12moWT)
- #############################
- # normalized_counts_12moAD_df
- class(normalized_counts_12moAD_df$ENTREZID) #character
- normalized_counts_12moAD_df$ENTREZID<-as.character(normalized_counts_12moAD_df$ENTREZID)
- anno <- AnnotationDbi::select(org.Mm.eg.db,
- keys=normalized_counts_12moAD_df$ENTREZID,
- columns=c("SYMBOL","GENENAME"),
- keytype="ENTREZID")
- head(anno)
- dim(anno)
- dim(normalized_counts_12moAD_df)
- #they match!
- # normalized_counts_12moAD_df
- normalized_counts_12moAD_df_annotated <- left_join(normalized_counts_12moAD_df,anno,by="ENTREZID")
- head(normalized_counts_12moAD_df_annotated)
- col_order_AD<-c("SYMBOL", "M17", "M18", "M19", "M20", "M25", "M26", "M27", "M28")
- norm_SYMBOL_12moAD<-normalized_counts_12moAD_df_annotated[ ,col_order_AD]
- norm_SYMBOL_12moAD<-norm_SYMBOL_12moAD %>% drop_na(SYMBOL)
- norm_SYMBOL_12moAD<-data.frame(norm_SYMBOL_12moAD, row.names = 1)
- norm_sig12moAD <- norm_SYMBOL_12moAD[sig_res_3moAWvsSL$SYMBOL, ]
- norm_sig12moAD<-na.omit(norm_sig12moAD)
- dim(norm_sig12moAD)
- norm_sig12moAD_mat<-as.matrix(norm_sig12moAD)
- ```
- #Heatmaps of normalized counts
- ```{r heatmaps of normalized counts for sig genes}
- #Set a color palette
- heat.colors <- brewer.pal(11, "RdBu")
- norm_sigAWvsSL_mat_scaled<-t(scale((t(norm_sigAWvsSL_mat))))
- #sig genes for AWvsSL
- hm<-pheatmap(norm_sigAWvsSL_mat, color = heat.colors, cluster_rows = T, show_rownames=T,
- border_color=NA, fontsize = 10, scale="row",
- fontsize_row = 3, height=20, main="AWvsSL sig genes")
- hm2<-Heatmap(norm_sigAWvsSL_mat_scaled, col=heat.colors, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm2, heatmap_legend_side="left")
- #save image as "pheatmap_AWvsSLnormcounts_AWvsSLgenelist.pdf"
- #to get row order for subsequent heatmaps
- ro1<-row_order(hm2)
- # to manually set which rows are labelled
- ro_label<-rownames(norm_sigAWvsSL_mat_scaled)[row_order(hm2)]
- label_file<-read.csv("3mo_heatmap_label.csv")
- rownumbers<-label_file$row_number
- rowgenes<-label_file$SYMBOL
- ha <-rowAnnotation(foo=anno_mark(at = rownumbers, labels = rowgenes, labels_gp=gpar(fontsize=6)))
- hm2<-Heatmap(norm_sigAWvsSL_mat_scaled, col=heat.colors, show_column_dend = FALSE, show_row_dend = FALSE, show_column_names = FALSE, right_annotation=ha, show_row_names = FALSE, row_names_gp=gpar(fontsize=5), clustering_distance_rows = "euclidean")
- draw(hm2, heatmap_legend_side="left")
- #saved as pdf "pheatmap_AWvsSLnormcounts_AWvsSLgenelist_select_labels_2.pdf" 14x4
- #sig genes for AwvsSD
- norm_sigAWvsSD_mat_scaled<-t(scale((t(norm_sigAWvsSD_mat))))
- hm3<-Heatmap(norm_sigAWvsSD_mat_scaled, col=heat.colors, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- #manually set which genes are labelled as above
- ro_label<-rownames(norm_sigAWvsSD_mat_scaled)[row_order(hm3)]
- label_file<-read.csv("3moAWvsSD_heatmap_label.csv")
- rownumbers<-label_file$row_number
- rowgenes<-label_file$SYMBOL
- ha <-rowAnnotation(foo=anno_mark(at = rownumbers, labels = rowgenes, labels_gp=gpar(fontsize=10)))
- hm3<-Heatmap(norm_sigAWvsSD_mat_scaled, col=heat.colors, show_column_dend = FALSE, show_row_dend = FALSE, show_column_names = FALSE, right_annotation=ha, show_row_names = FALSE, row_names_gp=gpar(fontsize=5), clustering_distance_rows = "euclidean")
- draw(hm3, heatmap_legend_side="left")
- #save image as "pheatmap_AWvsSDnormcounts_AWvsSDgenelist.pdf" 4x4 portrait
- #sig genes from AWvsSL in old WT norm counts
- norm_sig12moWT_mat_scaled<-t(scale((t(norm_sig12moWT_mat))))
- hm4<-Heatmap(norm_sig12moWT_mat_scaled, col=heat.colors, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm4, heatmap_legend_side="left")
- hm4<-Heatmap(norm_sig12moWT_mat_scaled, col=heat.colors, row_order=ro1, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm4, heatmap_legend_side="left")
- #save image as "pheatmap_oldWTnormcounts_AWvsSLgenelist_order.pdf" 14x4 portrait or pheatmap_oldWTnormcounts_AWvsSLgenelist.pdf not in order
- #heatmap of top 500 genes of the WT old data
- #need to first get the sig genes in order
- sig_res_12moWT_df_ordered <- sig_res_12moWT_df[order(sig_res_12moWT_df$padj), ]
- top500_sig_res_12moWT <- sig_res_12moWT_df_ordered[1:500, ]
- top500_sig_res_12moWT_genes<-norm_SYMBOL_12moWT[top500_sig_res_12moWT$SYMBOL, ]
- top500_sig_res_12moWT_genes<-na.omit(top500_sig_res_12moWT_genes)
- dim(top500_sig_res_12moWT_genes)
- #make into matrix and scale
- top500_sig_res_12moWT_genes_mat<-as.matrix(top500_sig_res_12moWT_genes)
- top500_sig_res_12moWT_genes_mat_scaled<-t(scale((t(top500_sig_res_12moWT_genes_mat))))
- #now make the heatmap!
- hm4_1<-Heatmap(top500_sig_res_12moWT_genes_mat_scaled, col=heat.colors, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm4_1, heatmap_legend_side="left")
- #but to select only some genes to be labelled need to save to csv then do in excel and get row #s too
- write.csv(top500_sig_res_12moWT_genes, file = "top500_sig_res_12moWT_genes.csv")
- #save file with log2FC as well
- write.csv(top500_sig_res_12moWT, file="top500_sig_res_12moWT.csv")
- label_file<-read.csv("12moWT_heatmap_label.csv")
- rownumbers<-label_file$row_number
- rowgenes<-label_file$SYMBOL
- ha <-rowAnnotation(foo=anno_mark(at = rownumbers, labels = rowgenes, labels_gp=gpar(fontsize=10)))
- hm4_1<-Heatmap(top500_sig_res_12moWT_genes_mat_scaled, col=heat.colors, show_column_dend = FALSE, show_row_dend = FALSE, right_annotation=ha, show_row_names = FALSE, row_names_gp=gpar(fontsize=5), clustering_distance_rows = "euclidean")
- draw(hm4_1, heatmap_legend_side="left")
- #sig genes from AWvsSL in old AD norm counts
- norm_sig12moAD_mat_scaled<-t(scale((t(norm_sig12moAD_mat))))
- hm5<-Heatmap(norm_sig12moAD_mat_scaled, col=heat.colors, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm5, heatmap_legend_side="left")
- hm5<-Heatmap(norm_sig12moAD_mat_scaled, col=heat.colors, row_order=ro1, row_names_gp = gpar(fontsize = 4), clustering_distance_rows = "euclidean")
- draw(hm5, heatmap_legend_side="left")
- #save image as "pheatmap_oldADnormcounts_AWvsSLgenelist_order.pdf" 14x4 portrait or pheatmap_oldWTnormcounts_AWvsSLgenelist.pdf not in order
- ```
- #Genes of interest across young, aged, AD groups
- ```{r plotting genes of interest by fuctional groups}
- SLC_family_genes<-c("Slc26a2", "Slc4a10", "Slc4a5", "Slc12a2", "Slc25a28", "Slc12a7", "Slc12a4", "Slc4a2", "Slc38a3", "Slc22a8")
- #"Slc12a1", "Slc12a6", "Slc25a37", "Slc5a5", "Slco4a1" not sig in any
- all_SLC_genes<-wide_young_old_ad %>% dplyr::filter(grepl("Slc", SYMBOL))
- all_SLC_genes_list<-all_SLC_genes$SYMBOL
- Na_K_ATPase_family_genes<-c("Atp1a2", "Atp1a1", "Atp1b1")
- # "Atp1b1", "Atp1b2", "Atp1a4" not sig in any
- Carbonic_anhydrase_family_genes<-c("Ca4", "Ca2", "Ca3","Ca13", "Ca8", "Ca14")
- #none of these are significant in the groups
- ATP_synthase_family<-c("Atp5l", "Atp23", "Atp5g3", "Atpaf1", "Atp5b" ) #none are significant
- tight_junctions<-c("Cldn5", "Cldn2", "Cldn3", "Cldn19", "Ocln")
- #"Cldn18" not expressed, "Cldn11", "Cldn1" not sig in any
- amyloid_proteins<-c("Abpa3", "Apbb1ip", "App") #only APP is different
- circadian_genes<-c("Nr1d1", "Nr1d2", "Manf", "Fus", "Ciart", "Dbp", "Arntl", "Clock", "Bhlhe41", "Nfil3", "Cry1", "Rorg", "Xbp1", "Per3")
- # "Sirt1" not sig in any
- #DEGs from Dani et al, age-dependent
- age_genes<-read.csv("age_genes_dani_et_al.csv")
- age_gene_names<-age_genes$Age_dependent_genes
- ```
- ```{r plots from above}
- res_3moAWvsSL_df[res_3moAWvsSL_df$SYMBOL %in% SLC_family_genes, ] %>% dplyr::filter(padj<0.05) %>%
- ggplot(aes(x=SYMBOL, y=log2FoldChange)) +
- geom_bar(stat="identity") +
- geom_text(aes(label= sprintf("%.2f",round(padj, digits=2))))
- ```
- ```{r}
- #combine young AWvsSL, oldWT and old AD datasets with FC and pvalues to have on same graph
- #need to take out the NA gene symbols from each dataset to be able to pivot wide later, otherwise numbers are converted to list and then nothing works
- young_fc_padj<-res_3moAWvsSL_df[, c("SYMBOL", "log2FoldChange", "padj")]
- #add column to designate the dataset group
- young_fc_padj<-young_fc_padj %>% mutate(Group= "Young")
- young_fc_padj<-young_fc_padj %>% drop_na(SYMBOL)
- oldWT_fc_padj<-res_12moWT_df[, c("SYMBOL", "log2FoldChange", "padj") ]
- oldWT_fc_padj<-oldWT_fc_padj %>% mutate(Group= "OldWT")
- oldWT_fc_padj<-oldWT_fc_padj%>% drop_na(SYMBOL)
- oldAD_fc_padj<-res_12moAD_df[, c("SYMBOL", "log2FoldChange", "padj") ]
- oldAD_fc_padj<-oldAD_fc_padj %>% mutate(Group= "OldAD")
- oldAD_fc_padj<-oldAD_fc_padj%>% drop_na(SYMBOL)
- young_old_ad<-dplyr::bind_rows(young_fc_padj,oldWT_fc_padj)
- young_old_ad<-dplyr::bind_rows(young_old_ad, oldAD_fc_padj)
- #Add row that has *s or ns for significance
- young_old_ad_symbol<-young_old_ad %>%
- mutate(padj_symbol=case_when(padj<0.001 ~ "***"
- , padj<0.01 ~ "**"
- , padj<0.05 ~ "*"
- , TRUE ~ NA))
- write.csv(young_old_ad_symbol, file="young_old_ad_long_FC_padj.csv")
- #to place p-values in the middle of the bars, need to calculate half the fold change
- young_old_ad_symbol<-young_old_ad_symbol %>%
- mutate(half_fc=log2FoldChange*0.5)
- #need to filter the data so that we have only genes left that are significant in at least one group
- #need to do this by gene
- wide_young_old_ad<-pivot_wider(young_old_ad, names_from = Group, values_from = c(log2FoldChange, padj))
- wide_young_old_ad<-wide_young_old_ad %>%
- mutate(Keep = case_when(padj_Young <0.05 ~ "SIG",
- padj_OldWT <0.05 ~ "SIG",
- padj_OldAD <0.05 ~ "SIG",
- .default = "Not_SIG") )
- #now filter the long data by values to keep from wide data
- wide_mod<-wide_young_old_ad[wide_young_old_ad$Keep =="SIG",]
- #make list with only sig genes
- sig_list<-wide_mod$SYMBOL
- #filter the whole dataset by the sig list
- young_old_ad_filtered_bysig<-young_old_ad_symbol[young_old_ad_symbol$SYMBOL %in% sig_list, ]
- young_old_ad_filtered_bysig$Group<-factor(young_old_ad_filtered_bysig$Group, levels=c("Young", "OldWT", "OldAD"))
- #want a list of ones that are sig in the young group
- young_sig_genes<-young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$Group=="Young", ] %>% dplyr::filter(padj<0.05) %>% dplyr::filter(log2FoldChange>0.58 | log2FoldChange < -0.58)
- young_sig_genes_list<-young_sig_genes$SYMBOL
- young_old_conserved<-young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% young_sig_genes_list, ] %>% subset(Group=="OldWT") %>% dplyr::filter(padj<0.05) %>% dplyr::filter(log2FoldChange>0.58 | log2FoldChange < -0.58)
- young_old_conserved_list<-young_old_conserved$SYMBOL
- write.csv(young_old_conserved, file= "young_old_conserved.csv")
- #make matrix with young/old data to plot as heatmap
- young_old_wide<-wide_young_old_ad[wide_young_old_ad$SYMBOL %in% young_old_conserved_list, c(1:4)]
- young_old_mat<-as.matrix(young_old_wide[,-1])
- rownames(young_old_mat)<-young_old_wide$SYMBOL
- write.csv(wide_young_old_ad, file = "wide_young_aged_ad_FC_padj.csv")
- ```
- ```{r plotting gene expression across groups}
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% circadian_genes, ] %>%
- ggplot(aes(fill=Group, x=SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity") +
- geom_text(aes(label= sprintf("%.2f",round(padj, digits=2))), size=3,vjust=1.5, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_viridis_d(option="inferno", begin=0.2, end=0.8)
- #label the p values as symbols instead
- #circadian related genes
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% circadian_genes, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% circadian_genes, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7))
- #saved as "barplot_young_old_ad_circadian_family_genes_rotated.pdf"
- #plotting the conserved genes in aged animals
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% young_old_conserved_list, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- # cool but can't see anything. try another heatmap
- pheatmap(young_old_mat)
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% SLC_family_genes, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- #saved as "barplot_young_old_ad_slc_family_genes.pdf" 5x4
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% all_SLC_genes_list, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% Na_K_ATPase_family_genes, ] %>%
- ggplot(aes(fill=Group, x=SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_viridis_d(option="inferno", alpha=0.6, begin=0.2, end=0.8)
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% amyloid_proteins, ] %>%
- ggplot(aes(fill=Group, x=SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_viridis_d(option="inferno", alpha=0.6, begin=0.2, end=0.8)
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% tight_junctions, ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- #combine these together
- slc_atp_app_tj<-c(SLC_family_genes, ATP_synthase_family, amyloid_proteins, tight_junctions, "Aqp1")
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% slc_atp_app_tj, ] %>%
- ggplot(aes(fill=Group, x= SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- #saved as "barplot_young_old_ad_slc_family_genes.pdf" 5x4
- #rotated
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% slc_atp_app_tj, ] %>%
- ggplot(aes(fill=Group, x= SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7))
- #saved as "barplot_young_old_ad_slc_atp_tj_aqp1_app_family_genes_rotate.pdf" 5x4
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% age_gene_names, ] %>%
- ggplot(aes(fill=Group, x=SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- theme(axis.text.x=element_text(size= 2, angle = 90)) +
- scale_fill_viridis_d(option="inferno", alpha=0.6, begin=0.2, end=0.8) +
- coord_flip()
- #this is too many genes. Need to filter by gene and have only those that are significant at least in one group be plotted
- #slc12a2
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% "Slc12a2", ] %>%
- ggplot(aes(fill=Group, x=SYMBOL, y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- theme(axis.text.x=element_text(size= 2, angle = 90)) +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7))
- young_old_ad_filtered_bysig[young_old_ad_filtered_bysig$SYMBOL %in% "slc12a2", ] %>%
- ggplot(aes(fill=Group, x=reorder(SYMBOL, -log2FoldChange), y=log2FoldChange)) +
- geom_bar(position="dodge", stat="identity", color="black") +
- geom_text(aes(y=half_fc, label= padj_symbol), size=3, vjust=1, position=position_dodge(0.9)) +
- theme_classic() +
- scale_fill_manual(values = alpha(c("darkcyan", 'midnightblue', 'orangered1'), 0.7)) +
- coord_flip()
- ```
- #Venn diagrams to visualize overlaps
- ```{r venn diagrams of gene list overlaps}
- library(VennDiagram)
- sig_res_3moAWvsSL_genelist<-sig_res_3moAWvsSL$SYMBOL
- sig_res_12moWT_df_genelist<-sig_res_12moWT_df$SYMBOL
- sig_res_12moAD_df_genelist<-sig_res_12moAD_df$SYMBOL
- venn.diagram(x=list(sig_res_3moAWvsSL_genelist, sig_res_12moWT_df_genelist, sig_res_12moAD_df_genelist),
- category.names=c("Young", "Aged", "AD"),
- filename = "Circadian Gene Overlaps Young Aged AD.png",
- output=TRUE,
- imagetype="png" ,
- height = 1000 ,
- width = 1000 ,
- resolution = 1000,
- compression = "lzw",
- lwd = 1,
- col=c("darkcyan", 'midnightblue', 'orangered1'),
- fill = c(alpha("darkcyan",0.3), alpha('midnightblue',0.3), alpha('orangered1',0.3)),
- cex = 0.5,
- fontfamily = "sans",
- cat.cex = 0.3,
- cat.default.pos = "outer",
- cat.pos = c(-27, 27, 135),
- cat.dist = c(0.055, 0.055, 0.085),
- cat.fontfamily = "sans",
- cat.col = c("darkcyan", 'midnightblue', 'orangered1'),
- rotation = 1
- )
- #for young, AWvsSD, AWvsSL
- sig_res_3moAWvsSL_genelist<-sig_res_3moAWvsSL$SYMBOL
- sig_res_3moAWvsSD_genelist<-sig_res_3moAWvsSD$SYMBOL
- venn.diagram(
- x=list(sig_res_3moAWvsSL_genelist,sig_res_3moAWvsSD_genelist),
- category.names=c("SL", "SD"),
- filename = "Circadian Gene Overlaps SL vs SD.png",
- output=TRUE,
- imagetype="png" ,
- height = 1000 ,
- width = 1000 ,
- resolution = 1000,
- compression = "lzw",
- lwd = 1,
- col=c("midnightblue", 'orangered1'),
- fill = c(alpha("midnightblue",0.3), alpha('orangered1',0.3)),
- cex = 0.4,
- fontfamily = "sans",
- cat.cex = 0.4,
- cat.default.pos = "outer",
- cat.fontfamily = "sans",
- cat.dist = c(0.055, 0.055),
- cat.pos = c(-50, 30),
- cat.col = c("midnightblue", 'orangered1')
- )
- ```
- ```{r heatmaps}
- #heatmap?
- young_old_ad_mat<-as.matrix(wide_mod[ ,c("log2FoldChange_Young", "log2FoldChange_OldWT", "log2FoldChange_OldAD") ])
- rownames(young_old_ad_mat)<-wide_mod$SYMBOL
- #make matrix of p values by taking the padj symbols
- wide_sig_symbol<-pivot_wider(young_old_ad_symbol[, c(1,4:5)], names_from = Group, values_from = padj_symbol)
- #then have to filter by ones that are significant in at least one group
- wide_filtered_sig<-wide_sig_symbol[wide_sig_symbol$SYMBOL %in% sig_list, ]
- #make into a matrix
- wide_filtered_sig_mat<-as.matrix(wide_filtered_sig[, c(2:4)])
- rownames(wide_filtered_sig_mat)<-wide_filtered_sig$SYMBOL
- #then get rid of the NA values so they don't show up on the heatmap
- wide_filtered_sig_mat[is.na(wide_filtered_sig_mat)]<-""
- pheatmap(young_old_ad_mat[rownames(young_old_ad_mat) %in% age_gene_names, ], cluster_cols = FALSE, display_numbers = wide_filtered_sig_mat[rownames(wide_filtered_sig_mat) %in% age_gene_names, ])
- ```
deseq2 feb 2023.Rmd, under CC-BY-4.0 · at the source
Overview
- School of Biological Sciences, University of Auckland, Auckland, New Zealand
- Department of Psychiatry and Behavioral Sciences, University of Washington School of Medicine, Seattle, WA USA
- VA Northwest Mental Illness Research, Education, and Clinical Center (MIRECC), VA Puget Sound Health Care System, Seattle, WA USA
- Department of Neurosurgery, Stanford University, Stanford, CA USA
- Department of Radiology, Brain Health Imaging Institute, Weill Cornell Medicine, New York, NY USA
- Department of Neurosurgery, Medical College of Georgia, Augusta University, Augusta, GA USA
- Department of Neurology, University of Washington School of Medicine, Seattle, WA USA
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 9 matches between paragraphs and lines of code.
figshare 32129572
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
- 28 September 2026: the link answers (HTTP 200)
7 files
- CP circadian gene validation.Rmd, R, 631 lines, 3 matches
- ClusterProfiler.Rmd, R, 389 lines
- Expt 8 WB quant.R, R, 142 lines
- deseq2 feb 2023.Rmd, R, 1,396 lines, 4 matches
- expt 7.Rmd, R, 955 lines
- genecompare.R, R, 1,034 lines, 2 matches
- README.md, Text, 10 lines
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:
- no repository, dataset or request procedure was recognized in it
Read it in the paper: doi.org/10.1038/s42003-026-10335-4.
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;
- 6 scripts, each with its path and the digest of its content;
- 9 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
- geo:GSE228866, at NCBI GEO; found in “Data availability”
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:
- it points to a dataset: NCBI GEO GSE228866
Read it in the paper: doi.org/10.1038/s42003-026-10335-4.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 12 authors, 2 keywords, 13 MeSH terms, 2 funders, 89 references.
Cite
This paper
Jansson, D., O’Boyle, R., Pedersen, T. J., Gino, E., Sevao, M., Vered, R., Suchland, K. L., Zhou, B., Fame, R., Keil, S. A., Braun, M., & Iliff, J. (2026). Diurnal choroid plexus function in mice depends on sex, age, and amyloid-β status. Communications biology, 9(1), 1073. https://
BibTeX
@article{jansson2026diur
author = {Jansson, Deidre and O’Boyle, Ryan and Pedersen, Taylor J and Gino, Elizabeth and Sevao, Mathew and Vered, Ron and Suchland, Katherine L and Zhou, Blake and Fame, Ryann and Keil, Samantha A and Braun, Molly and Iliff, Jeffrey},
title = {{Diurnal choroid plexus function in mice depends on sex, age, and amyloid-β status}},
journal = {Communications biology},
year = {2026},
month = may,
volume = {9},
number = {1},
pages = {1073},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/
url = {https://
pmid = {42162350},
pmcid = {PMC13457615}
}
RIS
TY - JOUR
AU - Jansson, Deidre
AU - O’Boyle, Ryan
AU - Pedersen, Taylor J
AU - Gino, Elizabeth
AU - Sevao, Mathew
AU - Vered, Ron
AU - Suchland, Katherine L
AU - Zhou, Blake
AU - Fame, Ryann
AU - Keil, Samantha A
AU - Braun, Molly
AU - Iliff, Jeffrey
TI - Diurnal choroid plexus function in mice depends on sex, age, and amyloid-β status
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 1073
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Diurnal choroid plexus function in mice depends on sex, age, and amyloid-β status",
"container-title": "Communications biology",
"author": [
{
"family": "Jansson",
"given": "Deidre"
},
{
"family": "O’Boyle",
"given": "Ryan"
},
{
"family": "Pedersen",
"given": "Taylor J"
},
{
"family": "Gino",
"given": "Elizabeth"
},
{
"family": "Sevao",
"given": "Mathew"
},
{
"family": "Vered",
"given": "Ron"
},
{
"family": "Suchland",
"given": "Katherine L"
},
{
"family": "Zhou",
"given": "Blake"
},
{
"family": "Fame",
"given": "Ryann"
},
{
"family": "Keil",
"given": "Samantha A"
},
{
"family": "Braun",
"given": "Molly"
},
{
"family": "Iliff",
"given": "Jeffrey"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "1073",
"DOI": "10.1038/
"PMID": "42162350",
"PMCID": "PMC13457615",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
20
]
]
}
}
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.1093/pnasnexus/pgad262 [code]
- Day-night fluctuations in choroid plexus transcriptomics and cerebrospinal fluid metabolomics.Journal: PNAS nexusIn common: DESeq2, pheatmap, ggplot2, 1 other tool, NCBI GEO GSE228866, genetics / omics, cellular / molecular, 7 references
- [2] doi:10.3390/biomedicines10020224
- Choroid Plexus in Alzheimer's Disease-The Current State of Knowledge.Journal: BiomedicinesIn common: Alzheimer's / dementia, 11 references
- [3] doi:10.1177/0271678x221082786
- Choroid plexus function in neurological homeostasis and disorders: The awakening of the circadian clocks and orexins.Journal: Journal of cerebral blood flow and metabolism : official journal of the International Society of Cerebral Blood Flow and MetabolismIn common: 11 references
- [4] doi:10.1038/s41467-025-61889-6 [code]
- Choroid plexus-mediated CSF secretion remains stable in aging rats via high and age-resistant metabolic activity.Journal: Nature communicationsIn common: DESeq2, ggplot2, tidyverse, genetics / omics, 8 references
- [5] doi:10.1186/s12987-024-00547-3
- The circadian clock in the choroid plexus drives rhythms in multiple cellular processes under the control of the suprachiasmatic nucleus.Journal: Fluids and barriers of the CNSIn common: genetics / omics, mouse, cellular / molecular, 10 references
- [6] doi:10.1016/j.xcrm.2023.101278 [code]
- Cholesterol 24-hydroxylase at the choroid plexus contributes to brain immune homeostasis.Journal: Cell reports. MedicineIn common: DESeq2, pheatmap, patchwork, 3 other tools, Alzheimer's / dementia, mouse, cellular / molecular, 5 references
- [7] doi:10.1038/s41467-023-39326-3 [code]
- Defining diurnal fluctuations in mouse choroid plexus and CSF at high molecular, spatial, and temporal resolution.Journal: Nature communicationsIn common: mouse, cellular / molecular, 6 references, author Ryann Fame
- [8] doi:10.1186/s13024-025-00853-w
- Early transcriptional and cellular abnormalities in choroid plexus of a mouse model of Alzheimer's disease.Journal: Molecular neurodegenerationIn common: Alzheimer's / dementia, genetics / omics, mouse, 1 other category, 7 references
- [9] doi:10.1093/brain/awag080 [code]
- Early glymphatic failure in AppNL-F knock-in mice is linked to parenchymal border macrophages loss.Journal: Brain : a journal of neurologyIn common: rstatix, ggpubr, ggplot2, 1 other tool, Alzheimer's / dementia, mouse, cellular / molecular, 4 references
- [10] doi:10.1038/s42003-025-08371-7 [code]
- Site- and cell-type-specific miRNA and mRNA genes and networks across the cortex, striatum, and hypothalamus.Journal: Communications biologyIn common: ComplexHeatmap, DESeq2, pheatmap, 4 other tools, mouse, cellular / molecular, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 6 scripts, and 9 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:8c92ae08ad528b6e…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1038/s42003-026-10335-4)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s42003-026-10335-4.svg
:target: https://openscicode.org/badge/doi/10.1038/s42003-026-10335-4
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s42003-026-10335-4"><img src="https://openscicode.org/badge/doi/10.1038/s42003-026-10335-4.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
