View source: R/pipeline_functions.R
cal.Activity.GS | R Documentation |
cal.Activity.GS
calculates activity value for each gene set, and return a numeric matrix with rows of gene sets and columns of samples.
cal.Activity.GS(
use_gs2gene = all_gs2gene[c("H", "CP:BIOCARTA", "CP:REACTOME", "CP:KEGG")],
cal_mat = NULL,
es.method = "mean",
std = TRUE
)
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.
Default is using |
cal_mat |
numeric matrix, gene/transcript expression matrix. If want to input activity matrix, need to use 'processDriverProfile()' to pre-process the dataset. Detailed could see demo. |
es.method |
character, method to calculate the activity value. Users can choose from "mean", "absmean", "maxmean", "gsva", "ssgsea", "zscore" and "plage".
The details for using the last four options, users can check |
std |
logical, if TRUE, the expression matrix will be normalized by column. Default is TRUE. |
Return an activity matrix with rows of gene sets and columns of samples.
analysis.par <- list()
analysis.par$out.dir.DATA <- system.file('demo1','driver/DATA/',package = "NetBID2")
NetBID.loadRData(analysis.par=analysis.par,step='ms-tab')
gs.preload(use_spe='Homo sapiens',update=FALSE)
use_gs2gene <- merge_gs(all_gs2gene=all_gs2gene,
use_gs=c('H','CP:BIOCARTA','CP:REACTOME','CP:KEGG','C5'))
exp_mat_gene <- Biobase::exprs(analysis.par$cal.eset)
## each row is a gene symbol, if not, must convert ID first
ac_gs <- cal.Activity.GS(use_gs2gene = use_gs2gene,
cal_mat = exp_mat_gene)
## if want to input activity-matrix
ac_mat <- cal.Activity(target_list=analysis.par$merge.network$target_list,
cal_mat=Biobase::exprs(analysis.par$cal.eset),
es.method='weightedmean')
# pre-process the activity matrix by selecting the one
# with larger target size for duplicate drivers
Driver_name <- rownames(ac_mat)
ms_tab <- analysis.par$final_ms_tab
driver_size <- ms_tab[Driver_name,]$Size
use_driver <- processDriverProfile(Driver_profile=driver_size,
Driver_name=Driver_name,
choose_strategy='max',
return_type='driver_name')
use_driver_gene_name <-
processDriverProfile(Driver_profile=driver_size,
Driver_name=Driver_name,
choose_strategy='max',
return_type='gene_name')
ac_mat_gene <- ac_mat[use_driver,]
rownames(ac_mat_gene) <- use_driver_gene_name
driver_ac_gs <- cal.Activity.GS(use_gs2gene = use_gs2gene,
cal_mat = ac_mat_gene)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.