calc_minfrac: Calculate minimum fraction of features across sample classes

Description Usage Arguments Value Examples

View source: R/calculation-functions.R

Description

Calculates the fraction of samples within each class that contains a given feature. Only the minimum fraction across all sample classes is returned.

Usage

1
calc_minfrac(Sample.df, xset4, BLANK, Peak.list)

Arguments

Sample.df

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

xset4

an xcms object that has had peak picking, retention time alignment, peak grouping, and imputing missing values performed

BLANK

a logical indicating whether blanks are being evaluated

Peak.list

a table of class 'tbl_df',tbl' or 'data.frame' with variables as columns. Should contain all output columns from XCMS and CAMERA, and additional columns from match_Annotation().

Value

data frame containing the original table with one additional column 'Minfrac' at the end, followed by the CAMERA columns 'isotopes','adduct','pcgroup'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  library(LUMA)
  if(require(lcmsfishdata, quietly = TRUE)) {
  file <- system.file('extdata','XCMS_objects_Pos.Rdata', package =
  "lcmsfishdata") # is case sensitive on Linux
  load(file)
  # case sensitive on Linux
  file2 <- system.file('extdata','Sample_Class.txt', package = "LUMA") # is
  Sample.df <- read.table(file2, sep = "\t", header = TRUE)
  Peak.list <- lcmsfishdata::Peaklist_Pos$From_CAMERA
  test <- calc_minfrac(Sample.df = Sample.df, xset4 = xset4, BLANK = FALSE,
  Peak.list = Peak.list)
  test[["MinFrac"]][11:23]
  }

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