Guillawme / rfret

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

fit_binding_model can only use one binding model equation #7

Closed Guillawme closed 7 years ago

Guillawme commented 7 years ago

As of commit 181d27db53de7f5b0f3240f6bd343452d649afe2, fit_binding_model() can only be used with one equation (the quadratic binding equation).

Ideally, this function should be able to take any binding model equation (like a homodimerization model, for example) and set of initial parameters, and return parameter values from the fit and a plot.

Available equations should be defined in a dedicated file and accessed by their names, which would allow to add new binding model equations easily.

Guillawme commented 7 years ago

It would also be nice to have the option to choose which parameters should be kept constant and which one should be fitted. I don't know how to do that with nls.

This is especially useful with donor_concentration: allowing this parameter to be fitted is an additional control of the data quality (the fitted value should match the concentration intended when setting up the experiment).

Guillawme commented 7 years ago

Maybe fit_binding_model should simply be a wrapper around nls: take an equation, a set of initial parameter values, and a set of fixed parameters, and return only a result table and a fit object. Or maybe the user can just use nls directly, but taking pre-written equations from an equation library?

Then, a separate figure making function could take any number of fit objects and make a figure with them (the first object would provide the data and first model, the other objects would provide alternative models for the same data). This function would also handle the scaling, averaging and figure making with an arbitrary number of biological replicates (same experiment, different data, same fitting model). Not sure this is easily achievable...