Giter Club home page Giter Club logo

growthcurve's Introduction

growthcurve: Analysis of Biological Growth

Project Status: Abandoned โ€“ Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development. BSD License Travis-CI Build Status CRAN_Status_Badge

The growthcurve package provides tools for analyzing biological growth, or "growth curves" in R. It is designed to integrate into modern workflows based around "tidy data", allowing it to be used in conjunction with other tools. growthcurve also provides wrappers that allow tidy growth data to be analyzed using the popular, but no-longer-maintained grofit package, if installed.

Installation

growthcurve is not quite ready to be available on CRAN, but you can use devtools to install the current development version:

    if(!require("devtools")) install.packages("devtools")
    devtools::install_github("briandconnelly/growthcurve", build_vignettes = TRUE)

Fitting Growth Curves

growthcurve's most important function is fit_growth, which fits a growth curve to the given data. Here, we'll fit a growth curve to one replicate population from the included pseudomonas data set, which has columns Time and CFUmL:

library(dplyr)
library(growthcurve)

rep1 <- filter(pseudomonas, Replicate == 1 & Strain == "PAO1")
myfit <- fit_growth(rep1, Time, CFUmL)

Even better, we can do this all at once with pipes:

myfit <- pseudomonas %>%
    filter(Replicate == 1 & Strain == "PAO1") %>%
    fit_growth(Time, CFUmL)

By default, fit_growth will fit a logistic curve, however the model argument can be used to specify a different model type. Here, we'll use a Gompertz function:

library(dplyr)
library(growthcurve)

rep1 <- filter(pseudomonas, Replicate == 1 & Strain == "PAO1")
myfit <- fit_growth(rep1, Time, CFUmL, model = "gompertz")

Other options include logistic4p, linear, loess, and spline. Additionally, grofit_logistic, grofit_gompertz, grofit_gompertz.exp, grofit_richards, and grofit_spline can be used to provide compatability with legacy scripts that use grofit. There's also a grofit_parametric, which finds the best among grofit's parametric models.

Interpreting Results

coming soon!

Visualizing Growth Curves

growthcurve includes tools for visualizing growth curves using either R's base graphics or ggplot2.

plot(myfit, show_raw = TRUE, show_maxrate = TRUE, show_asymptote = FALSE)

library(ggplot2)

autoplot(myfit, title = "PAO1 Replicate 1", subtitle = "Growth in LB")

Alternatively, we can add growth curves to a ggplot2 plot with stat_growthcurve:

pao1data <- filter(pseudomonas, Strain == "PAO1")
ggplot(data = pao1data, aes(x = Time, y = CFUmL, color = Replicate)) +
    geom_point(shape = 1) +
    stat_growthcurve()

Code of Conduct

This project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.

License

growthcurve is released under the Simplified BSD License.

growthcurve's People

Contributors

briandconnelly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

growthcurve's Issues

Fix NSE

For example, if time is given as a column name, the time() function is called.

Error in eval(expr, envir, enclos) : object 'datafile' not found

function

fit_curve <- function(d) {
fit <- fit_growth_logistic(d, time, OD600)
if (is.na(fit$integral)) {
data.frame(MaxGrowth = NA,
MaxRate = NA,
LagLength = NA)
}
else{
data.frame(MaxGrowth = fit$max_growth[["Estimate"]],
MaxRate = fit$max_rate[["Estimate"]],
LagLength = fit$lag_length[["Estimate"]])
}
}

growth curve

growthfit <- Bcc1_12_names %>%
filter(!grepl("blank", annotation)) %>% #filter out the blank wells
arrange(annotation, well_alias) %>%
group_by(annotation, well_alias) %>% # Group the data by well and strain annotation
do(fit_curve(.)) # For each well, fit a growth curve

growthcurve_test.xlsx

autoplot wont work on grofit_gompertz

Here an example: Method grofit_gompertz wont work with autofit.
Also: If colname of time column is not "time_data" the function wont run.

`library(ggplot2)
library(growthcurve)

testdat <- data.frame(c(24.00000,25.45455,26.90909,28.36364,29.81818,31.27273,32.72727
,34.18182,35.63636,37.09091,38.54545,40.00000,41.45455,42.90909
,44.36364,45.81818,47.27273,48.72727,50.18182,51.63636,53.09091
,54.54545,56.00000,57.45455,58.90909,60.36364,61.81818,63.27273
,64.72727,66.18182,67.63636,69.09091,70.54545,72.00000,73.45455
,74.90909,76.36364,77.81818,79.27273,80.72727,82.18182,83.63636
,85.09091,86.54545,88.00000,89.45455,90.90909,92.36364,93.81818
,95.27273,96.72727,98.18182,99.63636,101.09091,102.54545,104.00000
,105.45455,106.90909,108.36364,109.81818,111.27273,112.72727,114.18182
,115.63636,117.09091,118.54545,120.00000,121.45455,122.90909,124.36364
,125.81818,127.27273,128.72727,130.18182,131.63636,133.09091,134.54545
,136.00000,137.45455,138.90909,140.36364,141.81818,143.27273,144.72727
,146.18182,147.63636,149.09091,150.54545,152.00000,153.45455,154.90909
,156.36364,157.81818,159.27273,160.72727,162.18182,163.63636,165.09091
,166.54545,168.00000),

c(0.000000000,0.050269700,0.090107812,0.120330579,0.141754243
,0.155195048,0.161469238,0.161393055,0.155782743,0.145454545
,0.131224705,0.113909465,0.094325069,0.073287760,0.051613781
,0.030119376,0.009620787,-0.009082561,-0.025578095,-0.039840091
,-0.051859643,-0.061627849,-0.069135802,-0.074374600,-0.077335337
,-0.078009109,-0.076387011,-0.072460139,-0.066219588,-0.057656454
,-0.046761833,-0.033526820,-0.017942511,0.000000000,0.020662827
,0.045820927,0.077602471,0.118135626,0.169548562,0.233969447
,0.313526449,0.410347738,0.526561483,0.664295851,0.825679012
,1.012839135,1.227904388,1.473002940,1.750262960,2.061812617
,2.409780078,2.796293514,3.223481092,3.693470982,4.208391352
,4.770370370,5.381536207,6.044017030,6.759941008,7.531436310
,8.360631104,9.249653560,10.200631846,11.215694131,12.296968584
,13.446583373,14.666666667,15.959317200,17.326515971,18.770214542
,20.292364477,21.894917340,23.579824693,25.349038101,27.204509126
,29.148189331,31.182030281,33.307983539,35.528000668,37.844033231
,40.258032792,42.771950914,45.387739161,48.107349095,50.932732281
,53.865840282,56.908624661,60.063036981,63.331028807,66.714551700
,70.215557225,73.835996945,77.577822424,81.442985224,85.433436910
,89.551129044,93.798013190,98.176040911,102.687163771,107.333333333)
)

colnames(testdat) <- c("time_data", "value") # required to be named "time_data" else: error
myfit <- fit_growth(testdat, time=time_data, data=value, model = "grofit_gompertz")

autoplot(myfit, title = "test")

`

Unable to fit and how to get growth parameters from fitting

Hi,

I have been testing your package recently and seems more handy that grofit it self. It seems I cannot find out how to get growth parameters such as mu and lambda when fit_growth function is called. Could you explain briefly how to extract growth parameters from fitting?

On the other hand, the data im fitting are OD's determined each 2h. I use corrected OD's where the blank has been subtracted so initial values are close to 0 like (0.001 or 0.01). The fitting fails when the corrected values are used. However, fit success when raw data is used (blank not subtracted) so initial values in first 4-6h are like 0.100. Same happens in grofit package. Could you explain why this is happening and if there's a way to mitigate this rather than using raw data which would be my last choice.

Thank you :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.