11 #include <boost/lexical_cast.hpp>
12 #include <boost/program_options.hpp>
13 namespace po = boost::program_options;
15 int main(
int argc,
char **argv)
18 for (
int i = 0; i < argc; i++) std::cerr << argv[i] <<
" ";
19 std::cerr << std::endl;
21 bool use_offset =
false;
23 po::options_description
24 desc(
"Usage: <experimental_profile> <profile_file1> <profile_file2> ...");
26 (
"help",
"Any number of input profiles is supported. \
27 The chi value is computed relative to the first profile using its error column")
28 (
"input-files", po::value< std::vector<std::string> >(),
29 "input PDB and profile files")
30 (
"offset,o",
"use offset in fitting (default = false)")
32 po::positional_options_description p;
33 p.add(
"input-files", -1);
36 po::command_line_parser(argc,argv).options(desc).positional(p).run(), vm);
39 std::vector<std::string> files, dat_files;
40 if(vm.count(
"input-files")) {
41 files = vm[
"input-files"].as< std::vector<std::string> >();
43 if(vm.count(
"help") || files.size() == 0) {
44 std::cout << desc <<
"\n";
47 if(vm.count(
"offset")) use_offset=
true;
49 std::vector<IMP::saxs::Profile *> exp_profiles;
50 for(
unsigned int i=0; i<files.size(); i++) {
52 std::ifstream in_file(files[i].c_str());
54 std::cerr <<
"Can't open file " << files[i] << std::endl;
59 if(profile->
size() == 0) {
60 std::cerr <<
"can't parse input file " << files[i] << std::endl;
63 dat_files.push_back(files[i]);
64 exp_profiles.push_back(profile);
65 std::cout <<
"Profile read from file " << files[i] <<
" size = "
66 << profile->
size() << std::endl;
71 IMP::Pointer<IMP::saxs::ProfileFitter<IMP::saxs::ChiScore> >saxs_score =
72 new IMP::saxs::ProfileFitter<IMP::saxs::ChiScore>(*exp_saxs_profile);
73 for(
unsigned int i=1; i<exp_profiles.size(); i++) {
74 std::string fit_file =
"fit" +
75 std::string(boost::lexical_cast<std::string>(i)) +
".dat";
76 float chi = saxs_score->compute_score(*exp_profiles[i], use_offset,
"fit");
77 std::cout <<
"File " << files[i] <<
" chi=" << chi << std::endl;