safeplot: SAFE plot

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/safeplot.R

Description

A SAFE plot for a given category displays the empirical distribution function for the ranked (or unranked) local statistics of a given category.

Usage

1
2
3
4
5
  safeplot(safe = NULL, cat.name = "", limits = NULL, 
           c.vec = NULL, local.stats = NULL, gene.names = NULL,
           rank = TRUE, x.limits = NULL, c.thresh = 0, 
           colors = NULL, x.ticks = NULL, t.cex = 1, 
           p.val = NULL, cat.desc = NULL, title = "", ...)

Arguments

safe

Object of class SAFE

cat.name

Name of the category to be plotted. If omitted, the most significant category is plotted.

limits

Limits of the shaded region in the plot on the unranked scale

c.vec

Logical vector specifying membership to a gene category

local.stats

Numeric vector of local statistics

gene.names

Optional character vector to replace names(local.stats) in labels

rank

Logical to plotted raned (TRUE) or unranked (FALSE) local statistics on the x-axis

x.limits

Optional limits of the x-axis. By default will be range(local.stats)

c.thresh

Optional threshold for plotting tickmarks for a weighted (“soft”) gene category

colors

Optional vector specificy colors for gene labels

x.ticks

Optional location of x-axis tick marks on the ranked scale

t.cex

Text size for gene labels

p.val

Optional numeric value of the category's empirical p-value

cat.desc

Optional character string as a sub-title beneath the category name

title

Optional title to the plot

...

Allows arguments from version 2.0 to be ignored

Details

SAFE-plots display the differential expression in a given category relative to the complementary set of genes. The empirical cumulative distribution is plotted for local statistics in the category, on either a ranked or unranked scale. Tick marks are drawn along the top of the graph to indicate each gene's positions, and labeled when sufficient space permits. In this manner, genes with the most extreme local statistics can be identified as contributing to the category's significance.

Typical usages are

1
2
3
  safeplot(safe)
  safeplot(safe, cat.name)
  safeplot(c.vec, local.stats, p.val, limits)

Author(s)

William T. Barry: bbarry@jimmy.harvard.edu

References

W. T. Barry, A. B. Nobel and F.A. Wright, 2005, Significance Analysis of functional categories in gene expression studies: a structured permutation approach, Bioinformatics 21(9) 1943–1949.

See also the vignette included with this package.

See Also

safe.

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
25
26
27
28
29
30
31
## Simulate a dataset with 1000 genes and 20 arrays in a 2-sample design.
## The top 100 genes will be differentially expressed at varying levels

g.alt <- 100
g.null <- 900
n <- 20

data<-matrix(rnorm(n*(g.alt+g.null)),g.alt+g.null,n)
data[1:g.alt,1:(n/2)] <- data[1:g.alt,1:(n/2)] + 
                         seq(2,2/g.alt,length=g.alt)
dimnames(data) <- list(c(paste("Alt",1:g.alt),
                         paste("Null",1:g.null)),
                       paste("Array",1:n))

## A treatment vector 
trt <- rep(c("Trt","Ctr"),each=n/2)

## 2 alt. categories and 18 null categories of size 50

C.matrix <- kronecker(diag(20),rep(1,50))
dimnames(C.matrix) <- list(dimnames(data)[[1]],
    c(paste("TrueCat",1:2),paste("NullCat",1:18)))
dim(C.matrix)

results <- safe(data,trt,C.mat = C.matrix,Pi.mat = 100)
results

## SAFE-plot made for the first category
if (interactive()) { 
safeplot(results,"TrueCat 1")
}

Example output

Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

[1] 1000   20
Warning: y.vec is not (0,1), thus Group 1 == Trt 
100 permutations completed
SAFE results:
  Local: t.Student 
  Global: Wilcoxon 
  Method: permutation 
  Error: FDR.BH 

No categories were significant at FDR.BH < 0.05 

safe documentation built on Nov. 8, 2020, 5:37 p.m.