diffExp {piano} | R Documentation

## Perform differential expression analysis

### Description

Identifies differentially expressed genes by using the linear model approach of limma. Optionally produces a Venn diagram, heatmap, Polar plot and volcano plot.

### Usage

    diffExp(arrayData, contrasts, chromosomeMapping, fitMethod = "ls",
      adjustMethod = "fdr", significance = 0.001, plot = TRUE,
      heatmapCutoff = 1e-10, volcanoFC = 2, colors = c("red", "green",
      "blue", "yellow", "orange", "purple", "tan", "cyan", "gray60", "black"),
      save = FALSE, verbose = TRUE)

### Arguments

`arrayData` | an object of class `ArrayData`.
`contrasts` | a character vector giving the contrasts to be tested for differential expression. Use `extractFactors` to get allowed contrasts.
`chromosomeMapping` | character string giving the name of the chromosome mapping file, or an object of class `data.frame` or similar containing the chromosome mapping. Required for the Polar plot if the `ArrayData` object lacks annotation information. See details below.
`fitMethod` | character string giving the fitting method used by `lmFit`. Can be either `"ls"` for least squares (default) or `"robust"` for robust regression.
`adjustMethod` | character string giving the method to use for adjustment of multiple testing. Can be `"holm"`, `"hochberg"`, `"hommel"`, `"bonferroni"`, `"BH"`, `"BY"`, `"fdr"` (default) or `"none"`. See `p.adjust` for details.
`significance` | number giving the significance cutoff level for the Venn diagram and the horizontal line drawn in the volcano plot. Defaults to `0.001`.
`plot` | should plots be produced? Set either to `TRUE` (default) or `FALSE` to control all plots, or to a character vector with any combination of `"venn"`, `"heatmap"`, `"polarplot"` and `"volcano"`, to control the single plots (e.g. `plot=c("venn","polarplot")` or `plot="heatmap"`).
`heatmapCutoff` | number giving the significance cutoff level for the heatmap. Defaults to `1e-10`.
`volcanoFC` | number giving the x-coordinates of the vertical lines drawn in the volcano plot. Defaults to `2`.
`colors` | character vector of colors to be used by the Venn diagram and Polar plot.
`save` | should the figures and p-values be saved? Defaults to `FALSE`.
`verbose` | verbose? Defaults to `TRUE`.

### Details

This function uses limma to calculate p-values measuring differential expression in the given `contrasts`. The `uniqueFactors` given by `extractFactors` can be used to define a contrast vector, where each element should be a character string on the form `"uniqueFactorA - uniqueFactorB"`, note the space surrounding the `-`. (See the example below and for `extractFactors`.)

If appropriate annotation is missing for the `ArrayData` object the user can suppply this as `chromosomeMapping`. This should be either a `data.frame` or a tab delimited text file and include the columns chromosome with the chromosome name and chromosome location containing the starting position of each gene. A `-` sign can be used to denote the antisense strand but this will be disregarded while plotting. The rownames should be probe IDs or, if using a text file, the first column with a column header should contain the probe IDs.

Note that the `fitMethod="robust"` may need longer time to run.

A Venn diagram can be drawn for up to five contrasts (`diffExp()` will use `vennDiagram`).

The heatmap shows normalized expression values of the genes that pass the `heatmapCutoff` in at least one contrast.

A volcano plot is produced for each contrast showing magnitude of change versus significance.

The Polar plot sorts the genes according to chromosomal location, for each chromosome starting with unknown positions followed by increasing number in the chromosome location column. Genes which do not map to any chromosome are listed as U for unknown. The radial lines in the Polar plot are -log10 scaled p-values, so that a longer line means a smaller p-value. This gives an overview of the magnitude of differential expression for each contrast.

Typical usages are:

     # Identify significantly changed genes in
    'm1' and 'm2' compared to 'wt': diffExp(arrayData, contrasts=c("m1 - wt",
    "m2 - wt"))

### Value

A `list` with elements:

`pValues` | `data.frame` containing adjusted p-values (according to argument `adjustMethod`) for each contrast
`foldChanges` | `data.frame` containing log2 fold changes for each contrast
`resTable` | a `list` with an element for each contrast, each being a `data.frame` with full result information
`vennMembers` | `list` containing the gene members of each area of the Venn diagram (only returned when a Venn diagram is drawn)

### Author(s)

Leif Varemo piano.rpkg@gmail.com and Intawat Nookaew piano.rpkg@gmail.com

### References

Smyth, G. K. (2005). Limma: linear models for microarray data. In: 'Bioinformatics and Computational Biology Solutions using R and Bioconductor'. R. Gentleman, V. Carey, S. Dudoit, R. Irizarry, W. Huber (eds), Springer, New York, pages 397–420.

### See Also

piano, `loadMAdata`, `extractFactors`, `polarPlot`, `runGSA`, limma, `venn`, `heatmap.2`

### Examples

      # Get path to example data and setup files:
      dataPath <- system.file("extdata", package="piano")

      # Load normalized data:
      myArrayData <- loadMAdata(datadir=dataPath, dataNorm="norm_data.txt.gz", platform="yeast2")

      # Perform differential expression analysis:
      pfc <- diffExp(myArrayData, contrasts=c("aerobic_Clim - anaerobic_Clim",
                                              "aerobic_Nlim - anaerobic_Nlim"))

      # Order the genes according to p-values, for aerobic_Clim vs anaerobic_Clim:
      o <- order(pfc$resTable$'aerobic_Clim - anaerobic_Clim'$P.Value)

      # Display statistics for the top 10 significant genes:
      pfc$resTable$'aerobic_Clim - anaerobic_Clim'[o[1:10],]

[Package piano version 2.2.0 Index]