def copy_struct(self, struct, chain): """Make a copy of the argument structure to use for generating the animation. Only copy the chain specified in chain_id. """ cp_struct = Structure.Structure(structure_id = struct.structure_id) chain_id = chain.chain_id for chain in struct.iter_chains(): ## TODO: Move "200" to conf.py, 2009-06-19 if chain.chain_id == chain_id or chain.count_fragments() < 200: include_chain = True else: include_chain = False for frag in chain.iter_fragments(): ## skip all waters if frag.is_water() == True: continue elif frag.is_standard_residue() == True and include_chain: for atm in iter_filter_atoms(frag.iter_atoms()): cp_atom = Structure.Atom( chain_id = atm.chain_id, fragment_id = atm.fragment_id, res_name = atm.res_name, element = atm.element, name = atm.name, temp_factor = atm.temp_factor, occupancy = atm.occupancy, position = atm.position.copy()) cp_struct.add_atom(cp_atom, True) elif frag.is_standard_residue() == False: for atm in frag.iter_atoms(): cp_atom = Structure.Atom( chain_id = atm.chain_id, fragment_id = atm.fragment_id, res_name = atm.res_name, element = atm.element, name = atm.name, temp_factor = atm.temp_factor, occupancy = atm.occupancy, position = atm.position.copy()) cp_struct.add_atom(cp_atom, True) cp_struct.sort() return cp_struct