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

Add additional unittests for outputaccumulator #450

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mo-sameh
Copy link
Collaborator

Added some unit test for the ms2 quality post processing step in the output accumulator.
Mainly:

@mo-sameh mo-sameh marked this pull request as ready for review January 24, 2025 16:26
@mo-sameh mo-sameh requested review from mschwoer and GeorgWa January 24, 2025 16:26
Comment on lines +311 to +319
for frag_start, frag_stop in zip(
base_precursor_df["frag_start_idx"], base_precursor_df["frag_stop_idx"]
):
frag_corr = fragment_correlation_base_df.iloc[frag_start:frag_stop].values
frag_intensities = base_fragment_df.iloc[frag_start:frag_stop].values
# median corr of non zero intensities
frag_corr = frag_corr[frag_intensities > 0]
median_frag_corr = np.median(frag_corr) if len(frag_corr) > 0 else 0
target_use_for_ms2.append(median_frag_corr > precursor_correlation_cutoff)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel we are re-building the logic that we want to test here?

An alternative approach would be to use as test data a minimal example DataFrame, with only the relevant columns and only that many rows that the logic can be tested..

Advantages:

  • much simpler and readable test
  • increased robustness and strictness

cf. e.g. here https://github.com/MannLabs/alphabase/pull/291/files#diff-ee8a98e83ac2eb73798364728cf68e99da2f84c57ce071de56012e639288bd19

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