calculatePathwayStatistics    package:sigPathway    R Documentation

_C_a_l_c_u_l_a_t_e _t_h_e _N_T_k _a_n_d _N_E_k _s_t_a_t_i_s_t_i_c_s

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

     Calculates the NTk and NEk statistics and the corresponding
     p-values and q-values for each selected pathway.

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

     calculate.NTk(tab, phenotype, gsList, nsim = 1000,
                   ngroups = 2, verbose = FALSE, alwaysUseRandomPerm = FALSE)
     calculate.NEk(tab, phenotype, gsList, nsim = 1000,
                   weightType = c("constant", "variable"),
                   ngroups = 2, verbose = FALSE, alwaysUseRandomPerm = FALSE)

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

     tab: a numeric matrix of expression values, with the rows and
          columns representing probe sets and sample arrays,
          respectively

phenotype: a numeric (or character if 'ngroups' >= 2) vector indicating
          the phenotype

  gsList: a list containing three vectors from the output of the
          'selectGeneSets' function

    nsim: an integer indicating the number of permutations to use

weightType: a character string specifying the type of weight to use
          when calculating NEk statistics

 ngroups: an integer indicating the number of groups in the matrix

 verbose: a boolean to indicate whether to print debugging messages to
          the R console

alwaysUseRandomPerm: a boolean to indicate whether the algorithm can
          use complete permutations for cases where 'nsim' is greater
          than the total number of unique permutations possible with
          the 'phenotype' vector

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

     These functions calculate the NTk and NEk statistics and the
     corresponding p-values and q-values for each selected pathway. 
     The output of both functions should be together to rank top
     pathways with the 'rankPathways' function.

_V_a_l_u_e:

     A list containing 

     ngs: number of gene sets

    nsim: number of permutations performed

   t.set: a numeric vector of Tk/Ek statistics

t.set.new: a numeric vector of NTk/NEk statistics

  p.null: the proportion of nulls

 p.value: a numeric vector of p-values

 q.value: a numeric vector of q-values

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

     Lu Tian, Peter Park, and Weil Lai

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

     Tian L., Greenberg S.A., Kong S.W., Altschuler J., Kohane I.S.,
     Park P.J. (2005)  Discovering statistically significant pathways
     in expression profiling studies.  _Proceedings of the National
     Academy of Sciences of the USA_, *102*, 13544-9.

     <URL: http://www.pnas.org/cgi/doi/10.1073/pnas.0506577102>

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

     ## Load in filtered, expression data
     data(MuscleExample)

     ## Prepare the pathways to analyze
     probeID <- rownames(tab)
     gsList <- selectGeneSets(G, probeID, 20, 500)

     ## Calculate NTk and weighted NEk for each gene set
     ## * Use a higher nsim (e.g., 2500) value for more reproducible results
     nsim <- 1000
     ngroups <- 2
     verbose <- TRUE
     weightType <- "constant"
     methodNames <- c("NTk", "NEk")
     npath <- 25
     allpathways <- FALSE
     annotpkg <- "hgu133a.db"

     res.NTk <- calculate.NTk(tab, phenotype, gsList, nsim, ngroups, verbose)
     res.NEk <- calculate.NEk(tab, phenotype, gsList, nsim, weightType,
                              ngroups, verbose)

     ## Summarize results
     res.pathways <- rankPathways(res.NTk, res.NEk, G, tab, phenotype,
                                  gsList, ngroups, methodNames, npath, allpathways)
     print(res.pathways)

     ## Get more information about the probe sets' means and other statistics
     ## for the top pathway in res.pathways
     statList <- calcTStatFast(tab, phenotype, ngroups)
     gpsList <-
       getPathwayStatistics(tab, phenotype, G, res.pathways$IndexG,
                            ngroups, statList, FALSE, annotpkg)
     print(gpsList[[1]])

     ## Write table of top-ranked pathways and their associated probe sets to
     ## HTML files
     parameterList <-
       list(nprobes = nrow(tab), nsamples = ncol(tab),
            phenotype = phenotype, ngroups = ngroups,
            minNPS = 20, maxNPS = 500, ngs = res.NTk$ngs,
            nsim.NTk = res.NTk$nsim, nsim.NEk = res.NEk$nsim,
            weightType = weightType,
            annotpkg = annotpkg, npath = npath, allpathways = allpathways)

     writeSP(res.pathways, gpsList, parameterList, tempdir(), "sigPathway_cPS",
             "TopPathwaysTable.html")

