Skip to content

Raised meaningful error for short peptide stretch - #5163

Merged
IAlibay merged 7 commits into
MDAnalysis:developfrom
spyke7:error_msg_fix_DSSP
Jan 1, 2026
Merged

Raised meaningful error for short peptide stretch#5163
IAlibay merged 7 commits into
MDAnalysis:developfrom
spyke7:error_msg_fix_DSSP

Conversation

@spyke7

@spyke7 spyke7 commented Nov 30, 2025

Copy link
Copy Markdown
Contributor

Fixes #5046

Changes made in this Pull Request:

  • Added a block for raising value error inside init in dssp.py
  • Checked the length of ag.residues, and just raised a simple value error message showing the minimum required residues

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.


📚 Documentation preview 📚: https://mdanalysis--5163.org.readthedocs.build/en/5163/

@spyke7

spyke7 commented Nov 30, 2025

Copy link
Copy Markdown
Contributor Author

@orbeckst @marinegor please check this, and do I need to add extra tests for this? and also codecov is failing, so I think it would be better if I add tests right?

and please tell me what to write in CHANGELOG, cause I'm confused about the format.... :-)

@codecov

codecov Bot commented Nov 30, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (1e7644f) to head (d711d20).
⚠️ Report is 31 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5163      +/-   ##
===========================================
- Coverage    92.72%   92.72%   -0.01%     
===========================================
  Files          180      180              
  Lines        22472    22474       +2     
  Branches      3188     3189       +1     
===========================================
+ Hits         20838    20839       +1     
- Misses        1176     1177       +1     
  Partials       458      458              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IAlibay IAlibay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add:

  1. Tests that trigger the error
  2. Tests that check that the system passes with 6 residues (and that it returns correct results)
  3. Update the docstring "Raises" section
  4. Update relevant docs to make it clear that at least 6 residues are necessary
  5. Update the changelog

Comment thread package/MDAnalysis/analysis/dssp/dssp.py Outdated
@IAlibay

IAlibay commented Nov 30, 2025

Copy link
Copy Markdown
Member

and please tell me what to write in CHANGELOG, cause I'm confused about the format.... :-)

Please look at the instructions in the changelog (

The rules for this file:
* entries are sorted newest-first.
* summarize sets of changes - don't reproduce every git log comment here.
* don't ever delete anything.
* keep the format consistent (79 char width, M/D/Y date format) and do not
use tabs but use spaces for formatting
* accompany each entry with github issue/PR number (Issue #xyz)
* release numbers follow "Semantic Versioning" https://semver.org
), and try to add something. If something about the changelog is unclear, then ask us specifically about (edit: what is unclear).

@spyke7

spyke7 commented Nov 30, 2025

Copy link
Copy Markdown
Contributor Author

If something about the changelog is unclear, then ask us specifically about the.

ok

@spyke7
spyke7 requested a review from IAlibay November 30, 2025 20:23
@spyke7

spyke7 commented Dec 2, 2025

Copy link
Copy Markdown
Contributor Author

@IAlibay hi!
Please check it, and do I need to update any other things related to docs?

@spyke7

spyke7 commented Dec 4, 2025

Copy link
Copy Markdown
Contributor Author

Hi @marinegor @IAlibay if you are not busy, can you tell me any updates on this?

@IAlibay

IAlibay commented Dec 4, 2025

Copy link
Copy Markdown
Member

@spyke7 - I appreciate the ping. I won't get to this until the weekend at the very least. As per all core developers, we tend to not have time during the week days due to life priorities.

@spyke7

spyke7 commented Dec 4, 2025

Copy link
Copy Markdown
Contributor Author

@spyke7 - I appreciate the ping. I won't get to this until the weekend at the very least. As per all core developers, we tend to not have time during the week days due to life priorities.

Sure. No problem with that.

@orbeckst

Copy link
Copy Markdown
Member

@IAlibay I tentatively assigned you here, given that you've been reviewing already. If you don't have the bandwidth please unassign yourself.

@spyke7

spyke7 commented Dec 13, 2025

Copy link
Copy Markdown
Contributor Author

Hi @IAlibay
Any other changes or updates required?!

@spyke7 spyke7 left a comment

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.

Yeah done

----------
atoms : Union[Universe, AtomGroup]
input Universe or AtomGroup. In both cases, only protein residues will
input at least 6 Universe or AtomGroup. In both cases, only protein residues will

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This sentence is incorrect, please fix.

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.

ok, I need to remove at least 6 right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should mention "6 residues" somewhere, but this current sentence structure doesn't say that.

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.

input Universe or AtomGroup with at least 6 protein residues. In both cases, only protein residues will
is this good?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think so, I'll review when you push the commit.

Comment thread package/CHANGELOG Outdated
Comment thread package/CHANGELOG Outdated
resids = protein.residues.resids

with pytest.raises(ValueError, match="DSSP requires at least 6 residues"):
res2 = u.select_atoms(f"protein and resid {resids[0]}-{resids[1]}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use atomgroup maniuplations here (and below) instead of calling "select_atoms".

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.

Please check it now.

@spyke7
spyke7 requested a review from IAlibay January 1, 2026 18:01
u = mda.Universe(TPR, XTC)

protein = u.select_atoms("protein")
resids = protein.residues.resids

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
resids = protein.residues.resids

No longer being used?

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.

yeah removed now

@spyke7
spyke7 requested a review from IAlibay January 1, 2026 18:32
@IAlibay
IAlibay merged commit 8ff4d09 into MDAnalysis:develop Jan 1, 2026
24 checks passed
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.

confusing error message from DSSP for too short peptide stretches

3 participants