combinePDFs: Combine PDFs from multiple QuSAGE comparisons

Description Usage Arguments Details Value Examples

View source: R/CombinePDF.R

Description

This function combines the results of multiple qusage runs into a single, joint PDF. The resulting PDFs will be the average of the PDFs from each individual QSarray object, weighted by the number of samples in each dataset.

Usage

1
combinePDFs(QSarrayList, n.points=2^14)

Arguments

QSarrayList

A list of QSarray objects, each generated from the same list of geneSets

n.points

integer; the number of points at which to sample the convoluted t-distribution. For best results, this should be about 2-4 times higher than the n.points used in the individual QSarray objects.

Details

Like aggregateGeneSet, combinePDFs uses numerical convolution to calculate the combined PDFs for individual pathways, with each individual PDF weighted by the total number of samples used in the comparison. This method is useful for meta-analysis of multiple datasets, or for a meta comparison where the difference between two QuSAGE pdfs is of interest.

The results of combinePDFs can be plotted (on a pathway-by-pathway basis) using the plotCombinedPDF function, or by simply calling "plot" on a QSarray object which contains the QSlist field.

Value

A QSarray object containing a convolution of the original QSarrays. The new QSarray object will contain an additional field, QSlist, containing the input QSarrayList.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##create example data - a set of 500 genes normally distributed across 40 patients
  eset = matrix(rnorm(500*40),500,40, dimnames=list(1:500,1:40))
  labels = rep(c("A","B","C","D"),each=10)
   
##create a number of gene sets with varying levels of differential expression.
  geneSets = list()
  for(i in 0:10){
    genes = ((30*i)+1):(30*(i+1))
    eset[genes,labels=="B"] = eset[genes,labels=="B"] + 2 + rnorm(1)
    eset[genes,labels=="D"] = eset[genes,labels=="D"] + 1 + rnorm(1)
    
    geneSets[[paste("Set",i)]] = genes
  }
   
   
##calculate qusage results
  qsList = lapply(c("B-A","D-C"), function(comparison){
    qusage(eset,labels, comparison, geneSets)
  })
  
##combine the two QSarrays
  qsComb = combinePDFs(qsList)
  
  plot(qsComb, path.index=1)

Example output

Loading required package: limma
Calculating gene-by-gene comparisons...Done.
Aggregating gene data for gene sets...Done.
Calculating variance inflation factors...Done.
Calculating gene-by-gene comparisons...Done.
Aggregating gene data for gene sets...Done.
Calculating variance inflation factors...Done.

qusage documentation built on Nov. 8, 2020, 8:09 p.m.