cremerlab / hplc-py Goto Github PK
View Code? Open in Web Editor NEWA Python utility for the processing and quantification of chromatography data
Home Page: https://cremerlab.github.io/hplc-py/
License: GNU General Public License v3.0
A Python utility for the processing and quantification of chromatography data
Home Page: https://cremerlab.github.io/hplc-py/
License: GNU General Public License v3.0
Hello, I'm having some difficulty understanding the hplc-py peak fitting parameters and tuning them appropriately. It could be helpful to offer more examples of how changing them affects the results.
What parameters would you suggest to integrate this chromatogram?
Default:
Using approx_peak_width=0.25
(uncommented the line in the above codeblock):
Neither of the two examples seems to be visually valid, and I'm not finding a combination of parameters that would make sense.
I am testing the application of fit_peaks
to my dataset, whose profile you can see below:
The behavior is as expected unless I set peak prominence below 0.2, at which point I receive an error from least_squares
informing me that at least one upper bound is less than the corresponding lower bound.
The error is below:
Traceback (most recent call last):
File "/Users/jonathan/mres_thesis/wine_analysis_hplc_uv/src/wine_analysis_hplc_uv/dataset_eda/peak_analysis.py", line 125, in <module>
main()
File "/Users/jonathan/mres_thesis/wine_analysis_hplc_uv/src/wine_analysis_hplc_uv/dataset_eda/peak_analysis.py", line 122, in main
HPLCPy(data)
File "/Users/jonathan/mres_thesis/wine_analysis_hplc_uv/src/wine_analysis_hplc_uv/dataset_eda/peak_analysis.py", line 103, in __init__
peaks = chm.fit_peaks(
^^^^^^^^^^^^^^
File "/Users/jonathan/Library/Caches/pypoetry/virtualenvs/wine-analysis-hplc-uv-F-SbhWjO-py3.11/lib/python3.11/site-packages/hplc/quant.py", line 801, in fit_peaks
peak_props = self.deconvolve_peaks(verbose=verbose,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathan/Library/Caches/pypoetry/virtualenvs/wine-analysis-hplc-uv-F-SbhWjO-py3.11/lib/python3.11/site-packages/hplc/quant.py", line 671, in deconvolve_peaks
popt, _ = scipy.optimize.curve_fit(self._fit_skewnorms, v['time_range'],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathan/Library/Caches/pypoetry/virtualenvs/wine-analysis-hplc-uv-F-SbhWjO-py3.11/lib/python3.11/site-packages/scipy/optimize/_minpack_py.py", line 974, in curve_fit
res = least_squares(func, p0, jac=jac, bounds=bounds, method=method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jonathan/Library/Caches/pypoetry/virtualenvs/wine-analysis-hplc-uv-F-SbhWjO-py3.11/lib/python3.11/site-packages/scipy/optimize/_lsq/least_squares.py", line 814, in least_squares
raise ValueError("Each lower bound must be strictly less than each "
ValueError: Each lower bound must be strictly less than each upper bound.
The bounds in question are below, where 'lb' is lower bound, 'ub' is upper bound:
lb | ub | |
---|---|---|
0 | 0.000378979 | 0.0378979 |
1 | 0 | 0 |
2 | 0.0004896 | 0 |
3 | -inf | inf |
As I understand it, the prominence is the normalized prominence, i.e. the percentage of the maxima as a threshold for inclusion of a given peak. For the same dataset i've been using a value of 0.05 to ignore the smallest peaks with no problem.
I've developed hplc-py
using only one baseline estimation algorithm (SNIP), but there are many options that can be used. These are nicely tested and developed in the pybaselines
package. A development goal of hplc-py
would be to deprecate the correct_baseline
method of a Chromatogram
with a call to the broad pybaselines
API.
Hi, cool library! I noticed a small issue in the correct_baseline
method in quant.py.
Lines 884 to 885 in 8ce5223
Within the inner loop, the values of tform
need to be used for the minimum comparison rather than tform_new
. Since tform_new
is being written to within the loop, using its values for the comparison will cause some unforseen issues. To help compare with Morhác's original SNIP implementation, the working vector (w
in the paper) is tform_new
and the current vector (v
in the paper) is tform
.
The suggested change is show below:
for i in iter:
tform_new = tform.copy()
for j in range(i, len(tform) - i):
tform_new[j] = min(tform[j], 0.5 * (tform[j+i] + tform[j-i])) # changed here
tform = tform_new
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.