rbims (Reconstruction of Bin Metabolisms) is an R package designed to streamline the functional analysis and visualization of metagenome-assembled genomes (MAGs). It supports annotation integration from KEGG, InterProScan, dbCAN, MEROPS, and Picrust2 allowing researchers to quantify gene presence, abundance, and pathway coverage across microbial genomes.
rbims also integrates ALDEx2-derived effect sizes and random forest importance scores into a consensus table that prioritizes candidate discriminant KOs.This allows to distinguish enriched KO’s between groups.
Moreover, rbims enables a pathway-level directional bias analysis based on the discriminant output. This hierarchical framework allows rbims to distinguish between isolated gene-level differences and structurally coherent pathway-level enrichment across experimental gradients.
The package includes a curated database for hydrocarbon degradation pathways (aerobic and anaerobic) and provides tools to generate publication-ready visualizations such as heatmaps and bubble plots. It is designed to assist in exploratory trait analysis and early-stage hypothesis generation in genome-resolved metagenomics.

Figure 1: Overview of the rbims workflow. A) Steps to create the rbims conda environment integrating external tools (from KEGG, dbCAN, MEROPS, InterProScan) and running annotations. B) Workflow in R to import annotations using read() functions (blue). Map profile tables using mapping_ko() (green) and extract traits via get_subset() and calc_pathway_directional_bias() functions (orange). Results are visualized with plot() functions (purple).
install.packages("devtools")
library(devtools)
install_github("mirnavazquez/RbiMs")
library(rbims)If you are on macOS, install XQuartz.
If using Ubuntu, install system dependency: libcairo2-dev.
A complete example using MAGs from a hydrocarbon enrichment experiment is available in the folder /Hidrocarburos, including annotation files and code to reproduce the figures in our manuscript.
Full documentation: https://mirnavazquez.github.io/RbiMs