plotDensityCurves {qusage} | R Documentation

## Plot gene set PDFs

### Description

A function for plotting out the pdfs of a set of pathways.

### Usage

    plotDensityCurves(QSarray,
                      path.index=1:numPathways(QSarray),
                      zeroLine=TRUE,
                      addVIF=!is.null(QSarray$vif),
                      col=NULL,
                      plot=TRUE,
                      add=FALSE,
                      xlim=NULL,ylim=NULL,
                      xlab=NULL,ylab=NULL,
                      type="l",
                      ...)

### Arguments

`QSarray` | QSarray object
`path.index` | vector describing which pathways to plot. Can either be numeric or a character vector containing the names of the pathways to plot.
`zeroLine` | a logical indicating whether to include a vertical line at 0.
`addVIF` | a logical indicating whether the VIF should be used to calculate the variance of the pathway.
`col` | the color of the curves. Can be a vector of the same length as path.index specifying the color of each individual curve.
`plot` | Logical indicating whether to create the plot. If `FALSE`, only the coordinates for the plot will be returned, and no new plot will be created.
`add, xlim, ylim, xlab, ylab, type, ...` | parameters to be passed on to `plot`

### Details

This function uses the data produced by aggregateGeneSet to plot the PDFs of the pathways in QSarray. By default, `plotDensityCurves` will plot a curve for each pathway in the QSarray pathway, but this behavior can be controlled by the `path.index` parameter. For the best plots, it is suggested that you limit the number of curves plotted to below ten.

### Value

Invisibly returns a list of the same length as path.index, where each entry is a matrix of x- and y-coordinates for that pathway.

### Examples

       ##create example data
      eset = matrix(rnorm(500*20),500,20, dimnames=list(1:500,1:20))
      labels = c(rep("A",10),rep("B",10))

      ##genes 1:30 are differentially expressed
      eset[1:30, labels=="B"] = eset[1:30, labels=="B"] + 1
      geneSets = list(diff.set=1:30, base.set=31:60)

      ##Run qusage
      set.results = qusage(eset, labels, "B-A", geneSets)

      ##Plot results
      plotDensityCurves(set.results)

      ##plot just the first curve with a different color
      plotDensityCurves(set.results, path.index=1, col=2, lwd=2)

      ##plot the CDFs of the curves
      coords = plotDensityCurves(set.results, plot=FALSE)
      plot(0, type="n", xlim=c(-1,2),ylim=c(0,1),xlab="x",ylab="CDF")
      for(i in 1:length(coords)){
        points = coords[[i]]
        x = points$x
        y = cumsum(points$y)/sum(points$y)
        lines(x,y,col=i)
      }

[Package qusage version 2.20.0 Index]