Remove heteroatoms from PDB
问题 The heteroatoms from pdb file has to be removed. Here is the code but it did not work with my test PDB 1C4R. for model in structure: for chain in model: for reisdue in chain: id = residue.id if id[0] != ' ': chain.detach_child(id) if len(chain) == 0: model.detach_child(chain.id) Any suggestion? 回答1: The heteroatoms shouldn't be part of the chain. But you can know if a residue is a heteroatom with: pdb = PDBParser().get_structure("1C4R", "1C4R.pdb") for residue in pdb.get_residues(): tags =