formatLimmaResult: Format a Result from Limma

formatLimmaResultR Documentation

Format a Result from Limma

Description

It is not exported by DAPAR and has to be reproduced here.

Usage

formatLimmaResult(fit, conds, contrast)

Arguments

fit

Limma fit

conds

Condition vector

contrast

Contrast vector

Value

A list of two dataframes : logFC and P_Value. The first one contains the logFC values of all the comparisons (one column for one comparison), the second one contains the pvalue of all the comparisons (one column for one comparison). The names of the columns for those two dataframes are identical and correspond to the description of the comparison.

Author(s)

Adapted from the code of Samuel Wieczorek in the DAPAR package as it is an object that is not exported by the DAPAR package.

Examples

# library(DAPAR)
set.seed(2016)
data(qData)
data(sTab)
contrast=1
sTab.old <- sTab
conds <- factor(sTab$Condition, levels = unique(sTab$Condition))
sTab <- sTab[unlist(lapply(split(sTab, conds), function(x) {
  x["Sample.name"]
})), ]
qData <- qData[, unlist(lapply(split(sTab.old, conds), function(x) {
  x["Sample.name"]
}))]
conds <- conds[order(conds)]
res.l <- NULL
design.matrix <- mi4p::make.design(sTab)
contra <- mi4p::make.contrast(design.matrix, condition = conds, 
                                 contrast)
cmtx <- limma::makeContrasts(contrasts = contra, levels = make.names(colnames(design.matrix)))
fit <- limma::eBayes(limma::contrasts.fit(limma::lmFit(qData, 
                                                      design.matrix), cmtx))
res.l <- mi4p::formatLimmaResult(fit, conds, contrast)

mariechion/mi4p documentation built on March 28, 2023, 2:54 p.m.