Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: MetaVolcanoR
Type: Package
Title: Gene Expression Meta-analysis Visualization Tool
Version: 1.0.1
Version: 1.0.2
Authors@R: c(person("Cesar", "Prada", email = "cesar.prada@usp.br",
role = c("aut", "cre")), person("Diogenes", "Lima", email = "diogenes.lima@usp.br",
role = c("aut")), person("Helder", "Nakaya", email = "hnkaya@usp.br",
Expand Down Expand Up @@ -39,4 +39,4 @@ biocViews: GeneExpression, DifferentialExpression, Transcriptomics, mRNAMicroarr
LazyData: true
roxygennote: 6.1.1.9000
VignetteBuilder: knitr
RoxygenNote: 6.1.1
RoxygenNote: 7.2.3
18 changes: 10 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ export(remodel)
export(rename_col)
export(set_degbar_data)
export(votecount_mv)
import(dplyr)
import(ggplot2)
import(data.table)
import(graphics)
import(stats)
import(tidyr)
importFrom(grDevices, pdf, dev.off)
importFrom(htmlwidgets, saveWidget)
importFrom(cowplot,plot_grid)
importFrom(grDevices,dev.off)
importFrom(grDevices,pdf)
importFrom(graphics,plot)
importFrom(htmlwidgets,saveWidget)
importFrom(methods,'slot<-')
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,show)
importFrom(parallel,mclapply)
importFrom(plotly, as_widget, ggplotly)
importFrom(plotly,as_widget)
importFrom(plotly,ggplotly)
importFrom(stats,median)
importFrom(stats,quantile)
importFrom(stats,setNames)
importFrom(topconfects,normal_confects)
importFrom(dplyr, mutate, arrange, select, matches, '%>%')
44 changes: 25 additions & 19 deletions R/combining_mv.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ NULL
#' @param outputfolder /path where to write the results/
#' @param draw wheather or not to draw the .pdf or .html visualization
#' <c(NULL, "PDF", "HTML")>
#' @param render A boolean parameter that determines whether the plot should be rendered.
#' If `TRUE`, the function will produce and save the plot based on the specified `draw`
#' parameter (either as an HTML or PDF file). If `FALSE` (default), no plot will be
#' rendered or saved. It's useful for cases where you might want to run the function
#' for its side effects or calculations without necessarily visualizing the result.
#' @return \code{MetaVolcano} object
#' @keywords write 'combining meta-analysis' metavolcano
#' @export
Expand All @@ -36,7 +41,7 @@ combining_mv <- function(diffexp=list(), pcriteria="pvalue",
foldchangecol="Log2FC", genenamecol="Symbol",
geneidcol=NULL, metafc="Mean", metathr=0.01,
collaps="FALSE", jobname="MetaVolcano",
outputfolder=".", draw="HTML") {
outputfolder=".", draw="HTML", render = F) {

if(!draw %in% c('PDF', 'HTML')) {

Expand Down Expand Up @@ -159,24 +164,25 @@ combining_mv <- function(diffexp=list(), pcriteria="pvalue",

# --- Drawing combining MetaVolcano
gg <- plot_mv(meta_diffexp, NULL, genecol, TRUE, metafc)

if(draw == "HTML") {

# --- Writing html device for offline visualization
saveWidget(as_widget(ggplotly(gg)),
paste0(normalizePath(outputfolder),
'/combining_method_MetaVolcano_', jobname, ".html"))

} else if(draw == "PDF") {

# --- Writing PDF visualization
pdf(paste0(normalizePath(outputfolder),
'/combining_method_MetaVolcano_', jobname, ".pdf"),
width = 4, height = 5)
plot(gg)
dev.off()

}
if(render) {
if(draw == "HTML") {

# --- Writing html device for offline visualization
saveWidget(as_widget(ggplotly(gg)),
paste0(normalizePath(outputfolder),
'/combining_method_MetaVolcano_', jobname, ".html"))

} else if(draw == "PDF") {

# --- Writing PDF visualization
pdf(paste0(normalizePath(outputfolder),
'/combining_method_MetaVolcano_', jobname, ".pdf"),
width = 4, height = 5)
plot(gg)
dev.off()

}
}

# Set combining result
icols <- paste(c(genecol, pcriteria, foldchangecol), collapse="|")
Expand Down
39 changes: 24 additions & 15 deletions R/rem_mv.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ setClass('MetaVolcano', slots = list(input='data.frame',
#' @param outputfolder /path where to write the results/
#' @param draw wheather or not to draw the .html visualization <logical>
#' @param ncores the number of processors the user wants to use <integer>
#' #' @param render A boolean parameter that determines whether the plot should be rendered.
#' If `TRUE`, the function will produce and save the plot based on the specified `draw`
#' parameter (either as an HTML or PDF file). If `FALSE` (default), no plot will be
#' rendered or saved. It's useful for cases where you might want to run the function
#' for its side effects or calculations without necessarily visualizing the result.
#' @keywords write 'combining meta-analysis' metavolcano
#' @return MetaVolcano object
#' @export
Expand All @@ -61,7 +66,7 @@ rem_mv <- function(diffexp=list(), pcriteria="pvalue", foldchangecol="Log2FC",
genenamecol="Symbol", geneidcol=NULL, collaps=FALSE,
llcol="CI.L", rlcol="CI.R", vcol=NULL, cvar=TRUE,
metathr=0.01, jobname="MetaVolcano", outputfolder=".",
draw='HTML', ncores=1) {
draw='HTML', ncores=1, render = F) {


if(!draw %in% c('PDF', 'HTML')) {
Expand Down Expand Up @@ -199,24 +204,28 @@ rem_mv <- function(diffexp=list(), pcriteria="pvalue", foldchangecol="Log2FC",
# --- Draw REM MetaVolcano
gg <- plot_rem(meta_diffexp, jobname, outputfolder, genecol, metathr)

if(draw == "HTML") {
if(render) {

if(draw == "HTML") {

# --- Writing html device for offline visualization
saveWidget(as_widget(ggplotly(gg)),
paste0(normalizePath(outputfolder),
"/RandomEffectModel_MetaVolcano_",
jobname, ".html"))

} else if(draw == "PDF") {

paste0(normalizePath(outputfolder),
"/RandomEffectModel_MetaVolcano_",
jobname, ".html"))
} else if(draw == "PDF") {
# --- Writing PDF visualization
pdf(paste0(normalizePath(outputfolder),
"/RandomEffectModel_MetaVolcano_", jobname,
".pdf"), width = 7, height = 6)
plot(gg)
dev.off()

}
pdf(paste0(normalizePath(outputfolder),
"/RandomEffectModel_MetaVolcano_", jobname,
".pdf"), width = 7, height = 6)
plot(gg)
dev.off()

}

}

# Set REM result
icols <- paste(c(genecol, pcriteria, foldchangecol, llcol, rlcol, vcol),
Expand Down
24 changes: 20 additions & 4 deletions man/combining_mv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions man/diffexplist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions man/draw_forest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 24 additions & 6 deletions man/rem_mv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions man/votecount_mv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.