Closed JonasLi-19 closed 2 months ago
Hi @JonasLi-19, Are you still on this issue?
I'm not expert on this but I may try to help.
for res in cmd.get_model(base_name).atom:
if res.resn in mut_dict:
res_chain = res.chain
resi = res.resi
cmd.do(f'select res, {base_name} and chain {res_chain} and resi {resi}')
cmd.do(f"cmd.get_wizard().set_mode('{mut_dict[res.resn]}')")
cmd.do('cmd.get_wizard().apply()')
Maybe the error is because you're looping by atom instead of residues (but using variable name res
); you can try to skip residues if (res_chain, resi)
is already on the visited (use a set
).
You can also use the API's functions cmd.select
and cmd.get_wizard
instead of cmd.do
.
Disregarding the above, I couldn't reproduce your cmd.do
commands on 1E92
to mutate the first:
fetch 1e92
select res, 1e92 and chain A and resi 1
cmd.wizard("mutagenesis")
cmd.get_wizard().set_mode('PRO')
cmd.get_wizard().apply()
It keep displaying "Keep a residue...' and a rotamer should also be choosen.
Dear developer, I want to mutate all GLN&ASN to LEU of protein files to do some further research, but EVEN THOUGH the python scripts runs well without error, the output file still have all the GLN&ASN left.
AND the command terminal code output is like:
Selector: selection "res" defined with 14 atoms. PyMOL>cmd.get_wizard().set_mode('LEU') PyMOL>cmd.get_wizard().apply() PyMOL>select res, 1aaq_protein and chain B and resi 98 Selector: selection "res" defined with 14 atoms. PyMOL>cmd.get_wizard().set_mode('LEU') PyMOL>cmd.get_wizard().apply() PyMOL>select res, 1aaq_protein and chain B and resi 98 Selector: selection "res" defined with 14 atoms. PyMOL>cmd.get_wizard().set_mode('LEU') PyMOL>cmd.get_wizard().apply() PyMOL>select res, 1aaq_protein and chain B and resi 98 Selector: selection "res" defined with 14 atoms. PyMOL>cmd.get_wizard().set_mode('LEU') PyMOL>cmd.get_wizard().apply()