火山圖通常在生信分析中會經(jīng)常繪制的一種圖形跃惫,通常用來展示比較組的差異基因叮叹、蛋白或代謝物的,也通常是繪制為2D形式辈挂。但是衬横,如果我們給2D火山圖增加一個維度,變成3D火山圖呢终蒂?本文將介紹一個繪制3D火山圖的R包:volcano3D蜂林。
volcano3D允許繪制三組之間的差異基因、蛋白或代謝物拇泣,設計之初的目的也是為了探究差異基因表達情況噪叙,可以繪制成三維的,而且可以轉換為交互式動態(tài)格式的網(wǎng)頁文件霉翔。
本文例子中也慣用volcano3D包中的測試數(shù)據(jù)睁蕾,該數(shù)據(jù)是類風濕關節(jié)炎實驗數(shù)據(jù)the PEAC rheumatoid arthritis trial (Pathobiology of Early Arthritis Cohort),相關參考文獻見下面:
Lewis, Myles J., et al. Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports 28.9 (2019): 2455-2470. (DOI: 10.1016/j.celrep.2019.07.091
相關在線工具網(wǎng)址為:https://peac.hpc.qmul.ac.uk
## 1.設置當前工作目錄
setwd("./volcano3D/")
## 2.安裝和導入R包:volcano3D
# install.packages("volcano3D")
library(volcano3D)
library(ggplot2)
library(ggpubr)
library(plotly)
## 3.R包簡介
### 3.1 幫助信息
help(package="volcano3D")
# Package: volcano3D
# Type: Package
# Title: Interactive Plotting of Three-Way Differential Expression
# Analysis
# Version: 1.0.1
# Authors@R: c(person("Katriona", "Goldmann", role = c("aut", "cre"),
#? ? ? ? ? ? ? ? ? ? email = "k.goldmann@qmul.ac.uk"),
#? ? ? ? ? ? ? person("Myles", "Lewis", role = c("aut", "ctb")))
# Maintainer: Katriona Goldmann <k.goldmann@qmul.ac.uk>
#? URL: Interactive Plotting of Three-Way Differential Expression? ? ? ? Analysis,
# BugReports: KatrionaGoldmann/volcano3D
# Description: Differential expression (DE) analysis can be used to discover quantitative changes in expression levels between experimental groups. Such results are typically visualised using volcano plots, however in cases where more than two experimental groups are involved, visualising results can become convoluted and it quickly becomes difficult to see the wood for the trees. This package provides easy-to-use functions to extract and visualise outputs from DE between three groups (primarily aimed at 'limma' and 'DESeq2' outputs). We present novel methods to map DE results into polar coordinates to enable users to combine and simultaneously view three sets of results. These graphics also possess optional 'plotly' outputs for interactive and three-dimensional functionality, as seen in Lewis et. al. (2019) <doi:10.1016/j.celrep.2019.07.091>.
# Language: en-gb
# License: GPL-2
# Encoding: UTF-8
# LazyData: true
# Depends: R (>= 3.5)
# VignetteBuilder: knitr
# RoxygenNote: 7.1.0
# NeedsCompilation: no
# Packaged: 2020-06-26 15:43:50 UTC; kgoldmann
# Imports: plotly, ggplot2, ggpubr, ggrepel, methods
# Suggests: knitr, rmarkdown, kableExtra, usethis
# Author: Katriona Goldmann [aut, cre],
# Myles Lewis [aut, ctb]
# Repository: CRAN
# Date/Publication: 2020-06-26 17:20:03 UTC
# Built: R 3.6.3; ; 2020-06-28 23:39:01 UTC; windows
### 3.2 主要函數(shù)
ls(package:volcano3D)
# [1] "boxplot_trio"? ? "polar_coords"? ?
# [3] "polar_grid"? ? ? "radial_ggplot"?
# [5] "radial_plotly"? ? "show_grid"? ? ?
# [7] "syn_example_meta" "syn_example_p"?
# [9] "syn_example_rld"? "volcano_plot"? ?
# [11] "volcano_trio"? ? "volcano3D"
## 4.功能測試
data("example_data")
syn_polar <- polar_coords(sampledata = syn_example_meta,
? ? ? ? ? ? ? ? ? ? ? ? ? contrast = "Pathotype",
? ? ? ? ? ? ? ? ? ? ? ? ? pvalues = syn_example_p,
? ? ? ? ? ? ? ? ? ? ? ? ? expression = syn_example_rld,
? ? ? ? ? ? ? ? ? ? ? ? ? p_col_suffix = "pvalue",
? ? ? ? ? ? ? ? ? ? ? ? ? padj_col_suffix = "padj",
? ? ? ? ? ? ? ? ? ? ? ? ? fc_col_suffix = "log2FoldChange",
? ? ? ? ? ? ? ? ? ? ? ? ? multi_group_prefix = "LRT",
? ? ? ? ? ? ? ? ? ? ? ? ? non_sig_name = "Not Significant",
? ? ? ? ? ? ? ? ? ? ? ? ? significance_cutoff = 0.01,
? ? ? ? ? ? ? ? ? ? ? ? ? label_column = NULL,
? ? ? ? ? ? ? ? ? ? ? ? ? fc_cutoff = 0.1)
class(syn_polar)
# [1] "polar"
# attr(,"package")
# [1] "volcano3D"
head(syn_polar@pvalues)
# Fibroid_Lymphoid_pvalue Fibroid_Lymphoid_logFC
# FMOD? ? ? ? ? ? ? 3.080821e-24? ? ? ? ? ? ? 2.377676
# KCNIP3? ? ? ? ? ? 1.618961e-23? ? ? ? ? ? ? 2.575418
# TRIM29? ? ? ? ? ? 1.642192e-23? ? ? ? ? ? ? 4.301344
# CILP? ? ? ? ? ? ? 3.004557e-23? ? ? ? ? ? ? 4.159372
# CAB39L? ? ? ? ? ? 2.440277e-23? ? ? ? ? ? ? 2.176451
# PAMR1? ? ? ? ? ? 8.429953e-22? ? ? ? ? ? ? 2.666598
# Fibroid_Lymphoid_padj Lymphoid_Myeloid_pvalue
# FMOD? ? ? ? ? ? 5.001712e-20? ? ? ? ? ? 3.339001e-07
# KCNIP3? ? ? ? ? 2.628222e-19? ? ? ? ? ? 7.874796e-11
# TRIM29? ? ? ? ? 2.665770e-19? ? ? ? ? ? 5.329984e-19
# CILP? ? ? ? ? ? 4.876696e-19? ? ? ? ? ? 5.166450e-10
# CAB39L? ? ? ? ? 3.961057e-19? ? ? ? ? ? 3.537774e-07
# PAMR1? ? ? ? ? 1.368181e-17? ? ? ? ? ? 7.287287e-06
# Lymphoid_Myeloid_logFC Lymphoid_Myeloid_padj
# FMOD? ? ? ? ? ? ? ? -1.096532? ? ? ? ? 5.278293e-03
# KCNIP3? ? ? ? ? ? ? -1.538422? ? ? ? ? 1.271543e-06
# TRIM29? ? ? ? ? ? ? -3.515507? ? ? ? ? 8.651631e-15
# CILP? ? ? ? ? ? ? ? -2.388539? ? ? ? ? 8.326767e-06
# CAB39L? ? ? ? ? ? ? -1.022201? ? ? ? ? 5.589683e-03
# PAMR1? ? ? ? ? ? ? -1.144612? ? ? ? ? 1.126032e-01
# Myeloid_Fibroid_pvalue Myeloid_Fibroid_logFC
# FMOD? ? ? ? ? ? 2.050327e-06? ? ? ? ? ? -1.2811444
# KCNIP3? ? ? ? ? 4.664822e-04? ? ? ? ? ? -1.0369961
# TRIM29? ? ? ? ? 1.083911e-01? ? ? ? ? ? -0.7858377
# CILP? ? ? ? ? ? 2.430993e-04? ? ? ? ? ? -1.7708331
# CAB39L? ? ? ? ? 4.565418e-06? ? ? ? ? ? -1.1542502
# PAMR1? ? ? ? ? ? 1.979054e-06? ? ? ? ? ? -1.5219853
# Myeloid_Fibroid_padj? LRT_pvalue? ? LRT_padj? label
# FMOD? ? ? ? ? ? 0.03325835 1.933555e-27 3.640110e-23? FMOD
# KCNIP3? ? ? ? ? 1.00000000 4.340591e-27 4.085798e-23 KCNIP3
# TRIM29? ? ? ? ? 1.00000000 1.253930e-26 7.868832e-23 TRIM29
# CILP? ? ? ? ? ? 1.00000000 5.322664e-26 2.505112e-22? CILP
# CAB39L? ? ? ? ? 0.07403282 7.133283e-26 2.685824e-22 CAB39L
# PAMR1? ? ? ? ? ? 0.03210421 9.621579e-25 3.018931e-21? PAMR1
setNames(data.frame(table(syn_polar@polar$sig)), c("Significance", "Frequency"))
# Significance Frequency
# 1? ? ? ? ? Fibroid+? ? ? ? 9
# 2 Fibroid+Lymphoid+? ? ? ? 1
# 3? Fibroid+Myeloid+? ? ? 310
# 4? ? ? ? Lymphoid+? ? ? 124
# 5 Lymphoid+Myeloid+? ? ? ? 56
syn_plots <- volcano_trio(polar = syn_polar,
? ? ? ? ? ? ? ? ? ? ? ? ? sig_names = c("not significant","significant",
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "not significant","significant"),
? ? ? ? ? ? ? ? ? ? ? ? ? colours = rep(c("grey60",? "slateblue1"), 2),
? ? ? ? ? ? ? ? ? ? ? ? ? text_size = 9,
? ? ? ? ? ? ? ? ? ? ? ? ? marker_size=1,
? ? ? ? ? ? ? ? ? ? ? ? ? shared_legend_size = 0.9,
? ? ? ? ? ? ? ? ? ? ? ? ? label_rows = c("SLAMF6", "BOC", "FMOD"),
? ? ? ? ? ? ? ? ? ? ? ? ? fc_line = FALSE,
? ? ? ? ? ? ? ? ? ? ? ? ? share_axes = FALSE)
syn_plots$All
radial_plotly(polar = syn_polar, label_rows = c("SLAMF6", "GREM2", "FMOD"))
radial_ggplot(polar = syn_polar,
? ? ? ? ? ? ? label_rows = c("SLAMF6", "FMOD", "GREM2"),
? ? ? ? ? ? ? marker_size = 2.3,
? ? ? ? ? ? ? legend_size = 10) +
? theme(legend.position = "right")
plot1 <- boxplot_trio(syn_polar,
? ? ? ? ? ? ? ? ? ? ? value = "SLAMF6",
? ? ? ? ? ? ? ? ? ? ? text_size = 7,
? ? ? ? ? ? ? ? ? ? ? test = "polar_padj",
? ? ? ? ? ? ? ? ? ? ? my_comparisons=list(c("Lymphoid", "Myeloid"),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? c("Lymphoid", "Fibroid")))
plot2 <- boxplot_trio(syn_polar,
? ? ? ? ? ? ? ? ? ? ? value = "SLAMF6",
? ? ? ? ? ? ? ? ? ? ? box_colours = c("violet", "gold2"),
? ? ? ? ? ? ? ? ? ? ? levels_order = c("Lymphoid", "Fibroid"),
? ? ? ? ? ? ? ? ? ? ? text_size = 7,
? ? ? ? ? ? ? ? ? ? ? test = "polar_padj")
plot3 <- boxplot_trio(syn_polar,
? ? ? ? ? ? ? ? ? ? ? value = "FMOD",
? ? ? ? ? ? ? ? ? ? ? text_size = 7,
? ? ? ? ? ? ? ? ? ? ? stat_size=2.5,
? ? ? ? ? ? ? ? ? ? ? test = "polar_multi_padj",
? ? ? ? ? ? ? ? ? ? ? levels_order = c("Lymphoid", "Myeloid", "Fibroid"),
? ? ? ? ? ? ? ? ? ? ? box_colours = c("blue", "red", "green3"))
ggarrange(plot1, plot2, plot3, ncol=3)
p <- volcano3D(syn_polar,
? ? ? ? ? ? ? label_rows = c("SLAMF6", "GREM2", "FMOD"),
? ? ? ? ? ? ? label_size = 10,
? ? ? ? ? ? ? xy_aspectratio = 1,
? ? ? ? ? ? ? z_aspectratio = 0.9,
? ? ? ? ? ? ? plot_height = 700)
p
p %>% plotly::config(toImageButtonOptions = list(format = "svg"))
plotly::orca(p, "./volcano_3d_synovium.svg", format = "svg")
citation("volcano3D")
#' 在出版物中使用程序包時引用‘volcano3D’:
#'
#'? Katriona Goldmann and Myles Lewis (2020). volcano3D:
#'? Interactive Plotting of Three-Way Differential
#' Expression Analysis. R package version 1.0.0.
#'
#' A BibTeX entry for LaTeX users is
#'
#' @Manual{,
#'? title = {volcano3D: Interactive Plotting of Three-Way Differential Expression
#'? ? Analysis},
#'? author = {Katriona Goldmann and Myles Lewis},
#'? year = {2020},
#'? note = {R package version 1.0.0},
#'? url = {CRAN - Package volcano3D},
#' }
## 5.結束
sessionInfo()
# R version 3.6.3 (2020-02-29)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 10 x64 (build 18363)
#
# Matrix products: default
#
# locale:
#? [1] LC_COLLATE=Chinese (Simplified)_China.936
# [2] LC_CTYPE=Chinese (Simplified)_China.936?
# [3] LC_MONETARY=Chinese (Simplified)_China.936
# [4] LC_NUMERIC=C? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
# [5] LC_TIME=Chinese (Simplified)_China.936? ?
#
# attached base packages:
#? [1] stats? ? graphics? grDevices utils? ? datasets
# [6] methods? base? ?
#
# other attached packages:
#? [1] orca_1.1-1? ? ? ? htmlwidgets_1.5.1
#
# loaded via a namespace (and not attached):
#? [1] Rcpp_1.0.4.6? ? ? plotly_4.9.2.1? ? rstudioapi_0.11?
# [4] magrittr_1.5? ? ? tidyselect_1.1.0? munsell_0.5.0? ?
# [7] viridisLite_0.3.0 colorspace_1.4-1? R6_2.4.1? ? ? ?
# [10] rlang_0.4.6? ? ? httr_1.4.1? ? ? ? dplyr_1.0.0? ? ?
# [13] tools_3.6.3? ? ? grid_3.6.3? ? ? ? packrat_0.5.0? ?
# [16] data.table_1.12.8 gtable_0.3.0? ? ? htmltools_0.5.0?
# [19] ellipsis_0.3.1? ? lazyeval_0.2.2? ? digest_0.6.25? ?
# [22] tibble_3.0.1? ? ? lifecycle_0.2.0? crayon_1.3.4? ?
# [25] tidyr_1.1.0? ? ? purrr_0.3.4? ? ? ggplot2_3.3.2? ?
# [28] vctrs_0.3.1? ? ? glue_1.4.1? ? ? ? compiler_3.6.3?
# [31] pillar_1.4.4? ? ? generics_0.0.2? ? scales_1.1.1? ?
# [34] jsonlite_1.7.0? ? pkgconfig_2.0.3