This skill covers modifying protein structures: transforming coordinates, removing/adding atoms and residues, modifying B-factors and occupancies, and building structures programmatically.
pip install biopython numpyTell your AI agent what you want to do:
- "Remove all water molecules from this structure"
- "Translate the structure by 10 Angstroms in X"
- "Set B-factors based on this conservation score data"
"Center this structure at the origin"
"Rotate the structure 90 degrees around the Z axis"
"Translate chain A by [10, 5, 0]"
"Remove hydrogens from this structure"
"Delete chain B"
"Remove all hetero atoms (keep only protein)"
"Set all B-factors to 20"
"Color by conservation score in the B-factor column"
"Set occupancy to 0.5 for chain A"
"Renumber residues starting from 1"
"Rename chain A to X"
"Merge these two PDB files"
- Parse input structure(s)
- Navigate to target entities
- Apply requested modifications
- Save modified structure to new file
| Operation | Method |
|---|---|
| Remove atom | residue.detach_child(atom_id) |
| Remove residue | chain.detach_child(residue_id) |
| Remove chain | model.detach_child(chain_id) |
| Transform | Modify atom.coord directly |
| Modify B-factor | Set atom.bfactor |
| Modify occupancy | Set atom.occupancy |
| Rename chain | Set chain.id |
| Renumber residue | Set residue.id |
- Use
detach_child()to remove entities, notdel - Modify coord directly -
atom.coordis a numpy array - B-factors for visualization - Use B-factor column to encode custom data
- Chain IDs are single characters - typically A-Z
- Residue ID is a tuple -
(hetfield, resnum, icode) - Copy before modifying if you need to preserve original
- StructureBuilder for building from scratch