Extract Biovolumes from IFCB Data and Compute Carbon Content
Source:R/ifcb_extract_biovolumes.R
ifcb_extract_biovolumes.Rd
This function reads biovolume data from feature files generated by the ifcb-analysis
repository (Sosik and Olson 2007)
and matches them with corresponding classification results or manual annotations. It calculates biovolume in cubic micrometer and
determines if each class is a diatom based World Register of Marine Species (WoRMS). Carbon content
is computed for each roi using specific conversion functions depending on whether the class
is identified as a diatom or not, according to Menden-Deuer and Lessard 2000.
Usage
ifcb_extract_biovolumes(
feature_files,
mat_folder,
class2use_file = NULL,
micron_factor = 1/3.4,
diatom_class = "Bacillariophyceae",
marine_only = FALSE,
threshold = "opt",
multiblob = FALSE,
feature_recursive = TRUE,
mat_recursive = TRUE,
verbose = TRUE
)
Arguments
- feature_files
A path to a folder containing feature files or a character vector of file paths.
- mat_folder
Path to the folder containing class or manual files.
- class2use_file
A character string specifying the path to the file containing the class2use variable (default NULL).
- micron_factor
Conversion factor for biovolume to cubic microns. Default is 1 / 3.4.
- diatom_class
A string vector of diatom class names in the World Register of Marine Species (WoRMS). Default is "Bacillariophyceae".
- marine_only
Logical. If TRUE, restricts the WoRMS search to marine taxa only. Default is FALSE.
- threshold
Threshold for selecting class information ("opt" or other, default is "opt").
- multiblob
A logical indicating whether to include multiblob features. Default is FALSE.
- feature_recursive
Logical. If TRUE, the function will search for feature files recursively within when
feature_files
is a folder. Default is TRUE.- mat_recursive
Logical. If TRUE, the function will search for MATLAB files recursively within the
mat_folder
. Default is TRUE.- verbose
A logical indicating whether to print progress messages. Default is TRUE.
Value
A data frame containing 'sample', 'classifier' 'roi_number', 'class', 'biovolume_um3', and computed 'carbon_pg'.
Details
The function combines biovolume data extracted from feature files with class information read from corresponding MATLAB files. It determines if each class is a diatom based on user-defined criteria and computes carbon content using conversion functions specific to diatoms and non-diatom protists.
References
Menden-Deuer Susanne, Lessard Evelyn J., (2000), Carbon to volume relationships for dinoflagellates, diatoms, and other protist plankton, Limnology and Oceanography, 3, doi: 10.4319/lo.2000.45.3.0569.
Sosik, H. M. and Olson, R. J. (2007), Automated taxonomic classification of phytoplankton sampled with imaging-in-flow cytometry. Limnol. Oceanogr: Methods 5, 204–216.
Examples
if (FALSE) { # \dontrun{
# Example usage:
feature_files <- "data/features"
mat_folder <- "data/classified"
biovolume_df <- ifcb_extract_biovolumes(feature_files, mat_folder)
print(biovolume_df)
} # }