def _update_structure_lines(self):
        '''ATOM and HETATM lines may be altered by function calls. When this happens, this function should be called to keep self.structure_lines up to date.'''
        structure_lines = []
        atom_chain_order = []
        chain_atoms = {}

        for line in self.lines:
            linetype = line[0:6]
            if linetype == 'ATOM  ' or linetype == 'HETATM' or linetype == 'TER   ':
                chain_id = line[21]
                self.residue_types.add(line[17:20].strip())
                if missing_chain_ids.get(self.pdb_id):
                    chain_id = missing_chain_ids[self.pdb_id]
                structure_lines.append(line)
                if (chain_id not in atom_chain_order) and (chain_id != ' '):
                    atom_chain_order.append(chain_id)
                if linetype == 'ATOM  ':
                    atom_type = line[12:16].strip()
                    if atom_type:
                        chain_atoms[chain_id] = chain_atoms.get(chain_id, set())
                        chain_atoms[chain_id].add(atom_type)
            if linetype == 'ENDMDL':
                colortext.warning("ENDMDL detected: Breaking out early. We do not currently handle NMR structures properly.")
                break

        self.structure_lines = structure_lines
        self.atom_chain_order = atom_chain_order
        self.chain_atoms = chain_atoms
ATOM and HETATM lines may be altered by function calls. When this happens, this function should be called to keep self.structure_lines up to date.