Guillawme / rfret

Analyze FRET Binding Data with R
https://guillawme.github.io/rfret
Other
2 stars 5 forks source link

Make a simulation function #20

Open Guillawme opened 7 years ago

Guillawme commented 7 years ago

It would be useful to have a binding curve simulation function.

Such a function should take a kd value (or a vector of several values), a probe_concentration value (or a vector of several values), a hill_coeff value (or a vector of several values), and the minimum and maximum values of a concentration series, and should output a simulated binding curve (or several binding curves on the same plot, if a vector of values was provided for any parameter).

This would be a very useful tool for experimental planning.

Guillawme commented 7 years ago

Done with commit 42ee1c28b52628c234c76d356d71ca89aca9875f, but it would be nice to enhance it such it can plot several curves on the same graph for a series of Kd values (or Hill coefficient values, or probe concentration values, or all at the same time).

Guillawme commented 7 years ago

See here for a possible way to do that: https://stackoverflow.com/questions/32112505/ggplot2-plotting-multiple-graphs-in-the-same-plot

Guillawme commented 7 years ago

See also: http://t-redactyl.io/blog/2016/03/creating-plots-in-r-using-ggplot2-part-9-function-plots.html

According to this tutorial, one simply needs to add a + stat_function(...) line per curve to plot. How to automatically generate such lines when kd or n is a vector of several values instead of a single value? Also, how to plot lines with different styles and a corresponding legend?

Guillawme commented 6 years ago

Maybe this is easier to do with plotly? See add_trace(). It would also make sense to have an interactive graph to show this simulation.