Add new configuration file
This commit is contained in:
@@ -1,12 +1,4 @@
|
||||
#!/usr/bin/env Rscript
|
||||
# This R script performs GTA L and K Pairwise Compares for user specified pairs of Experiments
|
||||
#
|
||||
# Updated 240724 Bryan C Roessler to improve file operations and portability
|
||||
# NOTE: The two required arguments are the same and now there are two optional arguments
|
||||
# 1. Exp1
|
||||
# 2. Exp2
|
||||
# 3. StudyInfo.csv file
|
||||
# 4. Output Directory
|
||||
|
||||
library("ggplot2")
|
||||
library("plotly")
|
||||
@@ -16,31 +8,14 @@ library("grid")
|
||||
library("ggthemes")
|
||||
|
||||
args <- commandArgs(TRUE)
|
||||
exp_name <- args[1]
|
||||
exp_name2 <- args[2]
|
||||
exp1_name <- args[1]
|
||||
exp1_file <- args[2]
|
||||
exp2_name <- args[3]
|
||||
exp2_file <- args[4]
|
||||
output_dir <- args[5]
|
||||
|
||||
if (length(args) >= 3) {
|
||||
study_info_file <- args[3]
|
||||
} else {
|
||||
study_info_file <- "StudyInfo.csv"
|
||||
}
|
||||
|
||||
if (length(args) >= 4) {
|
||||
output_dir <- args[4]
|
||||
} else {
|
||||
output_dir <- "gta"
|
||||
}
|
||||
|
||||
expNumber1 <- as.numeric(sub("^.*?(\\d+)$", "\\1", exp_name))
|
||||
expNumber2 <- as.numeric(sub("^.*?(\\d+)$", "\\1", exp_name2))
|
||||
Labels <- read.csv(file = study_info_file, stringsAsFactors = FALSE)
|
||||
Name1 <- Labels[expNumber1, 2]
|
||||
Name2 <- Labels[expNumber2, 2]
|
||||
go_terms_file <- "Average_GOTerms_All.csv"
|
||||
input_file1 <- file.path(output_dir, exp_name, go_terms_file)
|
||||
input_file2 <- file.path(output_dir, exp_name2, go_terms_file)
|
||||
pairDirL <- file.path(output_dir, paste0("PairwiseCompareL_", exp_name, "-", exp_name2))
|
||||
pairDirK <- file.path(output_dir, paste0("PairwiseCompareK_", exp_name, "-", exp_name2))
|
||||
pairDirL <- file.path(output_dir, paste0("PairwiseCompareL_", exp1_name, "-", exp2_name))
|
||||
pairDirK <- file.path(output_dir, paste0("PairwiseCompareK_", exp1_name, "-", exp2_name))
|
||||
|
||||
# Pairwise L
|
||||
# outputPlotly <- "../GTAresults/PairwiseCompareL/" #"/GTAresults/PairwiseCompareL/"
|
||||
@@ -75,21 +50,6 @@ theme_Publication <- function(base_size = 14, base_family = "sans") {
|
||||
)
|
||||
}
|
||||
|
||||
scale_fill_Publication <- function(...) {
|
||||
library(scales)
|
||||
discrete_scale("fill", "Publication", manual_pal(
|
||||
values = c("#386cb0", "#fdb462", "#7fc97f", "#ef3b2c", "#662506",
|
||||
"#a6cee3", "#fb9a99", "#984ea3", "#ffff33")), ...
|
||||
)
|
||||
}
|
||||
|
||||
scale_colour_Publication <- function(...) {
|
||||
discrete_scale("colour", "Publication", manual_pal(
|
||||
values = c("#386cb0", "#fdb462", "#7fc97f", "#ef3b2c", "#662506",
|
||||
"#a6cee3", "#fb9a99", "#984ea3", "#ffff33")), ...
|
||||
)
|
||||
}
|
||||
|
||||
theme_Publication_legend_right <- function(base_size = 14, base_family = "sans") {
|
||||
(theme_foundation(base_size = base_size, base_family = base_family) +
|
||||
theme(
|
||||
@@ -131,8 +91,8 @@ scale_colour_Publication <- function(...) {
|
||||
"#a6cee3", "#fb9a99", "#984ea3", "#ffff33")), ...)
|
||||
}
|
||||
|
||||
X1 <- read.csv(file = input_file1, stringsAsFactors = FALSE, header = TRUE)
|
||||
X2 <- read.csv(file = input_file2, stringsAsFactors = FALSE, header = TRUE)
|
||||
X1 <- read.csv(file = exp1_file, stringsAsFactors = FALSE, header = TRUE)
|
||||
X2 <- read.csv(file = exp2_file, stringsAsFactors = FALSE, header = TRUE)
|
||||
|
||||
X <- merge(X1, X2, by = "Term_Avg", all = TRUE, suffixes = c("_X1", "_X2"))
|
||||
gg <- ggplot(data = X, aes(
|
||||
@@ -146,7 +106,7 @@ gg <- ggplot(data = X, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(
|
||||
aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2),
|
||||
color = "grey20",
|
||||
@@ -156,12 +116,12 @@ gg <- ggplot(data = X, aes(
|
||||
fill = NA
|
||||
) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, " vs. ", Name2) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, " vs. ", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOntology.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOntology.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -169,7 +129,7 @@ pdf(
|
||||
gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOntology.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOntology.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
# ID aggravators and alleviators, regardless of whether they meet 2SD threshold
|
||||
@@ -184,19 +144,19 @@ X2_Specific_Alleviators_X1_Aggravators <- X[which(X$Z_lm_L_Avg_X2 <= -2 & X$Z_lm
|
||||
X$Overlap_Avg <- NA
|
||||
|
||||
try(X[X$Term_Avg %in% X1_Specific_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name1, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Alleviators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name1, "Specific_Deletion_Suppresors", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Suppresors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% Overlap_Aggravators$Term_Avg, ]$Overlap_Avg <- "Overlapping_Deletion_Enhancers")
|
||||
try(X[X$Term_Avg %in% Overlap_Alleviators$Term_Avg, ]$Overlap_Avg <- "Overlapping_Deletion_Suppressors")
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators_X1_Alleviatiors$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Deletion_Enhancers", Name1, "Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Enhancers", exp1_name, "Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators_X1_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Deletion_Suppressors", Name1, "Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Suppressors", exp1_name, "Deletion_Enhancers", sep = "_"))
|
||||
|
||||
gg <- ggplot(data = X, aes(
|
||||
x = Z_lm_L_Avg_X1,
|
||||
@@ -209,7 +169,7 @@ gg <- ggplot(data = X, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(
|
||||
aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2),
|
||||
color = "grey20",
|
||||
@@ -219,12 +179,12 @@ gg <- ggplot(data = X, aes(
|
||||
fill = NA
|
||||
) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, " vs. ", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, " vs. ", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -232,7 +192,7 @@ pdf(
|
||||
gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOverlap.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
x_rem2_gene <- X[X$NumGenes_Avg_X1 >= 2 & X$NumGenes_Avg_X2 >= 2, ]
|
||||
@@ -249,15 +209,15 @@ gg <- ggplot(data = x_rem2_gene, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_above2genes.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_above2genes.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -266,7 +226,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOverlap_above2genes.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap_above2genes.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#4
|
||||
@@ -282,15 +242,15 @@ gg <- ggplot(data = X_overlap_nothresold, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_Above2SD_ByOverlap.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_Above2SD_ByOverlap.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -299,7 +259,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_Above2SD_ByOverlap.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_Above2SD_ByOverlap.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
# Only output GTA terms where average score is still above 2 after subtracting the SD
|
||||
@@ -320,16 +280,16 @@ X2_Specific_Aggravators2_X1_Alleviatiors2 <- Z1[which(Z1$L_Subtract_SD_X2 >= 2 &
|
||||
X2_Specific_Alleviators2_X1_Aggravators2 <- Z2[which(Z2$L_Subtract_SD_X2 <= -2 & Z1$L_Subtract_SD_X1 >= 2), ]
|
||||
X$Overlap <- NA
|
||||
|
||||
try(X[X$Term_Avg %in% X1_Specific_Aggravators2$Term_Avg, ]$Overlap <- paste(Name1, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Alleviators2$Term_Avg, ]$Overlap <- paste(Name1, "Specific_Deletion_Suppresors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators2$Term_Avg, ]$Overlap <- paste(Name2, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators2$Term_Avg, ]$Overlap <- paste(Name2, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Aggravators2$Term_Avg, ]$Overlap <- paste(exp1_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Alleviators2$Term_Avg, ]$Overlap <- paste(exp1_name, "Specific_Deletion_Suppresors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators2$Term_Avg, ]$Overlap <- paste(exp2_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators2$Term_Avg, ]$Overlap <- paste(exp2_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% Overlap_Aggravators2$Term_Avg, ]$Overlap <- "Overlapping_Deletion_Enhancers")
|
||||
try(X[X$Term_Avg %in% Overlap_Alleviators2$Term_Avg, ]$Overlap <- "Overlapping_Deletion_Suppressors")
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators2_X1_Alleviatiors2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Deletion_Enhancers", Name1, "Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Enhancers", exp1_name, "Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators2_X1_Aggravators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Deletion_Suppressors", Name1, "Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Suppressors", exp1_name, "Deletion_Enhancers", sep = "_"))
|
||||
|
||||
#5
|
||||
X_abovethreshold <- X[!(is.na(X$Overlap)), ]
|
||||
@@ -345,15 +305,15 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, " vs. ", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, " vs. ", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -362,7 +322,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#6
|
||||
@@ -377,16 +337,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = Term_Avg), nudge_y = 0.25, size = 2) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_names.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_names.pdf")),
|
||||
width = 20,
|
||||
height = 20
|
||||
)
|
||||
@@ -395,7 +355,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_names.html"))
|
||||
fname <- file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_names.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
X_abovethreshold$X1_Rank <- NA
|
||||
@@ -415,16 +375,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = X1_Rank), nudge_y = 0.25, size = 4) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX1.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX1.pdf")),
|
||||
width = 15,
|
||||
height = 15
|
||||
)
|
||||
@@ -435,7 +395,7 @@ pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
|
||||
fname <-
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX1.html"))
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX1.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#8
|
||||
@@ -450,16 +410,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_L_SD_X1,
|
||||
SD_2 = Z_lm_L_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = X2_Rank), nudge_y = 0.25, size = 4) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX2.pdf")),
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX2.pdf")),
|
||||
width = 15,
|
||||
height = 15
|
||||
)
|
||||
@@ -469,18 +429,18 @@ dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <-
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX2.html"))
|
||||
file.path(pairDirL, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX2.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
write.csv(
|
||||
x = X,
|
||||
file.path(pairDirL, paste0("All_GTA_Avg_Scores_", Name1, "_vs_", Name2, ".csv")),
|
||||
file.path(pairDirL, paste0("All_GTA_Avg_Scores_", exp1_name, "_vs_", exp2_name, ".csv")),
|
||||
row.names = FALSE
|
||||
)
|
||||
|
||||
write.csv(
|
||||
x = X_abovethreshold,
|
||||
file = file.path(pairDirL, paste0("AboveThreshold_GTA_Avg_Scores_", Name1, "_vs_", Name2, ".csv")),
|
||||
file = file.path(pairDirL, paste0("AboveThreshold_GTA_Avg_Scores_", exp1_name, "_vs_", exp2_name, ".csv")),
|
||||
row.names = FALSE
|
||||
)
|
||||
|
||||
@@ -582,8 +542,8 @@ scale_colour_Publication <- function(...) {
|
||||
)
|
||||
}
|
||||
|
||||
X1 <- read.csv(file = input_file1, stringsAsFactors = FALSE, header = TRUE)
|
||||
X2 <- read.csv(file = input_file2, stringsAsFactors = FALSE, header = TRUE)
|
||||
X1 <- read.csv(file = exp1_file, stringsAsFactors = FALSE, header = TRUE)
|
||||
X2 <- read.csv(file = exp2_file, stringsAsFactors = FALSE, header = TRUE)
|
||||
|
||||
#1
|
||||
X <- merge(X1, X2, by = "Term_Avg", all = TRUE, suffixes = c("_X1", "_X2"))
|
||||
@@ -599,15 +559,15 @@ gg <- ggplot(data = X, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOntology.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOntology.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -616,7 +576,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOntology.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOntology.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#2
|
||||
@@ -632,23 +592,23 @@ X2_Specific_Alleviators_X1_Aggravators <- X[which(X$Z_lm_K_Avg_X2 <= -2 & X$Z_lm
|
||||
X$Overlap_Avg <- NA
|
||||
|
||||
try(X[X$Term_Avg %in% X1_Specific_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name1, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Alleviators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name1, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% Overlap_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
"Overlapping_Deletion_Suppressors")
|
||||
try(X[X$Term_Avg %in% Overlap_Alleviators$Term_Avg, ]$Overlap_Avg <-
|
||||
"Overlapping_Deletion_Enhancers")
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators_X1_Alleviatiors$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Deletion_Suppressors", Name1, "Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Suppressors", exp1_name, "Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators_X1_Aggravators$Term_Avg, ]$Overlap_Avg <-
|
||||
paste(Name2, "Deletion_Enhancers", Name1, "Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Enhancers", exp1_name, "Deletion_Suppressors", sep = "_"))
|
||||
|
||||
plotly_path <- file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_byOverlap.html"))
|
||||
plotly_path <- file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap.html"))
|
||||
gg <- ggplot(data = X, aes(
|
||||
x = Z_lm_K_Avg_X1,
|
||||
y = Z_lm_K_Avg_X2,
|
||||
@@ -660,15 +620,15 @@ gg <- ggplot(data = X, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -678,12 +638,12 @@ dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
|
||||
#2
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOverlap.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#3
|
||||
x_rem2_gene <- X[X$NumGenes_Avg_X1 >= 2 & X$NumGenes_Avg_X2 >= 2, ]
|
||||
plotly_path <- file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_byOverlap_above2genes.html"))
|
||||
plotly_path <- file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap_above2genes.html"))
|
||||
gg <- ggplot(data = x_rem2_gene, aes(
|
||||
x = Z_lm_K_Avg_X1,
|
||||
y = Z_lm_K_Avg_X2,
|
||||
@@ -695,15 +655,15 @@ gg <- ggplot(data = x_rem2_gene, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_above2genes.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_above2genes.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -712,7 +672,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_byOverlap_above2genes.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_byOverlap_above2genes.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#4
|
||||
@@ -728,15 +688,15 @@ gg <- ggplot(data = X_overlap_nothresold, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_Above2SD_ByOverlap.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_Above2SD_ByOverlap.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -746,7 +706,7 @@ dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_Above2SD_ByOverlap.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_Above2SD_ByOverlap.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#5
|
||||
@@ -769,21 +729,21 @@ X2_Specific_Alleviators2_X1_Aggravators2 <- Z2[which(Z2$L_Subtract_SD_X2 <= -2 &
|
||||
X$Overlap <- NA
|
||||
|
||||
try(X[X$Term_Avg %in% X1_Specific_Aggravators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name1, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X1_Specific_Alleviators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name1, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp1_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Suppressors", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Specific_Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% Overlap_Aggravators2$Term_Avg, ]$Overlap <-
|
||||
"Overlapping_Deletion_Suppressors")
|
||||
try(X[X$Term_Avg %in% Overlap_Alleviators2$Term_Avg, ]$Overlap <-
|
||||
"Overlapping_Deletion_Enhancers")
|
||||
try(X[X$Term_Avg %in% X2_Specific_Aggravators2_X1_Alleviatiors2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Deletion_Suppressors", Name1, "Deletion_Enhancers", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Suppressors", exp1_name, "Deletion_Enhancers", sep = "_"))
|
||||
try(X[X$Term_Avg %in% X2_Specific_Alleviators2_X1_Aggravators2$Term_Avg, ]$Overlap <-
|
||||
paste(Name2, "Deletion_Enhancers", Name1, "Deletion_Suppressors", sep = "_"))
|
||||
paste(exp2_name, "Deletion_Enhancers", exp1_name, "Deletion_Suppressors", sep = "_"))
|
||||
|
||||
X_abovethreshold <- X[!(is.na(X$Overlap)), ]
|
||||
gg <- ggplot(data = X_abovethreshold, aes(
|
||||
@@ -797,15 +757,15 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold.pdf")),
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
@@ -814,7 +774,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#6
|
||||
@@ -829,16 +789,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = Term_Avg), nudge_y = 0.25, size = 2) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, " vs. ", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, " vs. ", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_names.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_names.pdf")),
|
||||
width = 20,
|
||||
height = 20
|
||||
)
|
||||
@@ -846,7 +806,7 @@ gg
|
||||
dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_names.html"))
|
||||
fname <- file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_names.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#7
|
||||
@@ -866,16 +826,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = X1_Rank), nudge_y = 0.25, size = 4) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX1.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX1.pdf")),
|
||||
width = 15,
|
||||
height = 15
|
||||
)
|
||||
@@ -885,7 +845,7 @@ dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <-
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX1.html"))
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX1.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
#8
|
||||
@@ -900,16 +860,16 @@ gg <- ggplot(data = X_abovethreshold, aes(
|
||||
SD_1 = Z_lm_K_SD_X1,
|
||||
SD_2 = Z_lm_K_SD_X2
|
||||
)) +
|
||||
xlab(paste("GO Term Avg lm Z for", Name1)) +
|
||||
xlab(paste("GO Term Avg lm Z for", exp1_name)) +
|
||||
geom_text(aes(label = X2_Rank), nudge_y = 0.25, size = 4) +
|
||||
geom_rect(aes(xmin = -2, xmax = 2, ymin = -2, ymax = 2), color = "grey20", size = 0.25, alpha = 0.1, inherit.aes = FALSE, fill = NA) +
|
||||
geom_point(shape = 3, size = 3) +
|
||||
ylab(paste("GO Term Avg lm Z for", Name2)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", Name1, "vs.", Name2)) +
|
||||
ylab(paste("GO Term Avg lm Z for", exp2_name)) +
|
||||
ggtitle(paste("Comparing Average GO Term Z lm for", exp1_name, "vs.", exp2_name)) +
|
||||
theme_Publication_legend_right()
|
||||
|
||||
pdf(
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX2.pdf")),
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTF_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX2.pdf")),
|
||||
width = 15,
|
||||
height = 15
|
||||
)
|
||||
@@ -919,17 +879,17 @@ dev.off()
|
||||
pgg <- ggplotly(gg)
|
||||
#pgg
|
||||
fname <-
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", Name1, "_vs_", Name2, "_All_ByOverlap_AboveThreshold_numberedX2.html"))
|
||||
file.path(pairDirK, paste0("Scatter_lm_GTA_Averages_", exp1_name, "_vs_", exp2_name, "_All_ByOverlap_AboveThreshold_numberedX2.html"))
|
||||
htmlwidgets::saveWidget(pgg, fname)
|
||||
|
||||
write.csv(
|
||||
x = X,
|
||||
file = file.path(pairDirK, paste0("All_GTF_Avg_Scores_", Name1, "_vs_", Name2, ".csv")),
|
||||
file = file.path(pairDirK, paste0("All_GTF_Avg_Scores_", exp1_name, "_vs_", exp2_name, ".csv")),
|
||||
row.names = FALSE
|
||||
)
|
||||
|
||||
write.csv(
|
||||
x = X_abovethreshold,
|
||||
file = file.path(pairDirK, paste0("AboveThreshold_GTF_Avg_Scores_", Name1, "_vs_", Name2, ".csv")),
|
||||
file = file.path(pairDirK, paste0("AboveThreshold_GTF_Avg_Scores_", exp1_name, "_vs_", exp2_name, ".csv")),
|
||||
row.names = FALSE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user