| Title: | 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. Methods are described in Purswani et al. (2017) <doi:10.3389/fmicb.2017.00919>. |
| Authors: | Maria Garcia Toledo [aut], Juan Emilio Martinez Manjon [aut, cre], Jessica Purswani [aut], Rocio Romero Zaliz [aut] |
| Maintainer: | Juan Emilio Martinez Manjon <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.1 |
| Built: | 2026-05-28 06:16:37 UTC |
| Source: | https://github.com/juane99/bsocialv2 |
Analyze Biofilm Assembly Sequences
analyze_biofilm_sequence(.Object)analyze_biofilm_sequence(.Object)
.Object |
A bsocial object. |
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.
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.
## S4 method for signature 'bsocial' analyze_biofilm_sequence(.Object)## S4 method for signature 'bsocial' analyze_biofilm_sequence(.Object)
.Object |
A bsocial object after |
The modified bsocial object with biofilm paths and plot functions.
Analyze Diversity Effect on Fitness
analyze_diversity(.Object)analyze_diversity(.Object)
.Object |
A bsocial object. |
The modified bsocial object with diversity boxplots in
graficos and relative fitness tables in resultados_analisis
(keyed by diversity level).
Analyzes the relationship between consortium diversity (number of strains) and fitness. Computes relative fitness by comparing each consortium's metric against the best monoculture reference.
## S4 method for signature 'bsocial' analyze_diversity(.Object)## S4 method for signature 'bsocial' analyze_diversity(.Object)
.Object |
A bsocial object after |
The modified bsocial object with diversity analysis in graficos and resultados_analisis.
Analyze Growth Metrics
analyze_growth(.Object)analyze_growth(.Object)
.Object |
A bsocial object. |
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.
Creates a scatter plot of LogPhase vs NGen colored by consortium diversity, and generates top-10 tables ranked by NGen and GR.
## S4 method for signature 'bsocial' analyze_growth(.Object)## S4 method for signature 'bsocial' analyze_growth(.Object)
.Object |
A bsocial object with |
The modified bsocial object with growth analysis in graficos and resultados_analisis.
Analyze Social Behavior (Fitness Effects)
analyze_social_behavior(.Object)analyze_social_behavior(.Object)
.Object |
A bsocial object. |
The modified bsocial object with
resultados_analisis$social_behavior containing fitness comparison data,
boxplot objects for NGen and GR, and a success flag.
Compares the fitness of each strain in consortia vs its monoculture baseline. Generates boxplots showing relative fitness for each strain across all consortia.
## S4 method for signature 'bsocial' analyze_social_behavior(.Object)## S4 method for signature 'bsocial' analyze_social_behavior(.Object)
.Object |
A bsocial object with |
The modified bsocial object with resultados_analisis$social_behavior.
Analyze Consortium Stability
analyze_stability(.Object)analyze_stability(.Object)
.Object |
A bsocial object. |
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.
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.
## S4 method for signature 'bsocial' analyze_stability(.Object)## S4 method for signature 'bsocial' analyze_stability(.Object)
.Object |
A bsocial object with |
The modified bsocial object with stability analysis results.
The bsocial class encapsulates data and results for analyzing microbial
social behavior in bacterial consortia.
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.
obj <- new("bsocial") obj@id_proyecto <- "my_experiment"obj <- new("bsocial") obj@id_proyecto <- "my_experiment"
Calculate Growth Parameters from Preprocessed Curves
calculate_growth_params(.Object, ...)calculate_growth_params(.Object, ...)
.Object |
A bsocial object. |
... |
Additional arguments (method). |
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.
Fits growth curves and extracts LogPhase, number of generations (NGen), and growth rate (GR) for each consortium.
## S4 method for signature 'bsocial' calculate_growth_params(.Object, method = "growthcurver")## S4 method for signature 'bsocial' calculate_growth_params(.Object, method = "growthcurver")
.Object |
A bsocial object after |
method |
Character. Fitting algorithm: |
The modified bsocial object with datos_procesados populated.
Renders the scatter of LogPhase against Number of Generations coloured by
consortium richness, with optional IQR-based outlier hiding for
visualization. The underlying datos_procesados is not modified.
plot_growth_scatter(.Object, remove_outliers = FALSE, outlier_coef = 1.5) ## S4 method for signature 'bsocial' plot_growth_scatter(.Object, remove_outliers = FALSE, outlier_coef = 1.5)plot_growth_scatter(.Object, remove_outliers = FALSE, outlier_coef = 1.5) ## S4 method for signature 'bsocial' plot_growth_scatter(.Object, remove_outliers = FALSE, outlier_coef = 1.5)
.Object |
A bsocial object with |
remove_outliers |
Logical; if |
outlier_coef |
Numeric multiplier for the IQR rule (default 1.5). |
A ggplot2 object.
Plot Preprocessed Growth Curves
plot_processed_curves(.Object)plot_processed_curves(.Object)
.Object |
A bsocial object. |
A ggplot object showing faceted line plots of
mean growth curves (optical density over time) grouped by experimental condition.
Creates a faceted line plot of mean growth curves after preprocessing, grouped by experimental condition.
## S4 method for signature 'bsocial' plot_processed_curves(.Object)## S4 method for signature 'bsocial' plot_processed_curves(.Object)
.Object |
A bsocial object after |
A ggplot2 object.
Classify Strains as Cooperators, Cheaters, or Neutrals
summarize_social_behavior(.Object, ...)summarize_social_behavior(.Object, ...)
.Object |
A bsocial object. |
... |
Additional arguments. |
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.
Uses pairwise t-tests and median comparisons to classify each strain based on its effect on consortium fitness.
## S4 method for signature 'bsocial' summarize_social_behavior(.Object)## S4 method for signature 'bsocial' summarize_social_behavior(.Object)
.Object |
A bsocial object after |
The modified bsocial object. Writes
resultados_analisis$summary_gen and $summary_gr (lists with
positives/negatives/neutrals), resultados_analisis$stats_gen and
$stats_gr (per-strain medians, pairwise p-values, and classification
string), and rebuilds the classification-annotated plots inside
resultados_analisis$social_behavior.
Import Pre-processed (Curated) Data
transform_curated_data(.Object, ...)transform_curated_data(.Object, ...)
.Object |
A bsocial object. |
... |
Additional arguments. |
The modified bsocial object with datos_procesados populated
as a data frame containing consortia identifiers, strain presence/absence, and
growth parameters (LogPhase, NGen, GR).
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.
## S4 method for signature 'bsocial' transform_curated_data(.Object)## S4 method for signature 'bsocial' transform_curated_data(.Object)
.Object |
A bsocial object with |
The modified bsocial object with datos_procesados populated.
Preprocess Raw Plate Reader Data
transform_raw_data(.Object, ...)transform_raw_data(.Object, ...)
.Object |
A bsocial object. |
... |
Additional arguments (groups, bg_type, bg_param). |
The modified bsocial object with resultados_analisis populated
with preprocessed growth curves, cycle times, curve mapping, and replicate statistics.
Normalizes raw plate reader data by applying background correction and aggregating replicates. Supports blank-based or OD threshold correction.
## S4 method for signature 'bsocial' transform_raw_data(.Object, groups, bg_type, bg_param)## S4 method for signature 'bsocial' transform_raw_data(.Object, groups, bg_type, bg_param)
.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 |
The modified bsocial object with resultados_analisis populated.