Analysis of expression values in monocytes

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(ggpubr)
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
#mpnocyte_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022/pseudobulk/Input_data_tab_5ds.tsv', sep='\t',header=T)
mpnocyte_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022/mono/Input_data_tab_5ds.tsv', sep='\t',header=T)
#bulk_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022//Input_data_tab_5ds.tsv', sep='\t',header=T)
monocyte_5ds_top <-   mpnocyte_5ds %>% group_by(feature_id_ng)  %>% distinct(feature_id_ng, .keep_all= TRUE)

Checking eQTLGen Zscore

k1 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v2_1m", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v2_1m", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v3_1m", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v3_1m", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_stemi_v3", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

library(ggpubr)

k1 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v2_1m", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v2_1m", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v3_1m", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v3_1m", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_stemi_v3", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

k1 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "beta_v2_1m", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "beta_v2_1m", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "beta_v3_1m", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "beta_v3_1m", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "beta_stemi_v3", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

k1 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "beta_se_v2_1m", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "beta_se_v2_1m", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "beta_se_v3_1m", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "beta_se_v3_1m", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "beta_se_stemi_v3", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

k1 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v2_1m", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v2_1m", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v3_1m", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v3_1m", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "mean.cell_stemi_v3", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

Calculating BH and Bonf for each datasets

library(multtest)
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## The following object is masked from 'package:gridExtra':
## 
##     combine
## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which.max, which.min
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_ng)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_ng, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_ng<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_ng <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_stemi_v2)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_stemi_v2, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_stemi_v2<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_stemi_v2 <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_stemi_v3)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_stemi_v3, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_stemi_v3   <- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_stemi_v3 <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_v2_1m)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_v2_1m, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_v2_1m<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_v2_1m <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_v3_1m)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_v3_1m, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_v3_1m<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_v3_1m <- multTestOut_zw[,3]
'ng'
## [1] "ng"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_ng <0.05,])
## [1] 617 276
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_ng <0.05,])
## [1]  80 276
'ng'
## [1] "ng"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_ng <0.05,])
## [1] 617 276
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_ng <0.05,])
## [1]  80 276
'v2_1m'
## [1] "v2_1m"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_v2_1m <0.05,])
## [1] 1369  276
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_v2_1m <0.05,])
## [1] 590 276
'v3_1m'
## [1] "v3_1m"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_v3_1m <0.05,])
## [1] 2294  276
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_v3_1m <0.05,])
## [1] 202 276
'stemi_v2'
## [1] "stemi_v2"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_stemi_v2 <0.05,])
## [1]   0 276
    dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_stemi_v2 <0.05,])
## [1]   0 276
  'stemi_v3'
## [1] "stemi_v3"
  dim(mpnocyte_5ds[mpnocyte_5ds$BH_stemi_v3 <0.05,])
## [1]   0 276
  dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_stemi_v3 <0.05,])
## [1]   0 276
  rm(monocyte_5ds_top)

PBMC

mpnocyte_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022/pseudobulk/Input_data_tab_5ds.tsv', sep='\t',header=T)
#mpnocyte_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022/mono/Input_data_tab_5ds.tsv', sep='\t',header=T)
#bulk_5ds <- read.table('/Users/korshe/Documents/Data_Groningen/WMA_sep2022//Input_data_tab_5ds.tsv', sep='\t',header=T)
monocyte_5ds_top <-   mpnocyte_5ds %>% group_by(feature_id_ng)  %>% distinct(feature_id_ng, .keep_all= TRUE)
library(ggpubr)

k1 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_ng", y = "corrected_zscore_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v2_1m", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v2_1m", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v3_1m", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_v3_1m", y = "corrected_zscore_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "corrected_zscore_stemi_v3", y = "corrected_zscore_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing non-finite values (stat_cor).
## Warning: Removed 5 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing non-finite values (stat_cor).
## Warning: Removed 5 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing non-finite values (stat_cor).
## Warning: Removed 5 rows containing missing values (geom_point).

k1 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "beta_ng", y = "beta_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "beta_v2_1m", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "beta_v2_1m", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "beta_v3_1m", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "beta_v3_1m", y = "beta_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "beta_stemi_v3", y = "beta_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

k1 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "beta_se_ng", y = "beta_se_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "beta_se_v2_1m", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "beta_se_v2_1m", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "beta_se_v3_1m", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "beta_se_v3_1m", y = "beta_se_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "beta_se_stemi_v3", y = "beta_se_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

k1 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "mean.cell_ng", y = "mean.cell_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v2_1m", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v2_1m", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v3_1m", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "mean.cell_v3_1m", y = "mean.cell_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "mean.cell_stemi_v3", y = "mean.cell_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson", label.x = 3)  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

Calculating BH and Bonf for each datasets

library(multtest)

  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_ng)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_ng, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_ng<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_ng <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_stemi_v2)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_stemi_v2, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_stemi_v2<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_stemi_v2 <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_stemi_v3)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_stemi_v3, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_stemi_v3   <- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_stemi_v3 <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_v2_1m)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_v2_1m, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_v2_1m<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_v2_1m <- multTestOut_zw[,3]
  
  
  mpnocyte_5ds <- mpnocyte_5ds %>% group_by(feature_id_ng) %>%  arrange(p_value_v3_1m)
  multTestOut_zw <- multtest::mt.rawp2adjp(mpnocyte_5ds$p_value_v3_1m, proc = c("BH","Bonferroni"))$adjp
  mpnocyte_5ds$BH_v3_1m<- multTestOut_zw[,2]
  mpnocyte_5ds$Bonf_v3_1m <- multTestOut_zw[,3]
'ng'
## [1] "ng"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_ng <0.05,])
## [1] 3808  349
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_ng <0.05,])
## [1] 722 349
'ng'
## [1] "ng"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_ng <0.05,])
## [1] 3808  349
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_ng <0.05,])
## [1] 722 349
'v2_1m'
## [1] "v2_1m"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_v2_1m <0.05,])
## [1] 7684  349
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_v2_1m <0.05,])
## [1] 1240  349
'v3_1m'
## [1] "v3_1m"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_v3_1m <0.05,])
## [1] 4246  349
dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_v3_1m <0.05,])
## [1] 665 349
'stemi_v2'
## [1] "stemi_v2"
dim(mpnocyte_5ds[mpnocyte_5ds$BH_stemi_v2 <0.05,])
## [1] 616 349
    dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_stemi_v2 <0.05,])
## [1]  15 349
  'stemi_v3'
## [1] "stemi_v3"
  dim(mpnocyte_5ds[mpnocyte_5ds$BH_stemi_v3 <0.05,])
## [1]   0 349
  dim(mpnocyte_5ds[mpnocyte_5ds$Bonf_stemi_v3 <0.05,])
## [1]   0 349

Checking eQTLGen ZScores

Checking eQTLGen Zscore

k1 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k2 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k3 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_v2_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k4 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_ng", y = "OverallZScore.eqtlgen_v3_1m", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k5 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v2_1m", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k6 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v2_1m", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k7 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v3_1m", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient

k8 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_v3_1m", y = "OverallZScore.eqtlgen_stemi_v3", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
k9 <- ggscatter(monocyte_5ds_top, x = "OverallZScore.eqtlgen_stemi_v3", y = "OverallZScore.eqtlgen_stemi_v2", add = "reg.line",   conf.int = TRUE,      add.params = list(color = "blue", fill = "lightgray") )+ stat_cor(method = "pearson" )  # Add correlation coefficient
grid.arrange(k1,k2,k3,k4,k5,k6,k7,k8, nrow =4)
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'