J. Taroni 2018
Here, we’ll compare what latent variables are differentially expressed in each of the ANCA-associated vasculitis data sets. An advantage of the multiPLIER approach is that we don’t have to compare across multiple models. We’ll use a cutoff of FDR < 0.05
. Recall that we used “BH” correction for multiple testing in each case.
At first, we’ll take the naive approach of just looking at the overlapping sets of significant LVs. There’s no guarantee that the directionality will be in agreement this way.
# magrittr pipe
`%>%` <- dplyr::`%>%`
# plot and result directory setup for this notebook
plot.dir <- file.path("plots", "21")
dir.create(plot.dir, recursive = TRUE, showWarnings = FALSE)
results.dir <- file.path("results", "21")
dir.create(results.dir, recursive = TRUE, showWarnings = FALSE)
# files with all the limma results
nares.file <- file.path("results", "18",
"NARES_recount2_model_LV_limma_results.tsv")
blood.file <- file.path("results", "19",
"GPA_blood_recount2_model_LV_limma_results.tsv")
kidney.file <- file.path("results", "20",
"ERCB_glom_recount2_model_LV_limma_results.tsv")
nares.df <- readr::read_tsv(nares.file)
Parsed with column specification:
cols(
.default = col_double(),
LV = col_character()
)
See spec(...) for full column specifications.
blood.df <- readr::read_tsv(blood.file)
Parsed with column specification:
cols(
LV = col_character(),
Control...GPAneg = col_double(),
Control...GPApos = col_double(),
GPAneg...GPApos = col_double(),
AveExpr = col_double(),
F = col_double(),
P.Value = col_double(),
adj.P.Val = col_double()
)
kidney.df <- readr::read_tsv(kidney.file)
Parsed with column specification:
cols(
LV = col_character(),
Living.donor.control...Nephrotic.syndrome = col_double(),
Living.donor.control...Vasculitis = col_double(),
Nephrotic.syndrome...Vasculitis = col_double(),
AveExpr = col_double(),
F = col_double(),
P.Value = col_double(),
adj.P.Val = col_double()
)
# initialize list to hold significant pathways for each of the datasets -- this
# is what VennDiagram functions generally take as an argument
sig.list <- list()
sig.list[["nares"]] <- nares.df$LV[which(nares.df$adj.P.Val < 0.05)]
sig.list[["blood"]] <- blood.df$LV[which(blood.df$adj.P.Val < 0.05)]
sig.list[["kidney"]] <- kidney.df$LV[which(kidney.df$adj.P.Val < 0.05)]
overlap <- VennDiagram::calculate.overlap(sig.list)
overlap.file <- file.path(results.dir, "AAV_FDR_0.05_overlap.RDS")
saveRDS(overlap, file = overlap.file)
vd.file <- file.path(plot.dir, "AAV_FDR_0.05_overlap.png")
VennDiagram::venn.diagram(x = sig.list, filename = vd.file,
imagetype = "png",
resolution = 600,
category.names = c("NARES", "GPA blood",
"ERCB glomeruli"))
[1] 1
# which element of the overlap list are we looking for?
lapply(overlap, length)
$a5
[1] 22
$a2
[1] 19
$a4
[1] 57
$a6
[1] 72
$a1
[1] 53
$a3
[1] 79
$a7
[1] 308
overlap$a5
[1] "10,SVM Macrophages M0" "38,PID_PLK1_PATHWAY" "LV 53" "LV 55" "LV 63" "LV 113"
[7] "LV 122" "LV 139" "LV 332" "LV 346" "LV 390" "LV 470"
[13] "LV 488" "524,IRIS_Neutrophil-Resting" "LV 624" "LV 631" "LV 745" "LV 793"
[19] "LV 834" "LV 887" "LV 909" "937,PID_HIF1_TFPATHWAY"
# remove files & data.frame no longer needed once we have the overlap
rm(list = setdiff(ls(), c("%>%", "overlap", "plot.dir", "results.list")))
lvs.to.plot <- overlap$a5
We’ll use these, from the individual dataset notebooks, for plotting.
nares.file <- file.path("results", "18",
"NARES_recount2_model_B_long_sample_info.tsv")
nares.df <- readr::read_tsv(nares.file)
Parsed with column specification:
cols(
.default = col_character(),
Value = col_double(),
Batch = col_integer(),
Age = col_integer(),
`Disease_Duration (yrs)` = col_integer(),
Flares = col_integer(),
PGA = col_integer(),
BVAS = col_integer(),
VDI = col_integer(),
Smoking_pkyrs = col_integer(),
Steroids_daily_pred_mg = col_integer(),
Steroids_Cat = col_integer(),
GC_or_Immune = col_integer(),
Immune_or_Nasal = col_integer(),
Any_Immune = col_integer()
)
See spec(...) for full column specifications.
|== | 1%
|=== | 2%
|==== | 2%
|===== | 3%
|======= | 3%
|======== | 4%
|======== | 4%
|========= | 5%
|========== | 5%
|=========== | 6%
|============ | 6%
|============= | 7%
|============== | 7%
|=============== | 8%
|=============== | 8%
|================ | 9%
|================= | 9%
|================== | 10%
|================== | 10% 1 MB
|=================== | 11% 1 MB
|==================== | 11% 1 MB
|===================== | 12% 1 MB
|====================== | 12% 1 MB
|======================= | 13% 1 MB
|======================== | 13% 1 MB
|======================== | 14% 1 MB
|========================= | 14% 1 MB
|========================== | 15% 1 MB
|=========================== | 15% 1 MB
|============================ | 16% 1 MB
|============================= | 16% 1 MB
|============================== | 17% 1 MB
|=============================== | 17% 1 MB
|================================ | 18% 1 MB
|================================= | 18% 1 MB
|================================== | 19% 1 MB
|=================================== | 19% 1 MB
|==================================== | 20% 2 MB
|==================================== | 20% 2 MB
|===================================== | 21% 2 MB
|====================================== | 21% 2 MB
|======================================= | 22% 2 MB
|======================================== | 23% 2 MB
|========================================= | 23% 2 MB
|========================================== | 23% 2 MB
|========================================== | 24% 2 MB
|=========================================== | 24% 2 MB
|============================================ | 25% 2 MB
|============================================= | 26% 2 MB
|============================================== | 26% 2 MB
|=============================================== | 27% 2 MB
|================================================ | 27% 2 MB
|================================================= | 28% 2 MB
|================================================== | 28% 2 MB
|=================================================== | 29% 2 MB
|==================================================== | 29% 2 MB
|==================================================== | 30% 2 MB
|===================================================== | 30% 2 MB
|====================================================== | 31% 3 MB
|======================================================= | 31% 3 MB
|======================================================== | 31% 3 MB
|========================================================= | 32% 3 MB
|========================================================== | 32% 3 MB
|========================================================== | 33% 3 MB
|=========================================================== | 33% 3 MB
|============================================================ | 34% 3 MB
|============================================================= | 34% 3 MB
|============================================================== | 35% 3 MB
|=============================================================== | 35% 3 MB
|================================================================ | 36% 3 MB
|================================================================= | 37% 3 MB
|================================================================= | 37% 3 MB
|================================================================== | 37% 3 MB
|=================================================================== | 38% 3 MB
|==================================================================== | 38% 3 MB
|===================================================================== | 39% 3 MB
|====================================================================== | 39% 3 MB
|======================================================================= | 40% 3 MB
|======================================================================= | 40% 4 MB
|======================================================================== | 41% 4 MB
|========================================================================= | 41% 4 MB
|========================================================================== | 42% 4 MB
|=========================================================================== | 43% 4 MB
|============================================================================ | 43% 4 MB
|============================================================================= | 44% 4 MB
|============================================================================== | 44% 4 MB
|=============================================================================== | 45% 4 MB
|================================================================================ | 45% 4 MB
|================================================================================= | 46% 4 MB
|================================================================================== | 46% 4 MB
|=================================================================================== | 47% 4 MB
|==================================================================================== | 47% 4 MB
|==================================================================================== | 48% 4 MB
|===================================================================================== | 48% 4 MB
|====================================================================================== | 49% 4 MB
|======================================================================================= | 49% 4 MB
|======================================================================================== | 50% 4 MB
|========================================================================================= | 51% 5 MB
|========================================================================================== | 51% 5 MB
|=========================================================================================== | 52% 5 MB
|============================================================================================ | 52% 5 MB
|============================================================================================= | 53% 5 MB
|============================================================================================== | 53% 5 MB
|=============================================================================================== | 54% 5 MB
|================================================================================================ | 54% 5 MB
|================================================================================================= | 55% 5 MB
|================================================================================================== | 55% 5 MB
|=================================================================================================== | 56% 5 MB
|==================================================================================================== | 56% 5 MB
|===================================================================================================== | 57% 5 MB
|====================================================================================================== | 58% 5 MB
|======================================================================================================= | 58% 5 MB
|======================================================================================================== | 59% 5 MB
|======================================================================================================== | 59% 5 MB
|========================================================================================================= | 60% 5 MB
|========================================================================================================== | 60% 5 MB
|=========================================================================================================== | 61% 6 MB
|============================================================================================================ | 61% 6 MB
|============================================================================================================= | 62% 6 MB
|============================================================================================================== | 62% 6 MB
|=============================================================================================================== | 63% 6 MB
|================================================================================================================ | 63% 6 MB
|================================================================================================================= | 64% 6 MB
|================================================================================================================= | 64% 6 MB
|================================================================================================================== | 65% 6 MB
|=================================================================================================================== | 65% 6 MB
|==================================================================================================================== | 66% 6 MB
|===================================================================================================================== | 66% 6 MB
|====================================================================================================================== | 67% 6 MB
|====================================================================================================================== | 67% 6 MB
|======================================================================================================================= | 68% 6 MB
|======================================================================================================================== | 68% 6 MB
|========================================================================================================================= | 69% 6 MB
|========================================================================================================================== | 69% 6 MB
|=========================================================================================================================== | 69% 6 MB
|=========================================================================================================================== | 70% 6 MB
|============================================================================================================================ | 70% 6 MB
|============================================================================================================================= | 71% 6 MB
|============================================================================================================================== | 71% 7 MB
|=============================================================================================================================== | 72% 7 MB
|================================================================================================================================ | 72% 7 MB
|================================================================================================================================ | 73% 7 MB
|================================================================================================================================= | 73% 7 MB
|================================================================================================================================== | 74% 7 MB
|=================================================================================================================================== | 74% 7 MB
|==================================================================================================================================== | 75% 7 MB
|===================================================================================================================================== | 75% 7 MB
|===================================================================================================================================== | 76% 7 MB
|====================================================================================================================================== | 76% 7 MB
|======================================================================================================================================= | 77% 7 MB
|======================================================================================================================================== | 77% 7 MB
|========================================================================================================================================= | 78% 7 MB
|========================================================================================================================================== | 78% 7 MB
|=========================================================================================================================================== | 79% 7 MB
|============================================================================================================================================ | 79% 7 MB
|============================================================================================================================================= | 80% 7 MB
|============================================================================================================================================= | 80% 7 MB
|============================================================================================================================================== | 81% 7 MB
|=============================================================================================================================================== | 81% 8 MB
|================================================================================================================================================ | 82% 8 MB
|================================================================================================================================================= | 82% 8 MB
|================================================================================================================================================= | 82% 8 MB
|================================================================================================================================================== | 83% 8 MB
|=================================================================================================================================================== | 83% 8 MB
|==================================================================================================================================================== | 84% 8 MB
|==================================================================================================================================================== | 84% 8 MB
|===================================================================================================================================================== | 85% 8 MB
|====================================================================================================================================================== | 85% 8 MB
|======================================================================================================================================================= | 86% 8 MB
|======================================================================================================================================================== | 86% 8 MB
|========================================================================================================================================================= | 86% 8 MB
|========================================================================================================================================================= | 87% 8 MB
|========================================================================================================================================================== | 87% 8 MB
|=========================================================================================================================================================== | 88% 8 MB
|============================================================================================================================================================ | 88% 8 MB
|============================================================================================================================================================= | 89% 8 MB
|============================================================================================================================================================== | 89% 8 MB
|=============================================================================================================================================================== | 90% 8 MB
|=============================================================================================================================================================== | 90% 8 MB
|================================================================================================================================================================ | 91% 8 MB
|================================================================================================================================================================= | 91% 8 MB
|================================================================================================================================================================== | 92% 9 MB
|================================================================================================================================================================== | 92% 9 MB
|=================================================================================================================================================================== | 92% 9 MB
|==================================================================================================================================================================== | 93% 9 MB
|==================================================================================================================================================================== | 93% 9 MB
|===================================================================================================================================================================== | 94% 9 MB
|====================================================================================================================================================================== | 94% 9 MB
|======================================================================================================================================================================= | 95% 9 MB
|======================================================================================================================================================================= | 95% 9 MB
|======================================================================================================================================================================== | 95% 9 MB
|========================================================================================================================================================================= | 96% 9 MB
|========================================================================================================================================================================== | 96% 9 MB
|=========================================================================================================================================================================== | 97% 9 MB
|=========================================================================================================================================================================== | 97% 9 MB
|============================================================================================================================================================================ | 98% 9 MB
|============================================================================================================================================================================= | 98% 9 MB
|============================================================================================================================================================================== | 98% 9 MB
|============================================================================================================================================================================== | 99% 9 MB
|===============================================================================================================================================================================| 99% 9 MB
|================================================================================================================================================================================| 100% 9 MB
number of columns of result is not a multiple of vector length (arg 1)147063 parsing failures.
row [38;5;246m# A tibble: 5 x 5[39m col row col expected actual file expected [3m[38;5;246m<int>[39m[23m [3m[38;5;246m<chr>[39m[23m [3m[38;5;246m<chr>[39m[23m [3m[38;5;246m<chr>[39m[23m [3m[38;5;246m<chr>[39m[23m actual [38;5;250m1[39m [4m1[24m975 Disease_Duration (yrs) no trailing characters .75 'results/18/NARES_recount2_model_B_long_sample_info.tsv' file [38;5;250m2[39m [4m1[24m976 Disease_Duration (yrs) no trailing characters .75 'results/18/NARES_recount2_model_B_long_sample_info.tsv' row [38;5;250m3[39m [4m1[24m977 Disease_Duration (yrs) no trailing characters .75 'results/18/NARES_recount2_model_B_long_sample_info.tsv' col [38;5;250m4[39m [4m1[24m978 Disease_Duration (yrs) no trailing characters .75 'results/18/NARES_recount2_model_B_long_sample_info.tsv' expected [38;5;250m5[39m [4m1[24m979 Disease_Duration (yrs) no trailing characters .75 'results/18/NARES_recount2_model_B_long_sample_info.tsv'
... ................................. ... ..................................................................................................................... ........ .................................................................................................................................................................................................................................................. ...... .............................................................................................................................................. .... .............................................................................................................................................. ... .............................................................................................................................................. ... .............................................................................................................................................. ........ ..............................................................................................................................................
See problems(...) for more details.
gpa.file <- file.path("results", "19",
"GPA_blood_recount2_model_B_long_sample_info.tsv")
gpa.df <- readr::read_tsv(gpa.file)
Parsed with column specification:
cols(
LV = col_character(),
Sample = col_character(),
Value = col_double(),
Name = col_character(),
GPA_signature = col_character(),
Cell_type = col_character()
)
kidney.file <- file.path("results", "20",
"ERCB_glom_recount2_model_B_long_sample_info.tsv")
kidney.df <- readr::read_tsv(kidney.file)
Parsed with column specification:
cols(
LV = col_character(),
Sample = col_character(),
Value = col_double(),
Diagnosis = col_character()
)
We’ll want the plots to be in the same general order and for the x-axis labels to display well.
# Nasal brushing data
nares.df <- nares.df %>%
dplyr::mutate(Classification =
dplyr::recode(Classification,
`GPA with active nasal disease` = "GPA active",
`GPA with prior nasal disease` = "GPA prior",
`GPA (no prior nasal disease)` = "GPA none"
)) %>%
dplyr::mutate(Classification =
factor(Classification,
levels = c("GPA active",
"GPA prior",
"GPA none",
"EGPA",
"Allergic Rhinitis",
"Sarcoidosis",
"Healthy")))
# GPA PBMC data
gpa.df <- gpa.df %>%
dplyr::mutate(GPA_signature = dplyr::recode(GPA_signature,
GPApos = "GPA-positive",
GPAneg = "GPA-negative",
Control = "Control")) %>%
dplyr::mutate(GPA_signature = factor(GPA_signature,
levels = c("GPA-positive",
"GPA-negative",
"Control")))
kidney.df <- kidney.df %>%
dplyr::mutate(Diagnosis = factor(Diagnosis,
levels = c("Vasculitis",
"Nephrotic syndrome",
"Living donor control")))
mean_ci <- function(x) ggplot2::mean_se(x, mult = 2)
# custom ggplot2 theme
custom_theme <- function() {
ggplot2::theme_bw() +
ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45,
hjust = 1),
legend.position = "none",
plot.title = ggplot2::element_text(hjust = 0.5,
face = "bold"),
axis.title.x = ggplot2::element_blank())
}
# wrapper function for plotting the three datasets -- this is only intended to
# be used in this environment
MultiPlotWrapper <- function(lv.name) {
# lv.name: string to be passed to dplyr::filter -- one LV plotted at a time
# returns a 3 panel plot with strip charts from the three tissues, the output
# of cowplot::plot_grid
#### NARES ####
nares.p <- nares.df %>%
dplyr::filter(LV == lv.name) %>%
ggplot2::ggplot(ggplot2::aes(x = Classification, y = Value)) +
ggplot2::geom_jitter(width = 0.2, alpha = 0.6,
ggplot2::aes(colour = Classification)) +
ggplot2::stat_summary(geom = "pointrange",
fun.data = mean_ci) +
ggplot2::labs(y = lv.name, title = "NARES") +
ggplot2::scale_color_manual(values = c("#2F4F4F", "#191970", "#20B2AA",
"#666666", "#CDCD00", "#FF4500",
"#FF8C69")) +
custom_theme()
#### Glomeruli ####
glom.p <- kidney.df %>%
dplyr::filter(LV == lv.name) %>%
ggplot2::ggplot(ggplot2::aes(x = Diagnosis, y = Value)) +
ggplot2::geom_jitter(width = 0.2, alpha = 0.6,
ggplot2::aes(colour = Diagnosis)) +
ggplot2::stat_summary(geom = "pointrange",
fun.data = mean_ci) +
ggplot2::labs(y = lv.name, title = "Glomeruli") +
ggplot2::scale_color_manual(values = c("#2F4F4F", "#666666", "#FF8C69")) +
custom_theme()
#### PBMC ####
pbmc.p <- gpa.df %>%
dplyr::filter(LV == lv.name) %>%
ggplot2::ggplot(ggplot2::aes(x = GPA_signature, y = Value)) +
ggplot2::geom_jitter(width = 0.2, alpha = 0.6,
ggplot2::aes(colour = GPA_signature)) +
ggplot2::stat_summary(geom = "pointrange",
fun.data = mean_ci) +
ggplot2::labs(y = lv.name, title = "GPA PBMCs") +
ggplot2::scale_color_manual(values = c("#2F4F4F", "#20B2AA", "#FF8C69")) +
custom_theme()
#### Return multipanel plot ####
return(cowplot::plot_grid(nares.p, glom.p, pbmc.p, align = "h", ncol = 3))
}
# list to hold the multipanel plots
plot.list <- lapply(lvs.to.plot, MultiPlotWrapper)
plot.file <- file.path(plot.dir, "significant_LVs_3_AAV_sets.pdf")
pdf(plot.file, width = 8, height = 6, onefile = TRUE)
plot.list
[[1]]
[[2]]
[[3]]
[[4]]
[[5]]
[[6]]
[[7]]
[[8]]
[[9]]
[[10]]
[[11]]
[[12]]
[[13]]
[[14]]
[[15]]
[[16]]
[[17]]
[[18]]
[[19]]
[[20]]
[[21]]
[[22]]
dev.off()
null device
1