Skip to content

[2/5] Refactor: make the fragment parsing helpers private - #435

Open
GeorgWa wants to merge 1 commit into
test/flatten-fragments-characterizationfrom
refactor/private-fragment-parsing-helpers
Open

[2/5] Refactor: make the fragment parsing helpers private#435
GeorgWa wants to merge 1 commit into
test/flatten-fragments-characterizationfrom
refactor/private-fragment-parsing-helpers

Conversation

@GeorgWa

@GeorgWa GeorgWa commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Pure refactor. Rename only, no functional change.

parse_fragment, fill_in_indices and calculate_fragment_numbers only serve flatten_fragments, and nothing in alphabase, alphadia or peptdeep calls them. A leading underscore states that, and frees their signatures for the refactoring that follows.

Stacked on #434. Splitting #429.

🤖 Generated with Claude Code

`parse_fragment`, `fill_in_indices` and `calculate_fragment_numbers` only serve
`flatten_fragments`, and nothing in alphabase, alphadia or peptdeep calls them.
A leading underscore states that, and frees their signatures for the refactoring
that follows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@GeorgWa GeorgWa changed the title Refactor: make the fragment parsing helpers private [2/5] Refactor: make the fragment parsing helpers private Aug 31, 2026

@mschwoer mschwoer left a comment

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.

LGTM

number_of_fragment_types: int,
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Parse fragments to get fragment numbers, fragment positions and not top k excluded indices in one hit

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.

"fragment numbers" is kinda ambigous.. is this counts? or enumeration? not sure if it should be renamed now (depends on the radius of this change), but at last a comment would help :-)

@mo-sameh

mo-sameh commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

PS: I'll be creating a PR soon to optimize the translation modules (translate.py, translate_diann.py). They each have their own fragment-flattening code (merge_precursor_fragment_df) that does very similar task as flatten_fragments, just emitting the type/loss/charge columns as strings for DIA-NN/Spectronaut rather than numeric codes.

I think it will be better to reuse the much more optimized helpers here instead.
So maybe worth keeping them public? Not a blocker, just flagging since there'll be a caller shortly.

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