structure = PDBParser(QUIET=False).get_structure( "dimer", path_structure + "dimer.pdb") new_model = Model(2) new_chain = Chain("C") new_model.add(new_chain) new_chain_mark = Chain("M") add_markers(new_chain_mark) new_model.add(new_chain_mark) structure.add(new_model) # mutations = {} [sorted IDs] : [cobalt], [residues], num_HIS, clash_info_list, num, type, coords res_co = Residue((" ", runtime_mark_id, " "), "Co3", " ") res_co.add(hit[0]) new_chain.add(res_co) # Add cobalt in its own residue for res in hit[1]: # Add rotamers if res not in new_chain: new_chain.add(res) if hit[2] > 0: directory = path_output + "/HIS/" + str( hit[2]) + "/" + mut_name_full + "/" if not os.path.exists(directory): os.makedirs(directory) count = len(glob.glob1(directory, "*.pdb")) io = PDBIO()
def initialize_res(residue): '''Creates a new structure containing a single amino acid. The type and geometry of the amino acid are determined by the argument, which has to be either a geometry object or a single-letter amino acid code. The amino acid will be placed into chain A of model 0.''' if isinstance(residue, Geo): geo = residue else: geo = geometry(residue) segID = 1 AA = geo.residue_name CA_N_length = geo.CA_N_length CA_C_length = geo.CA_C_length N_CA_C_angle = geo.N_CA_C_angle CA_coord = [0., 0., 0.] C_coord = [CA_C_length, 0, 0] N_coord = [ CA_N_length * math.cos(N_CA_C_angle * (math.pi / 180.0)), CA_N_length * math.sin(N_CA_C_angle * (math.pi / 180.0)), 0 ] N = Atom("N", N_coord, 0.0, 1.0, " ", " N", 0, "N") CA = Atom("CA", CA_coord, 0.0, 1.0, " ", " CA", 0, "C") C = Atom("C", C_coord, 0.0, 1.0, " ", " C", 0, "C") ##Create Carbonyl atom (to be moved later) C_O_length = geo.C_O_length CA_C_O_angle = geo.CA_C_O_angle N_CA_C_O_diangle = geo.N_CA_C_O_diangle carbonyl = calculateCoordinates(N, CA, C, C_O_length, CA_C_O_angle, N_CA_C_O_diangle) O = Atom("O", carbonyl, 0.0, 1.0, " ", " O", 0, "O") if (AA == 'G'): res = makeGly(segID, N, CA, C, O, geo) elif (AA == 'A'): res = makeAla(segID, N, CA, C, O, geo) elif (AA == 'S'): res = makeSer(segID, N, CA, C, O, geo) elif (AA == 'C'): res = makeCys(segID, N, CA, C, O, geo) elif (AA == 'V'): res = makeVal(segID, N, CA, C, O, geo) elif (AA == 'I'): res = makeIle(segID, N, CA, C, O, geo) elif (AA == 'L'): res = makeLeu(segID, N, CA, C, O, geo) elif (AA == 'T'): res = makeThr(segID, N, CA, C, O, geo) elif (AA == 'R'): res = makeArg(segID, N, CA, C, O, geo) elif (AA == 'K'): res = makeLys(segID, N, CA, C, O, geo) elif (AA == 'D'): res = makeAsp(segID, N, CA, C, O, geo) elif (AA == 'E'): res = makeGlu(segID, N, CA, C, O, geo) elif (AA == 'N'): res = makeAsn(segID, N, CA, C, O, geo) elif (AA == 'Q'): res = makeGln(segID, N, CA, C, O, geo) elif (AA == 'M'): res = makeMet(segID, N, CA, C, O, geo) elif (AA == 'H'): res = makeHis(segID, N, CA, C, O, geo) elif (AA == 'P'): res = makePro(segID, N, CA, C, O, geo) elif (AA == 'F'): res = makePhe(segID, N, CA, C, O, geo) elif (AA == 'Y'): res = makeTyr(segID, N, CA, C, O, geo) elif (AA == 'W'): res = makeTrp(segID, N, CA, C, O, geo) else: res = makeGly(segID, N, CA, C, O, geo) cha = Chain('A') cha.add(res) mod = Model(0) mod.add(cha) struc = Structure('X') struc.add(mod) return struc
def initialize_res(residue): '''Creates a new structure containing a single amino acid. The type and geometry of the amino acid are determined by the argument, which has to be either a geometry object or a single-letter amino acid code. The amino acid will be placed into chain A of model 0.''' if isinstance( residue, Geo ): geo = residue else: geo=geometry(residue) segID=1 AA= geo.residue_name CA_N_length=geo.CA_N_length CA_C_length=geo.CA_C_length N_CA_C_angle=geo.N_CA_C_angle CA_coord= [0.,0.,0.] C_coord= [CA_C_length,0,0] N_coord = [CA_N_length*math.cos(N_CA_C_angle*(math.pi/180.0)),CA_N_length*math.sin(N_CA_C_angle*(math.pi/180.0)),0] N= Atom("N", N_coord, 0.0 , 1.0, " "," N", 0, "N") CA=Atom("CA", CA_coord, 0.0 , 1.0, " "," CA", 0,"C") C= Atom("C", C_coord, 0.0, 1.0, " ", " C",0,"C") ##Create Carbonyl atom (to be moved later) C_O_length=geo.C_O_length CA_C_O_angle=geo.CA_C_O_angle N_CA_C_O_diangle=geo.N_CA_C_O_diangle carbonyl=calculateCoordinates(N, CA, C, C_O_length, CA_C_O_angle, N_CA_C_O_diangle) O= Atom("O",carbonyl , 0.0 , 1.0, " "," O", 0, "O") if(AA=='G'): res=makeGly(segID, N, CA, C, O, geo) elif(AA=='A'): res=makeAla(segID, N, CA, C, O, geo) elif(AA=='S'): res=makeSer(segID, N, CA, C, O, geo) elif(AA=='C'): res=makeCys(segID, N, CA, C, O, geo) elif(AA=='V'): res=makeVal(segID, N, CA, C, O, geo) elif(AA=='I'): res=makeIle(segID, N, CA, C, O, geo) elif(AA=='L'): res=makeLeu(segID, N, CA, C, O, geo) elif(AA=='T'): res=makeThr(segID, N, CA, C, O, geo) elif(AA=='R'): res=makeArg(segID, N, CA, C, O, geo) elif(AA=='K'): res=makeLys(segID, N, CA, C, O, geo) elif(AA=='D'): res=makeAsp(segID, N, CA, C, O, geo) elif(AA=='E'): res=makeGlu(segID, N, CA, C, O, geo) elif(AA=='N'): res=makeAsn(segID, N, CA, C, O, geo) elif(AA=='Q'): res=makeGln(segID, N, CA, C, O, geo) elif(AA=='M'): res=makeMet(segID, N, CA, C, O, geo) elif(AA=='H'): res=makeHis(segID, N, CA, C, O, geo) elif(AA=='P'): res=makePro(segID, N, CA, C, O, geo) elif(AA=='F'): res=makePhe(segID, N, CA, C, O, geo) elif(AA=='Y'): res=makeTyr(segID, N, CA, C, O, geo) elif(AA=='W'): res=makeTrp(segID, N, CA, C, O, geo) else: res=makeGly(segID, N, CA, C, O, geo) cha= Chain('A') cha.add(res) mod= Model(0) mod.add(cha) struc= Structure('X') struc.add(mod) return struc