Skip to content

Conversation

@spyke7
Copy link
Contributor

@spyke7 spyke7 commented Nov 30, 2025

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
Copy link
Contributor Author

spyke7 commented Nov 30, 2025

@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
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (bbcef1b) to head (8d0d67b).

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         20837    20838       +1     
  Misses        1177     1177              
- Partials       458      459       +1     

☔ 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.

Copy link
Member

@IAlibay IAlibay left a comment

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 on lines 360 to 365
n_residues = len(ag.residues)
MIN_RESIDUES = 5
if n_residues < MIN_RESIDUES:
raise ValueError(
f"DSSP requires at least {MIN_RESIDUES} residues for secondary structure analysis, but only {n_residues} residue(s) were provided in the selection."
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
n_residues = len(ag.residues)
MIN_RESIDUES = 5
if n_residues < MIN_RESIDUES:
raise ValueError(
f"DSSP requires at least {MIN_RESIDUES} residues for secondary structure analysis, but only {n_residues} residue(s) were provided in the selection."
)
if len(ag.residues) < 6:
raise ValueError(
"DSSP requires at least 6 residues for secondary structure analysis, "
f"but only {len(ag.residues)} residue(s) were provided in the selection."
)

See the original issue "fewer than 6 residues" not 5.
Also there's no need to define one time use variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, doing the changes!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@IAlibay
Copy link
Member

IAlibay commented Nov 30, 2025

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
Copy link
Contributor Author

spyke7 commented Nov 30, 2025

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
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

2 participants