Isoreader supports several continuous flow IRMS data formats. This vignette shows some of the functionality for continuous flow files. For additional information on operations more generally (caching, combining read files, data export, etc.), please consult the operations vignette. For details on downstream data processing and visualization, see the isoprocessor package.
Reading continuous flow files is as simple as passing one or multiple file or folder paths to the
iso_read_continuous_flow() function. If folders are provided, any files that have a recognized continuous flow file extensions within those folders will be processed (e.g. all
.iarc). Here we read several files that are bundled with the package as examples (and whose paths can be retrieved using the
iso_get_reader_example() function). Note that some of the files (.cf, .dxf) are individual analysis files whereas others (.iarc) are collections of several files.
# read a few of the continuous flow examples iso_files <- iso_read_continuous_flow( iso_get_reader_example("continuous_flow_example.cf"), iso_get_reader_example("continuous_flow_example.iarc"), iso_get_reader_example("continuous_flow_example.dxf"), iso_get_reader_example("linearity_example.dxf") ) #> Info: preparing to read 4 data file(s)... #> Info: reading file 'continuous_flow_example.cf' from cache... #> Info: reading file 'continuous_flow_example.iarc' from cache... #> Info: reading file 'continuous_flow_example.dxf' from cache... #> Info: reading file 'linearity_example.dxf' from cache... #> Info: finished reading 4 files in 0.16 secs
iso_files variable now contains a set of isoreader objects, one for each file. Take a look at what information was retrieved from the files using the
In case there was any trouble with reading any of the files, the following functions provide an overview summary as well as details of all errors and warnings, respectively. The examples here contain no errors but if you run into any unexpected file read problems, please file a bug report in the isoreader issue tracker.
Detailed file information can be aggregated for all isofiles using the
iso_get_file_info() function which supports the full select syntax of the dplyr package to specify which fields are of interest (by default, all file information is retrieved). The following provides a few examples for how this can be used (the names of the interesting info columns may vary between different file formats):
# select file information iso_files %>% iso_get_file_info( select = c( # select the Analysis column (keep the name) Analysis, # select the time stamp and rename it to `Date & Time` `Date & Time` = file_datetime, # select all columns that start with "Id" and rename them id1, id2, etc. id = starts_with("Id"), # select all columns that contain "Method" matches("Method")) ) %>% rmarkdown::paged_table() #> Info: aggregating file info from 7 data file(s)
Additionally, some IRMS data files contain resistor information that are useful for downstream calculations (see e.g. section on signal conversion later in this vignette):
As well as isotopic reference values for the different gases:
The raw data read from the IRMS files can be retrieved similarly using the
iso_get_raw_data() function. Most data aggregation functions also allow for inclusion of file information using the
include_file_info parameter, which functions identically to the
select parameter of the
iso_get_file_info function discussed earlier.
# get specific raw data and add some file information iso_files %>% iso_get_raw_data( # select just time and the m/z 2 and 3 ions select = c(time.s, v2.mV, v3.mV), # include the Analysis number fron the file info and rename it to 'run' include_file_info = c(run = Analysis) ) %>% # look at first few records only head(n=10) %>% rmarkdown::paged_table() #> Info: aggregating raw data from 7 data file(s), selecting data columns 'c(time.s, v2.mV, v3.mV)', including file info 'c(run = Analysis)'
The isoreader package is intended to make raw stable isotope data easily accessible. However, as with most analytical data, there is significant downstream processing required to turn these raw intensity chromatograms into peak-specific, properly referenced isotopic measurements. This and similar functionality as well as data visualization is part of the isoprocessor package which takes isotopic data through the various corrections in a transparent, efficient and reproducible manner.
That said, most vendor software also performs some of these calculations and it can be useful to be able to compare new data reduction procecures against those implemented in the vendor software. For this purpose, isoreader retrieves vendor computed data tables whenver possible, as illustrated below.
As with most data retrieval funtions, the
iso_get_vendor_data_table() function also allows specific column selection (by default, all columns are selected) and easy addition of file information via the
include_file_info parameter (by default, none is included).
# get specific parts and add some file information iso_files %>% iso_get_vendor_data_table( # select peak number, ret. time, overall intensity and all H delta columns select = c(Nr., Rt, area = `rIntensity All`, matches("^d \\d+H")), # include the Analysis number fron the file info and rename it to 'run' include_file_info = c(run = Analysis) ) %>% rmarkdown::paged_table() #> Info: aggregating vendor data table without units from 7 data file(s), including file info 'c(run = Analysis)'
# the data table also provides units if included in the original data file # caution however: it may require changes to the `select` parameter iso_files %>% iso_get_vendor_data_table( with_units = TRUE, # select peak number, ret. time, overall intensity and all H delta columns select = c(Nr., matches("^Rt"), matches("rIntensity All"), matches("^d \\d+H")), # include the Analysis number fron the file info and rename it to 'run' include_file_info = c(run = Analysis) ) %>% rmarkdown::paged_table() #> Info: aggregating vendor data table with units from 7 data file(s), including file info 'c(run = Analysis)'
For users familiar with the nested data frames from the tidyverse (particularly tidyr’s
unnest), there is an easy way to retrieve all data from the iso file objects in a single nested data frame. Use the
include_vendor_data_table parameters to specify which columns to include. By default, everything is included:
Saving entire collections of isofiles for retrieval at a later point is easily done using the
iso_save function which stores collections or individual isoreader file objects in the efficient R data storage format
.rds (if not specified, the extension
.cf.rds will be automatically appended). These saved collections can be convientiently read back using the same
iso_read_continuous_flow command used for raw data files.
# export to R data archive iso_files %>% iso_save("iso_files_export.cf.rds") #> Info: exporting data from 7 iso_files into R Data Storage 'iso_files_export.cf.rds' # read back the exported R data archive iso_files <- iso_read_continuous_flow("iso_files_export.cf.rds") #> Info: preparing to read 1 data file(s)... #> Info: reading file 'iso_files_export.cf.rds' with '.cf.rds' reader #> Info: loaded data for 7 data files from R Data Storage - checking load... #> Info: finished reading 1 files in 0.08 secs iso_files %>% iso_get_data_summary() %>% rmarkdown::paged_table() #> Info: aggregating data summary from 7 data file(s)
At the moment, isoreader supports export of all data to R Data archives, Excel, and the Feather file format (a Python/R cross-over format). Note that both export methods have similar syntax and append the appropriate file extension for each type of export file (
# export to excel iso_files %>% iso_export_to_excel("iso_files_export") #> Info: exporting data from 7 iso_files into Excel 'iso_files_export.cf.xlsx' # data sheets available in the exported data file: readxl::excel_sheets("iso_files_export.cf.xlsx") #>  "raw data" "file info" "method info" #>  "vendor data table" "problems"
# export to feather iso_files %>% iso_export_to_feather("iso_files_export") #> Info: exporting data from 7 iso_files into .cf.feather files at 'iso_files_export' # exported feather files list.files(pattern = ".cf.feather") #>  "iso_files_export_file_info.cf.feather" #>  "iso_files_export_method_info-resistors.cf.feather" #>  "iso_files_export_method_info-standards.cf.feather" #>  "iso_files_export_problems.cf.feather" #>  "iso_files_export_raw_data.cf.feather" #>  "iso_files_export_vendor_data_table.cf.feather"