def main(): pdb_name = sys.argv[1] output_file = pdb_name.split('.pdb')[0] + '_MBR.pdb' pdb = MyPDB.parse_PDB(pdb_name) memb_chain = determine_membrane_chain(pdb) highet_atom_number = determine_highest_serial_num(pdb) create_and_add_MBR_residue(pdb, memb_chain, highet_atom_number) MyPDB.write_PDB(output_file, pdb)
def main(): pdb_name = sys.argv[1] output_file = pdb_name.split('.pdb')[0] + '_MBR.pdb' pdb = MyPDB.parse_PDB(pdb_name) memb_chain = determine_membrane_chain(pdb) highet_atom_number = determine_highest_serial_num(pdb) create_and_add_MBR_residue(pdb, memb_chain, highet_atom_number) MyPDB.write_PDB(output_file, pdb) append_CONECT_to_PDB(output_file, highet_atom_number)
def test_symm_axis_interface(e: Entry, ch: str) -> bool: print(e) inter_resi = e.interface[ch] print(e.symm_segs) symm_resi = [a for seg in e.symm_segs for a in range(seg[0], seg[1]+1)] print('symm_resi', symm_resi) print(inter_resi) pdb = mp.parse_PDB(find_pdb(e.pdb), with_non_residue=False) symm_com = mp.com_residues(chain=pdb[e.chain], residues=symm_resi) print(symm_resi, symm_com) pdb.translate_xyz(mp.XYZ(0, 0, 0)-symm_com) print('pdb translated') print('writing pdb %s_%s_translated.pdb' % (e.pdb, e.chain)) mp.write_PDB('%s_%s_translated.pdb' % (e.pdb, e.chain), pdb) print('now symm com is at', mp.com_residues(chain=pdb[e.chain], residues=symm_resi)) print('symm axis XYZ %r' % (e.symm_axis)) print_pymol_select(e)
def test_symm_axis_interface(e: Entry, ch: str) -> bool: print(e) inter_resi = e.interface[ch] print(e.symm_segs) symm_resi = [a for seg in e.symm_segs for a in range(seg[0], seg[1] + 1)] print('symm_resi', symm_resi) print(inter_resi) pdb = mp.parse_PDB(find_pdb(e.pdb), with_non_residue=False) symm_com = mp.com_residues(chain=pdb[e.chain], residues=symm_resi) print(symm_resi, symm_com) pdb.translate_xyz(mp.XYZ(0, 0, 0) - symm_com) print('pdb translated') print('writing pdb %s_%s_translated.pdb' % (e.pdb, e.chain)) mp.write_PDB('%s_%s_translated.pdb' % (e.pdb, e.chain), pdb) print('now symm com is at', mp.com_residues(chain=pdb[e.chain], residues=symm_resi)) print('symm axis XYZ %r' % (e.symm_axis)) print_pymol_select(e)
def create_pdb_AA_AA_d_z(aa1: str, aa2: str, d: float, z: float, res_maker, path: str = './') -> None: """ create a pdb with residues aa1 and aa2 at the XY plane at Z=z and distance d """ res1 = res_maker.get_residue(aa1) res2 = res_maker.get_residue(aa2) res1.change_chain_name('A') res2.change_chain_name('B') # rotate around Z to oppose axis_z = mp.XYZ(0, 0, 1) res2.dot_matrix_me(mpf.rotation_matrix_around_vec(axis_z, np.pi)) # translate to get d distance move_d = mp.XYZ( 0, res1[res_maker.main_residue_atoms[res1.res_type][1]].xyz.y - res2[res_maker.main_residue_atoms[res2.res_type][1]].xyz.y + d, 0) res2.translate_xyz(move_d) # translate all to z move_z = mp.XYZ(0, 0, z) res1.translate_xyz(move_z) res2.translate_xyz(move_z) # setup in a MyPDB instance, and renumber and write pdb = mp.MyPDB() for res in [res1, res2]: for a in res.values(): pdb.add_atom(a) pdb.renumber() mp.write_PDB( '%s/%s_%s_%.2f_%.2f.pdb' % (path, res1.res_type, res2.res_type, d, z), pdb)
def create_pdb_AA_AA_d_z(aa1: str, aa2: str, d: float, z: float, res_maker, path: str = "./") -> None: """ create a pdb with residues aa1 and aa2 at the XY plane at Z=z and distance d """ res1 = res_maker.get_residue(aa1) res2 = res_maker.get_residue(aa2) res1.change_chain_name("A") res2.change_chain_name("B") # rotate around Z to oppose axis_z = mp.XYZ(0, 0, 1) res2.dot_matrix_me(mpf.rotation_matrix_around_vec(axis_z, np.pi)) # translate to get d distance move_d = mp.XYZ( 0, res1[res_maker.main_residue_atoms[res1.res_type][1]].xyz.y - res2[res_maker.main_residue_atoms[res2.res_type][1]].xyz.y + d, 0, ) res2.translate_xyz(move_d) # translate all to z move_z = mp.XYZ(0, 0, z) res1.translate_xyz(move_z) res2.translate_xyz(move_z) # setup in a MyPDB instance, and renumber and write pdb = mp.MyPDB() for res in [res1, res2]: for a in res.values(): pdb.add_atom(a) pdb.renumber() mp.write_PDB("%s/%s_%s_%.2f_%.2f.pdb" % (path, res1.res_type, res2.res_type, d, z), pdb)