Skip to content

matryoshkev/mixexptr

Repository files navigation

mixexptr - Analyze microbial interactions in mix experiments

R-CMD-check

A common experimental design for studying microbial interactions is to mix together two different microbes (different bacterial genotypes, for example) then measure how their fitness and behavior depends on mix frequency. How do they behave differently together compared to on their own?

mixexptr is an R package that provides tools to calculate and plot the fitness effects of microbial interactions, helping researchers get the most out of their data.

Calculate fitness effects

mixexptr provides a convenient way to calculate best-practice fitness measures that are:

  • Robust and quantitatively comparable across different species and types of interaction
  • Well-suited to statistical analysis of effect sizes and confidence intervals
  • Meaningful for both kin and multilevel selection theories of social evolution
fitness_results <- calculate_mix_fitness(
    data_smith_2010, 
    var_names = c(
        initial_number_A = "initial_cells_evolved",
        initial_number_B = "initial_cells_ancestral",
        final_number_A = "final_spores_evolved",
        final_number_B = "final_spores_ancestral", 
        name_A = "GVB206.3", 
        name_B = "GJV10"
    )
)
head(fitness_results)
#>     name_A name_B initial_fraction_A initial_ratio_A_B    fitness_A  fitness_B
#> 1 GVB206.3  GJV10         1.00000000               Inf 1.200000e-07         NA
#> 2 GVB206.3  GJV10         0.98901099       90.00000000 1.555556e-07 0.00000400
#> 3 GVB206.3  GJV10         0.90000000        9.00000000 2.600000e-06 0.00000480
#> 4 GVB206.3  GJV10         0.50000000        1.00000000 4.280000e-04 0.00156000
#> 5 GVB206.3  GJV10         0.10000000        0.11111111 4.200000e-02 0.01400000
#> 6 GVB206.3  GJV10         0.01098901        0.01111111 8.420000e-01 0.02288889
#>   fitness_total fitness_ratio_A_B
#> 1  1.200000e-07                NA
#> 2  1.978022e-07        0.03888889
#> 3  2.820000e-06        0.54166667
#> 4  9.940000e-04        0.27435897
#> 5  1.680000e-02        3.00000000
#> 6  3.189011e-02       36.78640777

Plot fitness effects

mixexptr provides convenient ways to plot calculated fitness effects. Here’s a quick diagnostic plot of the different fitness measures for this dataset:

plot_mix_fitness(fitness_results, mix_scale = "fraction")

Diagnostic plot from mixexptr

Installation

You can install the development version of mixexptr from GitHub with:

# install.packages("devtools")
devtools::install_github("matryoshkev/mixexptr")

Further reading

About

Analyze microbial mix experiments in R

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published