plotFreqStat              package:aCGH              R Documentation

_f_r_e_q_u_e_n_c_y _p_l_o_t_s _a_n_d _s_i_g_n_i_f_i_c_a_n_c_e _a_n_a_l_y_s_i_s

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

     The main application of this function is to plot the frequency of
     changes.

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

     plotFreqStat(aCGH.obj, resT, pheno,
                  chrominfo = human.chrom.info.Jul03, X = TRUE, Y = FALSE,
                  threshold = TRUE, minChanged = 0, all = FALSE,
                  rsp.uniq = unique(pheno), nlim = 1, cutplot = 0,
                  titles = rsp.uniq, thres = 0.2, ylm = c(-1, 1),
                  ngrid = 2, p.thres = c(0.01, 0.05, 0.1),
                  mincolors = 0.1, quant.col = 0.11, numaut = 22,
                  onepage = TRUE, colored = TRUE, summarize.clones = TRUE)

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

aCGH.obj: Object of class 'aCGH'

    resT: Data frame having the same structure as the result of
          applying 'mt.maxT' or 'mt.minP' functions from Bioconductor's
          'multtest' package for multiple testing. The result is a data
          frame including the following 4 components: 'index',
          'teststat', 'rawp' and 'adjp'. 

   pheno: phenotype to compare.

chrominfo: Chromosomal information. Defaults to
          'human.chrom.info.Jul03' 

       X: Include X chromosome? Defaults to yes.

       Y: Include Y chromosome? Defaults to no.

  titles: 'titles' names of the groups to be used. Default is the
          unique levels of the 'pheno'. 

   thres: 'thres' is either a vector providing unique threshold for
          each sample or a vector of the same length as number of
          samples (columns in 'data') providing sample-specific
          threshold. Clone is considered to be gained if it is above
          the threshold and lost if it below negative threshold. Used
          for plotting the gain/loss freqeuncy data as well as for
          clone screening and for significance analysis when
          'threshold' is T. 

 cutplot: only clones with at least 'cutplot' frequency of gain and
          loss are plotted. 

     ylm: 'ylm' vertical limits for the plot

 p.thres: 'p.thres' vector of p-value ciut-off to be plotted. computed
          conservatively as the threshold corresponding to a given
          adjusted p-value. 

   ngrid: 'ngrid' in how many grids red and green colors need to be
          divided. 

    nlim: 'nlim' maximum value for colors.

mincolors: 'mincolors' minimum value for colors.

quant.col: 'quant.col' what quantile to use for color display. 

  numaut: 'numaut' number of the autosomes

 onepage: 'onepage' whether all plots are to be plotted on one page or
          different pages. 

threshold: 'threshold' specifies whether significance analysis should
          be performed using original values (F) or thresholded
          (trimerized) values (T). 

minChanged: Only clones that change in at least minChanged proportion
          of samples are plotted; is 0 by default. 

     all: 'all' specifies whether samples should be analyzed by
          subgroups (T) or together (F). 

rsp.uniq: 'rsp.uniq' specified the codes for the groups of interest.
          Default is the unique levels of the phenotype. Not used when
          'all' is T. 

 colored: Is plotting in color or not? Default is T.

summarize.clones: Return frequency summaries for individual clones.

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

     'aCGH'

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

     data(colorectal)

     ## Use mt.maxT function from multtest package to test
     ## differences in group means for each clone grouped by sex
     colnames(phenotype(colorectal))
     sex <- phenotype(colorectal)$sex
     sex.na <- !is.na(sex)
     colorectal.na <- colorectal[ ,sex.na, keep = TRUE ]
     dat <- log2.ratios.imputed(colorectal.na)
     resT.sex <- mt.maxT(dat, sex[sex.na], test = "t", B = 1000)

     ## Plot the result along the genome
     plotFreqStat(colorectal.na, resT.sex, sex[sex.na],
                  titles = c("Male", "Female"))

     ## Adjust the p.values from previous exercise with "fdr"
     ## method and plot them
     resT.sex.fdr <- resT.sex
     resT.sex.fdr$adjp <- p.adjust(resT.sex.fdr$rawp, "fdr")
     plotFreqStat(colorectal.na, resT.sex.fdr, sex[sex.na],
                  titles = c("Male", "Female"))

     ## Derive statistics and p-values for testing the linear association of
     ## age with the log2 ratios of each clone along the samples

     age <- phenotype(colorectal)$age
     age.na <- !is.na(age)
     colorectal.na <- colorectal[ ,age.na, keep = TRUE ]
     dat <- log2.ratios.imputed(colorectal.na)
     stat.age <- sapply(1:nrow(dat),
                        function(i) {
                           if (i %% 100 == 0)
                              cat(i, "\n")
                           lm.fit <-
                               summary(lm(dat[i,] ~ age[age.na]))
                           c(lm.fit$fstatistic[1],
                             1 - pf(lm.fit$fstatistic[1],
                                    lm.fit$fstatistic[2],
                                    lm.fit$fstatistic[3])
                            )
                        }
                        )
     ## Make resT
     resT.age <- data.frame(index = 1:ncol(stat.age),
                            teststat = stat.age[ 1, ],
                            rawp = stat.age[ 2, ],
                            adjp = p.adjust(stat.age[ 2, ], "fdr"))
     #write out the table of results:
     tbl.age <- data.frame(clones.info(colorectal), resT.age)
     write.table(tbl.age, "table.age.txt", sep="\t", col.names = TRUE,
                 row.names = FALSE, quote = FALSE)

