Run limma contrasts with optional probe replicates
Source:R/jam_secontrasts.R
      run_limma_replicate.RdRun limma contrasts with optional probe replicates
Usage
run_limma_replicate(
  imatrix,
  idesign,
  icontrasts,
  weights = NULL,
  robust = FALSE,
  adjust.method = "BH",
  confint = FALSE,
  trim_colnames = c("t", "B", "F", "sca.t"),
  adjp_cutoff = 0.05,
  p_cutoff = NULL,
  fold_cutoff = 1.5,
  int_adjp_cutoff = adjp_cutoff,
  int_p_cutoff = p_cutoff,
  int_fold_cutoff = fold_cutoff,
  mgm_cutoff = NULL,
  ave_cutoff = NULL,
  block = NULL,
  rowData_df = NULL,
  collapse_by_gene = FALSE,
  correlation = NULL,
  posthoc_test = c("none", "DEqMS"),
  posthoc_args = list(DEqMS = list(PSM_counts = NULL, fit.method = "loess")),
  seed = 123,
  verbose = FALSE,
  ...
)Arguments
- confint
 logicalpassed tolimma::topTable(), which defines whether to return confidence intervals for each log2 fold change.- adjp_cutoff, p_cutoff, fold_cutoff, mgm_cutoff, ave_cutoff
 numericvalues representing the appropriate statistical threshold, orNULLwhen a threshold should not be applied.- int_adjp_cutoff, int_p_cutoff, int_fold_cutoff
 numericthresholds to apply only to interaction contrasts.- rowData_df
 data.framerepresenting optional rowData annotation to be retained in the resulting statdata.frame. This argument is usually defined usingrowData_colnamesinse_contrast_stats(), which uses corresponding columns fromrowData(se).- collapse_by_gene
 logicalindicating whether to applycollapse_stats_by_genewhich chooses one "best" exemplar per gene when there are multiple rows that represent the same gene.- correlation
 numericorNULLpassed tolimma::lmFit(). Note that whenblockis defined (and non-empty), and whencorrelation=NULL, the correlation will be calculated by callinglimma::duplicateCorrelation().- seed
 numericvalue used to defineset.seed()for reproducibility. To avoid setting seed, useseed=NULL.- verbose
 logicalindicating whether to print verbose output.
Value
list with the following entries:
"stats_df":
data.framewith all individualdata.frameper contrast, merged together."stats_df":
listof individualdata.frameper contrast, each result is the output fromebayes2dfs()."rep_fits":
listof various intermediate model fits, dependent upon whether limma, limma-voom, or limma-DEqMS were used.
Details
This function is called by se_contrast_stats() to perform
the comparisons defined as contrasts. The se_contrast_stats()
function operates on a SummarizedExperiment object,
this function operates on the numeric matrix values
directly.
This function also calls ebayes2dfs() which extracts
each contrast result as a data.frame, whose column names
are modified to include the contrast names.
This function optionally (not yet ported from previous
implementation) detects replicate probes, and performs
the internal correlation calculations recommended by
limma user guide for replicate probes. In that case,
it detects each level of probe replication so that
each can be properly calculated. For example, Agilent
human 4x44 arrays often contain a large number of probes
with 8 replicates; a subset of probes with 4 replicates;
then the remaining probes (the majority overall) have
only one replicate each. In that case, this function
splits data into 8-replicate, 4-replicate, and 1-replicate
subsets, calculates correlations on the 8-replicate and
4-replicate subsets separately, then runs limma calculations
on the three subsets independently, then merges the results
into one large table. The end result is that the
final table contains one row per unique probe after
adjusting for probe replication properly in each scenario.
As the Agilent microarray layout is markedly less widely
used that in past, the priority to port this methodology
is quite low.
See also
Other jamses stats: 
ebayes2dfs(),
format_hits(),
handle_na_values(),
hit_array_to_list(),
process_sestats_to_hitim(),
save_sestats(),
se_contrast_stats(),
sestats_to_dfs(),
sestats_to_df(),
voom_jam()