run_metric {MetProc} | R Documentation |
Calculate Longest Run of Blocks where Data is Present
Description
For each metabolite, data is split into blocks that consist of the preceding pooled plasma sample and following biological samples in an injection order. For each block, data is deemed present in biological samples if the missing rate is less than scut
. An entire block is deemed to have data present if both the preceding pooled plasma and folllowing biolgical samples are both considered to have data present. The length of the longest consecutive run of blocks with data present is returned for each metabolite.
Usage
run_metric(df, grps, scut = 0.5)
Arguments
df |
The metabolomics dataset, ideally read from the |
grps |
A group list from the |
scut |
The cutoff missing rate to determine if data is present in a group of biological samples. If the missing rate of the biological samples is greater than or equal to this missing rate threshold, data will be considered absent from the block of biological samples. Default is |
Value
Returns a vector containing the longest consecutive run of blocks with data present for each metabolite
See Also
See MetProc-package
for examples of running the full process.
Examples
library(MetProc)
#Read in metabolomics data
metdata <- read.met(system.file("extdata/sampledata.csv", package="MetProc"),
headrow=3, metidcol=1, fvalue=8, sep=",", ppkey="PPP", ippkey="BPP")
#Get indices of pooled plasma and samples
grps <- get_group(metdata,'PPP','X')
#Get the longest run metric for each metabolite
runs <- run_metric(metdata,grps,scut=.5)