search_IonDup: Searches Peak.list for ion mode duplicates

Description Usage Arguments Value Examples

View source: R/query-functions.R

Description

Searches Peak.list with combined ionization mode data tables for duplicate entries

Usage

1
2
3
4
5
6
7
search_IonDup(object, Peak.list.pos, Peak.list.neg, search.par, col.names)

## S3 method for class 'mz'
search_IonDup(object, Peak.list.pos, Peak.list.neg, search.par, col.names)

## S3 method for class 'monoMass'
search_IonDup(object, Peak.list.pos, Peak.list.neg, search.par, col.names)

Arguments

object

used for method dispatch. Can be any object. See usage for details

Peak.list.pos

Positive ionization mode data table

Peak.list.neg

Negative ionization mode data table

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".

col.names

character vector of column names to include when searching for duplicate entries. Default is to include the ion mode, unique EIC_ID, monomolecular mass and retention time

Value

data frame containing the original Peak.list with added columns "Duplicate_ID" and "Duplicate_EIC"

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
library(LUMA)
if(require(lcmsfishdata, quietly = TRUE)) {
  file <- system.file("extdata","Search_Parameters.txt", package =
  "lcmsfishdata") # is case sensitive on Linux
  search.par <- read.table(file, header = TRUE, sep = "\t")
  class(method) <- method <- "monoMass"
  Peak.list.neg <- lcmsfishdata::Peaklist_db$Peaklist_Neg_Solvent_Peaks_Removed
  Peak.list.pos <- lcmsfishdata::Peaklist_db$Peaklist_Pos_Solvent_Peaks_Removed
  test <- search_IonDup(method, Peak.list.pos = Peak.list.pos,
                        Peak.list.neg = Peak.list.neg, search.par = search.par)
  colnames(test)[-which(colnames(test) %in% colnames(Peak.list.pos))] #Adds two new columns
  length(which(duplicated(test[["Duplicate_ID"]]))) #number of ion mode duplicates found


class(method) <- method <- "mz"
Peak.list.neg <- lcmsfishdata::Peaklist_Neg$output_parsed
Peak.list.pos <- lcmsfishdata::Peaklist_Pos$output_parsed

test <- search_IonDup(method, Peak.list.pos = Peak.list.pos,
                      Peak.list.neg = Peak.list.neg, search.par = search.par)
colnames(test)[-which(colnames(test) %in% colnames(Peak.list.pos))] #Adds two new columns
dupID.mz <- test[["Duplicate_ID"]][which(duplicated(test[["Duplicate_ID"]]))]
length(dupID.mz) #number of ion mode duplicates found
  
}

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