timeLimits {ptairMS} | R Documentation

## Calculates time limits on the breath tracer

### Description

This function derives limits on the breath tracer indicated, where the intensity is greater than `fracMaxTIC*max(tracer)`. By setting `fracMaxTIC` close to 1, the size of the limits will be restricted. This function also determine the index corresponding to the background, where variation between two successive point can be control with `derivThreshold` parameter.

### Usage

    timeLimits(
      object,
      fracMaxTIC = 0.5,
      fracMaxTICBg = 0.2,
      derivThresholdExp = 1,
      derivThresholdBg = 0.05,
      mzBreathTracer = NULL,
      minPoints = 2,
      degreeBaseline = 1,
      baseline = TRUE,
      redefineKnots = TRUE,
      plotDel = FALSE
    )

    ## S4 method for signature 'ptrRaw'
    timeLimits(
      object,
      fracMaxTIC = 0.6,
      fracMaxTICBg = 0.2,
      derivThresholdExp = 0.5,
      derivThresholdBg = 0.05,
      mzBreathTracer = NULL,
      minPoints = 2,
      degreeBaseline = 1,
      baseline = TRUE,
      redefineKnots = TRUE,
      plotDel = FALSE
    )

    ## S4 method for signature 'ptrSet'
    timeLimits(
      object,
      fracMaxTIC = 0.5,
      fracMaxTICBg = 0.2,
      derivThresholdExp = 1,
      derivThresholdBg = 0.05,
      minPoints = 2,
      degreeBaseline = 1,
      baseline = TRUE,
      redefineKnots = TRUE,
      plotDel = FALSE
    )

### Arguments

`object` | a ptrRaw or ptrSet object
`fracMaxTIC` | between 0 and 1. Percentage of the maximum of the tracer amplitude with baseline removal. If you want a finer limitation, increase `fracMaxTIC`, indeed decrease
`fracMaxTICBg` | same as fracMaxTIC but for background detection (lower than fracMaxTIC*max(TIC))
`derivThresholdExp` | the threshold of the difference between two successive points of the expiration
`derivThresholdBg` | the threshold of the difference between two successive points of the background
`mzBreathTracer` | NULL or a integer. Correspond to a nominal masses of Extract Ion Current (EIC) whose limits you want to compute. If NULL, the limits are calculated on the Total Ion Current (TIC).
`minPoints` | minimum duration of an expiration (in index).
`degreeBaseline` | the degree of polynomial baseline function
`baseline` | logical, should the trace be baseline corrected?
`redefineKnots` | logical, should the knot location must be redefined with the new times limits ?
`plotDel` | boolean. If TRUE, the trace is plotted with limits and threshold.

### Value

a list with expiration limits (a matrix of index, where each column correspond to one expiration, the first row it is the beginning and the second the end, or NA if no limits are detected) and index of the background.

### Examples

    ## ptrRaw object

    library(ptairData)
    filePath <- system.file('extdata/exhaledAir/ind1', 'ind1-1.h5',
    package = 'ptairData')
    raw <- readRaw(filePath)

    timLim <- timeLimits(raw, fracMaxTIC=0.9, plotDel=TRUE)
    timLim_acetone <- timeLimits(raw, fracMaxTIC=0.5, mzBreathTracer = 59,
    plotDel=TRUE)

[Package ptairMS version 1.0.1 Index]