calc_corrstat: Calculate correlation matrices for metabolite groups

Description Usage Arguments Value Examples

View source: R/calculation-functions.R

Description

Calculates the correlation matrices for metabolite groups based on the best feature within the group that belongs to the primary metabolite.

Usage

1
calc_corrstat(Sample.df, Peak.list, get.mg, BLANK, IonMode)

Arguments

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

Peak.list

a data frame from CAMERA that has been parsed. Should contain all output columns from XCMS and CAMERA, and additional columns from match_Annotation(), calc_minfrac() and either parse_pos_results() or parse_neg_results().

get.mg

numerical vector of metabolite groups that have more than one feature

BLANK

a logical indicating whether blanks are being evaluated

IonMode

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

Value

Peak.list of class 'tbl_df','tbl' or 'data.frame' with variables as columns. Has all of the columns as the original data frame with one additional column "Correlation.stat"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(LUMA)
if(require(lcmsfishdata, quietly = TRUE)) {
file <- system.file('extdata','CAMERA_objects_Pos.Rdata', package =
"lcmsfishdata") # is case sensitive on Linux
load(file)
pspec.length <- sapply(anposGa@pspectra, function(x) length(x))
get.mg <- which(pspec.length > 1)
file2 <- system.file('extdata','Sample_Class.txt', package = "LUMA") # is
# case sensitive on Linux
Sample.df <- read.table(file2, sep = "\t", header = TRUE) #Ignore Warning message
Peak.list <-  lcmsfishdata::Peaklist_Pos$input_parsed
test <- calc_corrstat(Sample.df = Sample.df, Peak.list = Peak.list,
get.mg = get.mg, BLANK = FALSE, IonMode = "Positive")
test[["Correlation.stat"]][11:23]
}

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