# Example for: selection.mutate()
from modeller import *
env = environ()
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')
code = "t_str.pdb"
aln = alignment(env)
mdl = model(env, file=code)
aln.append_model(mdl, atom_files=code, align_codes=code)
sel_1 = selection(mdl.residues["40:A"])
sel_1.mutate(residue_type="SER")
aln.append_model(mdl, align_codes="1fas-1")
mdl.clear_topology()
mdl.generate_topology(aln['1fas-1'])
mdl.transfer_xyz(aln)
mdl.build(initialize_xyz=False, build_method='INTERNAL_COORDINATES')
mdl.write(file="4lyzT40S_S91V.pdb")