| Title: | Analysis of Microbial Social Behavior in Bacterial Consortia |
| Version: | 0.1.1 |
| Description: | Provides an S4 class and methods for analyzing microbial social behavior in bacterial consortia. Includes growth parameter extraction, social behavior classification (cooperators/cheaters/neutrals), diversity effect analysis, consortium assembly path finding, and stability analysis via coefficient of variation. Methods are described in Purswani et al. (2017) <doi:10.3389/fmicb.2017.00919>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/Juane99/bsocialv2 |
| BugReports: | https://github.com/Juane99/bsocialv2/issues |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| Depends: | R (≥ 4.0), methods |
| Imports: | dplyr, ggplot2, grDevices, growthcurver, igraph, magrittr, reshape2, rlang, stats, tidyr, viridis |
| Suggests: | readr, testthat (≥ 3.0.0), knitr, rmarkdown |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| Collate: | 'bsocial-package.R' 'bsocial-log.R' 'bsocial-class.R' 'transform-raw-data.R' 'transform-curated-data.R' 'calculate-growth-params.R' 'plot-processed-curves.R' 'analyze-growth.R' 'analyze-social-behavior.R' 'summarize-social-behavior.R' 'analyze-diversity.R' 'analyze-biofilm-sequence.R' 'analyze-stability.R' |
| NeedsCompilation: | no |
| Packaged: | 2026-04-07 12:33:00 UTC; juane |
| Author: | Maria Garcia Toledo [aut], Juan Emilio Martinez Manjon [aut, cre], Jessica Purswani [aut], Rocio Romero Zaliz [aut] |
| Maintainer: | Juan Emilio Martinez Manjon <juanemartinez999@hotmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-13 11:40:02 UTC |
bsocialv2: Analysis of Microbial Social Behavior in Bacterial Consortia
Description
Provides an S4 class and methods for analyzing microbial social behavior in bacterial consortia. Includes growth parameter extraction, social behavior classification (cooperators/cheaters/neutrals), diversity effect analysis, consortium assembly path finding, and stability analysis via coefficient of variation.
Author(s)
Maintainer: Juan Emilio Martinez Manjon juanemartinez999@hotmail.com
Authors:
Maria Garcia Toledo
Jessica Purswani
Rocio Romero Zaliz
See Also
Useful links:
Analyze Biofilm Assembly Sequences
Description
Analyze Biofilm Assembly Sequences
Usage
analyze_biofilm_sequence(.Object)
Arguments
.Object |
A bsocial object. |
Value
The modified bsocial object with assembly path lists in
resultados_analisis$biofilm_gen_paths and resultados_analisis$biofilm_gr_paths,
and plot functions in graficos.
Analyze Biofilm Assembly Sequences
Description
Builds a directed graph of possible consortium assembly paths based on strain subset relationships. Uses igraph to find shortest paths between simpler and more complex consortia.
Usage
## S4 method for signature 'bsocial'
analyze_biofilm_sequence(.Object)
Arguments
.Object |
A bsocial object after |
Value
The modified bsocial object with biofilm paths and plot functions.
Analyze Diversity Effect on Fitness
Description
Analyze Diversity Effect on Fitness
Usage
analyze_diversity(.Object)
Arguments
.Object |
A bsocial object. |
Value
The modified bsocial object with diversity boxplots in
graficos and relative fitness tables in resultados_analisis
(keyed by diversity level and top-k strain ranking).
Analyze Diversity Effect on Fitness
Description
Analyzes the relationship between consortium diversity (number of strains) and fitness. Compares fitness across diversity levels and identifies effects of including top-ranked strains.
Usage
## S4 method for signature 'bsocial'
analyze_diversity(.Object)
Arguments
.Object |
A bsocial object after |
Value
The modified bsocial object with diversity analysis in graficos and resultados_analisis.
Analyze Growth Metrics
Description
Analyze Growth Metrics
Usage
analyze_growth(.Object)
Arguments
.Object |
A bsocial object. |
Value
The modified bsocial object with a scatter plot stored in
graficos$growth_scatter and top-10 ranking tables in
resultados_analisis$best_10_ngen and resultados_analisis$best_10_gr.
Analyze Growth Metrics
Description
Creates a scatter plot of LogPhase vs NGen colored by consortium diversity, and generates top-10 tables ranked by NGen and GR.
Usage
## S4 method for signature 'bsocial'
analyze_growth(.Object)
Arguments
.Object |
A bsocial object with |
Value
The modified bsocial object with growth analysis in graficos and resultados_analisis.
Analyze Social Behavior (Fitness Effects)
Description
Analyze Social Behavior (Fitness Effects)
Usage
analyze_social_behavior(.Object)
Arguments
.Object |
A bsocial object. |
Value
The modified bsocial object with
resultados_analisis$social_behavior containing fitness comparison data,
boxplot objects for NGen and GR, and a success flag.
Analyze Social Behavior (Fitness Effects)
Description
Compares the fitness of each strain in consortia vs its monoculture baseline. Generates boxplots showing relative fitness for each strain across all consortia.
Usage
## S4 method for signature 'bsocial'
analyze_social_behavior(.Object)
Arguments
.Object |
A bsocial object with |
Value
The modified bsocial object with resultados_analisis$social_behavior.
Analyze Consortium Stability
Description
Analyze Consortium Stability
Usage
analyze_stability(.Object)
Arguments
.Object |
A bsocial object. |
Value
The modified bsocial object with coefficient of variation
data in resultados_analisis$stability_cv_data and violin plots in
graficos$stability_ngen_plot and graficos$stability_gr_plot.
Analyze Consortium Stability
Description
Calculates the coefficient of variation (CV) for growth metrics across replicates or diversity levels. Creates violin plots with Spearman correlation, p-value, and R-squared displayed as subtitles.
Usage
## S4 method for signature 'bsocial'
analyze_stability(.Object)
Arguments
.Object |
A bsocial object with |
Value
The modified bsocial object with stability analysis results.
S4 Class for Microbial Social Behavior Analysis
Description
The bsocial class encapsulates data and results for analyzing microbial
social behavior in bacterial consortia.
Slots
id_proyectoCharacter. Project identifier.
cepas_seleccionadasCharacter vector. Names of the selected strains.
datos_crudosList. Raw input data (plates, curated, consortia).
datos_procesadosData frame. Processed metrics (NGen, GR, LogPhase).
resultados_analisisList. Analysis results from each pipeline step.
graficosList. Generated ggplot2 plots and plotting functions.
Examples
obj <- new("bsocial")
obj@id_proyecto <- "my_experiment"
Log Messages for bsocialv2 Operations
Description
Internal logging utility that outputs timestamped messages to the console.
Usage
bsocial_log(level = "INFO", ..., .indent = 0)
Arguments
level |
Character. Log level (e.g., "INFO", "WARN", "ERROR"). |
... |
Messages to concatenate and display. |
.indent |
Integer. Number of spaces for indentation (default 0). |
Value
NULL (invisibly). Called for its side effect of printing a message.
Calculate Growth Parameters from Preprocessed Curves
Description
Calculate Growth Parameters from Preprocessed Curves
Usage
calculate_growth_params(.Object, ...)
Arguments
.Object |
A bsocial object. |
... |
Additional arguments (method). |
Value
The modified bsocial object with datos_procesados populated
as a data frame containing consortia identifiers, strain presence/absence, and
growth parameters (LogPhase, NGen, GR) fitted from the preprocessed curves.
Calculate Growth Parameters from Preprocessed Curves
Description
Fits growth curves and extracts LogPhase, number of generations (NGen), and growth rate (GR) for each consortium.
Usage
## S4 method for signature 'bsocial'
calculate_growth_params(.Object, method = "growthcurver")
Arguments
.Object |
A bsocial object after |
method |
Character. Fitting algorithm: |
Value
The modified bsocial object with datos_procesados populated.
Plot Preprocessed Growth Curves
Description
Plot Preprocessed Growth Curves
Usage
plot_processed_curves(.Object)
Arguments
.Object |
A bsocial object. |
Value
A ggplot object showing faceted line plots of
mean growth curves (optical density over time) grouped by experimental condition.
Plot Preprocessed Growth Curves
Description
Creates a faceted line plot of mean growth curves after preprocessing, grouped by experimental condition.
Usage
## S4 method for signature 'bsocial'
plot_processed_curves(.Object)
Arguments
.Object |
A bsocial object after |
Value
A ggplot2 object.
Classify Strains as Cooperators, Cheaters, or Neutrals
Description
Classify Strains as Cooperators, Cheaters, or Neutrals
Usage
summarize_social_behavior(.Object, ...)
Arguments
.Object |
A bsocial object. |
... |
Additional arguments. |
Value
The modified bsocial object with
resultados_analisis$summary_gen and resultados_analisis$summary_gr,
each a list with character vectors positives (cooperators),
negatives (cheaters), and neutrals.
Classify Strains as Cooperators, Cheaters, or Neutrals
Description
Uses pairwise t-tests and median comparisons to classify each strain based on its effect on consortium fitness.
Usage
## S4 method for signature 'bsocial'
summarize_social_behavior(.Object)
Arguments
.Object |
A bsocial object after |
Value
The modified bsocial object with resultados_analisis$summary_gen and $summary_gr.
Import Pre-processed (Curated) Data
Description
Import Pre-processed (Curated) Data
Usage
transform_curated_data(.Object, ...)
Arguments
.Object |
A bsocial object. |
... |
Additional arguments. |
Value
The modified bsocial object with datos_procesados populated
as a data frame containing consortia identifiers, strain presence/absence, and
growth parameters (LogPhase, NGen, GR).
Import Pre-processed (Curated) Data
Description
Imports a pre-processed CSV containing growth parameters already calculated
externally. Expected columns: Consortia, LogPhase, NGen, GR, plus
strain presence/absence columns matching cepas_seleccionadas.
Usage
## S4 method for signature 'bsocial'
transform_curated_data(.Object)
Arguments
.Object |
A bsocial object with |
Value
The modified bsocial object with datos_procesados populated.
Preprocess Raw Plate Reader Data
Description
Preprocess Raw Plate Reader Data
Usage
transform_raw_data(.Object, ...)
Arguments
.Object |
A bsocial object. |
... |
Additional arguments (groups, bg_type, bg_param). |
Value
The modified bsocial object with resultados_analisis populated
with preprocessed growth curves, cycle times, curve mapping, and replicate statistics.
Preprocess Raw Plate Reader Data
Description
Normalizes raw plate reader data by applying background correction and aggregating replicates. Supports blank-based or OD threshold correction.
Usage
## S4 method for signature 'bsocial'
transform_raw_data(.Object, groups, bg_type, bg_param)
Arguments
.Object |
A bsocial object with |
groups |
Numeric vector defining replicate group assignments for each plate. |
bg_type |
Character. Background correction method: |
bg_param |
Numeric or character. For |
Value
The modified bsocial object with resultados_analisis populated.