combineDE: Combine Multiple Comparison Results from Differential...

View source: R/pipeline_functions.R

combineDER Documentation

Combine Multiple Comparison Results from Differential Expression (DE) or Differential Activity (DA) Analysis

Description

combineDE combines multiple comparisons of DE or DA analysis. Can combine DE with DE, DA with DA and also DE with DA if proper transfer table prepared.

Usage

combineDE(
  DE_list,
  DE_name = NULL,
  transfer_tab = NULL,
  main_id = NULL,
  method = "Stouffer",
  twosided = TRUE,
  signed = TRUE
)

Arguments

DE_list

list, each element in the list is one DE/DA comparison need to be combined.

DE_name

a vector of characters, the DE/DA comparison names. If not NULL, it must match the names of DE_list in correct order. If NULL, names of the DE_list will be used. Default is NULL.

transfer_tab

data.frame, the ID conversion table. Users can call get_IDtransfer to get this table. The purpose is to correctly mapping ID for DE_list. The column names must match DE_name. If NULL, ID column of each DE comparison will be considered as the same type. Default is NULL.

main_id

character, a name of the element in DE_list. The ID column of that comparison will be used as the ID of the final combination. If NULL, the first element name from DE_list will be used. Default is NULL.

method

character, users can choose between "Stouffer" and "Fisher". Default is "Stouffer".

twosided

logical, if TRUE, a two-tailed test will be performed. If FALSE, a one-tailed test will be performed, and P value falls within the range of 0 to 0.5. Default is TRUE.

signed

logical, if TRUE, give a sign to the P value, which indicating the direction of testing. Default is TRUE.

Details

For example, there are 4 subgroups in the phenotype, G1, G2, G3 and G4. One DE analysis was performed on G1 vs. G2, and another DE was performed on G1 vs. G3. If user is interested in the DE analysis between G1 vs. (G2 and G3), he can call this function to combine the two comparison results above toghether. The combined P values will be taken care by combinePvalVector.

Value

Return a list contains the combined DE/DA analysis. Each single comparison result before combination is wrapped inside (may have with some IDs filtered out, due to the combination). A data frame named "combine" inside the list is the combined analysis. Rows are genes/drivers, columns are combined statistics (e.g. "logFC", "AveExpr", "t", "P.Value" etc.).

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')
phe_info <- Biobase::pData(analysis.par$cal.eset)
each_subtype <- 'G4'
G0  <- rownames(phe_info)[which(phe_info$`subgroup`!=each_subtype)] # get sample list for G0
G1  <- rownames(phe_info)[which(phe_info$`subgroup`==each_subtype)] # get sample list for G1
DE_gene_limma <- getDE.limma.2G(eset=analysis.par$cal.eset,
                               G1=G1,G0=G0,
                               G1_name=each_subtype,
                               G0_name='other')
DA_driver_limma <- getDE.limma.2G(eset=analysis.par$merge.ac.eset,
                                 G1=G1,G0=G0,
                                 G1_name=each_subtype,
                                 G0_name='other')
DE_list <- list(DE=DE_gene_limma,DA=DA_driver_limma)
g1 <- gsub('(.*)_.*','\\1',DE_list$DA$ID)
transfer_tab <- data.frame(DE=g1,DA=DE_list$DA$ID,stringsAsFactors = FALSE)
res1 <- combineDE(DE_list,transfer_tab=transfer_tab,main_id='DA')

## Not run: 
each_subtype <- 'G4'
G0  <- rownames(phe_info)[which(phe_info$`subgroup`!=each_subtype)] # get sample list for G0
G1  <- rownames(phe_info)[which(phe_info$`subgroup`==each_subtype)] # get sample list for G1
DE_gene_limma_G4 <- getDE.limma.2G(eset=analysis.par$cal.eset,
                                   G1=G1,G0=G0,
                                   G1_name=each_subtype,
                                   G0_name='other')
each_subtype <- 'SHH'
G0  <- rownames(phe_info)[which(phe_info$`subgroup`!=each_subtype)] # get sample list for G0
G1  <- rownames(phe_info)[which(phe_info$`subgroup`==each_subtype)] # get sample list for G1
DE_gene_limma_SHH <- getDE.limma.2G(eset=analysis.par$cal.eset,
                                    G1=G1,G0=G0,
                                    G1_name=each_subtype,
                                    G0_name='other')
DE_list <- list(G4=DE_gene_limma_G4,SHH=DE_gene_limma_SHH)
res2 <- combineDE(DE_list,transfer_tab=NULL)

## End(Not run)

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