plotSpectra           package:TargetSearch           R Documentation

_P_l_o_t _a _S_p_e_c_t_r_a _C_o_m_p_a_r_i_s_o_n

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

     'plotSpectra' plots a contrast between the reference spectra and
     the median spectra of a given metabolite in the library.
     'plotAllRIdev' saves the plots of the median-reference spectra
     comparisons of all the metabolites in the reference library into a
     PDF file.

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

     plotSpectra(Lib, peaks, libId = 1, type = "ht")

     plotAllSpectra(Lib, peaks, type = "ht", pdfFile, width = 8, height = 8, ...)

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

     Lib: A 'tsLib' object created by 'ImportLibrary' function. 

   peaks: A 'tsMSdata' object. See 'peakFind'.

   libId: A numeric vector providing the indices of the metabolites to
          plot. 

    type: The type of the plot. Options are '"ht"', head-tail plot,
          '"ss"', side by side plot, and '"diff"', spectrum difference
          plot. 

 pdfFile: A file name where the plot will be saved. Only
          'plotAllRIdev'. 

width, height: The width and height of the plots in inches. Only
          'plotAllRIdev'. 

     ...: Further options passed to 'pdf'. 

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

     The median spectra is obtained by computing the median intensity
     of every ion across the samples. The median and the reference
     spectra values are scaled to vary between 0 and 999 in order to
     make them comparable.

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

     Alvaro Cuadros-Inostroza, Matthew Hannah, Henning Redestig

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

     'tsLib', 'tsMSdata','pdf'

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

     require(TargetSearchData)
     data(TargetSearchData)

     # get RI file path
     RI.path <- file.path(.find.package("TargetSearchData"), "gc-ms-data")
     # update RI file path
     RIpath(sampleDescription) <- RI.path

     peakData <- peakFind(sampleDescription, refLibrary, corRI)

     # Plot a comparison RI deviation of metabolite "Valine"
     grep("Valine", libName(refLibrary)) # answer: 3
     plotSpectra(refLibrary, peakData, libId = 3, type = "ht")

     # Plot the spectra "side by side"
     plotSpectra(refLibrary, peakData, libId = 3, type = "ss")

     # Plot the spectra difference
     plotSpectra(refLibrary, peakData, libId = 3, type = "diff")

