ptrvListIntensityByTime: ptrvListIntensityByTime A function automating all...

View source: R/ptrvListIntensityByTime.r

ptrvListIntensityByTimeR Documentation

ptrvListIntensityByTime A function automating all pretreatements for several files,removing the noise and the breathing biases

Description

ptrvListIntensityByTime A function automating all pretreatements for several files,removing the noise and the breathing biases

Usage

ptrvListIntensityByTime(
  listFiles,
  timeCol = "RelTime",
  colToRemove = c("AbsTime", "Cycle"),
  removeBlankTime = FALSE,
  ions = NULL,
  dec_vec = rep(".", length(listFiles)),
  sep = "\t",
  metaData = NULL,
  correction = "cycle",
  halfWindowSize = 5,
  smoothMethodBreath = "MovingAverage",
  method = "MAD",
  total = FALSE,
  breathRatio = FALSE,
  stat = "area",
  minimalDuration = 2,
  minExpi = NULL,
  maxInspi = NULL,
  forMinExpiDivideMaxIntBy = 5,
  forMaxInspiDivideMaxIntBy = 4,
  wd = getwd(),
  removeNoise = FALSE,
  statNoise = "avg",
  k = 3,
  removeNegative = TRUE,
  smoothing = FALSE,
  smoothMethod = "Spline",
  spar = NULL,
  sameTime = TRUE,
  time_x = NULL,
  negativeValuesToZero = TRUE
)

Arguments

listFiles

list of the file names to be imported. These files should contain a culmn of time (timeCol) then columns containing ions.

timeCol

name of the column of dataset containing the time

colToRemove

vector containing the names of the columns of datasets to be removed in the analysis (column that are neither the time nor ions names)

removeBlankTime

boolean. If TRUE, the time of blank time is removed from the time column

ions

vector of ion to be analyzed

dec_vec

Vector with the same length as listFiles containing the decimal separator used in the list of files

sep

separator used in the files to be read

metaData

A data.frame with colnames as "file","product","subject","rep","breathing","into","swallow","start","stop").See details

correction

"none" or "cycle". See Details.

halfWindowSize

parameter used to determine the smooth for the peak-picking used in break detection

method

method used for peak picking ("MAD" by default)

total

if TRUE, the total intensity is calculated and added as a supplementary column

breathRatio

if TRUE, the ratio between the intensity of ion and the breath is calculated

stat

Statistic to be extracted for each ion in each file. Among c("sum","moy","sd","n","min","max","tmax","area")

minimalDuration

minimalDuration of a breathing cycle (2 by default - as a accelerated breathing frequency corresponds to 20 cycles and more by minut and a low frequency is 12 and less -)

minExpi

minimal value for an expiry intensity to be detected as an expiry (blue dotted line in the plot).

maxInspi

maximal intensity of the original curve required to be considered as a breathing peak (purple dotted line in the plot)

forMinExpiDivideMaxIntBy

default to 5. When minExpi is null, it is evaluated as the ratio of the maximal intensity and forMinIntensityDivideMaxIntBy

forMaxInspiDivideMaxIntBy

default to 5. When minExpi is null, it is evaluated as the ratio of the maximal intensity and forMinIntensityDivideMaxIntBy

wd

working directory where the files of listFiles are.

removeNoise

if TRUE, the averaged intensity obtained during the timeBlank period is removed from the signal

smoothMethod

NULL, "SavitzkyGolay" or "MovingAverage"

Details

The "file" column of metaData correspond to the identifier of an evaluation. The 'start' column contains the time corresponding to the beginning of the measurement (when the subject begins to breath in PTR device) The "into" column correspond to the time when the sample is put into the mouth of the subject. The blank period is calculated as between the 'start' and the 'into" period. The 'nothing' column is not useful for this version of package but should contain the time when the subject has nothing more in the mouth The 'stop' column contains the time of the end of the evaluation (not the time of swallowing) The 'swallow" column should contain the time of swallowing but is not used in this version of the package. The 'breathing" column should contains the name of the ion used to evaluate breathing (the name of the column of your files that contains isoprene or acetone, for example)

Remark: maxInspi and minExpi can also take the value 'median' that indicates that the median of the breathing ion intensity is chosen as limit to detect inspiration or expiration as peak

Value

a list containing : res (data containing the corrected timepoints), metaData, cycleLimits and call.


ChemoSens/PTRMSR documentation built on June 15, 2025, 10:40 a.m.