Skip to content

Optimize ProForma proteoform generation#204

Merged
levitsky merged 10 commits into
masterfrom
opt/proteoforms
May 11, 2026
Merged

Optimize ProForma proteoform generation#204
levitsky merged 10 commits into
masterfrom
opt/proteoforms

Conversation

@levitsky
Copy link
Copy Markdown
Owner

@levitsky levitsky commented May 7, 2026

This should preserve the functionality but improve speed by up to 50%.

One change is the addition of a deepcopy parameter that is disabled by default, assuming that the output of ProteoformCombinator will rarely be additionally modified.

Comment thread pyteomics/proforma.py Outdated
Comment thread pyteomics/proforma.py
Comment thread pyteomics/proforma.py
Comment thread pyteomics/proforma.py
Comment thread pyteomics/proforma.py

def generate(self):
seen = set()
for slots in self._build_modification_iter():
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.

When you have multiple modifications per position, _build_modification_iter produces a lot of redundant configurations. These are unlikely to be in the use-case you have in mind, but in the future if that becomes important, this is probably another place to tune.

Copy link
Copy Markdown
Contributor

@mobiusklein mobiusklein left a comment

Choose a reason for hiding this comment

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

Thank you for reviewing this issue in detail. Your solutions look good, especially the place where I was being wasteful with nested find_positions calls.

@levitsky levitsky merged commit f509b76 into master May 11, 2026
17 checks passed
@levitsky levitsky deleted the opt/proteoforms branch May 11, 2026 15:14
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