Skip to content

Fix PDB parsing for multi-chain polymers - #237

Open
ryanhulke wants to merge 1 commit into
HannesStark:mainfrom
ryanhulke:fix/pdb-multichain-subchains
Open

Fix PDB parsing for multi-chain polymers#237
ryanhulke wants to merge 1 commit into
HannesStark:mainfrom
ryanhulke:fix/pdb-multichain-subchains

Conversation

@ryanhulke

Copy link
Copy Markdown

fixes #236.

PDB files can declare one polymer entity with multiple chains, e.g. COMPND ... CHAIN: A, B. The PDB parser was assigning label_seq only for entity.subchains[0], leaving later subchains without label_seq_id after Gemmi converts the PDB to mmCIF.

this caused residues in the following subchains to be parsed as is_present=False and then dropped during mmCIF serialization, which could create token/design-mask length mismatches downstream.

Changes

  • assign label_seq for every polymer subchain in a multi-chain entity
  • preserve the existing fallback for generated PDB's without full_sequence/SEQRES by inferring the sequence from the first non-empty subchain

Testing

  • reproduced with PDB 3K4P, which declares CHAIN: A, B
  • confirmed parse_pdb(..., use_assembly=False) preserves both chains,
    • A: 444 residues, 438 present
    • B: 444 residues, 438 present
  • confirmed to_mmcif(...) round-trip preserves both chains with the same counts
  • ran:
    • python -m py_compile src/boltzgen/data/parse/pdb_parser.py
    • python -m pytest tests/test_residue_constraints.py
    • python -m pytest tests/test_inverse_fold_constraint_masks.py

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.

Bug: PDB parsing drops residues from secondary subchains in multi-chain entities

1 participant