Skip to content

Feature/osw auto addup spec#7742

Merged
timosachsenberg merged 17 commits into
OpenMS:developfrom
singjc:feature/osw_auto_addup_spec
Feb 27, 2025
Merged

Feature/osw auto addup spec#7742
timosachsenberg merged 17 commits into
OpenMS:developfrom
singjc:feature/osw_auto_addup_spec

Conversation

@singjc

@singjc singjc commented Dec 6, 2024

Copy link
Copy Markdown
Contributor

Description

This is 1 of 3 (probably) PRs related to improvements for ion mobility IPF scoring. I'm breaking up my main implementation into smaller PRs to hopefully make the revision easier.

This PR implements the ability to automatically add up spectra across the peak width in retention time. The original implementation extracted spectra at the peak apex, with the option of extracting more spectra across the peak by setting the add_up_spectra_ param to an odd value greater than 1. Now the user can set add_up_spectra_ to -1, which will turn on the automatic computation of add_up_spectra_ based on the percent of the peak width. The general idea behind adding up more spectra, is that it could lead to cleaner / higher signal in the ion mobility extraction.

image

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out
  • The details of the action statuses at the end of the PR or the "Checks" tab.
  • http://cdash.openms.de/index.php?project=OpenMS and look for your PR. Use the "Show filters" capability on the top right to search for your PR number.
    If you click in the column that lists the failed tests you will get detailed error messages.

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Comment thread src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathScoring.h Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated
@timosachsenberg

Copy link
Copy Markdown
Contributor

nice addition. I left some comments and added other reviewers.

Comment thread src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp Outdated
Comment thread src/openms/source/ANALYSIS/OPENSWATH/OpenSwathScoring.cpp Outdated

@jcharkow jcharkow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me.

One thought though is does it make sense to have both the "fixed" and the "percentile" based addition approaches? Would it make more sense to replace the fixed with the percentile approach or are there cases where the fixed approach is better?

I do not think the fixed approach is used in practice, at least for me.

@timosachsenberg

timosachsenberg commented Dec 9, 2024

Copy link
Copy Markdown
Contributor

Overall looks good to me.

One thought though is does it make sense to have both the "fixed" and the "percentile" based addition approaches? Would it make more sense to replace the fixed with the percentile approach or are there cases where the fixed approach is better?

I do not think the fixed approach is used in practice, at least for me.

I agree that this would also be my preferred way forward if possible. E.g., only support percentage
with a default parameters (e.g., something along FWHM) and just have reasonable internal boundaries (e.g. a minimum of 1 and a maximum of 5 scans - something that significantly reduces noise but does not increase computation too much).

@singjc

singjc commented Dec 9, 2024

Copy link
Copy Markdown
Contributor Author

Overall looks good to me.

One thought though is does it make sense to have both the "fixed" and the "percentile" based addition approaches? Would it make more sense to replace the fixed with the percentile approach or are there cases where the fixed approach is better?

I do not think the fixed approach is used in practice, at least for me.

I do agree as well, though I've left the fixed as an option because that's the current approach that is used. But we could make the dynamic merging of spectra the default? Or like Timo suggested, we could have a default where we just clamp between a reasonable range. This would probably be important for cases where we have a really large peak.


double getRT() const override;

double getMetaValue(std::string name) const;

@timosachsenberg timosachsenberg Dec 12, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using RangeRT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking into applying this, but I think it would require more changes to other parts of OpenSwath. Currently OpenSwath (and some of the other FeatureFinders) stores the leftWidth and rightWidth in the metaValue, which is then used for retrieval at some point. I think the RangeRT would be a good replacement, but I think those changes would maybe be for another PR?


// find spectrum that is closest to the apex of the peak using binary search
std::vector<OpenSwath::SpectrumPtr> spectrum = fetchSpectrumSwath(used_swath_maps, imrmfeature->getRT(), add_up_spectra_, im_range);
std::vector<OpenSwath::SpectrumPtr> spectrum = fetchSpectrumSwath(swath_maps, imrmfeature->getRT(), n_merge_spectra, im_range);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could probably be one

@timosachsenberg

Copy link
Copy Markdown
Contributor

Overall looks good to me.
One thought though is does it make sense to have both the "fixed" and the "percentile" based addition approaches? Would it make more sense to replace the fixed with the percentile approach or are there cases where the fixed approach is better?
I do not think the fixed approach is used in practice, at least for me.

I do agree as well, though I've left the fixed as an option because that's the current approach that is used. But we could make the dynamic merging of spectra the default? Or like Timo suggested, we could have a default where we just clamp between a reasonable range. This would probably be important for cases where we have a really large peak.

Yeah, less options = better test coverage, less combinatorics => less things that can get wrong

@timosachsenberg

Copy link
Copy Markdown
Contributor

I think the mock mrmfeature also needs the new method implemented

@singjc

singjc commented Feb 24, 2025

Copy link
Copy Markdown
Contributor Author

Sorry, been busy with another project. Just wanted to follow up on this, I think I mostly addressed all the comments/suggestions? You mentioned the mock MRMFeature needed the new method implementation? Can you point me to where that is?

@timosachsenberg

Copy link
Copy Markdown
Contributor

This is the error: ../src/tests/class_tests/openms/source/MRMScoring_test.cpp:590:46: error: allocating an object of abstract class type 'OpenSwath::MockMRMFeature'

class OPENSWATHALGO_DLLAPI MockMRMFeature :

Probably an added method is not implemented there.

@singjc

singjc commented Feb 25, 2025

Copy link
Copy Markdown
Contributor Author

This is the error: ../src/tests/class_tests/openms/source/MRMScoring_test.cpp:590:46: error: allocating an object of abstract class type 'OpenSwath::MockMRMFeature'

class OPENSWATHALGO_DLLAPI MockMRMFeature :

Probably an added method is not implemented there.

Ahh kk, I updated the MockObjects. Should work now, passed locally.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these interfaces would profit a lot from some documentation in the future.
e.g. such that things like the difference between:
virtual void getIntensity(std::vector& intens) const = 0;
virtual float getIntensity() const = 0;

for what virtual double getMetaValue(std::string name) const = 0; is used (and ideally which ones are currently queried)

@singjc

singjc commented Feb 27, 2025

Copy link
Copy Markdown
Contributor Author

All tests pass, can we merge?

@timosachsenberg
timosachsenberg merged commit f9610b4 into OpenMS:develop Feb 27, 2025
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.

3 participants