draw.GSEA.NetBID: Draw GSEA (gene set enrichment analysis) Plot with NetBID...

View source: R/pipeline_functions.R

draw.GSEA.NetBIDR Documentation

Draw GSEA (gene set enrichment analysis) Plot with NetBID Analysis of Drivers

Description

draw.GSEA.NetBID creates a GSEA plot for drivers with more NetBID analysis information. Such as number of target genes, ranking of target genes in differential expressed file, differential expression (DE) and differential activity (DA) values.

Usage

draw.GSEA.NetBID(
  DE = NULL,
  name_col = NULL,
  profile_col = NULL,
  profile_trend = "pos2neg",
  driver_list = NULL,
  show_label = driver_list,
  driver_DA_Z = NULL,
  driver_DE_Z = NULL,
  target_list = NULL,
  top_driver_number = 30,
  target_nrow = 2,
  target_col = "RdBu",
  target_col_type = "PN",
  left_annotation = "",
  right_annotation = "",
  main = "",
  profile_sig_thre = 0,
  Z_sig_thre = 1.64,
  pdf_file = NULL
)

Arguments

DE

data.frame, a data.frame created either by function getDE.limma.2G or getDE.BID.2G. Row names are gene/driver names, columns must include gene/driver name and calculated differencial values (e.g. "ID", "logFC", "AveExpr", "P.Value" etc.).

name_col

character, the name of the column in DE contains gene names. If NULL, will use the row names of DE. Default is NULL.

profile_col

character, the name of the column in DE contains calculated differencial value (e.g. "logFC" or "P.Value"). If DE is created by getDE.limma.2G or getDE.BID.2G, this parameter should be set to "logFC" or "t".

profile_trend

character, users can choose between "pos2neg" and "neg2pos". "pos2neg" means high profile_col in target group will be shown on the left. "neg2pos" means high profile_col in control group will be shown on the left. Default is "pos2neg". For details, please check online tutorial.

driver_list

a vector of characters, the names of top drivers.

show_label

a vector of characters, the names of top drivers. If NULL, will display the names in driver_list. Default is NULL.

driver_DA_Z

a vector of numerics, the Z statistics of differential activity (DA) value of the driver_list. It is highly suggested to give names to the vector, otherwise the names of driver_list will be used.

driver_DE_Z

a vector of numerics, the Z statistics of differential expressed (DE) value of the driver_list. It is highly suggested to give names to the vector, otherwise the names of driver_list will be used.

target_list

list, the driver-to-target list object. The names of the list elements are drivers. Each element is a data frame, usually contains at least three columns. "target", target gene names; "MI", mutual information; "spearman", spearman correlation coef- ficient. Users can call get_net2target_list to create this list.

top_driver_number

numeric, number for the top significant drivers to be displayed in the plot. Default is 30.

target_nrow

numeric, users can choose between 1 and 2. Number of panels to mark the ranking of target genes. If 1, the ranking of target genes will be marked in one panel. If 2, the ranking of target genes will be marked in two panels. Upper panel for positively-regulated, lower panel for negatively-regulated. Default is 2. For details, please check online tutorial.

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. If target_col_type is set as 'PN', the positive regulated genes will be colored in red and negative regulated genes in blue. If target_col_type is set as 'DE', the color for the target genes is set according to its value in the differentiated expression profile, with significant high set for red and low for blue. The significant threshold is set by profile_sig_thre. Default is 'RdBu'.

target_col_type

character, name of the color palette used for display target genes. This parameter works only when target_col is set as "RdBu". Users can choose between "PN" and "DE". If "PN", positively-regulated genes will be colored red and negatively-regulated genes will be colored blue. If "DE", the color shades is decided by its differentiated value. Default is "PN".

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 left_annotation. Default is "".

main

character, an overall title for the plot. Default is "".

profile_sig_thre

numeric, threshold value for target genes. This parameter works only when target_col_type is set as "DE" and target_col is set as "RdBu". Non-significant target genes will be colored grey. Default is 0.

Z_sig_thre

numeric, threshold value of Z statistics from driver_DA_Z and driver_DE_Z. Significant values will have background color. Default is 1.64.

pdf_file

character, the file path to save figure as PDF file. If NULL, no PDF file will be saved. Default is NULL.

Value

Return a logical value. If TRUE, the plot has been created successfully.

Examples

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]]
sig_driver <- draw.volcanoPlot(dat=ms_tab,label_col='gene_label',
                               logFC_col='logFC.G4.Vs.others_DA',
                               Pv_col='P.Value.G4.Vs.others_DA',
                               logFC_thre=0.4,
                               Pv_thre=1e-7,
                               main='Volcano Plot for G4.Vs.others_DA',
                               show_label=FALSE,
                               label_type = 'origin',
                               label_cex = 0.5)
driver_list <- rownames(sig_driver)
draw.GSEA.NetBID(DE=DE,profile_col='t',
                 name_col='ID',
                 profile_trend='neg2pos',
                 driver_list = driver_list,
                 show_label=ms_tab[driver_list,'gene_label'],
                 driver_DA_Z=ms_tab[driver_list,'Z.G4.Vs.others_DA'],
                 driver_DE_Z=ms_tab[driver_list,'Z.G4.Vs.others_DE'],
                 target_list=analysis.par$merge.network$target_list,
                 top_driver_number=5,
                 target_nrow=2,target_col='RdBu',
                 left_annotation = 'test_left',
                 right_annotation = 'test_right',
                 main='test',target_col_type='DE',
                 Z_sig_thre=1.64,
                 profile_sig_thre = 1.64)
## Not run: 
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]]
sig_driver <- draw.volcanoPlot(dat=ms_tab,label_col='gene_label',
                               logFC_col='logFC.G4.Vs.others_DA',
                               Pv_col='P.Value.G4.Vs.others_DA',
                               logFC_thre=0.4,
                               Pv_thre=1e-7,
                               main='Volcano Plot for G4.Vs.others_DA',
                               show_label=FALSE,
                               label_type = 'origin',
                               label_cex = 0.5)
driver_list <- rownames(sig_driver)
analysis.par$out.dir.PLOT <- getwd() ## directory for saving the pdf files
draw.GSEA.NetBID(DE=DE,profile_col='logFC',profile_trend='neg2pos',
                 driver_list = driver_list,
                 show_label=ms_tab[driver_list,'gene_label'],
                 driver_DA_Z=ms_tab[driver_list,'Z.G4.Vs.others_DA'],
                 driver_DE_Z=ms_tab[driver_list,'Z.G4.Vs.others_DE'],
                 target_list=analysis.par$merge.network$target_list,
                 top_driver_number=30,
                 target_nrow=2,
                 target_col='RdBu',
                 left_annotation = 'test_left',
                 right_annotation = 'test_right',
                 main='test',
                 target_col_type='DE',
                 Z_sig_thre=1.64,
                 profile_sig_thre = 1.64,
                 pdf_file=sprintf('%s/NetBID_GSEA_demo1.pdf',
                 analysis.par$out.dir.PLOT))
draw.GSEA.NetBID(DE=DE,profile_col='t',profile_trend='neg2pos',
                 driver_list = driver_list,
                 show_label=ms_tab[driver_list,'gene_label'],
                 driver_DA_Z=ms_tab[driver_list,'Z.G4.Vs.others_DA'],
                 driver_DE_Z=ms_tab[driver_list,'Z.G4.Vs.others_DE'],
                 target_list=analysis.par$merge.network$target_list,
                 top_driver_number=30,
                 target_nrow=1,
                 target_col='RdBu',
                 left_annotation = 'test_left',
                 right_annotation = 'test_right',
                 main='test',target_col_type='PN',
                 Z_sig_thre=1.64,profile_sig_thre = 1.64,
                 pdf_file=sprintf('%s/NetBID_GSEA_demo2.pdf',
                 analysis.par$out.dir.PLOT))

## End(Not run)

jyyulab/NetBID documentation built on Dec. 23, 2024, 6:34 a.m.