Skip to content

ptm sphere#452

Merged
3dot141592 merged 27 commits into
crosslinkingfrom
molstar-viewer-adapter
Jun 15, 2026
Merged

ptm sphere#452
3dot141592 merged 27 commits into
crosslinkingfrom
molstar-viewer-adapter

Conversation

@3dot141592

@3dot141592 3dot141592 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Description

fixes #405
Adds trimesh spheres for PTMs and amino acids and displays them in the validation step if they intersect.
The user can also specify the number of neighboring amino acids around the PTM that should be ignored when calculating intersections.

Changes

  • Added a PTM validation step that detects intersections between PTMs and amino acids.
  • Added trimesh spheres for PTMs and intersecting amino acids to the structure visualization.
  • Added an input for ignoring neighboring amino acids during intersection calculations.
  • Added a table listing the detected intersections.
  • Only intersecting amino acid spheres are displayed. PTM spheres are always shown, while amino acid spheres are only rendered when they intersect with a PTM sphere.
  • Neighbor filtering is chain-specific. Only neighboring residues within the specified sequence distance and on the same chain are ignored.

Testing

  1. Import a protein structure containing PTMs.
  2. Add and run the PTM Validation step.
  3. Verify that detected intersections are listed in the output table.
  4. Verify that the PTMs and intersecting amino acids are displayed as spheres in the structure visualization.
  5. Change the number of ignored PTM residue neighbors and verify that the results update accordingly.
  • Maybe check code for stupidity :)

How is a sphere calculated?

A sphere is calculated for each PTM and amino acid. Its center is the mean position of all corresponding atom coordinates. Its radius is the maximum distance from this center to any atom, extended by that atom's van der Waals radius.

Two spheres are considered intersecting when the distance between their centers is smaller than the sum of their radii.

PR checklist

Development

  • If necessary, I have updated the documentation (README, docstrings, etc.)
  • If necessary, I have created / updated tests.

Mergeability

  • main-branch has been merged into local branch to resolve conflicts
  • The tests and linter have passed AFTER local merge
  • The backend code has been formatted with black
  • The frontend code has been formatted with pnpm format and checked with pnpm lint

Code review

  • I have self-reviewed my code.
  • At least one other developer reviewed and approved the changes

@3dot141592 3dot141592 requested review from NeleRiediger and tE3m June 4, 2026 16:03
@3dot141592 3dot141592 self-assigned this Jun 4, 2026

@NeleRiediger NeleRiediger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Testing worked great and the code looks good to me too. Although I can't really verify, whether all the logic is completely correct.

Comment thread frontend/src/components/core/shared/molstar-viewer/molstar-viewer.tsx Outdated

@tE3m tE3m left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Everything works from what I can see, good work there! I didn't check the frontend code too closely as I'm out of my depth there. Since the PR is rather large, I didn't focus on the geometrical/trimesh operations but rather on the pandas/df operations.
See my comments about the column titles, I'm a big proponent of using the constants but you don't have to if you think it's better this way. I was just a bit confused by the wording throughout the code, I feel like amino_acid should in most cases be replaced by something like unmodified, since PTMs are just modifications on amino acids, they're not really different concepts.
Also check out the merge conflicts, since those currently block merging this addition

Comment thread backend/protzilla/data_analysis/amino_acid_spheres.py Outdated
Comment thread backend/protzilla/data_analysis/amino_acid_spheres.py Outdated
Comment thread backend/protzilla/data_analysis/amino_acid_spheres.py Outdated
Comment thread backend/protzilla/data_analysis/geometry_operations.py
Comment thread backend/protzilla/data_analysis/geometry_operations.py
Comment thread backend/protzilla/run.py
Comment thread backend/protzilla/data_analysis/ptm_analysis.py
Comment thread backend/protzilla/data_analysis/ptm_analysis.py Outdated
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  backend/main
  views_helper.py 239-252
  backend/protzilla/data_analysis
  amino_acid_spheres.py 28-60, 72-102, 111-135, 143-194
  crosslinking_validation.py 83
  geometry_operations.py 25-29, 48-94, 107-117, 121, 128, 139-144, 156-168, 184, 186, 190, 212-224, 242-246, 258-263
  ptm_analysis.py 106-142
  backend/protzilla/methods
  data_analysis.py 2514
  backend/protzilla/utilities
  ptm_helper.py 67, 69, 78-90
Project Total  

This report was generated by python-coverage-comment-action

@3dot141592 3dot141592 merged commit 4956e4e into crosslinking Jun 15, 2026
2 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.

4 participants