# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = gui alg qui .
+INPUT = alg qui .
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
CURDIR := $(BASEDIR)
-SOURCES.cxx := mussa.cxx \
+SOURCES.cpp := mussa_fltk.cpp \
#seqcomp.cxx \ #(old seqcomp)
#mussa_nway_refine.cxx \ (broken code)
-MUSSASRC := $(addprefix $(CURDIR), $(SOURCES.cxx))
+MUSSASRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
SRC += $(MUSSASRC)
CXXFLAGS += -I$(CURDIR)
MUSSA := $(CURDIR)/mussa$(BINEXT)
TARGETBINS += $(MUSSA)
-$(MUSSA): $(MUSSASRC:.cxx=$(OBJEXT)) $(MUSSA_FLTK_OBJ) $(MUSSA_ALG_OBJ)
+$(MUSSA): $(MUSSASRC:.cpp=$(OBJEXT)) $(MUSSA_FLTK_OBJ) $(MUSSA_ALG_OBJ)
g++ $(CXXFLAGS) -lfltk -o $@ $^
+++ /dev/null
-// This file is part of the Mussa source distribution.
-// http://mussa.caltech.edu/
-// Contact author: Tristan De Buysscher, tristan@caltech.edu
-
-// This program and all associated source code files are Copyright (C) 2005
-// the California Institute of Technology, Pasadena, CA, 91125 USA. It is
-// under the GNU Public License; please see the included LICENSE.txt
-// file for more information, or contact Tristan directly.
-
-
-#include "gui/ConnWindow.hpp"
-#include "alg/mussa.hpp"
-#include "mussa_exceptions.hpp"
-#include <iostream>
-using namespace std;
-
-char
-parse_args(int argc, char **argv, string *a_file_path, int *window,
- int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres);
-
-
-int main(int argc, char **argv)
-{
- Mussa an_analysis;
- string a_file_path;
- char * picked_file;
- int window, threshold;
- float ent_thres;
- char run_mode;
- enum Mussa::analysis_modes ana_mode;
- int x_max=1000;
- int y_max=500;
- string err_msg;
-
-
- err_msg = "";
-
- // yeah, its horrible to be passing these by reference, but I just don't see
- // any other way without making parse_args part of MussaClass, which just
- // seems wrong (args are after all, an io type thing, and the gui only mode
- // will have it own way as well...
- run_mode = parse_args(argc, argv, &a_file_path, &window, &threshold,
- &ana_mode, &ent_thres);
-
- cout << "mussa: run mode = " << run_mode;
- cout << "\tfile_path = "<< a_file_path << endl;
- cout << "mussa: ent_thres = " << ent_thres << endl;
-
- // if no error from parse args (run_mode = 'e', ie error), run in proper mode
- if (run_mode != 'e')
- {
- if ((run_mode == 'f') || (run_mode == 'n'))
- {
- an_analysis.load_mupa_file(a_file_path);
- an_analysis.analyze(window, threshold, ana_mode, ent_thres);
- //an_overlord.do_analysis();
- }
-
- if (run_mode == 'v')
- an_analysis.load(a_file_path);
- //an_overlord.get_analysis();
-
- // no longer needed, but still semi-useful reality check...
- if (run_mode == 'g')
- {
- cout << "GTV - All Gui, All the Time\n";
- }
-
- if (err_msg == "")
- {
- if ((run_mode == 'f') || (run_mode == 'v') || (run_mode == 'g'))
- {
- //an_overlord.spawnConnView(1000,500);
- ConnWindow *a_conn_win = new ConnWindow(x_max, y_max, "Mussa");
-
- // we have an analysis already if in these 2 modes
- if ((run_mode == 'f') || (run_mode == 'v'))
- a_conn_win->add_ana(&an_analysis);
-
- Fl::run();
- }
- }
- else
- cout << err_msg << endl;
- }
-}
-
-
-// minimal arg reading function, not very robust to errors
-char
-parse_args(int argc, char **argv, string *a_file_path, int *window,
- int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres)
-{
- int i, else_i;
- string an_arg;
- char run_mode;
-
- // initialize these to 0 as flag if they are not changed
- *window = 0;
- *threshold = 0;
- *ent_thres = 0.0;
- run_mode = 'e'; //error default if no run mode set implicitly or explicitly
- *ana_mode = Mussa::TransitiveNway; // default to transitivie analyses mode
-
- // no args means gui only mode
- if (argc == 1)
- run_mode = 'g';
- else
- {
- else_i = 0;
- i = 1;
- while (i < argc)
- {
- an_arg = * ++argv;
- i++;
-
- // see what alternate mode the user wants to run in
- if (an_arg == "-m")
- {
- an_arg = * ++argv;
- i++;
- if ( (an_arg == "v") || (an_arg == "n") ) //only 2 valid modes so far
- run_mode = an_arg[0];
- else
- {
- cout << "Error: \'" << an_arg;
- cout << "\' is not a valid analysis mode for -a argument" << endl;
- throw cmdline_error("not valid -a argument");
- }
- *a_file_path = * ++argv;
- i++;
- }
- // alternate analyses modes
- else if (an_arg == "-a")
- {
- an_arg = * ++argv;
- i++;
- // t = transitive, r = radial, e = entropy
- if (an_arg == "t") *ana_mode = Mussa::TransitiveNway;
- else if (an_arg == "r") *ana_mode = Mussa::RadialNway;
- else if (an_arg == "e") *ana_mode = Mussa::EntropyNway;
- else
- {
- cout << "Error: \'" << an_arg;
- cout << "\' is not a valid run mode for -m argument" << endl;
- throw cmdline_error("bad argument -m");
- }
- }
- else if (an_arg == "-w") // alternate window size arg
- {
- *window = atoi(* ++argv);
- i++;
- }
- else if (an_arg == "-t") // alternate threshold arg
- {
- *threshold = atoi(* ++argv);
- i++;
- }
- else if (an_arg == "-et") // alternate entropy threshold arg
- {
- *ent_thres = atof(* ++argv);
- i++;
- }
- else
- {
- if (else_i == 0)
- {
- *a_file_path = an_arg;
- run_mode = 'f';
- else_i++;
- }
- else
- {
- //cout << "Error, unknown arg: \'" << an_arg << "\'" << endl;
- cout << "Error, too many filenames: \'" << an_arg << "\'" << endl;
- run_mode == 'e';
- }
- }
- }
- }
- return run_mode;
-}
-
-
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
#define _MUSSA_EXCEPTIONS_H_
#include <stdexcept>
+//! base mussa exception
+class mussa_error : public std::runtime_error
+{
+public:
+ explicit mussa_error(const std::string& msg): std::runtime_error(msg) {};
+};
+
//! Error processing commandline arguments
-class cmdline_error : public std::runtime_error
+class cmdline_error : public mussa_error
{
public:
- explicit cmdline_error(const std::string& msg): std::runtime_error(msg) {};
+ explicit cmdline_error(const std::string& msg): mussa_error(msg) {};
};
//! Error loading information
-class mussa_load_error : public std::runtime_error
+class mussa_load_error : public mussa_error
{
public:
explicit mussa_load_error(const std::string& msg) :
- std::runtime_error(msg) {};
+ mussa_error(msg) {};
};
//! failure running analysis
-class mussa_analysis_error : public std::runtime_error
+class mussa_analysis_error : public mussa_error
{
public:
explicit mussa_analysis_error(const std::string& msg) :
- std::runtime_error(msg) {};
+ mussa_error(msg) {};
};
-class motif_normalize_error : public std::runtime_error
+class motif_normalize_error : public mussa_error
{
public:
explicit motif_normalize_error(const std::string& msg) :
- std::runtime_error(msg) {};
+ mussa_error(msg) {};
};
#endif
--- /dev/null
+// This file is part of the Mussa source distribution.
+// http://mussa.caltech.edu/
+// Contact author: Tristan De Buysscher, tristan@caltech.edu
+
+// This program and all associated source code files are Copyright (C) 2005
+// the California Institute of Technology, Pasadena, CA, 91125 USA. It is
+// under the GNU Public License; please see the included LICENSE.txt
+// file for more information, or contact Tristan directly.
+
+
+#include "gui/ConnWindow.hpp"
+#include "alg/mussa.hpp"
+#include "mussa_exceptions.hpp"
+#include <iostream>
+using namespace std;
+
+char
+parse_args(int argc, char **argv, string *a_file_path, int *window,
+ int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres);
+
+
+int main(int argc, char **argv)
+{
+ Mussa an_analysis;
+ string a_file_path;
+ char * picked_file;
+ int window, threshold;
+ float ent_thres;
+ char run_mode;
+ enum Mussa::analysis_modes ana_mode;
+ int x_max=1000;
+ int y_max=500;
+ string err_msg;
+
+
+ err_msg = "";
+
+ // yeah, its horrible to be passing these by reference, but I just don't see
+ // any other way without making parse_args part of MussaClass, which just
+ // seems wrong (args are after all, an io type thing, and the gui only mode
+ // will have it own way as well...
+ run_mode = parse_args(argc, argv, &a_file_path, &window, &threshold,
+ &ana_mode, &ent_thres);
+
+ cout << "mussa: run mode = " << run_mode;
+ cout << "\tfile_path = "<< a_file_path << endl;
+ cout << "mussa: ent_thres = " << ent_thres << endl;
+
+ // if no error from parse args (run_mode = 'e', ie error), run in proper mode
+ if (run_mode != 'e')
+ {
+ if ((run_mode == 'f') || (run_mode == 'n'))
+ {
+ an_analysis.load_mupa_file(a_file_path);
+ an_analysis.analyze(window, threshold, ana_mode, ent_thres);
+ //an_overlord.do_analysis();
+ }
+
+ if (run_mode == 'v')
+ an_analysis.load(a_file_path);
+ //an_overlord.get_analysis();
+
+ // no longer needed, but still semi-useful reality check...
+ if (run_mode == 'g')
+ {
+ cout << "GTV - All Gui, All the Time\n";
+ }
+
+ if (err_msg == "")
+ {
+ if ((run_mode == 'f') || (run_mode == 'v') || (run_mode == 'g'))
+ {
+ //an_overlord.spawnConnView(1000,500);
+ ConnWindow *a_conn_win = new ConnWindow(x_max, y_max, "Mussa");
+
+ // we have an analysis already if in these 2 modes
+ if ((run_mode == 'f') || (run_mode == 'v'))
+ a_conn_win->add_ana(&an_analysis);
+
+ Fl::run();
+ }
+ }
+ else
+ cout << err_msg << endl;
+ }
+}
+
+
+// minimal arg reading function, not very robust to errors
+char
+parse_args(int argc, char **argv, string *a_file_path, int *window,
+ int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres)
+{
+ int i, else_i;
+ string an_arg;
+ char run_mode;
+
+ // initialize these to 0 as flag if they are not changed
+ *window = 0;
+ *threshold = 0;
+ *ent_thres = 0.0;
+ run_mode = 'e'; //error default if no run mode set implicitly or explicitly
+ *ana_mode = Mussa::TransitiveNway; // default to transitivie analyses mode
+
+ // no args means gui only mode
+ if (argc == 1)
+ run_mode = 'g';
+ else
+ {
+ else_i = 0;
+ i = 1;
+ while (i < argc)
+ {
+ an_arg = * ++argv;
+ i++;
+
+ // see what alternate mode the user wants to run in
+ if (an_arg == "-m")
+ {
+ an_arg = * ++argv;
+ i++;
+ if ( (an_arg == "v") || (an_arg == "n") ) //only 2 valid modes so far
+ run_mode = an_arg[0];
+ else
+ {
+ cout << "Error: \'" << an_arg;
+ cout << "\' is not a valid analysis mode for -a argument" << endl;
+ throw cmdline_error("not valid -a argument");
+ }
+ *a_file_path = * ++argv;
+ i++;
+ }
+ // alternate analyses modes
+ else if (an_arg == "-a")
+ {
+ an_arg = * ++argv;
+ i++;
+ // t = transitive, r = radial, e = entropy
+ if (an_arg == "t") *ana_mode = Mussa::TransitiveNway;
+ else if (an_arg == "r") *ana_mode = Mussa::RadialNway;
+ else if (an_arg == "e") *ana_mode = Mussa::EntropyNway;
+ else
+ {
+ cout << "Error: \'" << an_arg;
+ cout << "\' is not a valid run mode for -m argument" << endl;
+ throw cmdline_error("bad argument -m");
+ }
+ }
+ else if (an_arg == "-w") // alternate window size arg
+ {
+ *window = atoi(* ++argv);
+ i++;
+ }
+ else if (an_arg == "-t") // alternate threshold arg
+ {
+ *threshold = atoi(* ++argv);
+ i++;
+ }
+ else if (an_arg == "-et") // alternate entropy threshold arg
+ {
+ *ent_thres = atof(* ++argv);
+ i++;
+ }
+ else
+ {
+ if (else_i == 0)
+ {
+ *a_file_path = an_arg;
+ run_mode = 'f';
+ else_i++;
+ }
+ else
+ {
+ //cout << "Error, unknown arg: \'" << an_arg << "\'" << endl;
+ cout << "Error, too many filenames: \'" << an_arg << "\'" << endl;
+ run_mode == 'e';
+ }
+ }
+ }
+ }
+ return run_mode;
+}
+
+
+/*
+ cout << "fee\n";
+ cout << "fie\n";
+ cout << "foe\n";
+ cout << "fum\n";
+*/