shuzhao-li-lab / asari

asari, metabolomics data preprocessing
Other
38 stars 9 forks source link

Peak boundaries issue #95

Open yufongpeng opened 1 month ago

yufongpeng commented 1 month ago

Hello,

Thank you for providing such wonderful tools!

While working with my lipidomics data, I noticed an unusual issue in the feature tables. The peak at 612.71 is correctly identified, but the left and right boundaries appear to be shifted to the left. image However, this peak looks normal in the composite mass track. image I’m wondering if this could be due to a bug in the feature generation process, or if it’s simply an effect of the larger peak on the right.

jmmitc06 commented 1 month ago

Thanks for bringing this to my attention. At first glance, I do not see an obvious explanation for this. @YuanyeChi, who is more familiar with the front end can check if this or is not a bug with the visualization of the mass track (my intuition is that it is not). Alternatively, it could be an alignment issue. I'll investigate.

One thing that could be helpful is if you can either share the feature table(s) from asari and if you can confirm, at least subjectively, that the peak areas look "correctish" for the peak.

shuzhao-li commented 1 month ago

Thx. Looks like a bug as the RT is (605, 612, 608). It might be a rare error from Gaussian fitting. I'll have a look shortly.

shuzhao-li commented 2 weeks ago

The apexes are identified correctly, but right base is wrong. The mass track viewer only uses apex values, thus immune from the error.

I think it's a bug in peaks.cleanup_peak_cluster. scipy.find_peaks makes some mistakes in defining the boundaries of overlap peaks. The cleanup_peak_cluster redefines the left and right bases by reordering base positions. Here, it looks like scipy.find_peaks produced a left base of the 2nd peak at 608 then cleanup_peak_cluster mistook it as a right base for the first peak.

Will update the function to make sure left and right bases flank apex.