color = viridis(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
selection <- order(apply(vstData, 1, var), decreasing = T)[1:1000]
data.subset <- vstData[selection, ]
# Perform PCA
pca <- prcomp(t(data.subset))
percentVar <- pca$sdev ^ 2 / sum(pca$sdev ^ 2)
data.pca <- data.frame('PC1' = pca$x[, 'PC1'],
'PC2' = pca$x[, 'PC2'],
'Sample' = colnames(data.subset)) %>%
cbind(colData)
ggplot(data.pca, aes(x=PC1, y=PC2, colour=condition)) + geom_point(size=4) + theme_bw() +
xlab(paste0("PC1: ", round(percentVar[1] * 100), "% variance")) + ylab(paste0("PC2: ", round(percentVar[2] * 100), "% variance")) +
ggtitle("1000 most variant genes") + scale_color_manual(values=cbPalette_PA) +
geom_text(aes(label = Sample), nudge_y = 1) + my_custom_theme
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = viridis(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
#color = viridis(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = magma(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = plasma(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = cividis(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = inferno(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
annotation_col <- data.frame(Group = conditions)
rownames(annotation_col) <- colnames(data.subset)
group_colors <- list(Group = c(old_exercise = cbPalette_long[2], old_control = cbPalette_long[6], young_control = cbPalette_long[1]))
pheatmap(data.subset,
scale = "row",         # Standardizes values by row (genes), optional
clustering_distance_rows = "euclidean",  # Distance measure for rows
clustering_distance_cols = "euclidean",  # Distance measure for columns
clustering_method = "complete",          # Clustering method (e.g., "complete", "ward.D2")
show_rownames = FALSE,  # Option to hide row names if too many genes
show_colnames = TRUE,    # Option to show column names
color = cividis(100),
annotation_col = annotation_col,    # Add group annotations for columns
annotation_colors = group_colors   # Define the colors for the groups
)
library(clusterProfiler)
BiocManager::install("clusterProfiler")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("enrichplot")
BiocManager::install("clusterProfiler")
library(clusterProfiler)
library(org.Mm.eg.db)
BiocManager::install("org.Mm.eg.db")
library(org.Mm.eg.db)
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
bg_genes <- res_all %>% filter(baseMean > 50) %>% dplyr::select(ensembl_gene_id) %>% distinct()
# GO analysis
library(clusterProfiler)
library(org.Mm.eg.db)
# Gene lists
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
bg_genes <- res_all %>% filter(baseMean > 50) %>% dplyr::select(ensembl_gene_id) %>% distinct()
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OCtrl <- enrichGO(gene = OCtrl_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Hs.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
# GO analysis
library(clusterProfiler)
library(org.Mm.eg.db)
# Gene lists
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_vs_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
bg_genes <- res_all %>% filter(baseMean > 50) %>% dplyr::select(ensembl_gene_id) %>% distinct()
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OCtrl <- enrichGO(gene = OCtrl_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OCtrl <- data.frame(ego_BPC_up_OCtrl)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OCtrl <- enrichGO(gene = OCtrl_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OCtrl <- data.frame(ego_BPC_down_OCtrl)
################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OEx <- enrichGO(gene = OEx_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OEx <- data.frame(ego_BPC_up_OEx)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OEx <- enrichGO(gene = OEx_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OEx <- data.frame(ego_BPC_down_OEx)
OCtrl_down_genes
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes
# GO analysis
library(clusterProfiler)
library(org.Mm.eg.db)
# Gene lists
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
bg_genes <- res_all %>% filter(baseMean > 50) %>% dplyr::select(ensembl_gene_id) %>% distinct()
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OCtrl <- enrichGO(gene = OCtrl_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OCtrl <- data.frame(ego_BPC_up_OCtrl)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OCtrl <- enrichGO(gene = OCtrl_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OCtrl <- data.frame(ego_BPC_down_OCtrl)
################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OEx <- enrichGO(gene = OEx_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OEx <- data.frame(ego_BPC_up_OEx)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OEx <- enrichGO(gene = OEx_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OEx <- data.frame(ego_BPC_down_OEx)
cluster_summaryBPC_down_OCtrl
cluster_summaryBPC_up_OCtrl
# GO analysis
library(clusterProfiler)
library(org.Mm.eg.db)
# Gene lists
OCtrl_up_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OCtrl_down_genes <- res_all %>% filter(comparison == "YCtrl_OCtrl" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_up_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange < -1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
OEx_down_genes <- res_all %>% filter(comparison == "YCtrl_OEx" & baseMean > 50 & padj < 0.05 & log2FoldChange > 1) %>% dplyr::select(ensembl_gene_id) %>% distinct()
bg_genes <- res_all %>% filter(baseMean > 50) %>% dplyr::select(ensembl_gene_id) %>% distinct()
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OCtrl <- enrichGO(gene = OCtrl_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OCtrl <- data.frame(ego_BPC_up_OCtrl)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OCtrl <- enrichGO(gene = OCtrl_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OCtrl <- data.frame(ego_BPC_down_OCtrl)
################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_OEx <- enrichGO(gene = OEx_up_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_OEx <- data.frame(ego_BPC_up_OEx)
#################
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_OEx <- enrichGO(gene = OEx_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_OEx <- data.frame(ego_BPC_down_OEx)
cluster_summaryBPC_up_OCtrl
cluster_summaryBPC_up_OEx
cluster_summaryBPC_down_OEx
dotplot(ego_BPC_up_OCtrl, showCategory = 10)
BPC_up_OCtrl_simple <- simplify(BPC_up_OCtrl, cutoff = 0.7, by = "p.adjust", select_fun = min)
BPC_up_OCtrl_simple <- simplify(ego_BPC_up_OCtrl, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_OCtrl_simple, showCategory = 10)
BPC_up_OCtrl_simple
ego_BPC_up_OCtrl
dotplot(ego_BPC_up_OCtrl, showCategory = 10)
BPC_down_OCtrl_simple <- simplify(ego_BPC_down_OCtrl, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_OCtrl_simple, showCategory = 10)
BPC_up_OEx_simple <- simplify(ego_BPC_up_OEx, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_OEx_simple, showCategory = 10)
BPC_down_OEx_simple <- simplify(ego_BPC_down_OEx, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_OEx_simple, showCategory = 10)
dotplot(BPC_up_OCtrl_simple, showCategory = 20)
dotplot(BPC_up_OCtrl_simple, showCategory = 15)
jour <- "mercredi"
jour
BPC_up_OEx_simple <- simplify(ego_BPC_up_OEx, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_OEx_simple, showCategory = 15)
BPC_down_OCtrl_simple <- simplify(ego_BPC_down_OCtrl, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_OCtrl_simple, showCategory = 15)
BPC_down_OEx_simple <- simplify(ego_BPC_down_OEx, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_OEx_simple, showCategory = 15)
exercise_rescue_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter(log2FoldChange.x > 0 & log2FoldChange.y > 0) | (log2FoldChange.x < 0 & log2FoldChange.y < 0) %>% distinct(ensembl_gene_id)
inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype"))
exercise_rescue_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter((log2FoldChange.x > 0 & log2FoldChange.y > 0) | (log2FoldChange.x < 0 & log2FoldChange.y < 0)) %>% distinct(ensembl_gene_id)
exercise_rescue_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter((log2FoldChange.x > 0 & log2FoldChange.y > 0) | (log2FoldChange.x < 0 & log2FoldChange.y < 0)) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_rescue <- enrichGO(gene = exercise_rescue_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_rescue <- data.frame(ego_BPC_rescue)
BPC_rescue_simple <- simplify(ego_BPC_rescue, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_rescue_simple, showCategory = 15)
up_age_down_ex_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter((log2FoldChange.x < 0 & log2FoldChange.y < 0)) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_age_down_ex <- enrichGO(gene = up_age_down_ex_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_age_down_ex <- data.frame(ego_BPC_up_age_down_ex_genes)
## Output results from GO analysis to a table
cluster_summaryBPC_up_age_down_ex <- data.frame(ego_BPC_up_age_down_ex)
BPC_up_age_down_ex_simple <- simplify(ego_BPC_up_age_down_ex, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_age_down_ex_simple, showCategory = 15)
up_age_down_ex_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter((log2FoldChange.x < 0 & log2FoldChange.y < 0)) %>% distinct(ensembl_gene_id)
down_age_up_ex_genes <- inner_join(nom_sig_YCtrl_OCtrl, nom_sig_OCtrl_OEx, by=c("ensembl_gene_id","external_gene_name","gene_biotype")) %>%
filter((log2FoldChange.x > 0 & log2FoldChange.y > 0)) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_age_down_ex <- enrichGO(gene = up_age_down_ex_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_age_down_ex <- data.frame(ego_BPC_up_age_down_ex)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_age_up_ex <- enrichGO(gene = down_age_up_ex_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_age_up_ex <- data.frame(ego_BPC_down_age_up_ex)
BPC_up_age_down_ex_simple <- simplify(ego_BPC_up_age_down_ex, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_age_down_ex_simple, showCategory = 15)
BPC_down_age_up_ex_simple <- simplify(ego_BPC_down_age_up_ex, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_age_up_ex_simple, showCategory = 15)
up_age_down_ex_genes
nrow(up_age_down_ex_genes)
nrow(down_age_up_ex_genes)
nom_sig_OCtrl_OEx_up <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange < 0) %>% distinct(ensembl_gene_id)
nom_sig_OCtrl_OEx_down <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange > 0) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_Old <- enrichGO(gene = Old_down_genes$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
nom_sig_OCtrl_OEx_up <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange < 0) %>% distinct(ensembl_gene_id)
nom_sig_OCtrl_OEx_down <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange > 0) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_Old <- enrichGO(gene = nom_sig_OCtrl_OEx_down$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_Old <- data.frame(ego_BPC_down_Old)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_Old <- enrichGO(gene = nom_sig_OCtrl_OEx_up$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_Old <- data.frame(ego_BPC_up_Old)
BPC_up_Old_simple <- simplify(ego_BPC_up_Old, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(ego_BPC_up_Old_simple, showCategory = 15)
BPC_up_Old_simple <- simplify(ego_BPC_up_Old, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_Old_simple, showCategory = 15)
BPC_down_Old_simple <- simplify(ego_BPC_down_Old, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_Old_simple, showCategory = 15)
dds_OCtrl_OEx
nom_sig_OCtrl_OEx_up <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange > 0) %>% distinct(ensembl_gene_id)
nom_sig_OCtrl_OEx_down <- nom_sig_OCtrl_OEx %>% filter(log2FoldChange < 0) %>% distinct(ensembl_gene_id)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_down_Old <- enrichGO(gene = nom_sig_OCtrl_OEx_down$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_down_Old <- data.frame(ego_BPC_down_Old)
## Run GO enrichment analysis Biological Process (BP)
ego_BPC_up_Old <- enrichGO(gene = nom_sig_OCtrl_OEx_up$ensembl_gene_id,
universe = bg_genes$ensembl_gene_id,
keyType = "ENSEMBL",
OrgDb = org.Mm.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff  = 0.05,
qvalueCutoff = 0.05,
readable = TRUE)
## Output results from GO analysis to a table
cluster_summaryBPC_up_Old <- data.frame(ego_BPC_up_Old)
BPC_up_Old_simple <- simplify(ego_BPC_up_Old, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_up_Old_simple, showCategory = 15)
BPC_down_Old_simple <- simplify(ego_BPC_down_Old, cutoff = 0.7, by = "p.adjust", select_fun = min)
dotplot(BPC_down_Old_simple, showCategory = 15)
