/*************************************************************************** pdbstat_mod.cpp - description ------------------- begin : Wed Sep 28 18:42:55 2005 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 using namespace Almost; #define ALMTOSTRING(s) \ template<> \ inline string to_string(const s & ){ \ return "<" #s ">"; \ } ALMTOSTRING(Molecules); void count_neighbors_cog(const Molecules & molecules, int sk, string file){ vector > fa; fa.resize(molecules.fragment_size()); for(int i=0;i X,Y,Z; for(int i=0;i count0;//less 7A vector count1;// 7-10 vector count2;//10-12 vector count3;//12+ count0.resize(X.size()); count1.resize(X.size()); count2.resize(X.size()); count3.resize(X.size()); for(int i=0;i=7)){ ++count1[i]; ++count1[j]; continue; } if((d<12)&&(d>=10)){ ++count2[i]; ++count2[j]; continue; } if((d>=12)){ ++count3[i]; ++count3[j]; continue; } } } ofstream out; out.open(file.c_str()); for(int i=0;i > fa; fa.resize(molecules.fragment_size()); for(int i=0;i X,Y,Z; for(int i=0;i count0;//less 7A vector count1;// 7-10 vector count2;//10-12 vector count3;//12+ count0.resize(X.size()); count1.resize(X.size()); count2.resize(X.size()); count3.resize(X.size()); for(int i=0;i=7)){ ++count1[i]; ++count1[j]; continue; } if((d<12)&&(d>=10)){ ++count2[i]; ++count2[j]; continue; } if((d>=12)){ ++count3[i]; ++count3[j]; continue; } } } ofstream out; out.open(file.c_str()); for(int i=0;i A; vector count0;//less 7A vector count1;// 7-10 vector count2;//10-12 vector count3;//12+ int size = molecules.atom_size(); for(int i=0;i=7)){ ++count1[i]; ++count1[j]; continue; } if((d<12)&&(d>=10)){ ++count2[i]; ++count2[j]; continue; } if((d>=12)){ ++count3[i]; ++count3[j]; continue; } } } ofstream out; out.open(file.c_str()); for(int i=0;i > Beta; vector > Helix; vector N,CA,C,O; const Molecules * molecules_; public: SecStructGeometry(const Molecules & molecules, string ss_file){ molecules_ = & molecules; //Read ss_file ifstream in; in.open(ss_file.c_str()); if(!in){ cerr<<"No such file: "<>ss; in.close(); cout<=0){ if(i-beta>1) Beta.push_back(pair(beta,i)); } beta = -1; } } for(int i=0;i=0){ if(i-helix>3) Helix.push_back(pair(helix,i)); } helix = -1; } } for(int i=0;i>ss; // in.close(); // cout< > Beta; // vector > Helix; // int beta = -1; // for(int i=0;i=0){ // if(i-beta>1) // Beta.push_back(pair(beta,i)); // } // beta = -1; // } // } // for(int i=0;i=0){ // if(helix-i>3) // Helix.push_back(pair(helix,i)); // } // helix = -1; // } // } // for(int i=0;i N,C,O; // for(int i=0;i Theta "< Phi "< Dotp "<<0.5*(abs(dp1)+abs(dp2)+abs(dp3)+abs(dp4))<<" " // <"; } extern "C" { void init_pdbstat(){ //declarations here Module mod = Module("pdbstat","Compute statistics on sets of PDBs"); mod .def_function("count_neighbors","Count neighbors of specified type",count_neighbors) .def_function("count_neighbors_cog","Count neighbors of specified type",count_neighbors_cog) .def_function("count_neighbors_pair","Count neighbors of specified type",count_neighbors_pair) ; Class >(mod.self(),"ss_geomerty") .def_method("SS_stat",&SecStructGeometry::SS_stat) .def_method("HH_stat",&SecStructGeometry::HH_stat) .def_method("HS_stat",&SecStructGeometry::HS_stat) ; } }