match_Annotation: Matches Peak.list annotations against Annotated Library

Description Usage Arguments Value Examples

View source: R/query-functions.R

Description

Compares isotope and adduct annotations within Peak.list (inherited from CAMERA) to user-defined annotation library and returns annotation results

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
match_Annotation(
  Peak.list,
  Annotated.library,
  Library.phenodata,
  rules,
  search.par,
  IonMode,
  lib_db,
  molweight
)

Arguments

Peak.list

a table of class 'tbl_dbi', 'tbl_sql', 'tbl_lazy', or 'tbl' with samples as columns. Should contain all output columns from XCMS and CAMERA, both metadata and sample data. Retention times must be in min.

Annotated.library

a data frame with annotated metabolite entries. Must contain at least five columns "Name", "Formula", "Molecular.Weight", "RT..Min.", and "Ion.Mode". Can contain additional columns.

Library.phenodata

a data frame with annotated metabolite entries. Contain all columns with additional information from Annotated Library.

rules

a data frame containing the rule list used by CAMERA to annotate ion adducts and fragments. Must contain the columns "name","nmol","charge","massdiff","oidscore", "quasi","ips".

search.par

a single-row data frame with 11 variables containing user-defined search parameters. Must contain the columns "ppm","rt","Voidrt","Corr.stat.pos","Corr.stat.neg", "CV","Minfrac", "Endogenous", "Solvent","gen.plots", "keep.singletons".

IonMode

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

lib_db

RSQLite connection

molweight

character string defining the name of the molecular weight column in Annotated.library. Default is "Molecular.Weight"

Value

data frame containing the original table with added columns 'Name','MS.ID','Formula','Annotated.adduct' and any additional info columns from Annotated.library

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
library(LUMA)
if(require(RSQLite, quietly = TRUE)) {
  Peak.list <- LUMA::Peaklist_Pos$From_CAMERA
  # is case sensitive on Linux
  file <- system.file('extdata','primary_adducts_pos.csv', package = "LUMA")
  rules <- read.table(file, header = TRUE, sep = ",")
  # is case sensitive on Linux
  file2 <- system.file('extdata','Search_Parameters.txt', package = "LUMA")
  search.par <- read.table(file2, header = TRUE, sep = "\t")
  # is case sensitive on Linux
  file3 <- system.file('extdata','Annotated_library.csv', package = "LUMA")
  temp.library <- read.table(file3, header = TRUE, sep = ",")
  Library.phenodata <- temp.library[,-which(colnames(temp.library) %in%
  c("Name","Formula","Molecular.Weight","RT..Min.","Ion.Mode"))]

  Annotated.library <- cbind.data.frame(Name = temp.library[["Name"]],
                                       Formula = temp.library[["Formula"]],
                                       Molecular.Weight = temp.library[["Molecular.Weight"]],
                                       RT..Min. = temp.library[["RT..Min."]],
                                       Ion.Mode = temp.library[["Ion.Mode"]])

  lib_db <- connect_libdb(lib.db = "Annotated_library", mem = TRUE)

  test <- match_Annotation(Peak.list = Peak.list, Annotated.library =
  Annotated.library, Library.phenodata = Library.phenodata, rules = rules,
  search.par = search.par, IonMode = "Positive", lib_db = lib_db)

  mycols <- c("Name","Formula","Molecular.Weight","Annotated.adduct","Annotated.mz")
  test[grep("GUANOSINE",test$Name),mycols]
  test[grep("INOSINE",test$Name),mycols]
  dbDisconnect(lib_db)
}

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