vignettes/volcano_plot.Rmd
volcano_plot.Rmd
library(massdataset)
library(tidyverse)
library(demodata)
library(massstat)
data("liver_aging_pos", package = "demodata")
liver_aging_pos
#> --------------------
#> massdataset version: 0.01
#> --------------------
#> 1.expression_data:[ 21607 x 24 data.frame]
#> 2.sample_info:[ 24 x 4 data.frame]
#> 3.variable_info:[ 21607 x 3 data.frame]
#> 4.sample_info_note:[ 4 x 2 data.frame]
#> 5.variable_info_note:[ 3 x 2 data.frame]
#> 6.ms2_data:[ 0 variables x 0 MS2 spectra]
#> --------------------
#> Processing information (extract_process_info())
#> Creation ----------
#> Package Function.used Time
#> 1 massdataset create_mass_dataset() 2021-12-23 00:24:02
w_78 =
liver_aging_pos %>%
activate_mass_dataset(what = "sample_info") %>%
dplyr::filter(group == "78W") %>%
dplyr::pull(sample_id)
w_24 =
liver_aging_pos %>%
activate_mass_dataset(what = "sample_info") %>%
dplyr::filter(group == "24W") %>%
dplyr::pull(sample_id)
control_sample_id = w_24
case_sample_id = w_78
liver_aging_pos =
mutate_fc(
object = liver_aging_pos,
control_sample_id = control_sample_id,
case_sample_id = case_sample_id,
mean_median = "mean"
)
#> 10 control samples.
#> 10 case samples.
#>
liver_aging_pos =
mutate_p_value(
object = liver_aging_pos,
control_sample_id = control_sample_id,
case_sample_id = case_sample_id,
method = "t.test",
p_adjust_methods = "BH"
)
#> 10 control samples.
#> 10 case samples.
#>
object = liver_aging_pos
volcano_plot(
object = object,
fc_column_name = "fc",
p_value_column_name = "p_value_adjust",
labs_x = "log2(Fold change)",
labs_y = "-log(p-adjust, 10)",
fc_up_cutoff = 2,
fc_down_cutoff = 0.5,
p_value_cutoff = 0.05,
add_text = TRUE
)
volcano_plot(
object = object,
fc_column_name = "fc",
p_value_column_name = "p_value",
labs_x = "log2(Fold change)",
labs_y = "-log(p-value, 10)",
fc_up_cutoff = 2,
fc_down_cutoff = 0.5,
p_value_cutoff = 0.05,
add_text = FALSE,
point_alpha = 0.5
)
volcano_plot(
object = object,
fc_column_name = "fc",
p_value_column_name = "p_value",
labs_x = "log2(Fold change)",
labs_y = "-log(p-value, 10)",
fc_up_cutoff = 2,
fc_down_cutoff = 0.5,
p_value_cutoff = 0.05,
add_text = FALSE,
point_alpha = 0.5,
point_size_scale = "p_value"
) +
scale_size_continuous(range = c(0.5, 3))
sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] ggfortify_0.4.12 massstat_0.99.1 demodata_0.0.1 forcats_0.5.1
#> [5] stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4 readr_2.0.0
#> [9] tidyr_1.1.3 tibble_3.1.3 ggplot2_3.3.5 tidyverse_1.3.1
#> [13] magrittr_2.0.1 tinytools_0.9.1 massdataset_0.99.1
#>
#> loaded via a namespace (and not attached):
#> [1] colorspace_2.0-2 rjson_0.2.20 ellipsis_0.3.2
#> [4] leaflet_2.0.4.1 rprojroot_2.0.2 circlize_0.4.14
#> [7] GlobalOptions_0.1.2 fs_1.5.0 clue_0.3-59
#> [10] rstudioapi_0.13 ggrepel_0.9.1 fansi_0.5.0
#> [13] lubridate_1.7.10 xml2_1.3.2 codetools_0.2-18
#> [16] doParallel_1.0.16 cachem_1.0.5 knitr_1.33
#> [19] jsonlite_1.7.2 Cairo_1.5-12.2 broom_0.7.9
#> [22] cluster_2.1.2 dbplyr_2.1.1 png_0.1-7
#> [25] BiocManager_1.30.16 compiler_4.1.0 httr_1.4.2
#> [28] rvcheck_0.1.8 backports_1.2.1 assertthat_0.2.1
#> [31] fastmap_1.1.0 lazyeval_0.2.2 cli_3.0.1
#> [34] htmltools_0.5.2 tools_4.1.0 gtable_0.3.0
#> [37] glue_1.4.2 Rcpp_1.0.7 Biobase_2.52.0
#> [40] cellranger_1.1.0 jquerylib_0.1.4 pkgdown_2.0.1
#> [43] vctrs_0.3.8 iterators_1.0.13 crosstalk_1.1.1
#> [46] xfun_0.24 openxlsx_4.2.4 rvest_1.0.1
#> [49] lifecycle_1.0.0 scales_1.1.1 ragg_1.1.3
#> [52] clisymbols_1.2.0 hms_1.1.0 parallel_4.1.0
#> [55] RColorBrewer_1.1-2 ComplexHeatmap_2.8.0 yaml_2.2.1
#> [58] memoise_2.0.0 pbapply_1.4-3 gridExtra_2.3
#> [61] sass_0.4.0 stringi_1.7.3 S4Vectors_0.30.0
#> [64] desc_1.3.0 foreach_1.5.1 BiocGenerics_0.38.0
#> [67] zip_2.2.0 BiocParallel_1.26.1 shape_1.4.6
#> [70] rlang_0.4.11 pkgconfig_2.0.3 systemfonts_1.0.2
#> [73] matrixStats_0.60.0 evaluate_0.14 patchwork_1.1.1
#> [76] htmlwidgets_1.5.3 tidyselect_1.1.1 ggsci_2.9
#> [79] plyr_1.8.6 R6_2.5.0 IRanges_2.26.0
#> [82] snow_0.4-3 generics_0.1.0 DBI_1.1.1
#> [85] pillar_1.6.2 haven_2.4.1 withr_2.4.2
#> [88] modelr_0.1.8 crayon_1.4.1 utf8_1.2.2
#> [91] plotly_4.9.4.1 tzdb_0.1.2 rmarkdown_2.9
#> [94] GetoptLong_1.0.5 grid_4.1.0 readxl_1.3.1
#> [97] data.table_1.14.0 reprex_2.0.0 digest_0.6.27
#> [100] gridGraphics_0.5-1 textshaping_0.3.6 stats4_4.1.0
#> [103] munsell_0.5.0 viridisLite_0.4.0 ggplotify_0.0.8
#> [106] bslib_0.3.1