14 #include <boost/program_options.hpp>
15 namespace po = boost::program_options;
17 int main(
int argc,
char **argv)
20 for (
int i = 0; i < argc; i++) std::cerr << argv[i] <<
" ";
21 std::cerr << std::endl;
24 po::options_description desc(
"Usage: <pdb_file1> <pdb_file2> \
25 ... <profile_file1> <profile_file2> ...");
27 (
"help",
"Any number of input PDBs and profiles is supported. \
28 Each PDB will be fitted against each profile.")
29 (
"input-files", po::value< std::vector<std::string> >(),
30 "input PDB and profile files")
31 (
"end_q_rg,q*rg", po::value<float>(&end_q_rg)->default_value(1.3),
32 "end q*rg value for rg computation, q*rg<end_q_rg (default = 1.3), \
33 use 0.8 for elongated proteins")
35 po::positional_options_description p;
36 p.add(
"input-files", -1);
39 po::command_line_parser(argc,argv).options(desc).positional(p).run(), vm);
42 std::vector<std::string> files, pdb_files, dat_files;
43 if (vm.count(
"input-files")) {
44 files = vm[
"input-files"].as< std::vector<std::string> >();
46 if(vm.count(
"help") || files.size() == 0) {
47 std::cout << desc <<
"\n";
53 std::vector<IMP::Particles> particles_vec;
54 std::vector<IMP::saxs::Profile *> exp_profiles;
55 for(
unsigned int i=0; i<files.size(); i++) {
57 std::ifstream in_file(files[i].c_str());
59 std::cerr <<
"Can't open file " << files[i] << std::endl;
69 IMP::Particles particles
70 = IMP::get_as<IMP::Particles>(
get_by_type(mhd, IMP::atom::ATOM_TYPE));
71 if(particles.size() > 0) {
72 pdb_files.push_back(files[i]);
73 particles_vec.push_back(particles);
74 std::cout << particles.size() <<
" atoms were read from PDB file "
75 << files[i] << std::endl;
77 }
catch(IMP::ValueException e) {
80 if(profile->
size() == 0) {
81 std::cerr <<
"can't parse input file " << files[i] << std::endl;
84 dat_files.push_back(files[i]);
85 exp_profiles.push_back(profile);
86 std::cout <<
"Profile read from file " << files[i] <<
" size = "
87 << profile->
size() << std::endl;
93 for(
unsigned int i=0; i<dat_files.size(); i++) {
95 double rg = exp_saxs_profile->radius_of_gyration(end_q_rg);
96 std::cout << dat_files[i] <<
" Rg= " << rg << std::endl;
100 for(
unsigned int i=0; i<pdb_files.size(); i++) {
102 std::cout << pdb_files[i] <<
" Rg= " << rg << std::endl;