replace_zeros_normalize: Replaces zeros and normalizes

Description Usage Arguments Value Examples

View source: R/normalization-functions.R

Description

Replaces zero values with half of the minimum value from all study samples and normalizes to unity

Usage

1
2
3
4
5
6
7
8
replace_zeros_normalize(
  Peak.list = NULL,
  Sample.df,
  tbl.id = NULL,
  QC.id = "Pooled_QC_",
  mult = 1000,
  ...
)

Arguments

Peak.list

a data frame containing combined ion mode peaklist with ion mode duplicates removed. Alternatively can be retrieved from databases. Default is NULL

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

tbl.id

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

QC.id

character vector specifying identifier in filename designating a Pooled QC sample. Only the first value will be used. Default is "Pooled_QC_"

mult

numeric multiplier to be added to unit normalization. Default is 1000

...

Arguments to pass parameters to database functions

Value

data frame containing normalized intensity matrix for all samples plus Pooled QCs

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","Sample_Class.txt", package = "lcmsfishdata")
  Sample.df <- read.table(file, header = TRUE, sep = "\t")
  Peak.list <- lcmsfishdata::Peaklist_db$Peaklist_Combined_FINAL
  QC.ID <- "Pooled_QC"
  mult <- 1

  test <- replace_zeros_normalize(Peak.list = Peak.list, Sample.df =
  Sample.df, QC.id = QC.ID, mult = mult)
  sum(test[,grep(QC.ID, colnames(test))]) # There are 11 Pooled QC samples,
  # each with unit normalized intensity values

  mult2 <- 1000
  test2 <- replace_zeros_normalize(Peak.list = Peak.list, Sample.df =
  Sample.df, QC.id = QC.ID, mult = mult2)
  sum(test2[,grep(QC.ID, colnames(test))]) #Now they are each normalized to 1000

  test_pos <- test[grep("Pos",test[["Ion.Mode"]]),grep(QC.ID, colnames(test))]
  test_neg <- test[grep("Neg",test[["Ion.Mode"]]),grep(QC.ID, colnames(test))]

  sum(test_pos) == sum(test_neg) #Ion modes are given equal weighting

}

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