hplc-py icon indicating copy to clipboard operation
hplc-py copied to clipboard

Missing peak in chrom.map_peaks() exits loop

Open connor-pl-delaney opened this issue 7 months ago • 7 comments

Thanks for making this package - it's really well done!

I noticed that if a mapped peak is absent from the peak list, all subsequent mappings are ignored, even if they are present in the chromatogram. I traced the issue back to line 1060 of quant.py, where the loop breaks when an absent peak is identified. Changing from "break" to "continue" seems like a more intuitive outcome, where all present peaks are mapped and then a warning is raised for each absent peak. I don't really know how to use git so I thought I'd leave this here.

connor-pl-delaney avatar May 13 '25 17:05 connor-pl-delaney

Hi @connor-pl-delaney, thanks for filing this issue! I will take a look at what's going on. In the mean time, could you please provide a minimal failing example? A sample chromatogram and a copy of a script where I could reproduce the failure will help me patch a fix.

gchure avatar May 14 '25 05:05 gchure

Thanks for getting back to me! I don't have permission to share the data I am working with publically, so I will try to reproduce the issue with some synthetic data or my own chromatograms and get back to you soon.

connor-pl-delaney avatar May 15 '25 20:05 connor-pl-delaney

Hi @connor-pl-delaney, hope you are doing well! Are you still interested in providing some synthetic data to test this? Alternatively, you could provide a raw chromatogram with obfuscated or absent metadata.

gchure avatar Jun 24 '25 16:06 gchure

Thanks for the reminder. I have sanitized the data and written up a minimal example that reproduces the bug. I've attached the Jupyter notebook, test data, and a PDF printout of the outcome of the tests on my computer. The tests were run in a fresh conda environment with the latest install of hplc-py. I was able to resolve the issue by changing line 1070 of quant.py from "break" to "continue". Hope this helps!

hplc-py_bug_report.zip

connor-pl-delaney avatar Jun 24 '25 17:06 connor-pl-delaney

Correction, I had it right the first time - the "break" occurs on line 1060

connor-pl-delaney avatar Jun 24 '25 17:06 connor-pl-delaney

Great, thanks! I will take a look at this soon. If you'd like, feel free to open a PR with that change and I can check if the logic is correct and if the tests pass.

gchure avatar Jun 27 '25 01:06 gchure

Hi @connor-pl-delaney, wanted to let you know I'm finally getting around to this (busy summer).

gchure avatar Oct 24 '25 15:10 gchure