plot_metgroup: Loop-based EIC Plotter for metabolite groups

Description Usage Arguments Value Examples

View source: R/plotting-functions.R

Description

Plots EICs and Pseudospectra from parsed metabolite groups using plotEICs-methods() and plotPsSpectrum-methods() from CAMERA. Also plots correlation matrices and clustered dendrograms for each parsed metabolite group.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_metgroup(
  CAMERA.obj,
  Sample.df,
  Peak.list,
  center,
  BLANK,
  gen.plots,
  IonMode,
  file.base,
  QC.id,
  maxlabel
)

Arguments

CAMERA.obj

xsannotate object in parent environment with isotopes, ion adducts and fragments for positive mode.

Sample.df

a data frame with class info as columns. Must contain a separate row entry for each unique sex/class combination. Must contain the columns "Sex","Class","n","Endogenous".

Peak.list

a data frame from CAMERA that has been parsed. Must contain all output columns from XCMS, CAMERA, ParseCAMERA(). Can contain additional columns from match_Annotation(), calc_minfrac().

center

numeric value indicating which sample to pick for plotting purposes

BLANK

a logical indicating whether blanks are being evaluated. Default is FALSE.

gen.plots

a logical indicating whether to create plots for metabolite groups. Default is FALSE.

IonMode

a character string defining the ionization mode. Must be one of c("Positive","Negative").

file.base

character string used to name graphical output. Will be appended with "_CorrPlots.pdf".

QC.id

character identifier for pooled QC samples. Default is "Pooled_QC_".

maxlabel

numeric How many m/z labels to print

Value

List of length 2. 1st element is a data frame with all columns as the original data frame with column "Correlation.stat". 2nd element is a list of objects used to validate CAMERA results.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
library(LUMA)
if(require(lcmsfishdata, quietly = TRUE)) {

  # is case sensitive on Linux
  file <- system.file("extdata","Sample_Class.txt", package = "lcmsfishdata")
  Sample.df <- read.table(file, header = TRUE, sep = "\t")
  file2 <- system.file("extdata","CAMERA_objects_Pos.Rdata", package =
  "lcmsfishdata") # is case sensitive on Linux
  load(file2, envir = environment())
  Peak.list <- lcmsfishdata::Peaklist_Pos[["input_parsed"]]
  # is case sensitive on Linux
  file3 <- system.file("extdata","Sample_Data.csv", package = "lcmsfishdata")
  sample_data <- read.table(file3, header = TRUE, sep = ",")
  mzdatafiles <- sample_data$CT.ID

  file.base <- gen_filebase(mzdatafiles = mzdatafiles, BLANK = FALSE, IonMode
  = "Positive", ion.id = c("Pos","Neg"))

  test <- plot_metgroup(CAMERA.obj = anposGa, Sample.df = Sample.df,
  Peak.list = Peak.list, center = 2, BLANK = FALSE, gen.plots = FALSE,
  IonMode = "Positive", file.base = file.base, QC.id = "Pooled_QC_", maxlabel
  = 10)
  class(test) ##is list
  length(test) ## with 2 elements
  test2 <- test[[1]]
  colnames(test2)[(which(!colnames(test2) %in% colnames(Peak.list)))] #Adds new column
  test2[["Correlation.stat"]][1:10]


  ## Not run: 
  #Runs with pdf plotting. This requires access to raw datafiles and won't
  #work with lcmsfishdata. Better to use your own data here.
  test <- plot_metgroup(CAMERA.obj = anposGa, Sample.df = Sample.df,
  Peak.list = Peak.list, center = 2, BLANK = FALSE, gen.plots = TRUE, IonMode
  = "Positive", file.base = file.base, QC.id = "Pooled_QC_", maxlabel = 10)

  
## End(Not run)
}

USEPA/LUMA documentation built on Aug. 29, 2020, 1:40 p.m.