remove the FLTK version of mussa and the non CMake-based build systems.
+++ /dev/null
-BASEDIR := ./
-CURDIR := $(shell pwd)
-
-BINEXT :=
-OBJEXT := .o
-LIBEXT := .a
-
-CXX := g++
-CXXFLAGS := -g -fPIC -I/usr/include/python2.3 -I$(CURDIR)
-# needed for linux (as darwin doesn't put gl.h in a directory starting with
-# GL
-CXXFLAGS += -I/usr/include/GL
-# needed for darwin
-CXXFLAGS += -I/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/usr/local/include
-LDFLAGS := -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/ -L/usr/local/lib
-
-# each module will add to this, .os are derived from it
-TARGETLIBS :=
-TARGETBINS :=
-LIBS :=
-LIBSRC :=
-SRC :=
-
-all: targets
-
-include alg/module.mk
-include alg/test/module.mk
-include py/module.mk
-include gui/module.mk
-
-# process what the module.mks defined
-OBJ := $(patsubst %.cpp,%.o, $(filter %.cpp,$(SRC)))
-DEPS := $(OBJ:.o=.d)
-
-targets: $(TARGETLIBS) $(TARGETBINS)
-
-# this make function came from
-# http://www.oreilly.com/catalog/make3/book/ch08.pdf
-# $(call make-depend,source-file,object-file,depend-file)
-define make-depend
- $(CXX) -MM -MF $3 -MP -MT $2 $(CFLAGS) $(CXXFLAGS) $1
-endef
-
-%.d: %.cpp
- $(call make-depend,$<,$@,$(subst .o,.d,$@))
-# makedepend -o.d $(dirname $^) $(CFLAGS) $(CXXFILAGS) $^ -f- > $@
-
-%.o: %.cpp
- $(CXX) -c -o $@ $(CXXFLAGS) $^
-
-include $(DEPS)
-
-clean:
- -rm $(OBJ) $(DEPS) $(TARGETLIBS) $(TARGETBINS)
-
-
-
+++ /dev/null
-CURDIR := $(BASEDIR)alg/
-
-SOURCES.cpp := annotation_colors.cpp \
- color.cpp \
- conserved_path.cpp \
- flp.cpp \
- flp_seqcomp.cpp \
- mussa.cpp \
- nway_paths.cpp \
- nway_entropy.cpp \
- nway_other.cpp \
- sequence.cpp
- # mussa_nway_refine.cpp (broken)
-
-MUSSA_ALG_SRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
-MUSSA_ALG_OBJ := $(MUSSA_ALG_SRC:.cpp=$(OBJEXT))
-
-GLSOURCES.cpp := glsequence.cpp \
- glseqbrowser.cpp
-MUSSA_ALG_GL_SRC := $(addprefix $(CURDIR), $(GLSOURCES.cpp))
-MUSSA_ALG_GL_OBJ := $(MUSSA_ALG_GL_SRC:.cpp=$(OBJEXT))
-
-SRC += $(MUSSA_ALG_SRC) $(MUSSA_ALG_GL_SRC)
-CXXFLAGS +=
+++ /dev/null
-CURDIR := $(BASEDIR)alg/test/
-
-SOURCES.cpp := test_annotation_color.cpp \
- test_conserved_path.cpp \
- test_flp.cpp \
- test_glsequence.cpp \
- test_glseqbrowser.cpp \
- test_color.cpp \
- test_main.cpp \
- test_mussa.cpp \
- test_nway.cpp \
- test_sequence.cpp
-
-TESTSRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
-TESTOBJ := $(TESTSRC:.cpp=$(OBJEXT))
-SRC += $(TESTSRC)
-CXXFLAGS += -DEXAMPLE_DIR=\"$(BASEDIR)/examples\"
-
-TEST := $(BASEDIR)/unittests$(BINEXT)
-TARGETBINS += $(TEST)
-
-$(TEST): $(TESTOBJ) $(MUSSA_ALG_OBJ) $(MUSSA_ALG_GL_OBJ)
- g++ $(CXXFLAGS) $(LDFLAGS) -lGL -lboost_unit_test_framework -lboost_filesystem -o $@ $^
-
+++ /dev/null
-build 015
- - added GPL notification to all modules
- - added LICENSE.txt (the GPL) and beginnings of a README.txt
- - bug fixes
- - fixed motif searching not working on sub-analyses
- (length of sub-analysis sequence not set...)
- - ...that other bug...
- - added code for compile under OS X so analyses dir created in
-same directory as the .mupa file when using "Do Analysis" option
-
-build 014
- - added Annotations window
- - displays all unique annots
- (Only uses the first column of annot ids after start & end indices)
- - allows selecting display colors each annot listed
- - available under View menu
- - added Sequence Copy window
- - enter seq #, start and end indices to display sequence
- - sequence buffer can selected and copied from
- - available under View menu
- - bug fixes
- - Analysis->Do/Load/Setup/Sub no longer crashes if cancelled/window closed
- - fixed file path issues with loading .mupa or analysis saves
- - mainly problem with OS X, which "runs" from harddrive root directory
- (note, still saves analyses at the root dir...)
- - problem on linux in some cases when switched build 013 save method
- (tho I didn't realize since I could run from any directory)
-
-build 013/build 012
- - finished seqcomp pairwise saving/loading code
- - can now set a higher threshold than initial analysis hard threshold
- - changed save format so all file go in a directory of analysis name
-
-
-build 011
- - added Sub Analysis window
- - can choose sub regions of the sequences
- - can set new window and threshold settings
- - available under Analysis menu
- - new menu - 'View'
- - moved bar/line toggle here as radio buttons
- - add simple motif search entry as well (can still middle click for it)
- - made sequence view resizable and scale correctly
-
-
-build 010
- - added Analysis setup window to interactively create analysis without needing to make a .mupa configuration file
- - added Analysis setup window under file menu
- - Mussa windows now include the name of the analysis in title bar
- - Sequence window clears previous scroll offset when new alignment choosen
-
-
-build 009 and earlier
- - occurred before writing was invented...
+++ /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/AnnotWindow.hpp"
-#include <iostream>
-#include <FL/fl_show_colormap.H>
-
-using namespace std;
-
-annot_color
-new_blank_annot()
-{
- annot_color *a_annot;
-
- a_annot = new annot_color;
- a_annot->type = "";
- a_annot->color = (Fl_Color) 5;
- //cout << "type: " << a_annot->type << endl;
-
- return *a_annot;
-}
-
-
-void
-cb_annot_color(Fl_Button* o, void* v)
-{
- annot_instance * blah = (annot_instance *) v;
- AnnotWindow* T= blah->mw_ptr;
- T->cb_annot_color_i(o,blah->index);
-}
-
-AnnotWindow::AnnotWindow(int w, int h, const char* title,
- vector<annot_color> * some_annots):Fl_Window(w,h,title)
-{
- int i, annot_num;
-
- the_annots = some_annots;
- annot_count = 0;
-
- annot_color_buttons.clear();
-
- begin();
- annot_input_pack = new Fl_Pack(0, 0, w, h);
- annot_input_pack->spacing(4);
-
- // button to add new annot inputs
- add_annot = new Fl_Button(0,0,100,24,"Add Annot Slot");
- add_annot->callback((Fl_Callback*)add_annot_cb, this);
- annot_input_pack->add(add_annot);
- // test button to make sure annot data is being stored
- test = new Fl_Button(0,0,100,24,"show annots");
- test->callback((Fl_Callback*)print_cb, this);
- annot_input_pack->add(test);
-
- // creat an initial set of annot input widgets and attach to annot vector
- annot_num = some_annots->size();
- for (i = 0; i < annot_num; i++)
- {
- add_annot_input(i);
- annot_count++;
- }
-
- add(annot_input_pack);
-
- end();
- resizable(this);
- show();
-}
-
- //tmp_input->user_data((void*) i);
-
-AnnotWindow::~AnnotWindow(){}
-
-void
-AnnotWindow::add_annot_input(int index)
-{
- Fl_Output * new_input;
- Fl_Button *new_color_button;
- annot_instance * something;
- Fl_Pack * annot_hor_pack;
-
-
- something = new annot_instance;
- something->mw_ptr = this;
- something->index = index;
-
- annot_hor_pack = new Fl_Pack(0, 0, w(), 24);
- annot_hor_pack->type(Fl_Pack::HORIZONTAL);
- annot_hor_pack->spacing(4);
-
- // setup the color display/selection button
- new_color_button = new Fl_Button(0, 0, 24, 24, "");
- new_color_button->color((*the_annots)[index].color);
- new_color_button->box(FL_FLAT_BOX);
- new_color_button->callback((Fl_Callback*)cb_annot_color, (void*) something);
- annot_color_buttons.push_back(new_color_button);
- annot_hor_pack->add(new_color_button);
-
-
- // setup the annot inputs
- new_input = new Fl_Output(0, 0, 200, 24, "");
- new_input->value( ((*the_annots)[index].type).c_str() );
- //new_input->callback((Fl_Callback*)cb_annot_in, (void*) something);
- annot_ins.push_back(new_input);
- annot_hor_pack->add(new_input);
-
- annot_input_pack->add(annot_hor_pack);
-}
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
-
-void
-AnnotWindow::cb_annot_in_i(Fl_Input* o, int i)
-{
- (*the_annots)[i].type = o->value();
-}
-
-void
-AnnotWindow::cb_annot_color_i(Fl_Button* o, int i)
-{
- //Fl_Color new_color;
-
- (*the_annots)[i].color = fl_show_colormap((*the_annots)[i].color);
- //annot_color_buttons[i]->
- o->color((*the_annots)[i].color);
- redraw();
-}
-
-void AnnotWindow::add_annot_cb(Fl_Button* o, void* v)
-{
- AnnotWindow* T=(AnnotWindow*)v;
- T->add_annot_cb_real(o,v);
-}
-
-
-void AnnotWindow::add_annot_cb_real(Fl_Button* , void*)
-{
- annot_color blank_annot;
-
- //blank_annot.name = "";
- //blank_annot.seq = "";
- blank_annot = new_blank_annot();
- (*the_annots).push_back(blank_annot);
- add_annot_input(annot_count++);
- redraw();
-}
-
-
-void AnnotWindow::print_cb(Fl_Button* o, void* v)
-{
- AnnotWindow* T=(AnnotWindow*)v;
- T->print_cb_real(o,v);
-}
-
-
-void AnnotWindow::print_cb_real(Fl_Button* , void*)
-{
- int i;
-
- for (i = 0; i < annot_count; i++)
- cout << (*the_annots)[i].type << endl;
-}
-
-/*
-void
-cb_annot_in(Fl_Input* o, void* v)
-{
- annot_instance * blah = (annot_instance *) v;
- AnnotWindow* T= blah->mw_ptr;
- T->cb_annot_in_i(o,blah->index);
-}
-
-
-*/
+++ /dev/null
-#ifndef _MUSSA_GUI_ANNOT_WINDOW_H_
-#define _MUSSA_GUI_ANNOT_WINDOW_H_
-// 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 <list>
-#include <string>
-#include <vector>
-
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Button.H>
-
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Output.H>
-#include <FL/Fl_Pack.H>
-
-#include "gui/MotifWindow.hpp"
-
-struct annot_color
-{
- std::string type;
- Fl_Color color;
-};
-
-//typedef annot_ptr *annot;
-
-
-class AnnotWindow : public Fl_Window
-{
- public:
- AnnotWindow(int w, int h, const char* title,
- std::vector<annot_color> * some_annots);
- ~AnnotWindow();
- Fl_Pack * annot_input_pack;
- std::list<Fl_Output*> annot_ins;
- std::vector<Fl_Button*> annot_color_buttons;
- std::list<Fl_Input*> name_ins;
- Fl_Button* test;
- Fl_Button* add_annot;
-
- void cb_annot_in_i(Fl_Input*, int i);
- void cb_annot_color_i(Fl_Button* o, int i);
-
- private:
- std::vector<annot_color> * the_annots;
- int annot_count;
-
- void add_annot_input(int index);
-
- static void add_annot_cb(Fl_Button*, void*);
- inline void add_annot_cb_real(Fl_Button*, void*);
-
- static void print_cb(Fl_Button*, void*);
- inline void print_cb_real(Fl_Button*, void*);
-};
-
-// crazy whacked shite Titus taught me to do to get an index value associated
-// with each instance of an input associated with the callback...
-struct annot_instance
-{
- AnnotWindow * mw_ptr;
- int index;
-};
-
-annot_color new_blank_annot();
-#endif
+++ /dev/null
-# recent versions of FLTK on debian have FL/Fl.H instead of Fl.h
-FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.H /usr/include)
-FIND_LIBRARY(FLTK_LIBRARY fltk /usr/lib )
-
-IF(FLTK_INCLUDE_DIR)
- SET(FLTK_FOUND 1)
-ENDIF(FLTK_INCLUDE_DIR)
-
-FIND_PACKAGE(Boost)
-FIND_PACKAGE(Qt4)
-INCLUDE( ${QT_USE_FILE} )
-
-SET(SOURCES
- AnnotWindow.cpp
- ConnView.cpp
- ConnWindow.cpp
- MotifWindow.cpp
- mussa_fltk.cpp
- SeqTextWindow.cpp
- SeqView.cpp
- SeqWindow.cpp
- SetupWindow.cpp
- SubAnalysisWindow.cpp
- )
-
-IF(FLTK_FOUND)
- ADD_EXECUTABLE(mussa_fltk WIN32 MACOSX_BUNDLE ${SOURCES})
- LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/alg)
- TARGET_LINK_LIBRARIES(mussa_fltk
- mussa_core
- ${BOOST_FILESYSTEM_LIBRARY}
- ${FLTK_LIBRARY})
-ELSE(FLTK_FOUND)
- MESSAGE(STATUS "Not building old FTLK version")
-ENDIF(FLTK_FOUND)
+++ /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/ConnView.hpp"
-
-#include <iomanip>
-#include <math.h>
-
-#include <FL/Fl.H>
-#include <FL/fl_draw.H>
-
-using namespace std;
-
-void
-ConnView::setup(string name, int sq_num, int win_len,
- vector<Sequence> *some_seqs,
- NwayPaths *some_paths)
-{
- int i, i2, seq_length;
- Sequence a_seq;
- fltk_motif blank_motif;
- annot_color new_annot;
-
-
- analysis_name = name;
- seq_num = sq_num;
- window = win_len;
- S = some_seqs;
- P = some_paths;
-
- cout << "num of paths = " << some_paths->refined_pathz.size() << endl;
-
- cout << "x()=" << x() << " y()=" << y() << " w()=" << w() << " h()=" << h();
- cout << endl;
-
- max_seq_len = 0;
- for(i = 0; i < seq_num; ++i)
- {
- a_seq = (*S)[i];
- cout << a_seq.size() << endl;
- seq_length = a_seq.size();
- seq_lens.push_back(seq_length);
- if (seq_length > max_seq_len)
- max_seq_len = seq_length;
- if (seq_length < 1000)
- seq_scales.push_back(1);
- else if (seq_length < 1000000)
- seq_scales.push_back(2);
- else
- seq_scales.push_back(3);
- }
-
- name_pad = 80;
- y_pad = 20;
-
- x_scale_factor = (float) max_seq_len / (w() - name_pad);
- cout << "scale factor is " << x_scale_factor << endl;
- y_seq_incre = (h()-(y_pad*2)) / (seq_num - 1);
-
-
- drag_start = -1000;
- drag_end = -1000;
- ref_seq_num = 0;
-
- dragging = false;
- selected = false;
-
- highlight.clear();
- show_bars = false;
- show_lines = false;
- bar_interval = max_seq_len / 20;
- line_interval = max_seq_len / 20;
- ref_seq_num = 0;
-
-
- some_motifs.clear();
- for(i = 0; i < 5; ++i)
- {
- blank_motif = new_blank_motif();
- some_motifs.push_back(blank_motif);
- }
-
- // find all unique annotation type ids
- some_annots.clear();
- vector<annot_color>::iterator annot_type_i;
- list<annot>::iterator annot_i;
-
- // loop thru all sequences
- for(i2 = 0; i2 < seq_num; i2++)
- {
- cout << "ConnView: annotation loop\n";
- // loop thru all annotation entries in this sequence
- for(annot_i = (*S)[i2].annots.begin(); annot_i != (*S)[i2].annots.end(); ++annot_i)
- {
- cout << annot_i->start << ", " << annot_i->end << " : ";
- cout << annot_i->name << " " << annot_i->type << endl;
- // loop thru annotation types
- annot_type_i = some_annots.begin();
- bool type_unfound = true;
- while ((annot_type_i != some_annots.end()) && type_unfound)
- {
- if (annot_i->type == annot_type_i->type)
- type_unfound = false; // stop search if found
- ++annot_type_i;
- }
- //if unfound, then add to list
- if (type_unfound)
- {
- new_annot = new_blank_annot();
- new_annot.type = annot_i->type;
- some_annots.push_back(new_annot);
- }
- }
- }
-}
-
-
-void
-ConnView::scale_paths()
-{
- ConservedPath a_path;
- list<ConservedPath >::iterator pathz_i;
- int i2;
-
-
- scaled_pathz.clear();
-
- for(pathz_i = P->refined_pathz.begin(); pathz_i != P->refined_pathz.end(); ++pathz_i)
- {
- a_path = *pathz_i;
- a_path.window_size = (int)(a_path.window_size / x_scale_factor);
- for(i2 = 0; i2 != a_path.size(); i2++)
- {
- a_path[i2] = (int) (a_path[i2] / x_scale_factor);
- }
- scaled_pathz.push_back(a_path);
- }
-}
-
-void
-ConnView::toggle_bars()
-{
- show_bars = !show_bars;
- redraw();
-}
-
-void
-ConnView::set_bar_interval(int new_bar_len)
-{
- bar_interval = new_bar_len;
- cout << "bar interval = " << bar_interval << endl;
- redraw();
-}
-
-void
-ConnView::toggle_lines()
-{
- show_lines = !show_lines;
- redraw();
-}
-
-void
-ConnView::set_line_interval(int new_line_len)
-{
- line_interval = new_line_len;
- cout << "line interval = " << line_interval << endl;
- redraw();
-}
-
-
-void
-ConnView::draw()
-{
- // this is temporary - check if new motifs have been added
- check_new_motifs();
-
- // clear drawing area and set background to white
- fl_color(FL_WHITE);
- fl_rectf(x(), y(), w(), h());
-
- // draw the scale indicators if they are on
- // put into own method soon...
- int i, div_num, x_loc;
- float div_len_scaled;
-
- if (show_bars)
- {
- div_num = max_seq_len / bar_interval;
- div_len_scaled = ((float) bar_interval) / x_scale_factor;
- fl_color(230,230,230);
- for(i = 0; i <= div_num; i+=2)
- {
- x_loc = (int)(i * div_len_scaled+x());
- fl_rectf(x_loc, y(), (int) div_len_scaled, h());
- }
- }
-
- if (show_lines)
- {
- div_num = max_seq_len / line_interval;
- div_len_scaled = ((float) line_interval) / x_scale_factor;
- fl_color(0,0,0);
- fl_line_style(FL_SOLID, 1, NULL);
- for(i = 0; i <= div_num; i++)
- {
- x_loc = (int)(i * div_len_scaled+x());
- fl_line(x_loc, y(), x_loc, h()+y());
- }
- }
-
-
- // divide up the space with some light blue lines
- fl_color(150,200,255);
- fl_line_style(FL_SOLID, 2, NULL);
- fl_rect(x(), y(), w(), h());
- fl_line(w()+x()-name_pad, y(), w()+x()-name_pad, h()+y());
-
- draw_paths();
-
- // white out any overdraw from path area into name/info area
- fl_color(FL_WHITE);
- fl_rectf(w()+x()-name_pad, y(), w()+x(), h());
-
- draw_sequence_stuff();
-
- // draw selection box
- /*
- if (selected)
- {
- fl_color(FL_BLACK);
- fl_line_style(FL_SOLID, 1, NULL);
- fl_rect(drag_start,(ref_seq_num*y_seq_incre)+y(),drag_end-drag_start,
- 16);
- }
- */
-}
-
-
-void
-ConnView::draw_paths()
-{
- list<ConservedPath >::iterator i;
- int i2, i3, y_loc, x_loc, x_start, x_end;
- list<bool>::iterator highlight_i;
- int window_size;
- bool rc_color;
- int path_start, path_end;
-
- // determine which paths to highlight
- highlight.clear();
- for(i = scaled_pathz.begin(); i != scaled_pathz.end(); ++i)
- {
- ConservedPath& a_path = *i;
- // determine if path falls within the selected region and mark it for
- // highlighted color
- path_start = abs(a_path[ref_seq_num]);
- path_end = path_start + a_path[0];
- if ( ( (path_start >= drag_start-x()) && (path_end <= drag_end-x()) ) ||
- ( (path_start < drag_start-x()) && (path_end > drag_end-x()) ) ||
- ( (path_start < drag_start-x()) && (path_end > drag_start-x()) ) ||
- ( (path_start < drag_end-x()) && (path_end > drag_end-x()) ) )
- highlight.push_back(true);
- else
- highlight.push_back(false);
- }
-
- fl_line_style(FL_SOLID, 1, NULL);
- // draw non-highlight paths (ie not in the selection box)
- highlight_i = highlight.begin();
- for(i = scaled_pathz.begin(); i != scaled_pathz.end(); ++i)
- {
- ConservedPath& a_path = *i;
- y_loc = y()+y_pad;
-
- window_size = a_path.window_size;
- // make sure width is at least 1 - might be zero to my slack rounding
- if (window_size == 0)
- window_size = 1;
-
- if (!(*highlight_i))
- for(i2 = 0; i2 < a_path.size()-1; i2++)
- {
- // RC case handling
- // ugh, an xor...only want blue if one of the nodes is rc
- if ( ((a_path[i2] < 0) || (a_path[i2+1] < 0)) &&
- !((a_path[i2] < 0) && (a_path[i2+1] < 0)) )
- fl_color(200,200,255);
- else
- fl_color(255,200,200);
-
- fl_line_style(FL_SOLID, 1, NULL);
- fl_polygon((int)abs(a_path[i2])+x(), y_loc + 3,
- (int)abs(a_path[i2])+window_size+x(), y_loc + 3,
- (int)abs(a_path[i2+1])+window_size+x(), y_loc + y_seq_incre - 3,
- (int)abs(a_path[i2+1])+x(), y_loc + y_seq_incre - 3);
-
- y_loc += y_seq_incre;
- }
- ++highlight_i;
- }
-
- // draw highlighted paths (ie in or partially in selection)
- // drawing these separately and after other paths so they are on top
- highlight_i = highlight.begin();
- for(i = scaled_pathz.begin(); i != scaled_pathz.end(); ++i)
- {
- ConservedPath& a_path = *i;
- y_loc = y()+y_pad;
-
- // get window size to determine line width
- window_size = a_path.window_size;
- // make sure width is at least 1 - might be zero to my slack rounding
- if (window_size == 0)
- window_size = 1;
-
- if (*highlight_i)
- for(i2 = 0; i2 != a_path.size()-1 ; i2++)
- {
- // RC case handling
- // ugh, an xor...only want blue if one of the nodes is rc
- if ( ((a_path[i2] < 0) || (a_path[i2+1] < 0)) &&
- !((a_path[i2] < 0) && (a_path[i2+1] < 0)) )
- fl_color(FL_BLUE);
- else
- fl_color(FL_RED);
-
- fl_polygon((int)abs(a_path[i2])+x(), y_loc + 3,
- (int)abs(a_path[i2])+window_size+x(), y_loc + 3,
- (int)abs(a_path[i2+1])+window_size+x(), y_loc + y_seq_incre - 3,
- (int)abs(a_path[i2+1])+x(), y_loc + y_seq_incre - 3);
-
- y_loc += y_seq_incre;
- }
- ++highlight_i;
- }
-}
-
-/*
- list<vector<int> >::iterator i;
- int window_size;
- bool rc_color;
- int path_start, path_end;
- Sequence a_seq;
- vector<int> a_path;
-*/
-
-void
-ConnView::draw_sequence_stuff()
-{
- int i2, i3, y_loc, y_offset, x_loc, x_start, x_end, mv_offset;
- list<annot>::iterator annot_i;
- string species_name, seq_length;
- stringstream raw_length;
-
-
- // draw sequence representation lines
- fl_font(FL_COURIER, 14);
- //fl_color(FL_BLACK);
- fl_color(100,100,100);
- // normally size 7, adjust for various screenshotage
- fl_line_style(FL_SOLID, 11, NULL);
- y_loc = y()+y_pad;
- y_offset = 5;
- for(i2 = 0; i2 < seq_num; i2++)
- {
- if (i2 == seq_num - 1)
- y_offset = -10;
- x_loc = (int)(seq_lens[i2] / x_scale_factor) + x();
- //report_float("seq scaled len", x_loc);
- fl_line(x(),y_loc,x_loc,y_loc);
-
- species_name = (*S)[i2].species;
- fl_draw(species_name.c_str(), x()+w()-name_pad+5, y_loc+y_offset);
-
- // funkiness to figure out which genomic scale to report size in
- if (seq_scales[i2] == 1)
- raw_length << setprecision(3) << seq_lens[i2] << " bp";
- else if (seq_scales[i2] == 2)
- raw_length << setprecision(3) << seq_lens[i2] / 1000.0 << " Kb";
- else if (seq_scales[i2] == 3)
- raw_length << setprecision(3) << seq_lens[i2] /1000000.0<< " Mb";
- seq_length = raw_length.str();
- fl_draw(seq_length.c_str(), x()+w()-name_pad+5, y_loc+y_offset+15);
- raw_length.str("");
-
- y_loc += y_seq_incre;
- }
-
- //fl_line(x(),y()+y_pad/2,w()-name_pad,y()+y_pad/2);
- //fl_line(x(),y()+h()-y_pad/2,w()-name_pad,y()+h()-y_pad/2);
-
- // draw annotations
- vector<annot_color>::iterator annot_type_i;
-
- fl_color(FL_GREEN);
- fl_line_style(FL_SOLID, 3, NULL);
- y_loc = y()+y_pad;
- for(i2 = 0; i2 < seq_num; i2++)
- {
- // loop thru all annotation entries
- for(annot_i = (*S)[i2].annots.begin(); annot_i != (*S)[i2].annots.end(); ++annot_i)
- {
- fl_line_style(FL_SOLID, 7, NULL);
- mv_offset = 0;
-
- // loop thru annotation types to determine color
- annot_type_i = some_annots.begin();
- bool type_unfound = true;
- while ((annot_type_i != some_annots.end()) && type_unfound)
- {
- if (annot_i->type == annot_type_i->type)
- {
- fl_color(annot_type_i->color);
- type_unfound = false;
- }
- else
- fl_color(FL_GREEN);
- ++annot_type_i;
- }
-
- // calculate scaled start and end, and draw
- x_start = (int)(annot_i->start / x_scale_factor) + x();
- x_end = (int)(annot_i->end / x_scale_factor) + x();
- fl_line(x_start,y_loc+mv_offset,x_end,y_loc+mv_offset);
- }
- y_loc += y_seq_incre;
- }
-
-
- // draw motifs found
- vector<fltk_motif>::iterator motif_i;
- vector<int> some_motif_locs;
- vector<int>::iterator i_locs;
- int scale_len, motif_len;
-
- fl_color(255,0,255);
- fl_line_style(FL_SOLID, 9, NULL);
- motif_i = some_motifs.begin();
- while (motif_i != some_motifs.end())
- {
- fl_color(motif_i->color);
- motif_len = motif_i->seq.length();
- scale_len = (int) (motif_len / x_scale_factor);
- if (scale_len == 0)
- scale_len = 1;
- y_loc = y()+y_pad;
- if (!motif_i->locations.empty())
- for(i2 = 0; i2 < seq_num; i2++)
- {
- some_motif_locs = (*motif_i).locations[i2];
-
- i_locs = some_motif_locs.begin();
- while (i_locs != some_motif_locs.end())
- {
- x_start = (int)(*i_locs / x_scale_factor) + x();
- fl_line(x_start,y_loc,x_start+scale_len,y_loc);
- ++i_locs;
- }
- y_loc += y_seq_incre;
- }
- ++motif_i;
- }
-}
-
-
-void
-ConnView::resize(int new_x, int new_y, int new_w, int new_h)
-{
-
- x(new_x);
- y(new_y);
- w(new_w);
- h(new_h);
-
- x_scale_factor = (float) max_seq_len / (w() - name_pad);
- cout << "scale factor is " << x_scale_factor << endl;
- y_seq_incre = (h()-(2*y_pad)) / (seq_num - 1);
-
- scale_paths();
-}
-
-
-void
-ConnView::reporter(string var, int value)
-{
- cout << var << " : " << value << endl;
-}
-
-
-void
-ConnView::report_float(string var, float value)
-{
- cout << var << " : " << value << endl;
-}
-
-int
-ConnView::handle(int e)
-{
- int return_value;
- float y_calc_tmp;
-
- // this empty string needs to be put on cout, otherwise the -O optimize
- // compile option seems to throw this function away with the following:
- // gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
- cout << "";
-
- // why do I need a -O for this module? Well, originally I just used the
- // same compile flags for all modules. I changed that. However, on debian
- // systems I need the -O otherwise the behavior I observe on redhat machines
- // with above compiler happens if I don't have that empty cout. WTF
-
- switch(e)
- {
- case FL_PUSH:
- if (Fl::event_button3())
- {
- spawnSeq();
- return_value = 1;
- }
- else if (Fl::event_button2())
- {
- find_motifs();
- return_value = 1;
- }
- break;
- case FL_DRAG:
- if (!dragging)
- {
- drag_start = Fl::event_x();
- y_drag_start = (float) Fl::event_y();
- ref_seq_num = (int) (round ( (y_drag_start/y_seq_incre) ) );
- dragging = true;
- selected = false;
- return_value = 1;
- }
- fl_line_style(FL_SOLID, 1, NULL);
- fl_overlay_rect(drag_start, (ref_seq_num*y_seq_incre)+y(),
- Fl::event_x()-drag_start, 16);
-
- break;
- case FL_RELEASE:
- if (dragging)
- {
- drag_end = Fl::event_x();
- dragging = false;
- selected = true;
- redraw();
- return_value = 1;
- }
- break;
- default:
- return_value = Fl_Widget::handle(e);
- }
-
- return return_value;
-}
-
-
-
-void
-ConnView::check_new_motifs()
-{
- vector<fltk_motif>::iterator i;
- int i2;
- vector<int> some_motif_locs;
- vector<int>::iterator i_locs;
-
- i = some_motifs.begin();
- while (i != some_motifs.end())
- {
- if (i->dirty)
- {
- cout << i->seq << " is new\n";
- i->locations.clear();
- //i_locs = i->locations;
- for(i2 = 0; i2 < seq_num; i2++)
- {
- some_motif_locs = (*S)[i2].find_motif(i->seq);
- (*i).locations.push_back(some_motif_locs);
-
-
- i_locs = some_motif_locs.begin();
- while (i_locs != some_motif_locs.end())
- {
- cout << *i_locs << " ";
- ++i_locs;
- }
- cout << endl;
-
- }
-
- i->dirty = false;
- }
- ++i;
- }
-}
-
-
-void
-ConnView::spawnSeq()
-{
- list<ConservedPath > selected_paths;
- list<ConservedPath >::iterator pathz_i;
- int i2, i3, y_loc, x_loc, x_start, x_end;
- list<bool>::iterator highlight_i;
- int y_max;
- string window_name;
-
- if (selected)
- {
- // make new list of connections that are highlighted
- selected_paths.clear();
- highlight_i = highlight.begin();
- for(pathz_i = P->refined_pathz.begin();
- pathz_i != P->refined_pathz.end(); ++pathz_i)
- {
- if (*highlight_i)
- {
- selected_paths.push_back(*pathz_i);
- }
- ++highlight_i;
- }
-
- // give 50 pixels of height per sequence
- y_max = seq_num * 50;
- window_name = "Mussa Sequence: " + analysis_name;
-
- a_seq_win = new SeqWindow(800, y_max, (const char*) window_name.c_str(),
- seq_num, S, selected_paths, seq_lens,
- &some_motifs);
- }
-}
-
-
-void
-ConnView::find_motifs()
-{
- motif_find_window = new MotifWindow(300, 300, "Motifs", &some_motifs);
-}
-
-void
-ConnView::annot_win()
-{
- annot_color_window = new AnnotWindow(300, 300, "Annotations", &some_annots);
-}
-
-// @!@! special hacked in color coding for the myf5/6 region annots
-
-/*
- if (annot_i->type == "mvista")
- {
- fl_color(255,230,0);
- fl_line_style(FL_SOLID, 8, NULL);
- mv_offset = -4;
- }
- else if (annot_i->type == "reg")
- {
- fl_line_style(FL_SOLID, 10, NULL);
- mv_offset = -8;
-
- if (annot_i->name == "CNS")
- fl_color(255,150,0);
- else if (annot_i->name == "ELA")
- fl_color(0,200,120);
- else if (annot_i->name == "ES")
- fl_color(0,200,200);
- else if (annot_i->name == "NA")
- fl_color(120,120,120);
- else if (annot_i->name == "EA")
- {
- fl_line_style(FL_SOLID, 7, NULL);
- mv_offset = -13;
- fl_color(0,200,120);
- }
- else if (annot_i->name == "VS")
- {
- fl_line_style(FL_SOLID, 7, NULL);
- mv_offset = -6;
- fl_color(255,255,0);
- }
- else if (annot_i->name == "SP")
- {
- fl_line_style(FL_SOLID, 7, NULL);
- mv_offset = -13;
- fl_color(255,230,150);
- }
- else if (annot_i->name == "L")
- {
- fl_line_style(FL_SOLID, 7, NULL);
- mv_offset = -6;
- fl_color(0,0,100);
- }
- else if (annot_i->name == "TCM")
- fl_color(0,130,230);
- }
-*/
+++ /dev/null
-#ifndef _MUSSA_GUI_CONN_VIEW_H_
-#define _MUSSA_GUI_CONN_VIEW_H_
-// 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 <list>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "alg/sequence.hpp"
-#include "alg/nway_paths.hpp"
-#include "gui/SeqView.hpp"
-#include "gui/SeqWindow.hpp"
-#include "gui/MotifWindow.hpp"
-#include "gui/AnnotWindow.hpp" // aparently for annot_color
-
-#include <FL/Fl_Box.H>
-
-class NwayPaths;
-class ConnView : public Fl_Box
-{
- public:
- ConnView(int x_top,int y_top,int x_bot,int y_bot) :
- Fl_Box(x_top,y_top,x_bot,y_bot)
- {}
-
- void setup(std::string name, int sq_num, int win_len,
- std::vector<Sequence> *, NwayPaths *);
- void scale_paths();
-
- void spawnSeq();
- void find_motifs();
- void annot_win();
-
- void toggle_bars();
- void set_bar_interval(int new_bar_len);
- void toggle_lines();
- void set_line_interval(int new_line_len);
-
-
- private:
- std::string analysis_name;
- int seq_num, window, threshold;
- bool win_append, thres_append;
-
- //this data is passed as pointers to the instantiated classes
- std::vector<Sequence> *S;
- //! Store the nway paths our analysis did, we mostly need the refined paths
- NwayPaths *P;
-
- int name_pad, y_pad;
- float x_scale_factor;
- int y_seq_incre;
- int drag_start, drag_end;
- float y_drag_start;
- int ref_seq_num, max_seq_len;
- bool dragging, selected;
- std::list<bool> highlight;
-
- //path data scaled for current view size
- std::list<ConservedPath > scaled_pathz;
- std::vector<int> seq_lens;
- std::vector<int> seq_scales;
- int bar_interval, line_interval;
- bool show_bars, show_lines;
-
- //keeps track of all the motifs the user has inputed
- std::vector<fltk_motif> some_motifs;
- MotifWindow *motif_find_window;
-
- //keeps track of the colors assigned to each fltk_motif type
- std::vector<annot_color> some_annots;
- AnnotWindow *annot_color_window;
-
- SeqWindow *a_seq_win;
-
- void draw();
- void draw_paths();
- void draw_sequence_stuff();
-
- void resize(int x, int y, int w, int h);
- int handle(int e);
- void check_new_motifs();
-
- //for drawing function debugging
- void reporter(std::string var, int value);
- void report_float(std::string var, float value);
-};
-#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 "mussa_exceptions.hpp"
-
-#include <iostream>
-using namespace std;
-
-void
-load_ana_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_load_ana_cb();
-}
-
-
-void
-ConnWindow::real_load_ana_cb()
-{
- char *picked_file;
- string a_file_path;
- string err_msg;
-
- cout << "Load! Load! Load, ye yellow-bellied seadogs!\n";
- //picked_file = fl_file_chooser("Find an Analysis", "", "", 1);
- picked_file = fl_dir_chooser("Find an Analysis", "", 1);
- if (picked_file != NULL)
- {
- a_file_path = picked_file;
- cout << "doo wah diddy diddy dum diddy doo\n";
- cout << a_file_path << endl;
-
- // load the analysis
- an_analysis = new Mussa();
- try {
- an_analysis->load(a_file_path);
- } catch (mussa_load_error e) {
- fl_alert(e.what());
- return;
- }
- //.substr(0,a_file_path.find(".mu")));
-
- // relabel window with the analysis name
- window_name = "Mussa: " + an_analysis->get_name();
- label((const char*)window_name.c_str());
- // show the user the analysis
- conn_box->setup(an_analysis->get_name(), an_analysis->size(),
- an_analysis->get_window(), &(an_analysis->the_seqs),
- &(an_analysis->the_paths));
- conn_box->scale_paths();
- }
-}
-
-
-void
-do_ana_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_do_ana_cb();
-}
-
-
-void
-ConnWindow::real_do_ana_cb()
-{
- char *picked_file;
- string a_file_path;
- string err_msg;
-
- picked_file = fl_file_chooser("Analysis Config File", "", "", 1);
- if (picked_file != NULL)
- {
- a_file_path = picked_file;
-
- an_analysis = new Mussa();
- try {
- an_analysis->load_mupa_file(a_file_path);
- } catch (mussa_load_error e) {
- fl_alert(e.what());
- return;
- }
-
- try {
- an_analysis->analyze(0, 0, Mussa::TransitiveNway, 0.0);
- // relabel window with the analysis name
- window_name = "Mussa: " + an_analysis->get_name();
- label((const char*)window_name.c_str());
- // show the user the analysis
- conn_box->setup(an_analysis->get_name(), an_analysis->size(),
- an_analysis->get_window(), &(an_analysis->the_seqs),
- &(an_analysis->the_paths));
- conn_box->scale_paths();
- } catch (mussa_analysis_error e) {
- fl_alert(e.what());
- }
- }
- conn_box->redraw();
-}
-
-
-void
-setup_ana_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_setup_ana_cb();
-}
-
-void
-ConnWindow::real_setup_ana_cb()
-{
- an_analysis = new Mussa();
- setup_win = new SetupWindow(650,700,"Analysis Setup", an_analysis);
-
- while(setup_win->visible())
- Fl::wait(.1);
- cout << "Like a warm summer day\n";
-
- if (setup_win->done())
- {
- // relabel window with the analysis name
- window_name = "Mussa: " + an_analysis->get_name();
- label((const char*)window_name.c_str());
- // is it this easy? what if setup window encounters an error...??
- conn_box->setup(an_analysis->get_name(), an_analysis->size(),
- an_analysis->get_window(), &(an_analysis->the_seqs),
- &(an_analysis->the_paths));
-
- conn_box->scale_paths();
- }
-}
-
-
-void
-subana_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_subana_cb();
-}
-
-void
-ConnWindow::real_subana_cb()
-{
- string subana_name;
-
- if (an_analysis == 0 || an_analysis->the_seqs.size() == 0) {
- fl_message("please load an analysis before creating a subanalysis");
- return;
- }
-
- sub_analysis = new Mussa();
- subana_win = new SubAnalysisWindow(500,400,"Sub Analysis Setup", sub_analysis,
- an_analysis->the_seqs);
-
- while(subana_win->visible())
- Fl::wait(.1);
- cout << "Like a warm summer day\n";
-
- if (subana_win->done())
- {
- subana_name = "SubMussa: " + sub_analysis->get_name();
- sub_conn_win = new ConnWindow(w(), h(), (const char*) subana_name.c_str());
- cout << "Like a warm day in may\n";
- sub_conn_win->add_ana(sub_analysis);
- //Fl::visual(FL_DOUBLE|FL_INDEX);
- //sub_conn_box->show();
- }
-}
-
-
-void
-seq_show_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_seq_show_cb();
-}
-
-void
-ConnWindow::real_seq_show_cb()
-{
- show_seq_win = new SeqTextWindow(500,400,"Seq Show", an_analysis->the_seqs);
-}
-
-void
-seq_win_spawn_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_seq_win_spawn_cb();
-}
-
-void
-ConnWindow::real_seq_win_spawn_cb()
-{
- conn_box->spawnSeq();
-}
-
-void
-motif_find_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_motif_find_cb();
-}
-
-void
-ConnWindow::real_motif_find_cb()
-{
- conn_box->find_motifs();
-}
-
-void
-annot_win_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_annot_win_cb();
-}
-
-void
-ConnWindow::real_annot_win_cb()
-{
- conn_box->annot_win();
-}
-
-
-// all the crap needed for dealing with the scale bars
-void
-toggle_scale_bars_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_toggle_bars_cb();
-}
-
-void
-ConnWindow::real_toggle_bars_cb()
-{
- conn_box->toggle_bars();
-}
-
-void
-set_bar_len_cb(Fl_Input* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- cout << "WAAAAAAAAA\n";
- T->real_set_bar_len_cb(o);
-}
-
-void
-ConnWindow::real_set_bar_len_cb(Fl_Input* o)
-{
- int new_bar_len;
-
- new_bar_len = atoi(o->value());
- cout << "new bar len = " << new_bar_len << endl;
- conn_box->set_bar_interval(new_bar_len);
-}
-
-
-// all the crap needed for dealing with the scale lines
-void
-toggle_scale_lines_cb(Fl_Button* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- T->real_toggle_lines_cb();
-}
-
-void
-ConnWindow::real_toggle_lines_cb()
-{
- conn_box->toggle_lines();
-}
-
-void
-set_line_len_cb(Fl_Input* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- cout << "WAAAAAAAAA\n";
- T->real_set_line_len_cb(o);
-}
-
-void
-ConnWindow::real_set_line_len_cb(Fl_Input* o)
-{
- int new_line_len;
-
- new_line_len = atoi(o->value());
- cout << "new line len = " << new_line_len << endl;
- conn_box->set_line_interval(new_line_len);
-}
-
-
-// setting new soft threshold
-
-void
-set_soft_thres_cb(Fl_Input* o, void* v)
-{
- ConnWindow* T=(ConnWindow*)v;
- cout << "WAAAAAAAAA\n";
- T->real_set_soft_thres_cb(o);
-}
-
-void
-ConnWindow::real_set_soft_thres_cb(Fl_Input* o)
-{
- int new_soft_thres;
-
- new_soft_thres = atoi(o->value());
- cout << "new soft thres = " << new_soft_thres << endl;
-
- an_analysis->set_soft_thres(new_soft_thres);
- an_analysis->set_analysis_mode(Mussa::TransitiveNway);
- an_analysis->nway();
- conn_box->scale_paths();
- conn_box->redraw();
-
- // hacked in stuff to save muway files at different thresholds
- string save_path;
- ostringstream append_info;
-
- save_path = an_analysis->get_name() + "/"
- + an_analysis->get_name().substr(0,an_analysis->get_name().find("_t"));
- append_info.str("");
- append_info << "_t" << new_soft_thres << ".muway";
- //<< "_w" << an_analysis->window
- save_path += append_info.str();
- cout << "saving as: " << save_path << endl;
- an_analysis->save_muway(save_path);
-}
-
-
-
-
-ConnWindow::ConnWindow(int w, int h, const char* title):
- Fl_Double_Window(w,h,title)
-{
- int button_len = 120;
- Fl_Color a_color = fl_rgb_color(150, 200, 255);
-
- padding = 5;
-
- begin();
- //fl_color(150,200,255);
- color(FL_WHITE);
- resizable(this);
-
-
- // create file menu button
- file_menu = new Fl_Menu_Button(padding, 2, button_len, 30, "Analysis");
- file_menu->color(FL_WHITE,a_color);
- file_menu->box(FL_BORDER_BOX);
- file_menu->clear();
-
- // add menu items
- file_menu->add("Do Analysis", 0, (Fl_Callback *) do_ana_cb, this);
- file_menu->add("Load Analysis", 0, (Fl_Callback *) load_ana_cb, this);
- file_menu->add("Setup Analysis", 0, (Fl_Callback *) setup_ana_cb, this);
- file_menu->add("Sub Analysis", 0, (Fl_Callback *) subana_cb, this);
-
-
- view_menu = new Fl_Menu_Button(padding+button_len,2, button_len, 30, "View");
- view_menu->color(FL_WHITE,a_color);
- view_menu->box(FL_BORDER_BOX);
- view_menu->clear();
- view_menu->add("Sequence Zoom", 0, (Fl_Callback*) seq_win_spawn_cb, this);
- view_menu->add("Motif Finder", 0, (Fl_Callback*) motif_find_cb, this);
- view_menu->add("Annotations", 0, (Fl_Callback*) annot_win_cb, this);
- view_menu->add("Copy Seq", 0, (Fl_Callback*) seq_show_cb, this);
- view_menu->add("Toggle Bars", 0, (Fl_Callback*) toggle_scale_bars_cb, this,
- FL_MENU_TOGGLE|FL_MENU_VALUE);
- view_menu->add("Toggle Lines", 0, (Fl_Callback*) toggle_scale_lines_cb, this,
- FL_MENU_TOGGLE|FL_MENU_VALUE);
-
- bar_input = new Fl_Input(padding+3*button_len, 2, button_len, 30, "Bar Length (bp)");
- bar_input->value("");
- bar_input->when(FL_WHEN_ENTER_KEY);
- bar_input->callback((Fl_Callback*)set_bar_len_cb, this);
-
- line_input = new Fl_Input(padding+5*button_len, 2, button_len, 30, "Line Interval (bp)");
- line_input->value("");
- line_input->when(FL_WHEN_ENTER_KEY);
- line_input->callback((Fl_Callback*)set_line_len_cb, this);
-
-
- thres_input = new Fl_Input(padding+7*button_len, 2, button_len, 30, "Threshold");
- thres_input->value("");
- thres_input->when(FL_WHEN_ENTER_KEY);
- thres_input->callback((Fl_Callback*)set_soft_thres_cb, this);
-
-
- // create the connections box
- conn_box = new ConnView(padding, padding + 30, w-2*padding, h-2*padding-30);
- //conn_box = new ConnView(padding, padding, w-2*padding, h-2*padding);
-
- end();
- show();
-}
-
-
-ConnWindow::~ConnWindow()
-{}
-
-
-void
-ConnWindow::add_ana(Mussa *the_ana)
-{
- an_analysis = the_ana;
-
- // relabel window with the analysis name
- window_name = "Mussa: " + an_analysis->get_name();
- label((const char*)window_name.c_str());
-
- conn_box->setup(an_analysis->get_name(), an_analysis->size(),
- an_analysis->get_window(), &(an_analysis->the_seqs),
- &(an_analysis->the_paths));
- conn_box->scale_paths();
-}
+++ /dev/null
-#ifndef _MUSSA_GUI_CONN_WINDOW_H_
-#define _MUSSA_GUI_CONN_WINDOW_H_
-
-// 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 <string>
-
-#include <FL/Fl_Double_Window.H>
-#include <FL/Fl_Menu_Bar.H>
-#include <FL/Fl_Menu_Item.H>
-
-#include "gui/ConnView.hpp"
-#include "gui/SetupWindow.hpp"
-#include "gui/SubAnalysisWindow.hpp"
-#include "gui/SeqTextWindow.hpp"
-
-//! Window for showing the lines connecting the various sequences together
-class ConnWindow : public Fl_Double_Window
-{
- private:
- Mussa *an_analysis, *sub_analysis;
- ConnWindow *sub_conn_win;
-
- Fl_Menu_Button *file_menu;
- Fl_Menu_Button *view_menu;
- Fl_Menu_Bar *menu_bar;
- Fl_Input *bar_input;
- Fl_Input *line_input;
- Fl_Input *thres_input;
- ConnView *conn_box;
- SetupWindow *setup_win;
- SubAnalysisWindow *subana_win;
- SeqTextWindow *show_seq_win;
- int padding, name_pad;
- std::string window_name;
-
- public:
- ConnWindow(int w, int h, const char* title);
- ~ConnWindow();
- void add_ana(Mussa *the_ana);
-
- void real_load_ana_cb();
- void real_do_ana_cb();
- void real_setup_ana_cb();
- void real_subana_cb();
- void real_resthres();
- void real_seq_show_cb();
-
- void real_seq_win_spawn_cb();
- void real_motif_find_cb();
- void real_annot_win_cb();
-
- void real_toggle_bars_cb();
- void real_set_bar_len_cb(Fl_Input* o);
- void real_toggle_lines_cb();
- void real_set_line_len_cb(Fl_Input* o);
- void real_set_soft_thres_cb(Fl_Input* o);
-};
-
-#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/MotifWindow.hpp"
-
-#include <iostream>
-
-#include <FL/fl_show_colormap.H>
-
-using namespace std;
-
-fltk_motif
-new_blank_motif()
-{
- fltk_motif *a_motif;
-
- a_motif = new fltk_motif;
- a_motif->name = "";
- a_motif->seq = "";
- a_motif->color = (Fl_Color) 5;
- a_motif->locations.clear();
- a_motif->dirty = false;
-
- cout << "name: " << a_motif->name << " seq: " << a_motif->seq << endl;
-
- return *a_motif;
-}
-
-
-void
-cb_motif_in(Fl_Input* o, void* v)
-{
- motif_instance * blah = (motif_instance *) v;
- MotifWindow* T= blah->mw_ptr;
- T->cb_motif_in_i(o,blah->index);
-}
-
-
-void
-cb_motif_color(Fl_Button* o, void* v)
-{
- motif_instance * blah = (motif_instance *) v;
- MotifWindow* T= blah->mw_ptr;
- T->cb_motif_color_i(o,blah->index);
-}
-
-
-MotifWindow::MotifWindow(int w, int h, const char* title,
- vector<fltk_motif> * some_motifs):Fl_Window(w,h,title)
-{
- int i;
-
- the_motifs = some_motifs;
- motif_count = 0;
-
- motif_color_buttons.clear();
-
- begin();
- motif_input_pack = new Fl_Pack(0, 0, w, h);
- motif_input_pack->spacing(4);
-
- // button to add new fltk_motif inputs
- add_motif = new Fl_Button(0,0,100,24,"Add Motif Slot");
- add_motif->callback((Fl_Callback*)add_motif_cb, this);
- motif_input_pack->add(add_motif);
- // test button to make sure fltk_motif data is being stored
- test = new Fl_Button(0,0,100,24,"show motifs");
- test->callback((Fl_Callback*)print_cb, this);
- motif_input_pack->add(test);
- // creat an initial set of fltk_motif input widgets and attach to fltk_motif vector
- for (i = 0; i < 5; i++)
- {
- add_motif_input(i);
- motif_count++;
- }
-
-
-
-
- add(motif_input_pack);
-
- end();
- resizable(this);
- show();
-}
-
- //tmp_input->user_data((void*) i);
-
-MotifWindow::~MotifWindow(){}
-
-void
-MotifWindow::add_motif_input(int index)
-{
- Fl_Input * new_input;
- Fl_Button *new_color_button;
- motif_instance * something;
- Fl_Pack * motif_hor_pack;
-
-
- something = new motif_instance;
- something->mw_ptr = this;
- something->index = index;
-
- motif_hor_pack = new Fl_Pack(0, 0, w(), 24);
- motif_hor_pack->type(Fl_Pack::HORIZONTAL);
- motif_hor_pack->spacing(4);
-
- // setup the color display/selection button
- new_color_button = new Fl_Button(0, 0, 24, 24, "");
- new_color_button->color((*the_motifs)[index].color);
- new_color_button->box(FL_FLAT_BOX);
- new_color_button->callback((Fl_Callback*)cb_motif_color, (void*) something);
- motif_color_buttons.push_back(new_color_button);
- motif_hor_pack->add(new_color_button);
-
-
- // setup the fltk_motif inputs
- new_input = new Fl_Input(0, 0, 200, 24, "");
- new_input->value( ((*the_motifs)[index].seq).c_str() );
- new_input->callback((Fl_Callback*)cb_motif_in, (void*) something);
- motif_ins.push_back(new_input);
- motif_hor_pack->add(new_input);
-
- motif_input_pack->add(motif_hor_pack);
-}
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
-
-void
-MotifWindow::cb_motif_in_i(Fl_Input* o, int i)
-{
- (*the_motifs)[i].seq = o->value();
- (*the_motifs)[i].dirty = true;
-}
-
-void
-MotifWindow::cb_motif_color_i(Fl_Button* o, int i)
-{
- //Fl_Color new_color;
-
- (*the_motifs)[i].color = fl_show_colormap((*the_motifs)[i].color);
- //motif_color_buttons[i]->
- o->color((*the_motifs)[i].color);
- redraw();
-}
-
-void MotifWindow::add_motif_cb(Fl_Button* o, void* v)
-{
- MotifWindow* T=(MotifWindow*)v;
- T->add_motif_cb_real(o,v);
-}
-
-
-void MotifWindow::add_motif_cb_real(Fl_Button* , void*)
-{
- fltk_motif blank_motif;
-
- //blank_motif.name = "";
- //blank_motif.seq = "";
- blank_motif = new_blank_motif();
- (*the_motifs).push_back(blank_motif);
- add_motif_input(motif_count++);
- redraw();
-}
-
-
-void MotifWindow::print_cb(Fl_Button* o, void* v)
-{
- MotifWindow* T=(MotifWindow*)v;
- T->print_cb_real(o,v);
-}
-
-
-void MotifWindow::print_cb_real(Fl_Button* , void*)
-{
- int i;
-
- for (i = 0; i < motif_count; i++)
- cout << (*the_motifs)[i].seq << endl;
-}
+++ /dev/null
-#ifndef _MUSSA_GUI_MOTIF_WINDOW_H_
-#define _MUSSA_GUI_MOTIF_WINDOW_H_
-// 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 <list>
-#include <string>
-#include <vector>
-
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Button.H>
-
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Pack.H>
-
-#include "alg/mussa.hpp"
-
-struct fltk_motif
-{
- std::string name, seq;
- Fl_Color color;
- std::vector<std::vector<int> > locations;
- bool dirty;
-};
-
-//typedef motif_ptr *fltk_motif;
-
-
-class MotifWindow : public Fl_Window
-{
- public:
- MotifWindow(int w, int h, const char* title, std::vector<fltk_motif> * some_motifs);
- ~MotifWindow();
- Fl_Pack * motif_input_pack;
- std::list<Fl_Input*> motif_ins;
- std::vector<Fl_Button*> motif_color_buttons;
- std::list<Fl_Input*> name_ins;
- Fl_Button* test;
- Fl_Button* add_motif;
-
- void cb_motif_in_i(Fl_Input*, int i);
- void cb_motif_color_i(Fl_Button* o, int i);
-
- private:
- std::vector<fltk_motif> * the_motifs;
- int motif_count;
-
- void add_motif_input(int index);
-
- static void add_motif_cb(Fl_Button*, void*);
- inline void add_motif_cb_real(Fl_Button*, void*);
-
- static void print_cb(Fl_Button*, void*);
- inline void print_cb_real(Fl_Button*, void*);
-};
-
-// crazy whacked shite Titus taught me to do to get an index value associated
-// with each instance of an input associated with the callback...
-struct motif_instance
-{
- MotifWindow * mw_ptr;
- int index;
-};
-
-fltk_motif new_blank_motif();
-#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/SeqTextWindow.hpp"
-
-#include <iostream>
-using namespace std;
-void
-get_seq_cb(Fl_Button* o, void* v)
-{
- SeqTextWindow* T=(SeqTextWindow*)v;
- T->real_get_seq_cb();
-}
-
-void
-SeqTextWindow::real_get_seq_cb()
-{
- string sub_seq_formatted;
- int seq_len, i, line_len;
-
-
- cout << "length = " << seq_end-seq_start << endl;
-
- // make sure inputed values within valid ranges
- if ((seq_end > seq_start) && (seq_id > -1) && (seq_id < the_seqs.size()) )
- {
- sub_sequence = the_seqs[seq_id].subseq(seq_start, seq_end-seq_start);
-
- sub_seq_formatted = "";
- seq_len = sub_sequence.size();
- line_len = 40;
- for (i = 0; i < seq_len; i += line_len)
- {
- sub_seq_formatted.append(sub_sequence.substr(i,line_len));
- sub_seq_formatted.append("\n");
- }
-
- seq_display->value((const char *)sub_seq_formatted.c_str());
- }
-}
-
-
-// *** input seq index id
-
-void
-set_seq_id_cb(Fl_Input* o, void* v)
-{
- SeqTextWindow* T=(SeqTextWindow*)v;
- T->real_set_seq_id_cb(o);
-}
-
-void
-SeqTextWindow::real_set_seq_id_cb(Fl_Input* o)
-{
- seq_id = atoi(o->value()) - 1; // -1 since arrays start at 0
-}
-
-
-// *** input seq start index
-
-void
-set_seq_start_cb(Fl_Input* o, void* v)
-{
- SeqTextWindow* T=(SeqTextWindow*)v;
- T->real_set_seq_start_cb(o);
-}
-
-void
-SeqTextWindow::real_set_seq_start_cb(Fl_Input* o)
-{
- seq_start = atoi(o->value());
-}
-
-// *** input seq end index
-
-void
-set_seq_end_cb(Fl_Input* o, void* v)
-{
- SeqTextWindow* T=(SeqTextWindow*)v;
- T->real_set_seq_end_cb(o);
-}
-
-void
-SeqTextWindow::real_set_seq_end_cb(Fl_Input* o)
-{
- seq_end = atoi(o->value());
-}
-
-
-SeqTextWindow::SeqTextWindow(int w, int h, const char* title,
- vector<Sequence> some_Seqs):Fl_Window(w,h,title)
-{
- string a_name;
- color(FL_WHITE);
- the_seqs = some_Seqs;
-
-
- seq_id = -1;
- seq_start = 1000000;
- seq_end = -1000000;
-
- begin();
-
- seq_id_input = new Fl_Input(80,10,30,30, "Seq num: ");
- seq_id_input->value("");
- seq_id_input->callback((Fl_Callback*)set_seq_id_cb, this);
-
- seq_start_input = new Fl_Input(160,10,100,30, " start: ");
- seq_start_input->value("");
- seq_start_input->callback((Fl_Callback*)set_seq_start_cb, this);
-
- seq_end_input = new Fl_Input(310,10,100,30, "end: ");
- seq_end_input->value("");
- seq_end_input->callback((Fl_Callback*)set_seq_end_cb, this);
-
- seq_display = new Fl_Multiline_Output(10, 50, w-20, h-60, "");
- seq_display->value("");
-
- //seq_display2 = new Fl_Text_Display(10,100, w-20, h-110,"");
-
- // button to get the sequence
- get_seq_but = new Fl_Button(w-80,10,80,30,"Get Seq");
- get_seq_but->callback((Fl_Callback*)get_seq_cb, this);
-
-
- end();
- //resizable(this);
- show();
-}
-
-
-SeqTextWindow::~SeqTextWindow(){}
-
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
+++ /dev/null
-#ifndef _MUSSA_GUI_SEQ_TEXT_H_
-#define _MUSSA_GUI_SEQ_TEXT_H_
-// 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 <string>
-#include <vector>
-
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Text_Buffer.H>
-#include <FL/Fl_Text_Display.H>
-#include <FL/Fl_Multiline_Output.H>
-#include <FL/Fl_Window.H>
-
-#include "alg/sequence.hpp"
-
-class SeqTextWindow : public Fl_Window
-{
- public:
- SeqTextWindow(int w, int h, const char* title, std::vector<Sequence> some_Seqs);
- ~SeqTextWindow();
-
- Fl_Button* get_seq_but;
- Fl_Multiline_Output* seq_display;
- Fl_Text_Buffer* seq_buffer;
- Fl_Text_Display* seq_display2;
- Fl_Input *seq_id_input;
- Fl_Input *seq_start_input;
- Fl_Input *seq_end_input;
-
- // callback receiver functions
-
- void real_get_seq_cb();
- void real_set_seq_id_cb(Fl_Input* o);
- void real_set_seq_start_cb(Fl_Input* o);
- void real_set_seq_end_cb(Fl_Input* o);
-
- private:
- // sequence data
- std::vector<Sequence> the_seqs;
- std::string sub_sequence;
- int seq_id, seq_start, seq_end;
-};
-#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/SeqView.hpp"
-#include <iostream>
-#include <sstream>
-
-#include <FL/Fl.H>
-#include <FL/fl_draw.H>
-
-using namespace std;
-
-void
-SeqView::setup(string name, int sq_num,
- vector<Sequence> *some_seqs,
- list<ConservedPath > some_paths, vector<int> some_lens,
- vector<fltk_motif> *some_motifs)
-{
- int seq_i;
-
- analysis_name = name;
- seq_num = sq_num;
- S = some_seqs;
- P = some_paths;
- seq_lens = some_lens;
- the_motifs = some_motifs;
-
- y_seq_incre = (y_max-10-10) / (seq_num - 1);
-
- fl_font(FL_COURIER, 14);
- cout << "font width: " << fl_width('A') << endl;
-
- index_pad = 6 * (int) fl_width('A') + 5;
-
- align_offsets(0);
-
- raw_sequence.clear();
- for(seq_i = 0; seq_i < seq_num; ++seq_i)
- raw_sequence.push_back( (*S)[seq_i].get_seq() );
-
- for(list<ConservedPath >::iterator pathz_i = P.begin();
- pathz_i != P.end();
- ++pathz_i)
- {
- show_aligns.push_back(true);
- }
-
- dragging = false;
- scroll_offset = 0;
- //scroll_pos = 0;
- drag_change = 0;
-
- cout << "waaaaa!\n";
- cout << x() << " " << y() << " " << w() << " " << h() << endl;
-}
-
-void
-SeqView::resize(int new_x, int new_y, int new_w, int new_h)
-{
- x(new_x);
- y(new_y);
- w(new_w);
- h(new_h);
-
- // hmmm, why do I use these values on the the widgets inherent ones?
- // I think there was a reason...once?
- x_max = new_w;
- y_max = new_h;
- x_min = new_x;
- y_min = new_y;
-
- // things that need to be recalculated
- y_seq_incre = (y_max-10-10) / (seq_num - 1);
-}
-
-
-void
-SeqView::draw()
-{
- double ch_width;
-
-
- // clear drawing area and set background to white
- fl_color(FL_WHITE);
- fl_rectf(x(), y(), w(), h());
-
- fl_font(FL_COURIER, 14);
- //blatantly stolen from FR2
- ch_width = fl_width('A'); // monospaced: all characters are same width
-
-
- if (show_bars)
- {
- int grey_box_num, grey_box_len;
- int i;
- // draw in some light grey boxes every 10bp to delineate for user
- //fl_color(200,235,235);
- fl_color(180,180,180);
- grey_box_num = (((x_max - index_pad) / (int) ch_width) / 10) + 1;
- grey_box_len = 10 * (int) ch_width;
- for(i = 0; i < grey_box_num; i++)
- if ((i % 2) != 0)
- fl_rectf(x()+index_pad-1 + (i * grey_box_len), y(), grey_box_len, h());
- }
-
- if (show_motifs)
- draw_motifs(ch_width);
-
- draw_sequence(ch_width);
-
- draw_match_lines(ch_width);
-
- draw_indices(ch_width);
-
-
- // draw some bounding boxes to visually separate things
- fl_color(150,200,255);
- fl_line_style(FL_SOLID, 2, NULL);
- fl_rect(x(), y(), w(), h());
- fl_rect(x()+index_pad-1, y(), w()-2*(index_pad-1), h());
-}
-
-void
-SeqView::draw_motifs(double ch_width)
-{
- vector<fltk_motif>::iterator motif_i;
- vector<int> some_motif_locs;
- vector<int>::iterator i_locs;
- int scale_len, motif_len, i2;
- int y_loc, x_start;
-
- //fl_color(255,0,255);
- fl_line_style(FL_SOLID, 10, NULL);
- motif_i = the_motifs->begin();
- while (motif_i != the_motifs->end())
- {
- fl_color(motif_i->color);
- motif_len = motif_i->seq.length();
- scale_len = (int) (motif_len * ch_width);
- y_loc = y_min + 10;
- if (!motif_i->locations.empty())
- for(i2 = 0; i2 < seq_num; i2++)
- {
- some_motif_locs = (*motif_i).locations[i2];
-
- i_locs = some_motif_locs.begin();
- while (i_locs != some_motif_locs.end())
- {
- x_start = (int) ((*i_locs +scroll_offset - seq_align_offsets[i2])
- * ch_width) + index_pad + x();
-
- //cout << *i_locs << ":" << x_start << " ";
- // don't draw highlights outside of box range, they can wraparound past some boundry
- if ((x_start > 0) && (x_start < w()))
- fl_line(x_start,y_loc,x_start+scale_len,y_loc);
- ++i_locs;
- }
- //cout << endl;
- y_loc += y_seq_incre;
- }
- ++motif_i;
- }
-}
-
-void
-SeqView::draw_sequence(double ch_width)
-{
- int i, seq_i, y_loc;
- Sequence a_seq;
- string sub_seq;
- int seq_len, sub_seq_start, sub_seq_len;
-
-
-
- fl_color(FL_BLACK);
- y_loc = y_min + 10 + 5;
-
- for(seq_i = 0; seq_i < seq_num; seq_i++)
- {
- seq_len = raw_sequence[seq_i].length();
- sub_seq_start = seq_align_offsets[seq_i] - scroll_offset;
- sub_seq_len = (x_max - index_pad) / (int) ch_width;
- //cout << x_max << " index_pad: " << index_pad << " y - ip: " << (x_max - index_pad) << endl;
-
- // gotta check thru boundary conditions to make sure we're producing the
- // right string for the current position (otherwise gonna crash due to
- // illegal indexing into substr
- if (sub_seq_start < 0)
- {
- sub_seq_len = sub_seq_len - sub_seq_start;
- if (sub_seq_len < 0)
- sub_seq_len = 0;
- sub_seq_start = 0;
- }
- else if (sub_seq_start >= seq_len)
- {
- sub_seq_start = seq_len;
- sub_seq_len = 0;
- }
- else if ((sub_seq_start + sub_seq_len) >= seq_len)
- sub_seq_len = seq_len - sub_seq_start;
-
- sub_seq = raw_sequence[seq_i].substr(sub_seq_start, sub_seq_len);
- fl_draw(sub_seq.c_str(), index_pad, y_loc);
- y_loc += y_seq_incre;
- }
-}
-
-
-void
-SeqView::draw_match_lines(double ch_width)
-{
- int i, y_loc;
- int i2, i3;
- int x_start, y_start, x_end, y_end;
- int window_length, win_i;
- int rc_1 = 0;
- int rc_2 = 0;
- int offset1, offset2;
- float center1, center2;
- bool rc_color;
- vector<bool> rc_list;
- bool full_match;
- vector<bool> matched;
- int align_counter;
-
-
- align_counter = 0;
- for(list<ConservedPath >::iterator pathz_i = P.begin();
- pathz_i != P.end();
- ++pathz_i)
- {
- if (show_aligns[align_counter])
- {
- ConservedPath& a_path = *pathz_i;
- window_length = a_path.window_size;
- // determine which parts of the path are RC relative to first species
- rc_list = a_path.reverseComplimented();
-
- // loop over each bp in the conserved region for all sequences
- for(win_i = 0; win_i < window_length; win_i++)
- {
- // determine which exact base pairs match between the sequences
- full_match = true;
- for(i2 = 0; i2 < a_path.size()-1; i2++)
- {
- // assume not rc as most likely, adjust below
- rc_1 = 0;
- rc_2 = 0;
- // no matter the case, any RC node needs adjustments
- if (a_path[i2] < 0)
- rc_1 = window_length-1;
- if (a_path[i2+1] < 0)
- rc_2 = window_length-1;
-
- x_start = (abs(a_path[i2]-rc_1+win_i));
- x_end = (abs(a_path[i2+1]-rc_2+win_i));
-
- // RC case handling
- // ugh, and xor...only want rc coloring if just one of the nodes is rc
- // if both nodes are rc, then they are 'normal' relative to each other
- if ( ( rc_list[i2] || rc_list[i2+1] ) &&
- !(rc_list[i2] && rc_list[i2+1] ) )
- { //the hideous rc matching logic - not complex, but annoying
- if ( !( ( (raw_sequence[i2][x_start] == 'A') &&
- (raw_sequence[i2+1][x_end] == 'T') ) ||
- ( (raw_sequence[i2][x_start] == 'T') &&
- (raw_sequence[i2+1][x_end] == 'A') ) ||
- ( (raw_sequence[i2][x_start] == 'G') &&
- (raw_sequence[i2+1][x_end] == 'C') ) ||
- ( (raw_sequence[i2][x_start] == 'C') &&
- (raw_sequence[i2+1][x_end] == 'G') ) ) )
- full_match = false;
- }
- else
- {
- if (!( (raw_sequence[i2][x_start] == raw_sequence[i2+1][x_end]) &&
- (raw_sequence[i2][x_start] != 'N') &&
- (raw_sequence[i2+1][x_end] != 'N') ) )
- full_match = false;
- }
- }
-
- // draw for matches stretching across all sequences
- if (full_match)
- {
- fl_line_style(FL_SOLID, 1, NULL);
-
- // now can draw the line for each bp in this window that matches
- // grrr, need to ask if anyone cares if I switch the seq
- // top-bot order...
- i3 = 0;
- y_loc = y_min + 5;
- for(i2 = 0; i2 < a_path.size()-1; i2++)
- {
- // assume not rc as most likely, adjust below
- rc_1 = 0;
- rc_2 = 0;
- // this makes the lines start in the middle of the drawn char/bp
- center1 = 0.5;
- center2 = 0.5;
- // no matter the case, any RC node needs adjustments
- if (a_path[i2] < 0)
- {
- rc_1 = window_length;
- center1 = -center1;
- }
- if (a_path[i2] < 0)
- {
- rc_2 = window_length;
- center2 = -center2;
- }
-
- // set offset based on current alignment for which bp to show
- offset1 = seq_align_offsets[i2];
- offset2 = seq_align_offsets[i2+1];
-
- if ( ( rc_list[i2] || rc_list[i2+1] ) &&
- !(rc_list[i2] && rc_list[i2+1] ) )
- fl_color(FL_BLUE);
- else
- fl_color(FL_RED);
-
- // maybe shouldn't recalc these, but store values from first loop
- x_start = (abs((int) (a_path[i2]-rc_1+win_i)));
- x_end = (abs((int) (a_path[i2+1]-rc_2+win_i)));
-
- fl_line( (int)((x_start+center1-offset1+scroll_offset)*ch_width)
- + index_pad, y_loc + 10,
- (int)((x_end+center2-offset2+scroll_offset)*ch_width)
- + index_pad, y_loc+y_seq_incre );
- y_loc += y_seq_incre;
- }
- }
- }
- }
- align_counter++;
- }
-}
-
-void
-SeqView::draw_indices(double ch_width)
-{
- int seq_i;
- Sequence a_seq;
- int y_loc;
- ostringstream an_index;
- int shown_seq_len;
-
-
- // clear out space on sides to draw in index values
- // I block out the sides rather than adding offsets to the drawing of seq
- // and conservation lines since the lines need to draw off the 'edge'
- fl_color(FL_WHITE);
- fl_rectf(0, y_min, index_pad, h()+y_min);
- fl_rectf(w()-index_pad, y_min, index_pad, h()+y_min);
-
- // now can draw in the indices of the start and end of the shown sequence
- fl_color(FL_BLACK);
- y_loc = y_min + 10 + 5;
- for(seq_i = 0; seq_i < seq_num; seq_i++)
- {
- an_index.str("");
- an_index << (seq_align_offsets[seq_i]-scroll_offset);
- fl_draw((an_index.str()).c_str(), 2, y_loc);
-
- shown_seq_len = (w() - 2 * index_pad) / (int) ch_width;
- an_index.str("");
- an_index << (seq_align_offsets[seq_i]-scroll_offset+shown_seq_len);
- fl_draw((an_index.str()).c_str(), w()-index_pad+2, y_loc);
- y_loc += y_seq_incre;
- }
-}
-
-
-void
-SeqView::toggle_align(int align_num)
-{
- //cout << align_num << endl;
- //cout << show_aligns[align_num] << endl;
- show_aligns[align_num] = !show_aligns[align_num];
- //cout << show_aligns[align_num] << endl;
-}
-
-
-void
-SeqView::align_offsets(int align_num)
-{
- list<ConservedPath >::iterator pathz_i;
- int i;
- int window_length;
-
- cout << "alignment: " << align_num << endl;
-
- if (P.begin() == P.end())
- cout << "crud....\n";
- else
- {
- pathz_i = P.begin();
-
- while(pathz_i != P.end())
- ++pathz_i;
-
- // find the path specified
- i = 0;
- pathz_i = P.begin();
- while( (i < align_num) && (pathz_i != P.end()) )
- {
- ++i;
- ++pathz_i;
- }
-
- // now set the alignment offsets - basically where the path starts
- seq_align_offsets.clear();
- for(i = 0; i < seq_num ; i++)
- {
- //cout << (*pathz_i)[i+1] << endl;
- seq_align_offsets.push_back( abs((*pathz_i).track_indexes[i]) );
- // for testing purposes: to see everything in the short test sequences
- //seq_align_offsets.push_back(0);
- }
- // reset any dragging done, otherwise might be hard to find selected align
- scroll_offset = 0;
- }
-}
-
-
-
-int
-SeqView::handle(int e)
-{
- int return_value;
-
- // this empty string needs to be put on cout, otherwise the -O optimize
- // compile option seems to throw this function away with the following:
- // gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
- cout << "";
-
- switch(e)
- {
- case FL_PUSH:
- if (Fl::event_button3())
- {
- cout << "menu menu menu!\n";
- return_value = 1;
- }
- break;
- case FL_DRAG:
- if (!dragging)
- {
- drag_change = Fl::event_x();
- dragging = true;
- return_value = 1;
- }
- drag_change = Fl::event_x() - drag_change;
- scroll_offset += drag_change;
- drag_change = Fl::event_x();
- redraw();
- break;
- case FL_RELEASE:
- if (dragging)
- {
- //scroll_offset += Fl::event_x() - drag_start;
- //scroll_dist = Fl::event_x() - drag_start;
- //scroll_offset += scroll_dist;
- //scroll_offset += scroll_pos;
- dragging = false;
- redraw();
- return_value = 1;
- }
- break;
- default:
- return_value = Fl_Widget::handle(e);
- }
-
- return return_value;
-}
-
-void
-SeqView::toggle_bars()
-{
- show_bars = !show_bars;
- redraw();
-}
-
-
-void
-SeqView::toggle_motifs()
-{
- show_motifs = !show_motifs;
- redraw();
-}
-
-
-void
-SeqView::reporter(string id, int value)
-{
- cout << id << " : " << value << endl;
-}
-
-
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
+++ /dev/null
-#ifndef _MUSSA_GUI_SEQ_VIEW_H_
-#define _MUSSA_GUI_SEQ_VIEW_H_
-// 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 <list>
-#include <string>
-#include <vector>
-
-#include <FL/Fl_Box.H>
-
-#include "gui/MotifWindow.hpp"
-#include "gui/SetupWindow.hpp"
-
-class SeqView : public Fl_Box
-{
- public:
- SeqView(int x_top,int y_top,int x_bot,int y_bot) :
- Fl_Box(x_top,y_top,x_bot,y_bot)
- {
- x_max = x_bot;
- y_max = y_bot;
- x_min = x_top;
- y_min = y_top;
- show_bars = true;
- show_motifs = true;
- }
-
- void setup(std::string name, int sq_num, std::vector<Sequence> *some_seqs,
- std::list<ConservedPath > some_paths,
- std::vector<int> some_lens, std::vector<fltk_motif> *some_motifs);
- void align_offsets(int align_num);
- void toggle_align(int align_num);
- void toggle_bars();
- void toggle_motifs();
-
- private:
- std::string analysis_name;
- int seq_num;
- int base_window_len;
-
- //this data is passed as pointers to the instantiated classes
- std::vector<Sequence> *S;
- //list of paths in selection box
- std::list<ConservedPath > P;
- std::vector<int> seq_lens;
- //pointer to passed fltk_motif data
- std::vector<fltk_motif> *the_motifs;
-
- int x_max, y_max, x_min, y_min;
- int y_seq_incre;
- int index_pad;
- std::vector<int> seq_align_offsets;
- std::vector<std::string> raw_sequence;
- bool dragging;
- int drag_change, scroll_offset;
- bool show_bars, show_motifs;
- std::vector<bool> show_aligns;
-
- void resize(int new_x, int new_y, int new_w, int new_h);
- void draw();
- void draw_motifs(double ch_width);
- void draw_sequence(double ch_width);
- void draw_match_lines(double ch_width);
- void draw_indices(double ch_width);
- int handle(int e);
- void reporter(std::string id, int value);
-};
-#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/SeqWindow.hpp"
-
-#include <sstream>
-
-#include <FL/Fl.H>
-
-using namespace std;
-
-void
-set_align_cb(Fl_Widget* widg, void* the_data)
-{
- menu_align_data_bundle * blah = (menu_align_data_bundle *) the_data;
- SeqWindow* T= blah->swm_ptr;
- T->real_set_align_cb(blah->which_align);
-}
-
-
-void
-SeqWindow::real_set_align_cb(int which_align)
-{
- seq_box->align_offsets(which_align);
- seq_box->redraw();
-}
-
-
-void
-show_align_cb(Fl_Widget* widg, void* the_data)
-{
- menu_align_data_bundle * blah = (menu_align_data_bundle *) the_data;
- SeqWindow* T= blah->swm_ptr;
- T->real_show_align_cb(blah->which_align);
-}
-
-
-void
-SeqWindow::real_show_align_cb(int which_align)
-{
- vector<int> a_path;
- int window_length;
-
- cout << "fumish\n";
- seq_box->toggle_align(which_align);
- seq_box->redraw();
-}
-
-
-void
-toggle_bars_cb(Fl_Button* o, void* v)
-{
- SeqWindow* T=(SeqWindow*)v;
- T->real_toggle_bars_cb();
-}
-
-
-void
-SeqWindow::real_toggle_bars_cb()
-{
- seq_box->toggle_bars();
-}
-
-
-void
-toggle_motifs_cb(Fl_Button* o, void* v)
-{
- SeqWindow* T=(SeqWindow*)v;
- T->real_toggle_motifs_cb();
-}
-
-
-void
-SeqWindow::real_toggle_motifs_cb()
-{
- seq_box->toggle_motifs();
-}
-
-
-// main code, window creation
-
-SeqWindow::SeqWindow(int w, int h, const char* title, int sq_num,
- vector<Sequence> *some_seqs,
- list<ConservedPath > some_paths,
- vector<int> some_lens,
- vector<fltk_motif> *some_motifs):
- Fl_Double_Window(w,h,title)
-{
- menu_align_data_bundle * some_menu_data;
- int window_length, align_number;
- int i;
- ostringstream align_id_ostr;
- string align_id_string;
- list<ConservedPath >::iterator align_iter;
-
- // most of this stuff is here just to pass to SeqView object
- // some is needed to setup the window menus
- seq_num = sq_num;
- S = some_seqs;
- P = some_paths;
- seq_lens = some_lens;
- the_motifs = some_motifs;
-
-
- begin();
- color(FL_WHITE);
- resizable(this);
-
- // make the menu that allows alignment selection
- choose_align_menu = new Fl_Menu_Button(5, 2, 180, 30, "Choose Alignment");
- choose_align_menu->color(FL_WHITE,FL_BLUE);
- choose_align_menu->box(FL_BORDER_BOX);
- choose_align_menu->clear();
-
- // make the menu that allows alignment selection
- show_align_menu = new Fl_Menu_Button(190, 2, 180, 30, "Show Alignment");
- show_align_menu->color(FL_WHITE,FL_BLUE);
- show_align_menu->box(FL_BORDER_BOX);
- show_align_menu->clear();
-
-
- // adds menu items for each path
- align_iter = P.begin();
- align_number = 0;
- while(align_iter != P.end())
- {
- some_menu_data = new menu_align_data_bundle;
- some_menu_data->swm_ptr = this;
- some_menu_data->which_align = align_number;
- align_id_ostr << (*align_iter).window_size << ": ";
- for(i = 0; i != seq_num; i++)
- align_id_ostr << (*align_iter).track_indexes[i] << ", ";
- align_id_string = align_id_ostr.str();
- choose_align_menu->add((const char*)align_id_string.c_str(), 0,
- (Fl_Callback *) set_align_cb,
- (void*) some_menu_data);
- show_align_menu->add((const char*)align_id_string.c_str(), 0,
- (Fl_Callback *) show_align_cb,
- (void*) some_menu_data, FL_MENU_TOGGLE|FL_MENU_VALUE);
-
- align_id_ostr.str("");
- ++align_number;
- ++align_iter;
- }
-
- Fl_Button *test_but = new Fl_Button(375, 2, 150, 30, "Toggle Motifs");
- test_but->color(FL_WHITE,FL_BLUE);
- test_but->box(FL_BORDER_BOX);
- test_but->callback((Fl_Callback*) toggle_motifs_cb, this);
-
- toggle_bars = new Fl_Button(530, 2, 150, 30, "Toggle 10bp bars");
- toggle_bars->color(FL_WHITE,FL_BLUE);
- toggle_bars->box(FL_BORDER_BOX);
- toggle_bars->callback((Fl_Callback*) toggle_bars_cb, this);
-
-
- // make the view of the sequence
- seq_box = new SeqView(0, 34, w, h-34);
- seq_box->setup(analysis_name, seq_num, S, P, seq_lens, the_motifs);
- //real_set_align_cb(2);
-
- end();
- Fl::visual(FL_DOUBLE|FL_INDEX);
- show();
-}
+++ /dev/null
-#ifndef _MUSSA_GUI_SEQ_H_
-#define _MUSSA_GUI_SEQ_H_
-// 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 <iostream>
-#include <list>
-#include <string>
-#include <vector>
-
-#include "gui/SeqView.hpp"
-
-#include <FL/Fl_Menu_Bar.H>
-#include <FL/Fl_Menu_Item.H>
-#include <FL/Fl_Menu_Button.H>
-#include <FL/Fl_Double_Window.H>
-
-class SeqWindow : public Fl_Double_Window
-{
- private:
- std::string analysis_name;
- int base_window_len;
-
- //this data is passed as pointers to the instantiated classes
- std::vector<Sequence> *S;
- // list of paths in selection box
- std::list<ConservedPath > P;
- std::vector<int> seq_lens;
- //pointer to passed fltk_motif data
- std::vector<fltk_motif> *the_motifs;
-
- int x_max, y_max;
- Fl_Menu_Button *choose_align_menu;
- Fl_Menu_Button *show_align_menu;
- Fl_Button *toggle_bars;
- SeqView *seq_box;
-
- public:
- int seq_num;
-
- SeqWindow(int w, int h, const char* title, int sq_num,
- std::vector<Sequence> *some_seqs,
- std::list<ConservedPath > some_paths,
- std::vector<int> some_lens,
- std::vector<fltk_motif> *some_motifs);
- virtual ~SeqWindow(){ std::cout << "dying\n"; }
-
- void make_choose_menu();
- void make_show_menu();
- void real_set_align_cb(int which_align);
- void real_show_align_cb(int which_align);
- void real_toggle_bars_cb();
- void real_toggle_motifs_cb();
-};
-
-
-struct menu_align_data_bundle
-{
- SeqWindow * swm_ptr;
- int which_align;
-};
-#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/SetupWindow.hpp"
-#include "alg/mussa.hpp"
-#include "mussa_exceptions.hpp"
-#include <iostream>
-#include <FL/Fl_File_Chooser.H>
-
-using namespace std;
-
-bool
-SetupWindow::done()
-{
- return all_done;
-}
-
-
-void
-do_analysis_cb(Fl_Button* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->real_do_analysis();
-}
-
-
-// passes the parameters to the mussa class object and orders it to run
-void
-SetupWindow::real_do_analysis()
-{
- int i;
- string err_msg;
-
- // <-- need a check here to make sure all vars have a valid value
-
- an_analysis->clear();
- an_analysis->set_name(analysis_name);
- an_analysis->set_window(window);
- an_analysis->set_threshold(threshold);
-
- for(i=0; i < seq_num; i++) {
- an_analysis->load_sequence(seq_files[i], annot_files[i], fasta_indices[i],
- sub_seq_starts[i], sub_seq_ends[i]);
- }
-
- try {
- an_analysis->analyze();
- } catch (mussa_analysis_error e) {
- fl_alert(e.what());
- }
-
- all_done = true;
-
- hide();
-}
-
-
-void
-choose_seq_file_cb(Fl_Button* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_choose_seq_file_cb(blah->index);
-}
-
-
-void
-SetupWindow::real_choose_seq_file_cb(int i)
-{
- char *picked_file;
- string a_file_path;
-
- picked_file = fl_file_chooser("Find an Analysis", "", "", 1);
- a_file_path = picked_file;
- seq_files[i] = a_file_path;
- seq_inputs[i]->value((const char *)picked_file);
-}
-
-
-void
-seq_file_in_cb(Fl_Input* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_seq_file_in_cb(o,blah->index);
-}
-
-
-void
-SetupWindow::real_seq_file_in_cb(Fl_Input* o, int i)
-{
- seq_files[i] = o->value();
- // leaving this as a reminder that bools will need to be set to determine
- // if all needed fields have been filled with some value before an analysis
- // is attempted
- //(*the_motifs)[i].dirty = true;
-}
-
-//char *picked_file;
-//picked_file = fl_file_chooser("Find an Analysis", "", "", 1);
-
-// *** Annot file selection
-
-void
-choose_annot_file_cb(Fl_Button* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_choose_annot_file_cb(blah->index);
-}
-
-
-void
-SetupWindow::real_choose_annot_file_cb(int i)
-{
- char *picked_file;
- string a_file_path;
-
- picked_file = fl_file_chooser("Find an Analysis", "", "", 1);
- a_file_path = picked_file;
- annot_files[i] = a_file_path;
- annot_inputs[i]->value((const char *)picked_file);
-}
-
-void
-annot_file_in_cb(Fl_Input* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_annot_file_in_cb(o,blah->index);
-}
-
-void
-SetupWindow::real_annot_file_in_cb(Fl_Input* o, int i)
-{
- annot_files[i] = o->value();
-}
-
-
-// *** fasta index selection
-
-void
-fa_index_in_cb(Fl_Input* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_fa_index_in_cb(o,blah->index);
-}
-
-void
-SetupWindow::real_fa_index_in_cb(Fl_Input* o, int i)
-{
- fasta_indices[i] = atoi(o->value());
-}
-
-// *** subsequence start select
-
-void
-sub_start_in_cb(Fl_Input* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_sub_start_in_cb(o,blah->index);
-}
-
-void
-SetupWindow::real_sub_start_in_cb(Fl_Input* o, int i)
-{
- sub_seq_starts[i] = atoi(o->value());
-}
-
-// *** subsequence end select
-
-void
-sub_end_in_cb(Fl_Input* o, void* v)
-{
- seq_data_instance * blah = (seq_data_instance *) v;
- SetupWindow* T= blah->sw_ptr;
- T->real_sub_end_in_cb(o,blah->index);
-}
-
-void
-SetupWindow::real_sub_end_in_cb(Fl_Input* o, int i)
-{
- sub_seq_ends[i] = atoi(o->value());
-
-}
-
-// *** input analysis name
-
-void
-set_ana_name_cb(Fl_Input* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->real_set_ana_name_cb(o);
-}
-
-void
-SetupWindow::real_set_ana_name_cb(Fl_Input* o)
-{
- analysis_name = o->value();
-}
-
-// *** input window size
-
-void
-set_win_size_cb(Fl_Input* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->real_set_win_size_cb(o);
-}
-
-void
-SetupWindow::real_set_win_size_cb(Fl_Input* o)
-{
- window = atoi(o->value());
-}
-
-// *** input threshold
-
-void
-set_threshold_cb(Fl_Input* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->real_set_threshold_cb(o);
-}
-
-void
-SetupWindow::real_set_threshold_cb(Fl_Input* o)
-{
- threshold = atoi(o->value());
-}
-
-void
-set_seq_num_cb(Fl_Input* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->real_set_seq_num_cb(o);
-}
-
-// *** input number of sequences, add appropriate inputs for each sequence
-
-void
-SetupWindow::real_set_seq_num_cb(Fl_Input* o)
-{
- int i;
-
- seq_num = atoi(o->value());
- seq_inputs.clear();
- annot_inputs.clear();
-
- seq_scroll = new Fl_Scroll(5,80,w()-10,h()-115);
- seq_scroll->color(FL_WHITE);
-
- for (i = 0; i < seq_num; i++)
- {
- seq_files.push_back("");
- annot_files.push_back("");
- fasta_indices.push_back(1);
- sub_seq_starts.push_back(0);
- sub_seq_ends.push_back(0);
- add_seq_input(i);
- }
- seq_scroll->box(FL_DOWN_FRAME);
- add(seq_scroll);
- redraw();
-}
-
-
-SetupWindow::SetupWindow(int w, int h, const char* title, Mussa *the_analysis):Fl_Window(w,h,title)
-{
- color(FL_WHITE);
-
- an_analysis = the_analysis;
- all_done = false;
-
- begin();
-
- name_input = new Fl_Input(110, 10, w-120, 30, "Analysis Name ");
- name_input->value("");
- //name_input->when(FL_WHEN_ENTER_KEY);
- name_input->box(FL_BORDER_BOX);
- name_input->callback((Fl_Callback*)set_ana_name_cb, this);
-
- // add in radio buttons for win_append and thres_append eventually
- win_append = true;
- thres_append = true;
-
- win_input = new Fl_Input(65,45,100,30, "Window ");
- win_input->value("");
- win_input->callback((Fl_Callback*)set_win_size_cb, this);
-
- thres_input = new Fl_Input(250,45,100,30, "Threshold ");
- thres_input->value("");
- thres_input->callback((Fl_Callback*)set_threshold_cb, this);
-
- seq_num_input = new Fl_Input(480,45,100, 30, "Number of Seqs");
- seq_num_input->value("");
- seq_num_input->callback((Fl_Callback*)set_seq_num_cb, this);
-
- // button to launch the analysis
- test = new Fl_Button(w-100,h-30,100,30,"Do Analysis");
- test->callback((Fl_Callback*)do_analysis_cb, this);
-
- // test button to make sure setup data is being stored
- test = new Fl_Button(w-200,h-30,100,30,"show setup");
- test->callback((Fl_Callback*)print_cb, this);
-
- // generic input, keeping around as template for future additions
- //_input = new Fl_Input(0, , 30, "");
- //_input->value("");
- //_input->when(FL_WHEN_ENTER_KEY);
- //_input->callback((Fl_Callback*)set__cb, this);
-
- end();
- //resizable(this);
- show();
-}
-
-
-SetupWindow::~SetupWindow(){}
-
-
-void
-SetupWindow::add_seq_input(int i)
-{
- Fl_Input *fasta_input, *start_input, *end_input;
- Fl_Button *seq_browse, *annot_browse;
-
-
- // this remembers what seq index each input is associated with
- seq_data_instance * something;
- something = new seq_data_instance;
- something->sw_ptr = this;
- something->index = i;
-
-
- // setup sequence file input for text input or file browsing
- seq_inputs.push_back(new Fl_Input(55, 85+(i*105), w()-165, 30, "seq "));
- seq_inputs[i]->value("");
- seq_inputs[i]->callback((Fl_Callback*)seq_file_in_cb, (void*) something);
-
- seq_browse = new Fl_Button(w()-105, 85+(i*105), 80, 30, "Browse");
- seq_browse->callback((Fl_Callback*)choose_seq_file_cb, (void*) something);
-
- // setup annotation file input for text input or file browsing
- annot_inputs.push_back(new Fl_Input(55, 120+(i*105), w()-165, 30, "annot "));
- annot_inputs[i]->value("");
- annot_inputs[i]->callback((Fl_Callback*)annot_file_in_cb,(void*)something);
-
- annot_browse = new Fl_Button(w()-105, 120+(i*105), 80, 30, "Browse");
- annot_browse->callback((Fl_Callback*)choose_annot_file_cb, (void*)something);
-
- // index of fasta seq wanted if more than 1 seq in file
- fasta_input = new Fl_Input(90, 155+(i*105), 50, 30, "fasta index");
- fasta_input->value("");
- fasta_input->callback((Fl_Callback*)fa_index_in_cb, (void*) something);
-
- // subsequence select, index of first bp wanted
- start_input = new Fl_Input(225, 155+(i*105), 50, 30, "start index");
- start_input->value("");
- start_input->callback((Fl_Callback*)sub_start_in_cb, (void*) something);
-
- // subsequence select, index of last bp wanted
- end_input = new Fl_Input(355, 155+(i*105), 50, 30, "end index");
- end_input->value("");
- end_input->callback((Fl_Callback*)sub_end_in_cb, (void*) something);
-
- seq_scroll->add(seq_inputs[i]);
- seq_scroll->add(seq_browse);
- seq_scroll->add(annot_inputs[i]);
- seq_scroll->add(annot_browse);
- seq_scroll->add(fasta_input);
- seq_scroll->add(start_input);
- seq_scroll->add(end_input);
-}
-
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
-
-void SetupWindow::print_cb(Fl_Button* o, void* v)
-{
- SetupWindow* T=(SetupWindow*)v;
- T->print_cb_real(o,v);
-}
-
-
-void SetupWindow::print_cb_real(Fl_Button* , void*)
-{
- cout << "analysis_name: " << analysis_name << endl;
- cout << "win: " << window << endl;
- cout << "thres: " << threshold << endl;
- cout << "seq_num: " << seq_num << endl;
- //cout << "win_add: " << win_append << end;
- //cout << "thres_add: " << thres_append << endl;
-
- int i;
-
-
-
- for (i = 0; i < seq_num; i++)
- {
- cout << seq_files[i] << endl;
- cout << annot_files[i] << endl;
- cout << "fasta: " << fasta_indices[i];
- cout << " start: " << sub_seq_starts[i];
- cout << " end: " << sub_seq_ends[i] << endl;
- cout << "blargle!\n";
- }
- cout << "end of inputs\n" << endl;
-}
+++ /dev/null
-#ifndef _MUSSA_GUI_LOAD_WINDOW_H_
-#define _MUSSA_GUI_LOAD_WINDOW_H_
-
-// 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 <string>
-#include <vector>
-
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_Scroll.H>
-#include <FL/Fl_Window.H>
-
-class Mussa;
-#include "gui/SetupWindow.hpp"
-
-class SetupWindow : public Fl_Window
-{
- public:
- SetupWindow(int w, int h, const char* title, Mussa *an_analysis);
- ~SetupWindow();
-
- bool done();
-
- //did I put these in public for a reason?
- Fl_Button* test;
- Fl_Input *name_input;
- Fl_Input *win_input;
- Fl_Input *thres_input;
- Fl_Input *seq_num_input;
- Fl_Scroll *seq_scroll;
- // need to keep track of these so a browsed file search can set the input
- // fields to teh selected file
- std::vector<Fl_Input*> seq_inputs, annot_inputs;
-
-
- // callback receiver functions
-
- void real_do_analysis();
-
- void real_set_ana_name_cb(Fl_Input* o);
- void real_set_win_size_cb(Fl_Input* o);
- void real_set_threshold_cb(Fl_Input* o);
- void real_set_seq_num_cb(Fl_Input* o);
-
- void real_seq_file_in_cb(Fl_Input* o, int i);
- void real_choose_seq_file_cb(int i);
- void real_annot_file_in_cb(Fl_Input* o, int i);
- void real_choose_annot_file_cb(int i);
-
- void real_fa_index_in_cb(Fl_Input* o, int i);
- void real_sub_start_in_cb(Fl_Input* o, int i);
- void real_sub_end_in_cb(Fl_Input* o, int i);
-
- private:
- Mussa *an_analysis;
- std::string analysis_name;
- int window, threshold, seq_num;
- std::vector<std::string> seq_files, annot_files;
- std::vector<int> fasta_indices, sub_seq_starts, sub_seq_ends;
- bool win_append, thres_append;
-
- bool all_done;
- static void print_cb(Fl_Button*, void*);
- inline void print_cb_real(Fl_Button*, void*);
-
- void add_seq_input(int index);
-};
-
-// crazy whacked shite Titus taught me to do to get an index value associated
-// with each instance of an input associated with the callback...
-
-struct seq_data_instance
-{
- SetupWindow * sw_ptr;
- int index;
-};
-
-#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/SubAnalysisWindow.hpp"
-#include "alg/mussa.hpp"
-#include "mussa_exceptions.hpp"
-
-#include <iostream>
-using namespace std;
-
-void
-do_subana_cb(Fl_Button* o, void* v)
-{
- SubAnalysisWindow* T=(SubAnalysisWindow*)v;
- T->real_do_subana();
-}
-
-
-// passes the parameters to the mussa class object and orders it to run
-void
-SubAnalysisWindow::real_do_subana()
-{
- int i;
- string a_sequence, err_msg;
-
- // <-- need a check here to make sure all vars have a valid value
-
- an_analysis->clear();
- an_analysis->set_name(analysis_name);
- an_analysis->set_window(window);
- an_analysis->set_threshold(threshold);
-
- for(i=0; i < seq_num; i++)
- {
- a_sequence = the_seqs[i].get_seq();
- cout << a_sequence.length() << endl;
- a_sequence = a_sequence.substr(sub_seq_starts[i],
- sub_seq_ends[i] - sub_seq_starts[i] );
- cout << a_sequence.length() << endl;
- an_analysis->add_a_seq(a_sequence);
- }
-
- try {
- an_analysis->analyze();
- } catch( mussa_analysis_error e) {
- fl_alert( e.what() );
- }
-
- all_done = true;
-
- hide();
-}
-
-
-
-// *** subsequence start select
-
-void
-sub_start_in_cb1(Fl_Input* o, void* v)
-{
- sub_seq_data_instance * blah = (sub_seq_data_instance *) v;
- SubAnalysisWindow* T= blah->sw_ptr;
- T->real_sub_start_in_cb(o,blah->index);
-}
-
-void
-SubAnalysisWindow::real_sub_start_in_cb(Fl_Input* o, int i)
-{
- sub_seq_starts[i] = atoi(o->value());
-}
-
-// *** subsequence end select
-
-void
-sub_end_in_cb1(Fl_Input* o, void* v)
-{
- sub_seq_data_instance * blah = (sub_seq_data_instance *) v;
- SubAnalysisWindow* T= blah->sw_ptr;
- T->real_sub_end_in_cb(o,blah->index);
-}
-
-void
-SubAnalysisWindow::real_sub_end_in_cb(Fl_Input* o, int i)
-{
- sub_seq_ends[i] = atoi(o->value());
-
-}
-
-// *** input analysis name
-
-void
-set_ana_name_cb1(Fl_Input* o, void* v)
-{
- SubAnalysisWindow* T=(SubAnalysisWindow*)v;
- T->real_set_ana_name_cb(o);
-}
-
-void
-SubAnalysisWindow::real_set_ana_name_cb(Fl_Input* o)
-{
- analysis_name = o->value();
-}
-
-// *** input window size
-
-void
-set_win_size_cb1(Fl_Input* o, void* v)
-{
- SubAnalysisWindow* T=(SubAnalysisWindow*)v;
- T->real_set_win_size_cb(o);
-}
-
-void
-SubAnalysisWindow::real_set_win_size_cb(Fl_Input* o)
-{
- window = atoi(o->value());
-}
-
-// *** input threshold
-
-void
-set_threshold_cb1(Fl_Input* o, void* v)
-{
- SubAnalysisWindow* T=(SubAnalysisWindow*)v;
- T->real_set_threshold_cb(o);
-}
-
-void
-SubAnalysisWindow::real_set_threshold_cb(Fl_Input* o)
-{
- threshold = atoi(o->value());
-}
-
-
-bool
-SubAnalysisWindow::done()
-{
- return all_done;
-}
-
-
-SubAnalysisWindow::SubAnalysisWindow(int w, int h, const char* title,Mussa *the_analysis,
- vector<Sequence> some_Seqs):Fl_Window(w,h,title)
-{
- string a_name;
-
- color(FL_WHITE);
-
- an_analysis = the_analysis;
- the_seqs = some_Seqs;
- all_done = false;
-
- // initialize parameters
- analysis_name = "";
- window = -1;
- threshold = -1;
-
- begin();
-
- name_input = new Fl_Input(135, 10, w-140, 30, "SubAnalysis Name ");
- name_input->value("");
- //name_input->when(FL_WHEN_ENTER_KEY);
- name_input->box(FL_BORDER_BOX);
- name_input->callback((Fl_Callback*)set_ana_name_cb1, this);
-
- // add in radio buttons for win_append and thres_append eventually
- win_append = true;
- thres_append = true;
-
- win_input = new Fl_Input(135,45,100,30, "Window: ");
- win_input->value("");
- win_input->callback((Fl_Callback*)set_win_size_cb1, this);
-
- thres_input = new Fl_Input(320,45,100,30, "Threshold: ");
- thres_input->value("");
- thres_input->callback((Fl_Callback*)set_threshold_cb1, this);
-
- // button to launch the analysis
- test = new Fl_Button(w-100,h-30,100,30,"Do Analysis");
- test->callback((Fl_Callback*)do_subana_cb, this);
-
- // test button to make sure setup data is being stored
- test = new Fl_Button(w-200,h-30,100,30,"show setup");
- test->callback((Fl_Callback*)print_cb, this);
-
- // add all the inputs for the sub sequence starts & ends
- int i;
-
- seq_num = the_seqs.size();
-
- seq_scroll = new Fl_Scroll(5,80,w-10,h-115);
- seq_scroll->color(FL_WHITE);
-
- for (i = 0; i < seq_num; i++)
- {
- sub_seq_starts.push_back(0);
- sub_seq_ends.push_back(0);
- //a_name = the_seqs[i].sp_name();
- //cout << a_name << endl;
- add_seq_input(i, a_name);
- }
- seq_scroll->box(FL_DOWN_FRAME);
- //add(seq_scroll);
- //redraw();
-
- end();
- //resizable(this);
- show();
-}
-
-
-SubAnalysisWindow::~SubAnalysisWindow(){}
-
-
-void
-SubAnalysisWindow::add_seq_input(int i, string a_name)
-{
- Fl_Input *start_input, *end_input;
-
-
- // this remembers what seq index each input is associated with
- sub_seq_data_instance * something;
- something = new sub_seq_data_instance;
- something->sw_ptr = this;
- something->index = i;
-
-
- // subsequence select, index of first bp wanted
- start_input = new Fl_Input(150, 85+(i*35), 70, 30, "start index: ");
- start_input->value("");
- start_input->callback((Fl_Callback*)sub_start_in_cb1, (void*) something);
-
- // subsequence select, index of last bp wanted
- end_input = new Fl_Input(300, 85+(i*35), 70, 30, "end index: ");
- end_input->value("");
- end_input->callback((Fl_Callback*)sub_end_in_cb1, (void*) something);
-
- seq_scroll->add(start_input);
- seq_scroll->add(end_input);
-}
-
-/*
- cout << "fee\n";
- cout << "fie\n";
- cout << "foe\n";
- cout << "fum\n";
-*/
-
-void SubAnalysisWindow::print_cb(Fl_Button* o, void* v)
-{
- SubAnalysisWindow* T=(SubAnalysisWindow*)v;
- T->print_cb_real(o,v);
-}
-
-
-void SubAnalysisWindow::print_cb_real(Fl_Button* , void*)
-{
- cout << "analysis_name: " << analysis_name << endl;
- cout << "win: " << window << endl;
- cout << "thres: " << threshold << endl;
- cout << "seq_num: " << seq_num << endl;
- //cout << "win_add: " << win_append << end;
- //cout << "thres_add: " << thres_append << endl;
-
- int i;
-
-
-
- for (i = 0; i < seq_num; i++)
- {
- cout << " start: " << sub_seq_starts[i];
- cout << " end: " << sub_seq_ends[i] << endl;
- cout << "blargle!\n";
- }
- cout << "end of inputs\n" << endl;
-}
+++ /dev/null
-#ifndef _MUSSA_GUI_SUBANA_H_
-#define _MUSSA_GUI_SUBANA_H_
-// 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 <string>
-#include <vector>
-
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Input.H>
-#include <FL/Fl_File_Chooser.H>
-#include <FL/Fl_Scroll.H>
-
-#include "alg/mussa.hpp"
-#include "gui/SeqTextWindow.hpp"
-
-class SubAnalysisWindow : public Fl_Window
-{
- public:
- SubAnalysisWindow(int w, int h, const char* title, Mussa *an_analysis,
- std::vector<Sequence> some_Seqs);
- ~SubAnalysisWindow();
- bool done();
-
-
- Fl_Button* test;
-
- Fl_Input *name_input;
- Fl_Input *win_input;
- Fl_Input *thres_input;
- Fl_Input *seq_num_input;
- Fl_Scroll *seq_scroll;
- // need to keep track of these so a browsed file search can set the input
- // fields to the selected file
- std::vector<Fl_Input*> seq_inputs, annot_inputs;
-
-
- // callback receiver functions
-
- void real_do_subana();
-
- void real_set_ana_name_cb(Fl_Input* o);
- void real_set_win_size_cb(Fl_Input* o);
- void real_set_threshold_cb(Fl_Input* o);
-
- void real_sub_start_in_cb(Fl_Input* o, int i);
- void real_sub_end_in_cb(Fl_Input* o, int i);
-
- private:
- // sequence data
- std::vector<Sequence> the_seqs;
- Mussa *an_analysis;
- std::string analysis_name;
- int window, threshold, seq_num;
- std::vector<int> sub_seq_starts, sub_seq_ends;
- bool win_append, thres_append;
- bool all_done;
-
- static void print_cb(Fl_Button*, void*);
- inline void print_cb_real(Fl_Button*, void*);
-
- void add_seq_input(int index, std::string a_name);
-};
-
-// crazy whacked shite Titus taught me to do to get an index value associated
-// with each instance of an input associated with the callback...
-
-
-struct sub_seq_data_instance
-{
- SubAnalysisWindow * sw_ptr;
- int index;
-};
-#endif
+++ /dev/null
-CURDIR := $(BASEDIR)gui/
-
-SOURCES.cpp := AnnotWindow.cpp \
- ConnView.cpp \
- ConnWindow.cpp \
- MotifWindow.cpp \
- mussa_fltk.cpp \
- SeqTextWindow.cpp \
- SeqView.cpp \
- SeqWindow.cpp \
- SetupWindow.cpp \
- SubAnalysisWindow.cpp
-
-MUSSA_FLTK_SRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
-MUSSA_FLTK_OBJ := $(MUSSA_FLTK_SRC:.cpp=$(OBJEXT))
-
-SRC += $(MUSSA_FLTK_SRC)
-CXXFLAGS += -I$(BASEDIR)
-
-MUSSA := $(BASEDIR)/mussa$(BINEXT)
-TARGETBITS += $(MUSSA)
-
-$(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";
-*/
+++ /dev/null
-import sys
-import _mussa
-g = _mussa.gui()
-g.mussa()
-sys.exit(g.run())
+++ /dev/null
-######################################################################
-# Automatically generated by qmake (2.00a) Fri Feb 24 12:04:00 2006
-######################################################################
-
-TEMPLATE = app
-CONFIG += assistant
-TARGET +=
-DEPENDPATH += . \
- alg \
- qui
-# test
-INCLUDEPATH += . alg qui
-
-# Input
-HEADERS += mussa_exceptions.hpp \
- qui/MussaWindow.hpp \
- qui/MussaAlignedWindow.hpp \
- qui/ThresholdWidget.hpp \
- qui/ZoomWidget.hpp \
- qui/ImageScaler.hpp \
- qui/ImageSaveDialog.hpp \
- qui/IntAction.hpp \
- qui/motif_editor/MotifDetail.hpp \
- qui/motif_editor/MotifEditor.hpp \
- qui/seqbrowser/SequenceBrowserWidget.hpp \
- qui/seqbrowser/SequenceBrowser.hpp \
- qui/seqbrowser/SequenceBrowserSidebar.hpp \
- qui/seqbrowser/ScrollableSequenceBrowser.hpp \
- qui/seqbrowser/SequenceDescription.hpp \
- qui/mussa_setup_dialog/MussaSetupWidget.hpp \
- qui/mussa_setup_dialog/MussaSetupDialog.hpp \
- qui/mussa_setup_dialog/SequenceSetupWidget.hpp \
- qui/mussa_setup_dialog/SequenceSetupFrame.hpp \
- qui/mussa_setup_dialog/SetupInfo.hpp \
- alg/annotation_colors.hpp \
- alg/color.hpp \
- alg/conserved_path.hpp \
- alg/flp.hpp \
- alg/glsequence.hpp \
- alg/glseqbrowser.hpp \
- alg/mussa.hpp \
- alg/nway_paths.hpp \
- alg/parse_options.hpp \
- alg/sequence.hpp
-SOURCES += qui/mussagl.cpp \
- qui/MussaWindow.cpp \
- qui/MussaAlignedWindow.cpp \
- qui/ThresholdWidget.cpp \
- qui/ZoomWidget.cpp \
- qui/ImageScaler.cpp \
- qui/ImageSaveDialog.cpp \
- qui/IntAction.cpp \
- qui/motif_editor/MotifDetail.cpp \
- qui/motif_editor/MotifEditor.cpp \
- qui/seqbrowser/SequenceBrowserWidget.cpp \
- qui/seqbrowser/SequenceBrowser.cpp \
- qui/seqbrowser/SequenceBrowserSidebar.cpp \
- qui/seqbrowser/ScrollableSequenceBrowser.cpp \
- qui/seqbrowser/SequenceDescription.cpp \
- qui/mussa_setup_dialog/MussaSetupWidget.cpp \
- qui/mussa_setup_dialog/MussaSetupDialog.cpp \
- qui/mussa_setup_dialog/SequenceSetupWidget.cpp \
- qui/mussa_setup_dialog/SequenceSetupFrame.cpp \
- qui/mussa_setup_dialog/SetupInfo.cpp \
- alg/annotation_colors.cpp \
- alg/color.cpp \
- alg/conserved_path.cpp \
- alg/flp.cpp \
- alg/flp_seqcomp.cpp \
- alg/glsequence.cpp \
- alg/glseqbrowser.cpp \
- alg/mussa.cpp \
- alg/nway_entropy.cpp \
- alg/nway_other.cpp \
- alg/nway_paths.cpp \
- alg/parse_options.cpp \
- alg/sequence.cpp
-RESOURCES = icons.qrc
-
-LIBS += -lm
-QT += opengl
-LIBS += -lboost_program_options
-LIBS += -lboost_filesystem
-
-win32 {
- MINGW_HOME = C:/MinGW
- INCLUDEPATH += $$MINGW_HOME/include/GL
- BOOST_HOME = c:/Boost
- INCLUDEPATH += $$BOOST_HOME/include/boost-1_33_1
- LIBS -= -lboost_program_options
- LIBS += $$BOOST_HOME/lib/libboost_program_options-mgw-s.lib
- LIBS -= -lboost_filesystem
- LIBS += $$BOOST_HOME/lib/libboost_filesystem-mgw-s.lib
-} macx {
- INCLUDEPATH += /usr/local/include
- INCLUDEPATH += /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Headers
- LIBS += -L/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Libraries/
- LIBS += -L/usr/local/lib
-} else {
- INCLUDEPATH += /usr/include/GL
-}
+++ /dev/null
-CURDIR := $(BASEDIR)py/
-
-SOURCES.cpp := module.cpp \
- conserved_path.cpp \
- glsequence.cpp \
- mussa.cpp \
- nway_paths.cpp \
- sequence.cpp
-
-MUSSA_PY_SRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
-MUSSA_PY_OBJ := $(MUSSA_PY_SRC:.cpp=$(OBJEXT))
-
-SRC += $(MUSSA_PY_SRC)
-CXXFLAGS +=
-
-MUSSAPY := $(CURDIR)/mussa.so
-TARGETBINS += $(MUSSAPY)
-
-$(MUSSAPY): $(MUSSA_PY_OBJ) $(MUSSA_ALG_OBJ) $(MUSSA_ALG_GL_OBJ)
- g++ -shared $(CXXFLAGS) -lGL -lpython2.3 -lboost_python -o $@ $^