#include #include #include #include #include #ifdef PDB_USE_MAGICK #include #endif #include int main(int argc, char *argv[]){ std::vector inputs; bool print_help=false; bool crms=false, drms=false; bool warn=false; bool all_atoms=false; std::string image_name; { boost::program_options::options_description o("Allowed options"), po, ao; o.add_options() ("crms,c", boost::program_options::bool_switch(&crms), "Output the cRMS between the two pdbs (after alignment).") ("drms,d", boost::program_options::bool_switch(&drms), "Output the dRMS between the two pdbs.") ("all-atoms,a", boost::program_options::bool_switch(&all_atoms), "Output the distances between all atoms, not just the C_alphas.") ("verbose,v", boost::program_options::bool_switch(&warn), "Warn about errors parsing pdb file.") ("image-file,i", boost::program_options::value(&image_name), "Output the max distance difference between pairwise distances.") ("help", boost::program_options::bool_switch(&print_help), "Produce help message"); po.add_options()("input-pdbs", boost::program_options::value< std::vector >(&inputs)->composing(), "The input files. Names with a % in their name are assumed to have printf style converters for ints and will be expanded to the first n integers that correspond to names of actual files."); ao.add(o).add(po); boost::program_options::positional_options_description p; p.add("input-pdbs", -1); boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::command_line_parser(argc, argv). options(ao).positional(p).run(), vm); boost::program_options::notify(vm); if (inputs.empty() || print_help) { std::cout << "This program computes the distances between a collection of pdb files.\n"; std::cout << "usage: " << argv[0] << " file1.pdb file%03d.pdb ...\n\n"; std::cout << o << "\n"; return EXIT_SUCCESS; } } std::vector names; std::vector pdbs; for (unsigned int i=0; i < inputs.size(); ++i){ if (inputs[i].find('%') == std::string::npos){ std::ifstream in(inputs[i].c_str()); if (!in) { std::cerr << "Error opening file " << inputs[i] << std::endl; } else { pdbs.push_back(CGAL_PDB_NS::Protein(in)); names.push_back(inputs[i]); } } else { for (unsigned int j=0; ; ++j){ char buf[5000]; sprintf(buf, inputs[i].c_str(), j); std::ifstream in(buf); if (!in) { break; } else { pdbs.push_back(CGAL_PDB_NS::Protein(in)); names.push_back(buf); } } } } CGAL_TNT_NS::Array2D dists(pdbs.size(), pdbs.size(), 0.0); double max=0; for (unsigned int i=0; i< pdbs.size(); ++i){ for (unsigned int j=0; j