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

Change coordinate integration from raw intensity to area under the curve #24

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

alex-l-kong
Copy link
Contributor

What is the purpose of this PR?

When writing out the peak image, the raw peak intensity at each spot is currently used. The agreed upon practice is to use the area under this curve from the peak base, so this needs to be updated.

How did you implement your changes

In order to properly calculate this area, the l_ips_r (left bound of peak), r_ips_r (right bound of peak), and peak_widths_height (height at which peak base begins) needs to be passed into coordinate_integration.

Find the closest value in the spot spectra that matches up with the m/z values associated with the corresponding l_ips_r and r_ips_r, then use those indices as the bounds for integrating the signal at the spot. Integration is done using scipy.integrate.simpson.

Because the peak only begins at 10% higher than the peak's prominence, the bottom rectangle below this must be subtracted out. This area to be removed can be computed using the corresponding peak_widths_height and the base length defined by subtracting the corresponding l_ips_r from r_ips_r.

Remaining issues

The peaks are currently determined across all spots. However, integration needs to be done on a spot level. While it is assumed that peaks at a spot level correspond to peaks across all spots, we have no way of knowing for sure. If this isn't the case, integration for peaks could be wrong because the actual peak interval for spots aren't getting captured.

This PR may also need to change if the raw glycan list is used instead of the existing peak finding/filtering algorithm.

@alex-l-kong alex-l-kong self-assigned this May 30, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9309656476

Details

  • 2 of 5 (40.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.0%) to 95.833%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/maldi_tools/extraction.py 2 5 40.0%
Totals Coverage Status
Change from base Build 6777233943: -1.0%
Covered Lines: 154
Relevant Lines: 157

💛 - Coveralls

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 this pull request may close these issues.

2 participants