gatherInfo              package:flagme              R Documentation

_G_a_t_h_e_r_s _a_b_u_n_d_a_n_c_e _i_n_f_o_r_m_a_t_i_o_n_s _f_r_o_m _a_n _a_l_i_g_n_m_e_n_t

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

     Given an alignment table (indices of matched peaks across several
     samples) such as that within a 'progressiveAlignment' or
     'multipleAlignment' object,  this routines goes through the raw
     data and collects the abundance of each fragment peak, as well as
     the retention times across the samples.

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

     gatherInfo(pD, obj, newind = NULL, method = c("apex"), findmzind = TRUE, useTIC = FALSE, top = NULL, intensity.cut = 0.05)

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

      pD: a 'peaksDataset' object, to get the abundance data from 

     obj: either a 'multipleAlignment' or 'progressiveAlignment' object

  newind: list giving the 

  method: method used to gather abundance information, only 'apex'
          implemented currently.

findmzind: logical, whether to take a subset of all m/z indices

  useTIC: logical, whether to use total ion current for abundance
          summaries

     top: only use the top 'top' peaks

intensity.cut: percentage of the maximum intensity

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

     This procedure loops through the the table of matched peaks and
     gathers the

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

     Returns a list (of lists) for each row in the alignment table. 
     Each list has 3 elements: 

      mz: a numerical vector of the m/z fragments used

      rt: a numerical vector for the exact retention time of each peak
          across all samples

    data: matrix of fragment intensities.  If 'useTIC=TRUE', this
          matrix will have a single row

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

     Mark Robinson

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

     Mark D Robinson (2008).  Methods for the analysis of gas
     chromatography - mass spectrometry data  _PhD dissertation_
     University of Melbourne.

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

     'imputePeaks'

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

     require(gcspikelite)

     # paths and files
     gcmsPath<-paste(.find.package("gcspikelite"),"data",sep="/")
     cdfFiles<-dir(gcmsPath,"CDF",full=TRUE)
     eluFiles<-dir(gcmsPath,"ELU",full=TRUE)

     # read data, peak detection results
     pd<-peaksDataset(cdfFiles[1:2],mz=seq(50,550),rtrange=c(7.5,8.5))
     pd<-addAMDISPeaks(pd,eluFiles[1:2])

     # multiple alignment
     ma<-multipleAlignment(pd,c(1,1),wn.gap=0.5,wn.D=.05,bw.gap=0.6,bw.D=.2,usePeaks=TRUE,filterMin=1,df=50,verbose=TRUE)

     # gather apex intensities
     d<-gatherInfo(pd,ma)

     # table of retention times
     nm<-list(paste("MP",1:length(d),sep=""),c("S1","S2"))
     rts<-matrix(unlist(sapply(d,.subset,"rt")),byrow=TRUE,nc=2,dimnames=nm)

