Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mechanism to constrain fitting parameters #53

Closed
anloes opened this issue Jan 5, 2024 · 4 comments · Fixed by #56
Closed

Add mechanism to constrain fitting parameters #53

anloes opened this issue Jan 5, 2024 · 4 comments · Fixed by #56

Comments

@anloes
Copy link

anloes commented Jan 5, 2024

image

Sometimes, neutcurve generates a curve for a given replicate with a slope or top that is aberrant with other replicates, potentially due to noisy data. This may be able to be resolved by adding a mechanism to constrain the fitting parameters to a reasonable slope or top, we could add a mechanism to do this to the package.

Attached (and shown in plots included) are several examples of curves where this issue was observed.
240104_curveswithdifferentslopes.csv

@anloes
Copy link
Author

anloes commented Mar 22, 2024

@jbloom and @ckikawa this issue is similar to what we were discussing for the data with the new libraries.

@jbloom
Copy link
Member

jbloom commented Mar 22, 2024

Yes, I agree. I am hoping @ckikawa can add her relevant data here so I have more test cases for this, and whenever that is done I am going to start working on this.

@ckikawa
Copy link

ckikawa commented Mar 22, 2024

@jbloom, here are some test cases from the H3N2 library. I've separated these into cases where replicates are called widely varying tops, usually in the case where virus-barcodes start at 0 fraction infectivity and are unable to consistently infer accurate tops:
image
240322_curves_with_different_tops_fits.csv
240322_curves_with_different_tops_frac_infectivity.csv

And other cases where replicates have widely varying slopes, usually in the case where neutralization takes place over most of the entire window of serum dilutions:
image
240322_curves_with_different_slopes_fits.csv
240322_curves_with_different_slopes_frac_infectivity.csv

@jbloom jbloom linked a pull request Mar 24, 2024 that will close this issue
jbloom added a commit that referenced this issue Mar 24, 2024
- The curve fitting parameters (top, bottom, slope) can now be constrained to a range in addition to being completely free or fixed. This can help with fitting some curves more sensibly (see [this issue](#53)). Specifically:
  - ``fixtop`` and ``fixbottom`` parameters to ``HillCurve`` can be 2-tuples of bounds
  - added ``fixslope`` parameter to ``HillCurve`` and ``CurveFits``
  - New ``constrain_params_range`` notebook tests and documents this functionality.

- Add ``no_curve_fit_first`` argument to ``HillCurve`` to aid debugging/development.
@jbloom
Copy link
Member

jbloom commented Mar 25, 2024

@ckikawa @anloes, this shows the data Caroline posted with constraints on the fit parameters:
https://jbloomlab.github.io/neutcurve/constrain_params_range.html

I will work on integrating this into seqneut-pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants