View source: R/pipeline_functions.R
draw.GSEA.NetBID.GS | R Documentation |
draw.GSEA.NetBID.GS
creates a GSEA plot for gene sets with more NetBID analysis information.
Such as, number of genes in each gene set, marking the rank of annotated genes in the differential expression profile and differential activity (DA) values.
draw.GSEA.NetBID.GS(
DE = NULL,
name_col = NULL,
profile_col = NULL,
profile_trend = "pos2neg",
sig_gs_list = NULL,
gs_DA_Z = NULL,
use_gs2gene = NULL,
top_gs_number = 30,
target_col = "RdBu",
left_annotation = "",
right_annotation = "",
main = "",
profile_sig_thre = 0,
Z_sig_thre = 1.64,
pdf_file = NULL
)
DE |
data.frame, a data.frame created either by function |
name_col |
character, the name of the column in |
profile_col |
character, the name of the column in |
profile_trend |
character, users can choose between "pos2neg" and "neg2pos". "pos2neg" means high |
sig_gs_list |
a vector of characters, the names of top gene sets. |
gs_DA_Z |
a vector of numerics, the Z-statistics of differentail activity (DA) values for the |
use_gs2gene |
list, contains elements of gene sets. Element name is gene set name, each element contains a vector of genes belong to that gene set.
This list can be created by calling one element from |
top_gs_number |
integer, the number of top significant gene sets to be displayed. Default is 30. |
target_col |
character, name of the color palette used for display marker line in the panel. Users can choose between "black" and "RdBu". If "black", the marker line in the panel is black. If "RdBu", the marker line in the panel is Red to Blue. The color shade of the marker line is decided by each gene's significance of differentiation. High in red, low in blue. Default is "RdBu". |
left_annotation |
character, annotation on the left of profile curve, indicating high in control group or target group. Default is "". |
right_annotation |
character, annotation on the right of profile curve, indicating high in the opposite group of |
main |
character, an overall title for the plot. Default is "". |
profile_sig_thre |
numeric, threshold value for target genes. This parameter works only when |
Z_sig_thre |
numeric, threshold value of Z-statistics from |
pdf_file |
character, the file path to save figure as PDF file. If NULL, no PDF file will be saved. Default is NULL. |
Return a logical value. If TRUE, the plot has been created successfully.
## Not run:
db.preload(use_level='transcript',use_spe='human',update=FALSE)
## get all_gs2gene
analysis.par <- list()
analysis.par$out.dir.DATA <- system.file('demo1','driver/DATA/',package = "NetBID2")
NetBID.loadRData(analysis.par=analysis.par,step='ms-tab')
ms_tab <- analysis.par$final_ms_tab
comp <- 'G4.Vs.others'
DE <- analysis.par$DE[[comp]]
analysis.par$out.dir.PLOT <- getwd()
## directory for saving the pdf files
exp_mat_gene <- Biobase::exprs(analysis.par$cal.eset)
## calculate activity for all genesets
use_gs2gene <- merge_gs(all_gs2gene=all_gs2gene,
use_gs=c('H','CP:BIOCARTA','CP:REACTOME','CP:KEGG','C5'))
ac_gs <- cal.Activity.GS(use_gs2gene = use_gs2gene,cal_mat = exp_mat_gene)
## get DA for the gene set
phe_info <- Biobase::pData(analysis.par$cal.eset)
G0 <- rownames(phe_info)[which(phe_info$`subgroup`!='G4')]
# get sample list for G0
G1 <- rownames(phe_info)[which(phe_info$`subgroup`=='G4')]
# get sample list for G1
DA_gs <- getDE.limma.2G(eset=generate.eset(ac_gs),G1=G1,G0=G0,
G1_name='G4',G0_name='others')
## or use: DA_gs <- getDE.BID.2G(eset=generate.eset(ac_gs),G1=G1,G0=G0,
G1_name='G4',G0_name='others')
## draw vocalno plot for top sig-GS
sig_gs <- draw.volcanoPlot(dat=DA_gs,
label_col='ID',
logFC_col='logFC',
Pv_col='P.Value',
logFC_thre=0.25,
Pv_thre=1e-4,
main='Volcano Plot for gene sets',
show_label=TRUE,
label_type = 'distribute',
label_cex = 0.5,
pdf_file=sprintf('%s/vocalno_GS_DA.pdf',
analysis.par$out.dir.PLOT))
## GSEA plot for the significant gene sets
draw.GSEA.NetBID.GS(DE=DE,name_col='ID',
profile_col='t',profile_trend='pos2neg',
sig_gs_list = sig_gs$ID,
gs_DA_Z=DA_gs[sig_gs$ID,'Z-statistics'],
use_gs2gene = use_gs2gene,
top_gs_number=5,target_col='RdBu',
left_annotation = 'test_left',
right_annotation = 'test_right',
main='test',Z_sig_thre=1.64,profile_sig_thre = 0,
pdf_file=sprintf('%s/NetBID_GSEA_GS_demo1.pdf',
analysis.par$out.dir.PLOT))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.