Skip to contents

Detect miss injected samples or samples with a total ion count below a percentage threshold of the median.

Usage

detectMissInjections(x, idx = "injOrder", threshold = 25)

# S4 method for Binalysis
detectMissInjections(x, idx = "injOrder", threshold = 25)

# S4 method for MetaboProfile
detectMissInjections(x, idx = "injOrder", threshold = 25)

Arguments

x

object of S4 class Binalysis or MetaboProfile

idx

the sample information column to use for sample indexes

threshold

the percentage of the median TIC below which samples will be considered miss injections.

Value

A list containing the name of the sample information column used to index the miss injections and a vector of miss injection indexes.

Examples

## Retrieve file paths and sample information for example data
files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]

info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]

## Perform spectral binning
analysis <- binneR::binneRlyse(files, 
                               info, 
                               parameters = binneR::detectParameters(files))
#> binneR v2.6.3 Fri Jul 21 17:26:20 2023
#> ________________________________________________________________________________
#> Scans: 5:14 
#> ________________________________________________________________________________
#> Reading raw data
#> Gathering bins
#> Removing single scan events
#> Averaging intensities across scans
#> Calculating bin metrics
#> Calculating accurate m/z
#> Building intensity matrix
#> Gathering file headers
#> 
#> Completed! [1.5S]

## Detect miss injections
miss_injections <- detectMissInjections(analysis)

## Display detected miss injections
miss_injections
#> $idx
#> [1] "injOrder"
#> 
#> $missInjections
#> numeric(0)
#>