calculate.NGSk          package:sigPathway          R Documentation

_C_a_l_c_u_l_a_t_e _N_G_S_k (_N_T_k-_l_i_k_e) _s_t_a_t_i_s_t_i_c_s _w_i_t_h _g_e_n_e _l_a_b_e_l _p_e_r_m_u_t_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates the NGSk (NTk-like) statistics with gene label
     permutation and the corresponding p-values and q-values for each
     selected pathway.

_U_s_a_g_e:

     calculate.NGSk(statV, gsList, nsim = 1000, verbose = FALSE,
                    alwaysUseRandomPerm = FALSE)

_A_r_g_u_m_e_n_t_s:

   statV: a numeric vector of test statistic (not p-values) for each
          individual probe/gene

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

    nsim: an integer indicating the number of permutations to use

 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:

     This function is a generalized version of NTk calculations;
     'calculate.NTk' calls this function internally.  To use this
     function, the user must specify a vector of test statistics (e.g.,
     t-statistic, Wilcoxon).  Pathways from this function can be ranked
     with 'rankPathways.NGSk' or with 'rankPathways' when combined with
     results from another pathway analysis algorithm (e.g.,
     'calculate.NEk').

_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)

     nsim <- 1000
     ngroups <- 2
     verbose <- TRUE
     weightType <- "constant"
     methodName <- "NGSk"
     npath <- 25
     allpathways <- FALSE
     annotpkg <- "hgu133a.db"

     statV <- calcTStatFast(tab, phenotype, ngroups)$tstat
     res.NGSk <- calculate.NGSk(statV, gsList, nsim, verbose)

     ## Summarize top pathways from NGSk
     res.pathways.NGSk <-
       rankPathways.NGSk(res.NGSk, G, gsList, methodName, npath)
     print(res.pathways.NGSk)

     ## Get more information about the probe sets' means and other statistics
     ## for the top pathway in res.pathways.NGSk
     gpsList <-
       getPathwayStatistics.NGSk(statV, probeID, G, res.pathways.NGSk$IndexG,
                                 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.NGSk$ngs,
            nsim.NGSk = res.NGSk$nsim,
            annotpkg = annotpkg, npath = npath, allpathways = allpathways)

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

