diff_expr {crossmeta} | R Documentation

## Differential expression analysis of esets.

### Description

After selecting control and test samples for each contrast, surrogate variable analysis (`sva`) and differential expression analysis is performed.

### Usage

    diff_expr(
      esets,
      data_dir = getwd(),
      annot = "SYMBOL",
      prev_anals = list(NULL),
      svanal = TRUE,
      recheck = FALSE,
      postfix = NULL
    )

### Arguments

`esets` | List of annotated esets. Created by `load_raw`.
`data_dir` | String specifying directory of GSE folders.
`annot` | String, column name in fData common to all esets. For duplicated values in this column, the row with the highest interquartile range across selected samples will be kept. If meta-analysis will follow, appropriate values are "SYMBOL" (default - for gene level analysis) or, if all esets are from the same platform, "PROBE" (for probe level analysis).
`prev_anals` | Previous result of `diff_expr`, which can be reloaded using `load_diff`. If present, previous selections, names, and pairs will be reused.
`svanal` | Use surrogate variable analysis? Default is `TRUE`.
`recheck` | Would you like to recheck previous group/contrast annotations? Requires `prev_anals`. Default is FALSE.
`postfix` | Optional string to append to saved results. Useful if need to run multiple meta-analyses on the same series but with different contrasts.

### Details

The Samples tab is used to select control and test samples for each contrast. To do so: select rows for control samples, type a group name in the Control group name text input box and click the Add Group button. Repeat for test samples. While adding additional contrasts, a previous control group can be quickly reselected from the Previous selections dropdown box. After control and test samples have been added for all contrasts that you wish to include, click the Done button. Repeat for all GSEs.

Paired samples (e.g. the same subject before and after treatment) can be specified by selecting sample rows to pair and then clicking Pair Samples. The author does not usually specify paired samples and instead allows surrogate variable analysis to discover these inter-sample relationships from the data itself.

The Contrasts tab is used to view and delete contrasts that have already been added.

For each GSE, analysis results are saved in the corresponding GSE folder in `data_dir` that was created by `get_raw`. If analyses needs to be repeated, previous results can be reloaded with `load_diff` and supplied to the `prev_anals` parameter. In this case, previous selections, names, and pairs will be reused.

### Value

List of named lists, one for each GSE. Each named list contains:

`pdata` | data.frame with phenotype data for selected samples. Columns `treatment` ('ctrl' or 'test'), `group`, and `pair` are added based on user selections.
`top_tables` | List with results of `topTable` call (one per contrast). These results account for the effects of nuissance variables discovered by surrogate variable analysis.
`ebayes_sv` | Results of call to `eBayes` with surrogate variables included in the model matrix.
`annot` | Value of `annot` variable.

### Examples

    library(lydata)

    # location of raw data
    data_dir <- system.file("extdata", package = "lydata")

    # gather GSE names
    gse_names  <- c("GSE9601", "GSE15069", "GSE50841", "GSE34817", "GSE29689")

    # load first eset
    esets <- load_raw(gse_names[1], data_dir)

    # run analysis
    # anals <- diff_expr(esets, data_dir)

    # re-run analysis on first eset
    prev <- load_diff(gse_names[1], data_dir)
    # anals <- diff_expr(esets[1], data_dir, prev_anals = prev)

[Package crossmeta version 1.16.1 Index]