Best Python code snippet using localstack_python
mutation_one_by_one.py
Source:mutation_one_by_one.py
...31# prot_list = [['1shr', 'B']] # example [['1nzp', 'A'], ['4oxn', 'B']] # how many proteins do you want32residues_list = [int(z) for x,y,z in second_shell_residues]33aminoacid = ['ALA','GLY' ] # only two34def mutate_this(prot, res ,num ):35 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))36 cmd.frame(1)37 cmd.get_wizard().apply()38 cmd.save(f"../files/mutant_{res}_{prot[1]}.pdb","obj_%s"%(num))39def mutate_all(prot, res ,num ):40 if res != "ALA":41 cmd.get_wizard().set_mode(aminoacid[0])42 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))43 cmd.frame(1)44 cmd.get_wizard().apply()45 cmd.save(f"../files/mutant_{res}_{prot[1]}_ALA.pdb","obj_%s"%(num))46 # cmd.save("../files/mutant_all_residues.pdb","obj_%s"%(num))47 else:48 cmd.get_wizard().set_mode(aminoacid[1])49 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))50 cmd.frame(1)51 cmd.get_wizard().apply()52 cmd.save(f"../files/mutant_{res}_{prot[1]}_GLY.pdb","obj_%s"%(num))53 # cmd.save("../files/mutant_all_residues.pdb","obj_%s"%(num)) 54for prot in prot_list:55 #Initialize56 # fetch protein by PDB code57 cmd.fetch(prot[0], async_=0)58 # mutagenesis mode59 cmd.wizard("mutagenesis")60 cmd.do("refresh_wizard")61 62 # create 7 object 63 for obj in range(len(second_shell_residues)):64 cmd.create('obj_%s' % obj, prot[0])65 # Mutate66 # cmd.get_wizard().set_mode(aminoacid)67 #for obj_1 (mutation in all residues) 68 for num,res in enumerate ( residues_list ) :69 num +=170 if num == choice: 71 mutate_all(prot, res, num=num)72 73 74 # cmd.get_wizard().do_select("/obj_1//%s/%d" % (prot[1], residues_list[1]))75 # cmd.frame(1)76 # cmd.get_wizard().apply()77 # cmd.get_wizard().do_select("/obj_1//%s/%d" % (prot[1], residues_list[2]))78 # cmd.frame(1)79 # cmd.get_wizard().apply()80 # cmd.save("%s_%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[1], residues_list[2], aminoacid),'obj_1')81 82# #for obj_2 (mutation in residue # 1 and 2)83# cmd.get_wizard().do_select("/obj_2//%s/%d" % (prot[1], residues_list[0]))84# cmd.frame(1)85# cmd.get_wizard().apply()86# cmd.get_wizard().do_select("/obj_2//%s/%d" % (prot[1], residues_list[1]))87# cmd.frame(1)88# cmd.get_wizard().apply()89# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[2], aminoacid),'obj_2')90# 91# #for obj_3 (mutation in residue # 1 and 3)92# cmd.get_wizard().do_select("/obj_3//%s/%d" % (prot[1], residues_list[0]))93# cmd.frame(1)94# cmd.get_wizard().apply()95# cmd.get_wizard().do_select("/obj_3//%s/%d" % (prot[1], residues_list[2]))96# cmd.frame(1)97# cmd.get_wizard().apply()98# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[2], aminoacid),'obj_3')99# 100# #for obj_4 (mutation in residue # 2 and 3)101# cmd.get_wizard().do_select("/obj_4//%s/%d" % (prot[1], residues_list[1]))102# cmd.frame(1)103# cmd.get_wizard().apply()104# cmd.get_wizard().do_select("/obj_4//%s/%d" % (prot[1], residues_list[2]))105# cmd.frame(1)106# cmd.get_wizard().apply()107# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[1], residues_list[2], aminoacid),'obj_4')108# 109# #for obj_5 (mutation in residue # 1)110# cmd.get_wizard().do_select("/obj_5//%s/%d" % (prot[1], residues_list[0]))111# cmd.frame(1)112# cmd.get_wizard().apply()113# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], aminoacid),'obj_5')114# #for obj_6 (mutation in residue # 2)115# cmd.get_wizard().do_select("/obj_6//%s/%d" % (prot[1], residues_list[1]))116# cmd.frame(1)117# cmd.get_wizard().apply()118# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[1], aminoacid),'obj_6')119# #for obj_7 (mutation in residue # 3)120# cmd.get_wizard().do_select("/obj_7//%s/%d" % (prot[1], residues_list[2]))121# cmd.frame(1)122# cmd.get_wizard().apply()123# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[2], aminoacid),'obj_7')124#125# # Done126# cmd.set_wizard()127# if len(prot_list) == 1:128# continue129# else:130# cmd.reinitialize() 131# ...
mutation.py
Source:mutation.py
...29# prot_list = [['1shr', 'B']] # example [['1nzp', 'A'], ['4oxn', 'B']] # how many proteins do you want30residues_list = [int(z) for x,y,z in second_shell_residues]31aminoacid = ['ALA','GLY' ] # only two32def mutate_this(prot, res ,num ):33 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))34 cmd.frame(1)35 cmd.get_wizard().apply()36 cmd.save(f"../files/mutant_{res}_{prot[1]}.pdb","obj_%s"%(num))37def mutate_all(prot, res ,num ):38 if res != "ALA":39 cmd.get_wizard().set_mode(aminoacid[0])40 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))41 cmd.frame(1)42 cmd.get_wizard().apply()43 cmd.save("../files/mutant_all_residues.pdb","obj_%s"%(num))44 else:45 cmd.get_wizard().set_mode(aminoacid[1])46 cmd.get_wizard().do_select("/obj_%s//%s/%d" % (num,prot[1], res))47 cmd.frame(1)48 cmd.get_wizard().apply()49 cmd.save("../files/mutant_all_residues.pdb","obj_%s"%(num)) 50for prot in prot_list:51 #Initialize52 # fetch protein by PDB code53 cmd.fetch(prot[0], async_=0)54 # mutagenesis mode55 cmd.wizard("mutagenesis")56 cmd.do("refresh_wizard")57 58 # create 7 object 59 for obj in range(len(second_shell_residues)):60 cmd.create('obj_%s' % obj, prot[0])61 # Mutate62 # cmd.get_wizard().set_mode(aminoacid)63 #for obj_1 (mutation in all residues) 64 for res in residues_list: 65 mutate_all(prot, res, num=1)66 # cmd.get_wizard().do_select("/obj_1//%s/%d" % (prot[1], residues_list[1]))67 # cmd.frame(1)68 # cmd.get_wizard().apply()69 # cmd.get_wizard().do_select("/obj_1//%s/%d" % (prot[1], residues_list[2]))70 # cmd.frame(1)71 # cmd.get_wizard().apply()72 # cmd.save("%s_%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[1], residues_list[2], aminoacid),'obj_1')73 74# #for obj_2 (mutation in residue # 1 and 2)75# cmd.get_wizard().do_select("/obj_2//%s/%d" % (prot[1], residues_list[0]))76# cmd.frame(1)77# cmd.get_wizard().apply()78# cmd.get_wizard().do_select("/obj_2//%s/%d" % (prot[1], residues_list[1]))79# cmd.frame(1)80# cmd.get_wizard().apply()81# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[2], aminoacid),'obj_2')82# 83# #for obj_3 (mutation in residue # 1 and 3)84# cmd.get_wizard().do_select("/obj_3//%s/%d" % (prot[1], residues_list[0]))85# cmd.frame(1)86# cmd.get_wizard().apply()87# cmd.get_wizard().do_select("/obj_3//%s/%d" % (prot[1], residues_list[2]))88# cmd.frame(1)89# cmd.get_wizard().apply()90# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], residues_list[2], aminoacid),'obj_3')91# 92# #for obj_4 (mutation in residue # 2 and 3)93# cmd.get_wizard().do_select("/obj_4//%s/%d" % (prot[1], residues_list[1]))94# cmd.frame(1)95# cmd.get_wizard().apply()96# cmd.get_wizard().do_select("/obj_4//%s/%d" % (prot[1], residues_list[2]))97# cmd.frame(1)98# cmd.get_wizard().apply()99# cmd.save("%s_%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[1], residues_list[2], aminoacid),'obj_4')100# 101# #for obj_5 (mutation in residue # 1)102# cmd.get_wizard().do_select("/obj_5//%s/%d" % (prot[1], residues_list[0]))103# cmd.frame(1)104# cmd.get_wizard().apply()105# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[0], aminoacid),'obj_5')106# #for obj_6 (mutation in residue # 2)107# cmd.get_wizard().do_select("/obj_6//%s/%d" % (prot[1], residues_list[1]))108# cmd.frame(1)109# cmd.get_wizard().apply()110# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[1], aminoacid),'obj_6')111# #for obj_7 (mutation in residue # 3)112# cmd.get_wizard().do_select("/obj_7//%s/%d" % (prot[1], residues_list[2]))113# cmd.frame(1)114# cmd.get_wizard().apply()115# cmd.save("%s_%s_%s_x_%s.pdb" % (prot[0], prot[1], residues_list[2], aminoacid),'obj_7')116#117# # Done118# cmd.set_wizard()119# if len(prot_list) == 1:120# continue121# else:122# cmd.reinitialize() 123# ...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!