sum_features: Sum features by metabolite group

Description Usage Arguments Value Examples

View source: R/calculation-functions.R

Description

Sums all features belonging to the same metabolite into a single intensity value per metabolite group per sample

Usage

1
sum_features(Peak.list, Sample.df, search.par, QC.id, BLANK, IonMode)

Arguments

Peak.list

data frame. Must have column "metabolite_group". Should contain output columns from XCMS and CAMERA. Can contain columns from functions match_Annotation(), calc_minfrac(), ParseCAMERA(), plot_metgroup().

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

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

QC.id

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

BLANK

a logical indicating whether blanks are being evaluated

IonMode

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

Value

sum.range.list with the first column containing metabolite group and the rest containing sample and QC columns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(LUMA)
# is case sensitive on Linux
file <- system.file('extdata','Search_Parameters.txt', package = "LUMA")
search.par <- read.table(file, sep = "\t", header = TRUE)
# is case sensitive on Linux
file2 <- system.file('extdata','Sample_Class.txt', package = "LUMA")
Sample.df <- read.table(file2, sep = "\t", header = TRUE)
Peak.list <- LUMA::Peaklist_Pos$output_parsed
if("metabolite_group" %in% colnames(Peak.list)) {
  test <- sum_features(Peak.list = Peak.list, Sample.df = Sample.df ,
                       search.par = search.par, BLANK = FALSE, IonMode = "Positive")
} else (stop("Peak.list must have a column called \"metabolite_group\""))
## Not run: 
Peak.list <- LUMA::Peaklist_Pos$Annotated
if("metabolite_group" %in% colnames(Peak.list)) {
  test <- sum_features(Peak.list = Peak.list, Sample.df = Sample.df ,
                       search.par = search.par, BLANK = FALSE, IonMode = "Positive")
} else (stop("Peak.list must have a column called \"metabolite_group\""))

## End(Not run)

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