-
Notifications
You must be signed in to change notification settings - Fork 4
fixed diann PTM parse bug #57
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
|
I think the handling of labelling modifications is wrong in general. In the docs it is recommended to add "label" only to mods that do not affect retention time |
|
Yes, so quantms currently support DIA-LFQ. DIA-iso is not supported. If label support is required, other dia module will need to be coordinated. I'm not sure if it's necessary now. |
|
True. I agree it is not super important. But then we should probably fail instead of producing something wrong. Let's at least fix the aggregation. And add a TODO for the "label" issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to fix a PTM parsing bug in DIA-NN configuration by introducing a merging mechanism for duplicate modifications across different sites. However, the implementation contains critical bugs that need to be addressed.
Key Changes:
- Introduced
defaultdictto collect sites for each modification - Refactored PTM handling to merge modifications with different sites into a single entry
- Updated sdrf-pipelines dependency to version 0.0.33 across all dependency files
- Bumped package version to 0.0.24
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| quantmsutils/diann/dianncfg.py | Introduces merging logic for PTMs but contains bugs in string-to-list conversion |
| pyproject.toml | Updates package version to 0.0.24 and pins sdrf-pipelines to 0.0.33 |
| requirements.txt | Pins sdrf-pipelines dependency to version 0.0.33 |
| environment.yml | Pins sdrf-pipelines dependency to version 0.0.33 |
| quantmsutils/init.py | Updates package version string to 0.0.24 |
Critical Issues Found:
-
String-to-list conversion bugs (lines 84, 86, 126, 128): The code uses
list(site)andlist(site + "," + "label")which converts strings into character arrays. For example,list("K,label")produces['K', ',', 'l', 'a', 'b', 'e', 'l']instead of keeping it as a single string or list of strings. This breaks the merging logic. -
Label modification format inconsistency (lines 95-96, 131-133): The merging approach is incompatible with label modifications that require a
,labelsuffix. The old format was"ModName,mass,K,label"but the new merging logic doesn't properly handle this case. -
Missing test coverage: The
convert_modfunction lacks functional tests despite being complex and bug-prone. Only a help message test exists for thedianncfgcommand.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
quantmsutils/diann/dianncfg.py
Outdated
| merged[diann_mod].extend(list(site + "," + "label")) | ||
| else: | ||
| var_ptm.append(diann_mod + "," + site) | ||
| merged[diann_mod].extend(list(site)) |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Using list(site) converts the string into a list of individual characters. For example, if site="*n" (as set on line 116), this produces ['*', 'n'] instead of ['*n'].
This should be: merged[diann_mod].append(site) to add the site as a single string element.
quantmsutils/diann/dianncfg.py
Outdated
| or "mTRAQ" in diann_mod | ||
| ): | ||
| fix_ptm.append(diann_mod + "," + site + "," + "label") | ||
| merged[diann_mod].extend(list(site + "," + "label")) |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Using list(site + "," + "label") converts the string into a list of individual characters rather than a list containing the string. For example, if site="K", this produces ['K', ',', 'l', 'a', 'b', 'e', 'l'] instead of ['K', ',', 'label'].
This should be: merged[diann_mod].extend([site, ",", "label"]) or merged[diann_mod].append(site + "," + "label")
|
It would be nice to have a test for the PTM parsing e.g. here or because the parsing is a function, it could be a small unit test. |
This is true, @fabianegli feel free to help us here, we are now quite busy with other issues, including quantms PTMs handling in SDRF DIA and DDA. |
PR Type
Bug fix, Enhancement
Description
Fixed PTM parsing bug in DIA-NN configuration by merging duplicate modifications
Improved handling of multiple sites for same modification using defaultdict
Updated sdrf-pipelines dependency to version 0.0.33 for compatibility
Bumped package version to 0.0.24
Diagram Walkthrough
File Walkthrough
__init__.py
Version bump to 0.0.24quantmsutils/init.py
pyproject.toml
Update version and dependency constraintspyproject.toml
dianncfg.py
Refactor PTM parsing to merge duplicate modificationsquantmsutils/diann/dianncfg.py
defaultdictimport for efficient modification groupingconvert_mod()function to merge duplicate modificationsacross different sites
mergeddictionaryand formats as
name (sites)environment.yml
Pin sdrf-pipelines to version 0.0.33environment.yml
requirements.txt
Pin sdrf-pipelines to version 0.0.33requirements.txt