Learn R Programming

I 'R' FlowCytobot (iRfcb): Tools for Managing Imaging FlowCytobot (IFCB) Data

Overview

The iRfcb R package offers a suite of tools for managing and performing quality control on plankton data generated by the Imaging FlowCytobot (IFCB). It streamlines the processing and analysis of IFCB data, facilitating the preparation of IFCB data and images for publication (e.g. in GBIF, OBIS, EMODNet, SHARK or EcoTaxa). It is especially useful for researchers using, or partly using, the MATLAB ifcb-analysis package.

Functional Highlights

  • Data Management: Functions for reading raw and processed IFCB files, counting and summarizing annotated or classified image data, and accessing, correcting, and merging manually annotated datasets.
  • Quality Control: Tools for geospatial quality control of IFCB data and analysis of Particle Size Distribution.
  • Image Extraction: Tools to extract and prepare images for publication.
  • Taxonomical Data: Tools for handling and analyzing taxonomic data and calculating biomass concentration from image data.

Installation

You can install iRfcb from CRAN using:

install.packages("iRfcb")

Development version

To access a feature from the development version of iRfcb, install the latest development version from GitHub using the remotes package:

# install.packages("remotes")
remotes::install_github("EuropeanIFCBGroup/iRfcb")

Documentation and Tutorials

Reference

For a detailed overview of all available iRfcb functions, please visit the reference section:

Tutorials

Explore the key features and capabilities of iRfcb through the tutorials:

Example Usage

iRfcb is designed for integration into IFCB data processing pipelines. For an example, see its implementation in the following project:

Python Dependency

Some functions in iRfcb require Python, and you will be notified when you call one of these functions. You can download Python from the official website: python.org/downloads. For details on what function that require Python, please visit the project's Function Reference.

A Python virtual environment (venv) can be created using the ifcb_py_install() function before calling the function that require Python.

The iRfcb package can also be configured to automatically activate an installed Python venv upon loading by setting an environment variable. This feature is especially useful for users who regularly interact with Python dependencies within the iRfcb package.

USE_IRFCB_PYTHON

  • Description: The USE_IRFCB_PYTHON environment variable controls whether the package automatically activates a pre-installed Python venv named iRfcb when the package is loaded.
  • Default: By default, this environment variable is not set. This means that the Python environment will not be loaded automatically, and the user must call the ifcb_py_install() functions manually before using a Python feature.
  • Usage: To enable automatic setup of the Python environment when iRfcb is loaded, set USE_IRFCB_PYTHON to "TRUE". Ensure that a venv named iRfcb is installed (e.g. through ifcb_py_install()) in reticulate::virtualenv_root() and available via reticulate::virtualenv_list().

How to Set the USE_IRFCB_PYTHON Variable

You can set the USE_IRFCB_PYTHON variable in your R session or make it persistent across sessions:

  1. Temporary for the session: You can set the variable in your R session before loading iRfcb using the following command:

    Sys.setenv(USE_IRFCB_PYTHON = "TRUE")
  2. Permanent across sessions: To ensure this setting persists across R sessions, add it to your .Renviron file in your R home directory. You can easily edit the file using the following command:

    usethis::edit_r_environ("user")

    Then, add the following line to the file:

    USE_IRFCB_PYTHON=TRUE

    This will automatically set the environment variable each time you start an R session.

Getting help

If you encounter a bug or need an IFCB feature that’s missing, please report it on GitHub with a minimal reproducible example.

Repository

For more details and the latest updates, visit the GitHub repository.

License

This package is licensed under the MIT License.

Copy Link

Version

Install

install.packages('iRfcb')

Monthly Downloads

170

Version

0.5.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Anders Torstensson

Last Published

April 22nd, 2025

Functions in iRfcb (0.5.1)

ifcb_download_dashboard_data

Download IFCB data files from an IFCB Dashboard
ifcb_extract_pngs

Extract Images from IFCB ROI File
ifcb_get_ferrybox_data

Retrieve Ferrybox Data for Specified Timestamps
ifcb_download_whoi_plankton

Download and Extract WHOI-Plankton Data
ifcb_extract_classified_images

Extract Taxa Images from MATLAB Classified Sample
ifcb_create_manifest

Create a MANIFEST.txt File
ifcb_extract_annotated_images

Extract Annotated Images from IFCB Data
ifcb_extract_biovolumes

Extract Biovolumes from IFCB Data and Compute Carbon Content
ifcb_is_near_land

Determine if Positions are Near Land
ifcb_is_diatom

Identify Diatoms in Taxa List
ifcb_is_in_basin

Check if Points are in a Specific Sea Basin
ifcb_match_taxa_names

Retrieve WoRMS Records with Retry Mechanism
ifcb_get_shark_example

Get Shark Column Example
ifcb_get_trophic_type

Get Trophic Type for a List of Plankton Taxa
ifcb_get_mat_names

Get Variable Names from a MAT File
ifcb_get_mat_variable

Get Classes from a MAT File
ifcb_read_summary

Read and Summarize Classified IFCB Data
ifcb_replace_mat_values

Replace Values in MATLAB Classlist
ifcb_get_runtime

Read IFCB Header File and Extract Runtime Information
ifcb_read_features

Read Feature Files from a Specified Folder or File Paths
ifcb_get_shark_colnames

Get Shark Column Names
ifcb_py_install

Install iRfcb Python Environment
ifcb_read_hdr_data

Reads HDR Data from IFCB HDR Files
ifcb_volume_analyzed

Estimate Volume Analyzed from IFCB Header File
ifcb_read_mat

Read a MATLAB .mat File in R
ifcb_which_basin

Determine if Points are in a Specified Sea Basin
ifcb_psd

Plot and Save IFCB PSD Data
ifcb_psd_plot

Generate PSD Plot for a Given Sample
ifcb_volume_analyzed_from_adc

Estimate Volume Analyzed from IFCB ADC File
ifcb_summarize_png_metadata

Summarize PNG Image Metadata
vol2C_nondiatom

Convert Biovolume to Carbon for Non-Diatom Protists
ifcb_run_image_gallery

Run IFCB Image Gallery
process_ifcb_string

Process IFCB String
read_hdr_file

Function to Read Individual Files and Extract Relevant Lines
ifcb_summarize_biovolumes

Summarize Biovolumes and Carbon Content from IFCB Data
ifcb_merge_manual

Merge IFCB Manual Classification Data
ifcb_prepare_whoi_plankton

Download and Prepare WHOI-Plankton Data
ifcb_zip_pngs

Zip PNG Folders
ifcb_zip_matlab

Create a Zip Archive of Manual MATLAB Files
summarize_TBclass

Summarize TreeBagger Classifier Results
vol2C_lgdiatom

Convert Biovolume to Carbon for Large Diatoms
ifcb_summarize_class_counts

Count Cells from TreeBagger Classifier Output
ifcb_summarize_png_counts

Summarize Image Counts by Class and Sample
retrieve_worms_records

Retrieve WoRMS Records with Retry Mechanism
split_large_zip

Split Large Zip File into Smaller Parts
iRfcb-package

iRfcb: Tools for Managing Imaging FlowCytobot (IFCB) Data
create_package_manifest

Function to Create MANIFEST.txt
ifcb_correct_annotation

Correct Annotations in MATLAB Classlist Files
ifcb_convert_filenames

Convert IFCB Filenames to Timestamps
ifcb_annotate_batch

Annotate IFCB Images with Specified Class
ifcb_create_class2use

Create a class2use .mat File
ifcb_count_mat_annotations

Count IFCB Annotations from .mat Files
ifcb_create_empty_manual_file

Create an Empty Manual Classification MAT File
ifcb_adjust_classes

Adjust Classifications in Manual Annotations
defunct

Defunct functions
ifcb_download_test_data

Download Test IFCB Data
ifcb_get_ecotaxa_example

Get EcoTaxa Column Names