Tarskin / HappyTools

A tool for the (high-throughput) processing of HPLC data.
Apache License 2.0
34 stars 16 forks source link

Automatic edge adjustment of peak detection fails on sequentially overlapping peaks #13

Closed Tarskin closed 6 years ago

Tarskin commented 6 years ago

This was caused by the i['Peak'] value no longer being in the middle of i['Data'] after the border was changed. The fix was to always compare to relevant border of i['Data'] to i['Peak'] rather than the two opposite ends of i['Data'].

Detailed Explanation:

--- ORIGINAL --- Peak 1: 15.00-15.50 - Intensity: 1 Peak 2: 15.25-15.75 - Intensity: 1 Peak 3: 15.70-16.20 - Intensity: 1

--- PROCESSED -- Peak 1: 15.000-15.375 - Intensity: 1 Peak 2: 15.375-15.750 - Intensity: 1 Peak 3: 15.700-16.200 - Intensity: 1

--- CAUSE ---

15.750 - 15.375 = 0.375 (down from 0.5) 15.50 (Center) + 0.5*0.375 = 15.6875 Peak 2 Border (Expected) = 15.6875 - Peak 2 Border (Actual) = 15.750 No overlap between Peak 3 (Lower) and Peak 2 (Expected) No adjustment made between peak 2 and 3

Tarskin commented 6 years ago

--- FIX ---

Window = abs(Peak Edge - Peak Max) instead of abs(Peak Lower Edge - Peak Upper Edge) This ensures that the algorithm knows the actual 'edge' of the peak window.

Tarskin commented 6 years ago

This bug also affects the generated peak list.