R/calculateIndividualLogFC.R
calculateIndividualLogFC.Rd
Utility function to run limma differential expression analysis
calculateIndividualLogFC(
x,
design,
contrast = ncol(design),
robust.fit = FALSE,
robust.eBayes = FALSE,
trend.eBayes = FALSE,
treat.lfc = NULL,
weights = NULL,
confint = TRUE,
with.fit = FALSE,
use.qlf = TRUE,
...,
xmeta. = NULL,
as.dt = FALSE
)
The expression object. This can be 1 column matrix if you are not running any analysis, and this function essentially is just a "pass through"
The design matrix for the experiment
The contrast you want to test and provide stats for. By
default this tests the last column of the design
matrix. If you
want to test a custom contrast, this can be a contrast vector, which
means that it should be as long as ncol(design)
and it most-often sum to
one. In the future, the user will be able to specify a range of
coefficients over design
to perform an ANOVA analysis, cf.
Issue #11 (https://github.com/lianos/multiGSEA/issues/11).
The value of the robust
parameter to pass down to the
limma::lmFit()
function. Defaults to FALSE
.
The value of the robust
parameter to pass down to
the limma::eBayes()] function.
The value of the trend
parameter to pass down to the
limma::eBayes()
function.
If this is numeric, this activates limma's "treat"
functionality and tests for differential expression against this
specified log fold change threshold. This defaults to NULL
.
an option matrix of weights to use in limma::lmFit()
.
If x
is an EList already, and x$weights
is already defined, this
argument will be ignored.
add confidence intervals to topTable
output (default
TRUE
)? Ignored if x
is a DGEList
.
If TRUE
, this function returns a list object with
both the fit and the table of logFC statistics, otherwise just the
logFC statistics table is returned.
If TRUE
(default), will use edgeR's quasilikelihood
framework for analysis, otherwise uses glmFit/glmTest.
parameters passed down into the relevant limma/edgeR based functions.
a data.frame to add meta data (symbol, primarly) to the outgoing
logFC data.frame. This is used when x
was a vector (pre-ranked).
If FALSE
(default), the data.frame like thing that
this funciton returns will be set to a data.frame. Set this to TRUE
to keep this object as a data.table
If with.fit == FALSE
(the default) a data.table
of
logFC statistics for the contrast under test. Otherwise, a list is
returned with $result
containing the logFC statistics, and
$fit
has the limma fit for the data/design/contrast under test.
This function fits linear modles (or glms) to perform differential
expression analyses. If the x
object is a DGEList
the
analysis will be performed using edgeR's quasi-likelihood framework,
otherwise limma will be used for all other scenarios.
If x
is a edgeR::DGEList()
we require that edgeR::estimateDisp()
has
already been called. If you prefer to analyze rnaseq data using voom, be sure
that x
is the object that has been returned from a call to limma::voom()
(or limma::voomWithQualityWeights()
.
The documentation here is speaking the language of a "limma" analysis, however for each parameter, there is an analagous function/parameter that will be delegated to.
Lastly, if x
is simply a single column matrix, we assume that we are
just passing a single pre-ranked vector of statistics through sparrow::seas's
analysis pipelines (for use in methods like "fgsea", "cameraPR", etc.), and
a logFC-like data.frame is constructed with these statistics in the
logFC
and t
columns.
vm <- exampleExpressionSet(do.voom = TRUE)
lfc <- calculateIndividualLogFC(vm, vm$design, "tumor")