/*************************************************************************** protein.cpp - description ------------------- begin : Mon Jan 27 06:38:48 2003 copyright : (C) 2002 by Cavalli Andrea email : cavalli@bioc.unizh.ch **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #include #include #include #include #include #include Almost::Protein Almost::Protein::mutate(int aa, string frgm, MDB & mdb, string fpatch, string lpatch, bool keep_bb) const { vector sequ = sequence(Protein::LONG); --aa; if((aa=fragment_.size()+fragment_offset())){ throw "Almost::Protein::mutate invalid amino-acid number\n"; } // aout<<"DEBUG "<::const_iterator // wt_iter = frgment_atoms(fd_wt).begin(), // wt_end = frgment_atoms(fd_wt).end(), // mut_iter = p.frgment_atoms(fd_wt).begin(), // mut__end = p.frgment_atoms(fd_wt).end(); if(i!=aa-fragment_offset()){ for(int k=0;k s1,s2; s1 = fragment_atoms(aa); s2 = p.fragment_atoms(aa); int N1=-1,N2=-1,CA1=-1,CA2=-1,C1=-1,C2=-1,O1=-1,O2=-1; for(int q=0;q datom = disu.del_atoms(); for(int i=0;i atom = disu.atoms(); for(int i=0;i imph = disu.dihedrals(); for(int i=0;i iv(4); for(int j=0;j<4;j++){ a[j] = imph[i].atom(j); idx[j] = atoi(a[j].c_str()); if(idx[j]<=0) throw "Wrong disulfide-patch"; else if(idx[j]==1){ a[j] = frag1+"/"+string(a[j].begin()+1,a[j].end()); } else if(idx[j]==2){ a[j] = frag2+"/"+string(a[j].begin()+1,a[j].end()); } na[j] = find_atom(a[j]); if(na[j]==-1){ throw "Unable to find atom: " +a[j]; } iv[j] = na[j]; } if(!dihedral_.add_dihedral(iv)) aout<<"Warning can't add dihedral"< imph = disu.impropers(); for(int i=0;i iv(4); for(int j=0;j<4;j++){ a[j] = imph[i].atom(j); idx[j] = atoi(a[j].c_str()); if(idx[j]<=0) throw "Wrong disulfide-patch"; else if(idx[j]==1){ a[j] = frag1+"/"+string(a[j].begin()+1,a[j].end()); } else if(idx[j]==2){ a[j] = frag2+"/"+string(a[j].begin()+1,a[j].end()); } na[j] = find_atom(a[j]); if(na[j]==-1){ throw "Unable to find atom: " +a[j]; } iv[j] = na[j]; } if(!improper_.add_improper(iv)) aout<<"Warning can't add improper"< bond = disu.bonds(); for(int i=0;i cysd; for(int i=0;i bond_rotation(*this); vector > atoms; vector coor; for(int i=0;i(atom_[i].coor())); for(int i=0;i(i,name)); } for(int i=0;i atoms = fragment_atoms_[i]; // int N = -1; // int CA= -1; // int CB= -1; // int SC= -1; //"first" atom in side chain; // for(int j=0;j out_bonds = this->bonds(CB,Molecules::OUT); // int j=0; // while(j Almost::Protein::phi() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i t; //first is undef == 999 t.push_back(999); for(int i=1;i > Almost::Protein::phi_atoms() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i > t; t.resize(fragment_size()); //first is undef == 999 for(int i=1;i v; for(int q=0;q<4;q++) v.push_back(c[q]); t[i] = v; } return t; } vector Almost::Protein::psi() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i t; for(int i=0;i > Almost::Protein::psi_atoms() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i > t; t.resize(fragment_size()); for(int i=0;i v; for(int q=0;q<4;q++) v.push_back(c[q]); t[i] = v; } return t; } vector Almost::Protein::omega() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i t; for(int i=0;i > Almost::Protein::omega_atoms() const { vector N; vector C; vector CA; int b = atom_offset(); int e = atom_size()+atom_offset(); for(int i = b; i > t; t.resize(fragment_size()); for(int i=0;i v; for(int q=0;q<4;q++) v.push_back(c[q]); t[i] = v; } return t; } inline bool check_index(int a, int b, int c, int d){ if(a==-1) return false; if(b==-1) return false; if(c==-1) return false; if(d==-1) return false; return true; } #define CHI(a,b,c,d,res) { \ if(check_index(a,b,c,d)){ \ double chi = Kernel::Geometry::dihedral(p[a].coor(), \ p[b].coor(), \ p[c].coor(), \ p[d].coor()); \ rot.push_back(chi); \ } \ else{ cout<<">> Missing atom "< rotamer_ARG(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD_ = -1, NE_ = -1, CZ_ = -1, NH1_ = -1, NH2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"ARG"); CHI(CA_,CB_,CG_,CD_,"ARG"); CHI(CB_,CG_,CD_,NE_,"ARG"); CHI(CG_,CD_,NE_,CZ_,"ARG"); CHI(CD_,NE_,CZ_,NH1_,"ARG"); CHI(CD_,NE_,CZ_,NH2_,"ARG"); return rot; } vector rotamer_ASN(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, OD1_ = -1, ND2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"ASN"); CHI(CA_,CB_,CG_,OD1_,"ASN"); CHI(CA_,CB_,CG_,ND2_,"ASN"); return rot; } vector rotamer_ASP(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, OD1_ = -1, OD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"ASP"); CHI(CA_,CB_,CG_,OD1_,"ASP"); CHI(CA_,CB_,CG_,OD2_,"ASP"); return rot; } vector rotamer_CYS(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, SG_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,SG_,"CYS"); return rot; } vector rotamer_GLN(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD_ = -1, OE1_ = -1, NE2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"GLN"); CHI(CA_,CB_,CG_,CD_,"GLN"); CHI(CB_,CG_,CD_,OE1_,"GLN"); CHI(CB_,CG_,CD_,NE2_,"GLN"); return rot; } vector rotamer_GLU(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD_ = -1, OE1_ = -1, OE2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"GLU"); CHI(CA_,CB_,CG_,CD_,"GLU"); CHI(CB_,CG_,CD_,OE1_,"GLU"); CHI(CB_,CG_,CD_,OE2_,"GLU"); return rot; } vector rotamer_HIS(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, ND1_ = -1, CD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"HIS"); CHI(CA_,CB_,CG_,ND1_,"HIS"); CHI(CA_,CB_,CG_,CD2_,"HIS"); return rot; } vector rotamer_ILE(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG1_ = -1, CG2_ = -1, CD1_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG1_,"ILE"); CHI(N_,CA_,CB_,CG2_,"ILE"); CHI(CA_,CB_,CG1_,CD1_,"ILE"); return rot; } vector rotamer_LEU(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD1_ = -1, CD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"LEU"); CHI(CA_,CA_,CB_,CD1_,"LEU"); CHI(CA_,CB_,CB_,CD2_,"LEU"); return rot; } vector rotamer_LYS(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD_ = -1, CE_ = -1, NZ_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"LYS"); CHI(CA_,CB_,CG_,CD_,"LYS"); CHI(CB_,CG_,CD_,CE_,"LYS"); CHI(CG_,CD_,CE_,NZ_,"LYS"); return rot; } vector rotamer_MET(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, SD_ = -1, CE_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"MET"); CHI(CA_,CB_,CG_,SD_,"MET"); CHI(CB_,CG_,SD_,CE_,"MET"); return rot; } vector rotamer_PHE(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD1_ = -1, CD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"PHE"); CHI(CA_,CA_,CB_,CD1_,"PHE"); CHI(CA_,CB_,CB_,CD2_,"PHE"); return rot; } //PRO??? vector rotamer_SER(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, OG_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,OG_,"SER"); return rot; } vector rotamer_THR(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, OG1_ = -1, CG2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,OG1_,"THR"); CHI(N_,CA_,CB_,CG2_,"THR"); return rot; } vector rotamer_TRP(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD1_ = -1, CD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"TRP"); CHI(CA_,CA_,CB_,CD1_,"TRP"); CHI(CA_,CB_,CB_,CD2_,"TRP"); return rot; } vector rotamer_TYR(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG_ = -1, CD1_ = -1, CD2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG_,"TYR"); CHI(CA_,CA_,CB_,CD1_,"TYR"); CHI(CA_,CB_,CB_,CD2_,"TYR"); return rot; } vector rotamer_VAL(const Almost::Protein & p, const vector & atom, bool verbose){ int N_ = -1, CA_ = -1, CB_ = -1, CG1_ = -1, CG2_ = -1; for(int i=0;i rot; //CHI1 CHI(N_,CA_,CB_,CG1_,"VAL"); CHI(N_,CA_,CB_,CG2_,"VAL"); return rot; } vector Almost::Protein::rotamer(int aa, bool verbose) const{ /* chi1 chi2 chi3 chi4 ARG N-CA-CB-CG CA-CB-CG-CD CB-CG-CD-NE CG-CD-NE-CZ ASN N-CA-CB-CG CA-CB-CG-ND2(?)(OD1?) ASP N-CA-CB-CG CA-CB-CG-OD1 CYS N-CA-CB-SG GLN N-CA-CB-CG CA-CB-CG-CD CB-CG-CD-NE2/OE1 GLU N-CA-CB-CG CA-CB-CG-CD CB-CG-CD-OE1 HIS N-CA-CB-CG CA-CB-CG-ND1/CD2(?) ILE N-CA-CB-CG(*) ??? LEU N-CA-CB-CG CA-CB-CG-CD1/CD2 LYS N-CA-CB-CG CA-CB-CG-CD CB-CG-CD-CE CG-CD-CE-NZ MET N-CA-CB-CG CA-CB-CG-SD CB-CG-SD-CE PHE N-CA-CB-CG CA-CB-CG-CD1/2 PRO ?? SER N-CA-CB-OG THR N-CA-CB-OG1(*) TRP N-CA-CB-CG CA-CB-CG-CD1/2 TYR N-CA-CB-CG CA-CB-CG-CD1/CD2(?) VAL N-CA-CB-CG */ string fname = fragment_name(aa,Protein::SHORT); vector fatom = fragment_atoms(aa); // { // for(int i=0;i(); }