Skip to content

Add idealize pre-processing option#14

Merged
delalamo merged 19 commits intomainfrom
idealize
Jan 13, 2026
Merged

Add idealize pre-processing option#14
delalamo merged 19 commits intomainfrom
idealize

Conversation

@delalamo
Copy link
Copy Markdown
Owner

No description provided.

delalamo and others added 19 commits January 12, 2026 09:08
- Add Dockerfile using condaforge/miniforge3 for conda dependencies
- Add docker-build.yml workflow triggered by releases, tags, or manual dispatch
- Add .dockerignore to exclude build artifacts
- Update README with Docker usage instructions

Image published to ghcr.io/delalamo/graphrelax

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…mization

Detects missing residues in protein chains by checking residue numbering
discontinuities and C-N bond distances. Chains are split at gaps before
OpenMM minimization to prevent the creation of unrealistic peptide bonds
across gaps. Original chain IDs are restored after minimization.

- Add chain_gaps.py module with detect_chain_gaps, split_chains_at_gaps,
  and restore_chain_ids functions
- Integrate gap detection into relaxer.py relax() method
- Add split_chains_at_gaps config option (enabled by default)
- Add --no-split-gaps CLI flag to disable the feature
- Add comprehensive tests for chain gap detection
…atom

The bug was assigning a new chain ID for every atom at a gap start residue
instead of just once when entering a new segment. Added tracking of
processed gap starts to prevent duplicate chain assignments.
- Free up disk space by removing unused .NET, GHC, and Boost packages
- Install CPU-only PyTorch to avoid large CUDA dependencies
- Use --no-cache-dir to minimize pip cache usage

The GitHub Actions runner was running out of disk space when installing
PyTorch with CUDA dependencies (~5-7GB) alongside conda packages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements a pre-idealization step inspired by Rosetta's idealize.cc:
- Add --pre-idealize CLI flag to enable backbone geometry idealization
- Run constrained minimization to fix local geometry while preserving dihedrals
- Detect and preserve chain gaps during idealization
- Add --ignore-missing-residues flag to skip SEQRES-based residue addition

Also fixes ligand handling throughout the pipeline:
- Extract ligands before relaxation (AMBER can't parameterize arbitrary ligands)
- Restore ligands after relaxation completes
- Ligands are preserved through both idealization and main relaxation steps

New files:
- src/graphrelax/idealize.py: Core idealization module
- tests/test_idealize.py: Unit and integration tests

Modified files:
- src/graphrelax/cli.py: Add --pre-idealize and --ignore-missing-residues flags
- src/graphrelax/config.py: Add IdealizeConfig dataclass
- src/graphrelax/pipeline.py: Integrate idealization step
- src/graphrelax/relaxer.py: Add ligand extraction/restoration
- .pre-commit-config.yaml: Add E501 ignore for test_idealize.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes the default behavior of pre-idealization to close chain breaks
(treating all segments as a single continuous chain). This allows gaps
to be filled during the constrained minimization step.

Add --retain-chainbreaks CLI flag to preserve the old behavior where
chain gaps are detected and split into separate chains to prevent
closure during minimization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolve merge conflicts in cli.py and relaxer.py to preserve
idealization config and ligand extraction/restoration features.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Make pdbfixer a required dependency (not optional)
- Clarify that PyPI install gets latest release
- Clarify that source install gets latest development version
- Fix GitHub URL from your-username to delalamo

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PDBFixer handles missing residues through findMissingResidues() +
findMissingAtoms() + addMissingAtoms(). The addMissingResidues()
method does not exist.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These tests would have caught the AttributeError from calling
non-existent fixer.addMissingResidues() method:

- test_minimize_with_constraints_basic: Basic test without missing residues
- test_minimize_with_constraints_add_missing: Test with add_missing_residues=True
- test_minimize_with_seqres_missing_residues: Test with PDB containing SEQRES
  indicating missing residues (exercises the full code path)
- test_minimize_with_seqres_skip_missing: Test skipping missing residue addition

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The features are already evident from the Usage and How It Works sections.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
pdbfixer is a conda-only dependency not available in the unit tests CI
job. Use pytest.importorskip to skip the entire test module when
pdbfixer is not installed. The tests still run in the integration tests
job which has pdbfixer installed via conda.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of skipping idealize tests when pdbfixer isn't available,
install pdbfixer via conda in the unit tests job. This ensures all
tests run in both CI jobs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add disk space cleanup step before conda setup (removes dotnet, ghc,
  boost, android SDK)
- Use miniforge for smaller conda installation
- Use --no-update-deps to avoid pulling unnecessary dependencies
- Use --no-cache-dir for pip to save disk space

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@delalamo delalamo merged commit 8473113 into main Jan 13, 2026
3 checks passed
@delalamo delalamo deleted the idealize branch January 13, 2026 15:30
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