View source: R/run_limma_and_lfc.R
run_limma_and_lfc | R Documentation |
Function to calculate LFC, run limma using lmFit
, contrasts.fit
,
and eBayes
with the flag robust = TRUE.
If neither weights
or gamma_reg_model
is provided, then
lmFit
will be run without precision weights.
If both are provided, then it will default to using the gamma_reg_model
model to produce the weights.
run_limma_and_lfc( data, design, contrast_matrix, gamma_reg_model = NULL, id_col = "id", weights = NULL, .robust = T )
data |
a |
design |
a design or model matrix produced by
|
contrast_matrix |
a contrast matrix produced by
|
gamma_reg_model |
the regression model produced by
|
id_col |
a character for the name of the column containing the name of the features in data (e.g., peptides, proteins, etc.). |
weights |
a matrix of precision weights. |
a tibble
with the id_col, then one p_val_* and lfc_* for each
comparison (*) in the contrast matrix
# Generate a design matrix for the data design <- model.matrix(~ 0 + factor(rep(1:2, each = 3))) # Set correct colnames, this is important for fit_gamma_* colnames(design) <- paste0("ng", c(50, 100)) # Generate the contrast matrix contrast <- limma::makeContrasts( contrasts = "ng100-ng50", levels = design ) # Normalize and log-transform the data yeast <- psrn(yeast, "identifier") # Fit the gamma regressions gamma_reg_model <- fit_gamma_weights(yeast, design, "identifier") # Exemplify on the non-missing data yeast <- tidyr::drop_na(yeast) results <- run_limma_and_lfc( yeast, design, contrast, gamma_reg_model, "identifier" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.