Aldh1l1.Turbo.DIA <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/Aldh1l1_Turbo_DIA_unique_Final.rds")
Aldh1l1.Turbo.DIA <- Aldh1l1.Turbo.DIA[rowMeans(!is.na(Aldh1l1.Turbo.DIA)) >= 0.5, ]
# load Aldh1l1.Turbo.DIA metadata
Aldh1_metadata <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/Aldh1_metadata.rds")
row.names(Aldh1_metadata)==colnames(Aldh1l1.Turbo.DIA)
##  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#IMPORT SUBSET METADATA
metadata.Exp5.ON.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp5.ON.Beads.rds")
metadata.Exp5.OFF.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp5.OFF.Beads.rds")
metadata.Exp4.ON.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp4.ON.Beads.rds")
metadata.Exp4.OFF.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp4.OFF.Beads.rds")
metadata.Exp3.ON.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp3.ON.Beads.rds")
metadata.Exp3.OFF.Beads <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/metadata.Exp3.OFF.Beads.rds")
#MAKING OF SUBSET COUNT MATRIX BASED ON RAW INTENSITY FILE
#Step 1: Get the sample names from metadata
#Step 2: Subset the matrix by these columns
##1
samples <- rownames(metadata.Exp5.ON.Beads)
Aldh1l1.Turbo.DIA_exp5.on.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp5.on.beads)
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp5.on.beads)==row.names(metadata.Exp5.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp5.on.beads, file = 'Aldh1l1.Turbo.DIA_exp5.on.beads.rds')
##2
samples <- rownames(metadata.Exp5.OFF.Beads)
Aldh1l1.Turbo.DIA_exp5.off.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp5.off.beads)
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp5.off.beads)==row.names(metadata.Exp5.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp5.off.beads, file = 'Aldh1l1.Turbo.DIA_exp5.off.beads.rds')
##3
samples <- rownames(metadata.Exp4.ON.Beads)
Aldh1l1.Turbo.DIA_exp4.on.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp4.on.beads)
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp4.on.beads)==row.names(metadata.Exp4.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp4.on.beads, file = 'Aldh1l1.Turbo.DIA_exp4.on.beads.rds')
##4
samples <- rownames(metadata.Exp4.OFF.Beads)
Aldh1l1.Turbo.DIA_exp4.off.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp4.off.beads)
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp4.off.beads)==row.names(metadata.Exp4.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp4.off.beads, file = 'Aldh1l1.Turbo.DIA_exp4.off.beads.rds')
##5
samples <- rownames(metadata.Exp3.ON.Beads)
Aldh1l1.Turbo.DIA_exp3.on.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp3.on.beads )
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp3.on.beads )==row.names(metadata.Exp3.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp3.on.beads , file = 'Aldh1l1.Turbo.DIA_exp3.on.beads.rds')
##6
samples <- rownames(metadata.Exp3.OFF.Beads)
Aldh1l1.Turbo.DIA_exp3.off.beads <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA_exp3.off.beads )
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA_exp3.off.beads )==row.names(metadata.Exp3.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA_exp3.off.beads , file = 'Aldh1l1.Turbo.DIA_exp3.off.beads.rds')
#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp5.on.beads
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp5.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp5.ON.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## Attaching package: 'foreach'
## The following objects are masked from 'package:purrr':
## 
##     accumulate, when
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 13 [0.26%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_5_Turbo vs Exp_5_negative) for volcano ...
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: package 'ggrepel' was built under R version 4.3.3
## Generating PDF volcano for ANOVAout column 3 (Exp_5_Turbo vs Exp_5_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_5_Turbo vs Exp_5_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp5.off.beads
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp5.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp5.OFF.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 22 [0.44%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_5_Turbo vs Exp_5_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_5_Turbo vs Exp_5_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_5_Turbo vs Exp_5_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp4.on.beads
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp4.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp4.ON.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 2 [0.04%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_4_Turbo vs Exp_4_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_4_Turbo vs Exp_4_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_4_Turbo vs Exp_4_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp4.off.beads
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp4.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp4.OFF.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 4 [0.08%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_4_Turbo vs Exp_4_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_4_Turbo vs Exp_4_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_4_Turbo vs Exp_4_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp3.on.beads 
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp3.ON.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp3.ON.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 0 [0%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_3_Turbo vs Exp_3_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_3_Turbo vs Exp_3_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_3_Turbo vs Exp_3_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA_exp3.off.beads 
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.Exp3.OFF.Beads)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.Exp3.OFF.Beads
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 1 [0.02%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_3_Turbo vs Exp_3_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_3_Turbo vs Exp_3_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_3_Turbo vs Exp_3_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

library(readr)
#Exp5_ON_Beads 
diffEx_Exp5_ON_Beads <- read_csv("Erics.ALDH.FINAL/diffEx.Exp5.ON.Beads.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_5_Turbo-Exp_5_negative, diff
## Exp_5_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
#Rename the column
colnames(diffEx_Exp5_ON_Beads)[colnames(diffEx_Exp5_ON_Beads) == "...1"] <- "Protein"
diffEx_Exp5_ON_Beads <- as.data.frame(diffEx_Exp5_ON_Beads)
row.names(diffEx_Exp5_ON_Beads) <- diffEx_Exp5_ON_Beads$Protein

#Step-2
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 1: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05       # p-value threshold

# Step 2: Prepare data
volcano_df <- diffEx_Exp5_ON_Beads %>%
    rename(
        log2FC = `diff Exp_5_Turbo-Exp_5_negative`,
        p_value = `Exp_5_Turbo-Exp_5_negative`
    ) %>%
    mutate(
        log10p = -log10(p_value),
        Significance = case_when(
            log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
            log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
            TRUE ~ "Not Sig"
        )
    )

# Step 3: Count up/down
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 4: Top 15 Up and Down
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(10, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(10, wt = log10p)
top_genes <- bind_rows(top_up, top_down)
top_up
##                       Protein  F-Value     FDR (BH)      p_value   log2FC
## Slc4a4_O88343   Slc4a4_O88343 3378.708 2.892754e-06 1.741923e-09 6.283898
## Map4_P27546       Map4_P27546 1438.066 1.075367e-05 2.245023e-08 3.631223
## Eef1d_P57776     Eef1d_P57776 5574.100 9.681143e-07 3.886448e-10 3.563441
## Stip1_Q60864     Stip1_Q60864 1404.077 1.075367e-05 2.411402e-08 3.783095
## Myo6_Q64331       Myo6_Q64331 7136.251 9.232919e-07 1.853255e-10 8.016202
## Slc20a2_Q80UP8 Slc20a2_Q80UP8 1467.265 1.075367e-05 2.114100e-08 2.583634
## Dlg1_Q811D0       Dlg1_Q811D0 2393.385 6.091933e-06 4.891154e-09 2.800138
## Copa_Q8CIE6       Copa_Q8CIE6 1416.713 1.075367e-05 2.347684e-08 1.909558
## Coro7_Q9D2V7     Coro7_Q9D2V7 1690.228 1.075367e-05 1.384930e-08 3.972169
## Plec_Q9QXS1       Plec_Q9QXS1 1653.715 1.075367e-05 1.478402e-08 2.143308
##                  log10p Significance
## Slc4a4_O88343  8.758971           Up
## Map4_P27546    7.648779           Up
## Eef1d_P57776   9.410447           Up
## Stip1_Q60864   7.617730           Up
## Myo6_Q64331    9.732065           Up
## Slc20a2_Q80UP8 7.674875           Up
## Dlg1_Q811D0    8.310589           Up
## Copa_Q8CIE6    7.629360           Up
## Coro7_Q9D2V7   7.858572           Up
## Plec_Q9QXS1    7.830207           Up
top_down
##                         Protein   F-Value     FDR (BH)      p_value     log2FC
## Nid2_O88322         Nid2_O88322  95.01960 1.308786e-03 6.698927e-05 -0.8516189
## Col4a1_P02463     Col4a1_P02463 393.65342 7.791271e-05 1.063441e-06 -1.3272487
## Col4a2_P08122     Col4a2_P08122  66.59384 2.702409e-03 1.821995e-04 -1.0203593
## Nid1_P10493         Nid1_P10493  87.14107 1.558827e-03 8.563691e-05 -1.0009125
## Lama4_P97927       Lama4_P97927  92.42635 1.393898e-03 7.246966e-05 -1.1633267
## Rasl11a_Q6IMB1   Rasl11a_Q6IMB1  97.50928 1.250236e-03 6.223573e-05 -0.8184796
## Tmem106b_Q80X71 Tmem106b_Q80X71  54.11618 4.126996e-03 3.230687e-04 -0.3920583
## Bmp2k_Q91Z96       Bmp2k_Q91Z96 241.03900 1.974703e-04 4.518590e-06 -0.7461150
## Ddx50_Q99MJ9       Ddx50_Q99MJ9 105.26842 1.083547e-03 5.002323e-05 -0.4963876
## Srrt_Q99MR6         Srrt_Q99MR6  68.73999 2.607252e-03 1.667912e-04 -0.7918027
##                   log10p Significance
## Nid2_O88322     4.173995         Down
## Col4a1_P02463   5.973287         Down
## Col4a2_P08122   3.739453         Down
## Nid1_P10493     4.067339         Down
## Lama4_P97927    4.139844         Down
## Rasl11a_Q6IMB1  4.205960         Down
## Tmem106b_Q80X71 3.490705         Down
## Bmp2k_Q91Z96    5.344997         Down
## Ddx50_Q99MJ9    4.300828         Down
## Srrt_Q99MR6     3.777827         Down
# Save volcano plot to PDF
# Save to PDF
# Save volcano plot to PDF
pdf("Exp5_ON_Beads.volcano.pdf", width = 8, height = 6)

# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp5_ON_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 40 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp5_ON_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##      60    3545    1417
library(readr)
diffEx_Exp5_OFF_beads <- read_csv("/Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based/diffEx.Exp5.OFF.beads.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_5_Turbo-Exp_5_negative, diff
## Exp_5_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp5_OFF_beads)[colnames(diffEx_Exp5_OFF_beads) == "...1"] <- "Protein"
diffEx_Exp5_OFF_beads <- as.data.frame(diffEx_Exp5_OFF_beads)
row.names(diffEx_Exp5_OFF_beads) <- diffEx_Exp5_OFF_beads$Protein

# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp5_OFF_beads %>%
  rename(
    log2FC = `diff Exp_5_Turbo-Exp_5_negative`,
    p_value = `Exp_5_Turbo-Exp_5_negative`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("Exp5_OFF_Beads.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp5_OFF_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 12 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp5_OFF_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##      74    3388    1560
library(readr)
diffEx_Exp4_ON_Beads <- read_csv("/Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based/diffEx.Exp4.ON.Beads.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_4_Turbo-Exp_4_negative, diff
## Exp_4_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp4_ON_Beads)[colnames(diffEx_Exp4_ON_Beads) == "...1"] <- "Protein"
diffEx_Exp4_ON_Beads <- as.data.frame(diffEx_Exp4_ON_Beads)
row.names(diffEx_Exp4_ON_Beads) <- diffEx_Exp4_ON_Beads$Protein

# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp4_ON_Beads %>%
  rename(
    log2FC = `diff Exp_4_Turbo-Exp_4_negative`,
    p_value = `Exp_4_Turbo-Exp_4_negative`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("Exp4_ON_Beads.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp4_ON_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp4_ON_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##     351    3983     688
library(readr)
diffEx_Exp4_OFF_Beads <- read_csv("/Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based/diffEx.Exp4.OFF.Beads.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_4_Turbo-Exp_4_negative, diff
## Exp_4_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp4_OFF_Beads)[colnames(diffEx_Exp4_OFF_Beads) == "...1"] <- "Protein"
diffEx_Exp4_OFF_Beads <- as.data.frame(diffEx_Exp4_OFF_Beads)
row.names(diffEx_Exp4_OFF_Beads) <- diffEx_Exp4_OFF_Beads$Protein

# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp4_OFF_Beads %>%
  rename(
    log2FC = `diff Exp_4_Turbo-Exp_4_negative`,
    p_value = `Exp_4_Turbo-Exp_4_negative` 
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("Exp4_OFF_Beads.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp4_OFF_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp4_OFF_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##     649    3633     740
library(readr)
diffEx_Exp3_ON_Beads <- read_csv("Erics.ALDH.FINAL/diffEx.Exp3.ON.Beadscsv.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_3_Turbo-Exp_3_negative, diff
## Exp_3_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp3_ON_Beads)[colnames(diffEx_Exp3_ON_Beads) == "...1"] <- "Protein"
diffEx_Exp3_ON_Beads <- as.data.frame(diffEx_Exp3_ON_Beads)
row.names(diffEx_Exp3_ON_Beads) <- diffEx_Exp3_ON_Beads$Protein
# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp3_ON_Beads %>%
  rename(
    log2FC = `diff Exp_3_Turbo-Exp_3_negative`,
    p_value = `Exp_3_Turbo-Exp_3_negative`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("Exp3_ON_Beads.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp3_ON_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 89 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp3_ON_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##     124    4392     506
library(readr)
diffEx_Exp3_OFF_Beads <- read_csv("Erics.ALDH.FINAL/diffEx.Exp3.OFF.Beads.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_3_Turbo-Exp_3_negative, diff
## Exp_3_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp3_OFF_Beads)[colnames(diffEx_Exp3_OFF_Beads) == "...1"] <- "Protein"
diffEx_Exp3_OFF_Beads <- as.data.frame(diffEx_Exp3_OFF_Beads)
row.names(diffEx_Exp3_OFF_Beads) <- diffEx_Exp3_OFF_Beads$Protein
# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp3_OFF_Beads %>%
  rename(
    log2FC = `diff Exp_3_Turbo-Exp_3_negative` ,
    p_value = `Exp_3_Turbo-Exp_3_negative`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("Exp3_OFF_Beads.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "Exp3_OFF_Beads:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 40 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'Exp3_OFF_Beads.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##      92    4043     887
metadata.INPUT <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based/metadata.INPUT.rds")
samples <- rownames(metadata.INPUT)
Aldh1l1.Turbo.DIA.INPUT <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA.INPUT)
## [1] 5022    4
colnames(Aldh1l1.Turbo.DIA.INPUT)==row.names(metadata.INPUT)
## [1] TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA.INPUT, file = 'Aldh1l1.Turbo.DIA.INPUT.rds')
###
#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA.INPUT
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.INPUT)
## [1] TRUE TRUE TRUE TRUE
numericMeta <- metadata.INPUT
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 6 [0.12%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (strap_Urea vs strap_sds) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (strap_Urea vs strap_sds) ...
## Generating HTML volcano for ANOVAout column 3 (strap_Urea vs strap_sds) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

library(readr)
diffEx_strap_Urea_vs_strap_sds_INPUT <- read_csv("Erics.ALDH.FINAL/diffEx.strap_Urea_vs_strap_sds.INPUT.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), strap_Urea-strap_sds, diff
## strap_Urea-strap_sds
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_strap_Urea_vs_strap_sds_INPUT)[colnames(diffEx_strap_Urea_vs_strap_sds_INPUT) == "...1"] <- "Protein"
diffEx_strap_Urea_vs_strap_sds_INPUT <- as.data.frame(diffEx_strap_Urea_vs_strap_sds_INPUT)
row.names(diffEx_strap_Urea_vs_strap_sds_INPUT) <- diffEx_strap_Urea_vs_strap_sds_INPUT$Protein
# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_strap_Urea_vs_strap_sds_INPUT %>%
  rename(
    log2FC = `diff strap_Urea-strap_sds` ,
    p_value = `strap_Urea-strap_sds`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("strap_Urea_vs_strap_sds_INPUT.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "INPUT:strap_Urea_vs_strap_sds",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 58 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'strap_Urea_vs_strap_sds_INPUT.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##     357    4260     405
metadata.ISD <- readRDS("~/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based/metadata.ISD.rds")
samples <- rownames(metadata.ISD)
Aldh1l1.Turbo.DIA.ISD <- Aldh1l1.Turbo.DIA[, samples]
dim(Aldh1l1.Turbo.DIA.ISD)
## [1] 5022    8
colnames(Aldh1l1.Turbo.DIA.ISD)==row.names(metadata.ISD)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
saveRDS(Aldh1l1.Turbo.DIA.ISD, file = 'Aldh1l1.Turbo.DIA.ISD.rds')
###
#note: Imputation is not working well so here i did not used imputaion
cleanDat <- Aldh1l1.Turbo.DIA.ISD
cleanDat <- log2(cleanDat + 1)
# Step 2: Median normalization (column-wise centering)
normalize_median <- function(mat) {
    sweep(mat, 2, apply(mat, 2, median, na.rm = TRUE), FUN = "-")
}

log2_median_norm <- normalize_median(cleanDat)
cleanDat <- log2_median_norm
colnames(cleanDat)==rownames(metadata.ISD)
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
numericMeta <- metadata.ISD
numericMeta$Group <- numericMeta$Group1.old
condition <- numericMeta$Group
Grouping <- numericMeta$Group
source("/Users/us74/Desktop/2025/parANOVA.dex.R")
ANOVAout <- parANOVA.dex()
## - parallelThreads variable not set. Running with 2 threads only.
## - Network color assignment vector not supplied or not of length in rows of cleanDat; will not be included in output table and data frame.
## - twoGroupCorrMethod variable not set to a correction method for p.adjust when only 2 groups of samples specified in Grouping. Using Benjamini Hochberg 'BH' FDR.
## - fallbackIfSmallTukeyP variable not set. Using recommended Bonferroni t-test FDR for unreliable Tukey p values <10^-8.5
## 
## ...Tukey p<10^-8.5 Fallback calculations using Bonferroni corrected T test: 14 [0.28%]
labelTop <- 15
FCmin= 0
flip = -3
signifP=0.05
plotVolc()
## - No comparison p value columns selected in selectComps. Using ALL comparisons.
##  - selectComps may not reference valid integer p value column indexes of ANOVAout (or CORout).
##    Output will be for all comparisons or correlation(s).
## - useNETcolors not set or not TRUE/FALSE. NETcolors not found in ANOVAout, so 3 color volcano(es) will be drawn.
## - Variable outputfigs not specified. Saving volcano plots to /Users/us74/Desktop/Eric.AlDH.data.06.2025/Aldh1l1_Turbo_DIA_Phospho.Analysis/raw.Intensity.based .
## 
## ...Thresholds:
##    [x] Applying a 0% minimum fold change threshold at + and - x=0 .
##    [y] with minimum significance cutoff p < 0.05, equivalent to -log10(p) y=1.3 .
## 
## Processing ANOVA column 3 (Exp_1_Turbo vs Exp_1_negative) for volcano ...
## Generating PDF volcano for ANOVAout column 3 (Exp_1_Turbo vs Exp_1_negative) ...
## Generating HTML volcano for ANOVAout column 3 (Exp_1_Turbo vs Exp_1_negative) ...
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues
## Warning in geom2trace.default(dots[[1L]][[3L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomLabelRepel() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

library(readr)
diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD <- read_csv("Erics.ALDH.FINAL/diffEx.Exp_1_Turbo_vs_Exp_1_negative.ISD.csv")
## New names:
## Rows: 5022 Columns: 5
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (4): F-Value, FDR (BH), Exp_1_Turbo-Exp_1_negative, diff
## Exp_1_Turbo-Exp...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
# Step 0: Rename and prepare
colnames(diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD)[colnames(diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD) == "...1"] <- "Protein"
diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD <- as.data.frame(diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD)
row.names(diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD) <- diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD$Protein
# Step 1: Load libraries
library(ggplot2)
library(dplyr)
library(ggrepel)

# Step 2: Set thresholds
fc_cutoff <- 0        # log2 fold change threshold
p_cutoff <- 0.05      # p-value threshold

# Step 3: Prepare volcano data
volcano_df <- diffEx_Exp_1_Turbo_vs_Exp_1_negative_ISD %>%
  rename(
    log2FC = `diff Exp_1_Turbo-Exp_1_negative`, 
    p_value = `Exp_1_Turbo-Exp_1_negative`
  ) %>%
  mutate(
    log10p = -log10(p_value),
    Significance = case_when(
      log2FC >= fc_cutoff & p_value < p_cutoff ~ "Up",
      log2FC <= -fc_cutoff & p_value < p_cutoff ~ "Down",
      TRUE ~ "Not Sig"
    )
  )

# Step 4: Count significant proteins
up_count <- sum(volcano_df$Significance == "Up", na.rm = TRUE)
down_count <- sum(volcano_df$Significance == "Down", na.rm = TRUE)

# Step 5: Get top 15 most significant Up/Down proteins
top_up <- volcano_df %>% filter(Significance == "Up") %>% top_n(15, wt = log10p)
top_down <- volcano_df %>% filter(Significance == "Down") %>% top_n(15, wt = log10p)
top_genes <- bind_rows(top_up, top_down)

# Step 6: Save volcano plot to PDF
pdf("ISD_Exp_1_Turbo_vs_Exp_1_negative.volcano.pdf", width = 8, height = 6)
# Plot
ggplot(volcano_df, aes(x = log2FC, y = log10p)) +
    geom_point(aes(color = Significance), size = 2, alpha = 0.8) +
    scale_color_manual(values = c("Up" = "red", "Down" = "blue", "Not Sig" = "grey")) +
    geom_vline(xintercept = c(-fc_cutoff, fc_cutoff), linetype = "dashed", color = "black") +
    geom_hline(yintercept = -log10(p_cutoff), linetype = "dashed", color = "black") +
    geom_text_repel(data = top_genes, aes(label = Protein), size = 3.5, max.overlaps = 100) +
    annotate("text", x = max(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Up: ", up_count), hjust = 1.1, vjust = 1.5, color = "red", size = 5) +
    annotate("text", x = min(volcano_df$log2FC, na.rm = TRUE), y = max(volcano_df$log10p, na.rm = TRUE),
             label = paste0("Down: ", down_count), hjust = -0.1, vjust = 1.5, color = "blue", size = 5) +
    scale_x_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    labs(
        title = "ISD:Turbo vs Negative",
        x = "Log2 Fold Change (Turbo vs Negative)",
        y = "-log10(p-value)"
    ) +
    theme_minimal(base_size = 14)
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
dev.off()
## quartz_off_screen 
##                 2
write.csv(volcano_df, file = 'ISD_Exp_1_Turbo_vs_Exp_1_negative.volcano.result.csv', row.names = FALSE)
table(volcano_df$Significance)
## 
##    Down Not Sig      Up 
##     795    3208    1019