#include <boost/program_options.hpp>
namespace po = boost::program_options;
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
#include <string>
#include <iostream>
#include "alg/mussa.hpp"
#include "alg/parse_options.hpp"
-Mussa *initialize_mussa(int argc, char **argv)
+MussaOptions::MussaOptions()
+ : useGUI(true),
+ runAsPythonInterpeter(false)
+{
+}
+
+void initialize_mussa(MussaOptions& opts, int argc, char **argv)
{
po::options_description options("Mussa options");
po::positional_options_description pos_options;
"run an analysis defined by the mussa parameter file")
("view-analysis", po::value<std::string>(),
"load a previously run analysis")
+ ("motifs", po::value<std::string>(),
+ "annotate analysis with motifs from this file")
("no-gui", "terminate without running an analysis")
+ ("python", "launch as a python interpreter")
;
po::variables_map vm;
if (vm.count("help")) {
std::cout << options << std::endl;
- return 0;
+ return;
}
+
+ opts.analysis = Mussa::init();
- Mussa *m = new Mussa();
// currently we can only have one analysis loaded, so
// running trumps viewing.
if (vm.count("run-analysis")) {
- m->load_mupa_file( vm["run-analysis"].as< std::string >() );
+ fs::path analysis_path(vm["run-analysis"].as< std::string >(), fs::native);
+ opts.analysis->load_mupa_file( analysis_path );
std::cout << "I apologize for blocking the gui while running the analysis"
<< std::endl;
- m->analyze();
+ opts.analysis->analyze();
+ if (opts.analysis->is_dirty())
+ opts.analysis->save();
}
else if (vm.count("view-analysis")) {
- m->load( vm["view-analysis"].as< std::string >() );
+ fs::path analysis_path(vm["view-analysis"].as< std::string >(), fs::native);
+ opts.analysis->load( analysis_path );
+ }
+ if (vm.count("motifs") and opts.analysis) {
+ fs::path motif_path(vm["motifs"].as< std::string >(), fs::native);
+ opts.analysis->load_motifs( motif_path );
}
if (vm.count("no-gui")) {
- return 0;
- } else {
- return m;
+ opts.useGUI=false;
+ }
+ if (vm.count("python")) {
+ opts.runAsPythonInterpeter = true;
}
}
-