remove_background_peaks: Removes background components from Peak.list

Description Usage Arguments Value Examples

View source: R/trimming-functions.R

Description

Searches features or compounds in Peak.list that are present in process blanks and removes them. Also flags compounds as exogenous, defined as mean abundance in endogenous samples below user-defined threshold.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
remove_background_peaks(
  Peak.list = NULL,
  Sample.df,
  search.par,
  method,
  lib.db,
  tbl.id,
  db.list,
  db.dir,
  new.db,
  mem,
  ...
)

Arguments

Peak.list

a named list of data frames (two per ionization mode) containing intensity matrices across all study samples and Pooled QCs and process blanks. Names should be c('pos','neg','blanks_pos','blanks_neg'). Alternatively may use existing database connections by setting to NULL

Sample.df

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

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

method

which method to apply to search for background components. See find_Background() for details.

lib.db

character name of database to contain Solvent Library

tbl.id

character vector of table names to draw from databases. First value should be table name from peak database, second should be table name from solvent database. Default is NULL.

db.list

list chracter names of databases containing results from processing positive mode (1,3) and negative mode (2,4) data for samples (1,2) and blanks (3,4) Default is NULL.

db.dir

character directory containing the databases Default is "db".

new.db

character what should the new database be called Default is "Peaklist_db".

mem

logical should database be in-memory. Default is FALSE.

...

Arguments to pass parameters to find_Background

Value

nested list a list for each ionization mode, each containing a list of two dataframes: the first contains the intensity matrix for the peaklist with solvent peaks removed, the second contains the intensity matrix for the solvent peaks

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
library(LUMA)
if(require(lcmsfishdata, quietly = TRUE)) {
file <- system.file('extdata','Sample_Class.txt', package = "LUMA") # is case
# sensitive on Linux
Sample.df <- read.table(file, header = TRUE, sep = "\t")
# is case sensitive on Linux
file2 <- system.file('extdata','Search_Parameters.txt', package = "LUMA")
search.par <- read.table(file2, header = TRUE, sep = "\t")

  #From m/z features
  Peak.list <- list(pos = lcmsfishdata::Peaklist_Pos$From_CAMERA, neg =
  lcmsfishdata::Peaklist_Neg$From_CAMERA, blanks_pos =
  lcmsfishdata::Blanks_Pos$From_CAMERA, blanks_neg =
  lcmsfishdata::Blanks_Neg$From_CAMERA)
  test <- remove_background_peaks(Peak.list = Peak.list, Sample.df =
  Sample.df, search.par = search.par, method = "mz", mem = TRUE)
  lapply(test, head) #Peaklists with removed background components are returned


#From combined features
Peak.list <- list(pos = lcmsfishdata::Peaklist_Pos$Trimmed_by_MinFrac, neg =
lcmsfishdata::Peaklist_Neg$Trimmed_by_MinFrac, blanks_pos =
lcmsfishdata::Blanks_Pos$Combined_Isotopes_and_Adducts, blanks_neg =
lcmsfishdata::Blanks_Neg$Combined_Isotopes_and_Adducts)
test <- remove_background_peaks(Peak.list = Peak.list, Sample.df = Sample.df,
search.par = search.par, method = "monoMass", mem = TRUE)
lapply(test, head) #Peaklists with removed background components are returned
 }

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