peakCDFextraction: NetCDF to R

peakCDFextractionR Documentation

NetCDF to R

Description

This function reads a netcdf chromatogram (format 3 or 4) file and returns a list containing raw data (retention time, intensity matrix) for easy manipulation.

Usage

peakCDFextraction(cdfFile, massRange)

Arguments

cdfFile

A character string naming a netcdf file.

massRange

Deprecated. The mass range is extracted automatically.

Details

The cdfFile is a path to a CDF-3 or a CDF-4 format file. The CDF-4 format file is a custom file used on TargetSearch.

The massRange parameter is deprecated but kept for compatibility. The actual m/z range is detected automatically and returned to the user.

Value

A list with the following components:

Time

The retention time vector.

Index

The retention time index vector or NULL if unavailable.

Peaks

The intensity matrix. Rows are the retention times and columns are masses. The first column is the lower mass value and the last one is the higher mass.

massRange

The mass range.

baselineCorrected

Logical. It is TRUE if the file was baseline corrected by the function baseline. See note below.

Note

This function does not look for peaks, just extracts all the raw intensity values of the chromatogram file. Use NetCDFPeakFinding instead.

The function does not know whether a CDF file was baseline corrected (for example by the GC-MS software vendor), unless it was performed by the function baseline. It is perfectly possible to have a baseline corrected file and the element baselineCorrected be FALSE.

Author(s)

Alvaro Cuadros-Inostroza, Matthew Hannah, Henning Redestig

See Also

ncdf4_data_extract for an updated and more flexible version of this function, NetCDFPeakFinding, baseline.

Examples

### take a NCDF3 file from the package TargetSearchData
require(TargetSearchData)
# pick a CDF file and extract its data
cdffile <- tsd_cdffiles()[4]
peakData <- peakCDFextraction(cdffile)

# it also works for NCDF4 files (we need to convert the file first)
nc4file <- ncdf4_convert(cdffile, tempfile(fileext='.nc4'))
peakData2 <- peakCDFextraction(nc4file)

# clean-up
unlink(nc4file)

acinostroza/TargetSearch documentation built on June 14, 2024, 8:03 a.m.