#' Wrapper for EnhancedVolcano
#' @export
#' @import EnhancedVolcano
#' @param Hotgenes_input R object generated by DEseq2_export or
#' Limma_export functions
#' @param pval_cut numeric indicating pvalue cut off
#' @param FCcutoff numeric indicating logfoldchange cut off
#' @param stuffer is a positive number added or subtracted from pvalue
#' or fold change values, used for x and y limits.
#' @param contrast name or numeric value to retrieve differential
#' expression data. See names(Hotgenes_input$Output_DE).
#' @examples
#' Example_Hotgenes_dir<-system.file("extdata",
#' "Example_Hotgenes.Rdata",
#' package = "Hotgenes", mustWork = TRUE)
#' load(Example_Hotgenes_dir)
#' names(Example_Hotgenes$Output_DE)
#' Vplot(Example_Hotgenes, contrast = 1)
Vplot<-function(Hotgenes_input=NULL,
pval_cut=0.1,
FCcutoff=0,
stuffer=1,
contrast=1){
id_sel<-names(Hotgenes_input$Output_DE[contrast])
plot_inputff<-Hotgenes_input$Output_DE[[id_sel]]
if(length(plot_inputff[plot_inputff$pvalue ==0,]$pvalue)>0){
message("0 pvalue replaced by min(pvalue)")
temp<-plot_inputff[plot_inputff$pvalue !=0,]
plot_inputff[plot_inputff$pvalue ==0,]$pvalue<-min(temp$pvalue)
}
xlim_min<-c(min(plot_inputff$log2FoldChange)-stuffer)
xlim_max<-c(stuffer+max(plot_inputff$log2FoldChange))
ylim_min<-c(min(-log10(plot_inputff$pvalue)-stuffer))
ylim_max<-c(stuffer+max(-log10(plot_inputff$pvalue)))
sdff<- EnhancedVolcano(plot_inputff,
lab = rownames(plot_inputff),
x = 'log2FoldChange', y = 'pvalue',
xlim = c( xlim_min,xlim_max),
ylim = c(ylim_min,ylim_max),
title = id_sel,
pCutoff = pval_cut,
FCcutoff = FCcutoff,
pointSize =3.0,
labSize = 3.0)
return(sdff)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.