safeplot                package:safe                R Documentation

_S_A_F_E _p_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     A SAFE plot for a given category displays the distribution of
     ranked local statistics for the genes in the category against
     their complement.

_U_s_a_g_e:

     safeplot(safe)
     safeplot(safe , cat.name)
     safeplot(c.vec=, local.stats= , p.val=, one.sided=, limits=,
              extreme=, italic =, x.label=)

_A_r_g_u_m_e_n_t_s:

    safe: Object of class 'SAFE'. 

cat.name: Name of the category to be plotted. 

   c.vec: Optional numeric vector specifying the gene category. 

local.stats: Optional numeric vector of local statistics. Gene names
          should  be provided as 'names(local.stats)'.

   p.val: Optional numeric value of the category's empirical p-value

one.sided: Optional logical value indicating if local statistics are
          one-sided. 

  limits: Limits of the shaded region in the plot on the unranked
          scale. 

 extreme: Optional logical value whether only genes in the shaded
          region should be labeled. 

  italic: Optional logical value whether gene names should be italic. 

 x.label: Optional character string for the x-axis label. 

_D_e_t_a_i_l_s:

     SAFE-plots are suggeted as appropriate for visualizing the
     differential expression in a given category relative to the
     complementary set of genes. The empirical cumulative distribution
     is plotted for the ranked local statistics in the category. Tick
     marks are drawn along the top of the graph to indicate the genes'
     positions, and labeled. In this manner, genes with the most
     extreme local statistics can be identified in the plot.

_A_u_t_h_o_r(_s):

     William T. Barry: wbarry@bios.unc.edu

_R_e_f_e_r_e_n_c_e_s:

     W. T. Barry, A. B. Nobel and F.A. Wright, 2004, _Significance
     Analysis of functional categories in gene expression studies: a
     structured permutation approach_, _Bioinformatics_ In press. 

     See also the vignette included with this package.

_S_e_e _A_l_s_o:

     {'safe'.}

_E_x_a_m_p_l_e_s:

     ## Consider 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 is also made
     trt <- rep(c("Trt","Ctr"),each=n/2)
     trt

     ## 2 alternative catagories and  18 null categories
     ## will be made of 50 null genes. 

     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.matrix,Pi.mat = 100)
     results

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

