1 #include "mussa_gui_subana.hh"
5 do_subana_cb(Fl_Button* o, void* v)
7 SubanaWindow* T=(SubanaWindow*)v;
12 // passes the parameters to the mussa class object and orders it to run
14 SubanaWindow::real_do_subana()
17 string a_sequence, err_msg;
19 // <-- need a check here to make sure all vars have a valid value
22 an_analysis->set_name(ana_name);
23 an_analysis->set_seq_num(seq_num);
24 an_analysis->set_window(window);
25 an_analysis->set_threshold(threshold);
27 for(i=0; i < seq_num; i++)
29 a_sequence = the_Seqs[i].seq();
30 cout << a_sequence.length() << endl;
31 a_sequence = a_sequence.substr(sub_seq_starts[i],
32 sub_seq_ends[i] - sub_seq_starts[i] );
33 cout << a_sequence.length() << endl;
34 an_analysis->add_a_seq(a_sequence);
37 err_msg = an_analysis->analyze(0,0, 't', 0.0);
39 cout << "Feel the tribal beat\n";
42 //fl_alert(err_msg.c_str());
53 // *** subsequence start select
56 sub_start_in_cb1(Fl_Input* o, void* v)
58 sub_seq_data_instance * blah = (sub_seq_data_instance *) v;
59 SubanaWindow* T= blah->sw_ptr;
60 T->real_sub_start_in_cb(o,blah->index);
64 SubanaWindow::real_sub_start_in_cb(Fl_Input* o, int i)
66 sub_seq_starts[i] = atoi(o->value());
69 // *** subsequence end select
72 sub_end_in_cb1(Fl_Input* o, void* v)
74 sub_seq_data_instance * blah = (sub_seq_data_instance *) v;
75 SubanaWindow* T= blah->sw_ptr;
76 T->real_sub_end_in_cb(o,blah->index);
80 SubanaWindow::real_sub_end_in_cb(Fl_Input* o, int i)
82 sub_seq_ends[i] = atoi(o->value());
86 // *** input analysis name
89 set_ana_name_cb1(Fl_Input* o, void* v)
91 SubanaWindow* T=(SubanaWindow*)v;
92 T->real_set_ana_name_cb(o);
96 SubanaWindow::real_set_ana_name_cb(Fl_Input* o)
98 ana_name = o->value();
101 // *** input window size
104 set_win_size_cb1(Fl_Input* o, void* v)
106 SubanaWindow* T=(SubanaWindow*)v;
107 T->real_set_win_size_cb(o);
111 SubanaWindow::real_set_win_size_cb(Fl_Input* o)
113 window = atoi(o->value());
116 // *** input threshold
119 set_threshold_cb1(Fl_Input* o, void* v)
121 SubanaWindow* T=(SubanaWindow*)v;
122 T->real_set_threshold_cb(o);
126 SubanaWindow::real_set_threshold_cb(Fl_Input* o)
128 threshold = atoi(o->value());
139 SubanaWindow::SubanaWindow(int w, int h, const char* title,Mussa *the_analysis,
140 vector<Sequence> some_Seqs):Fl_Window(w,h,title)
146 an_analysis = the_analysis;
147 the_Seqs = some_Seqs;
152 name_input = new Fl_Input(135, 10, w-140, 30, "SubAnalysis Name ");
153 name_input->value("");
154 //name_input->when(FL_WHEN_ENTER_KEY);
155 name_input->box(FL_BORDER_BOX);
156 name_input->callback((Fl_Callback*)set_ana_name_cb1, this);
158 // add in radio buttons for win_append and thres_append eventually
162 win_input = new Fl_Input(135,45,100,30, "Window: ");
163 win_input->value("");
164 win_input->callback((Fl_Callback*)set_win_size_cb1, this);
166 thres_input = new Fl_Input(320,45,100,30, "Threshold: ");
167 thres_input->value("");
168 thres_input->callback((Fl_Callback*)set_threshold_cb1, this);
170 // button to launch the analysis
171 test = new Fl_Button(w-100,h-30,100,30,"Do Analysis");
172 test->callback((Fl_Callback*)do_subana_cb, this);
174 // test button to make sure setup data is being stored
175 test = new Fl_Button(w-200,h-30,100,30,"show setup");
176 test->callback((Fl_Callback*)print_cb, this);
178 // add all the inputs for the sub sequence starts & ends
181 seq_num = the_Seqs.size();
183 seq_scroll = new Fl_Scroll(5,80,w-10,h-115);
184 seq_scroll->color(FL_WHITE);
186 for (i = 0; i < seq_num; i++)
188 sub_seq_starts.push_back(0);
189 sub_seq_ends.push_back(0);
190 a_name = the_Seqs[i].sp_name();
191 cout << a_name << endl;
192 add_seq_input(i, a_name);
194 seq_scroll->box(FL_DOWN_FRAME);
204 SubanaWindow::~SubanaWindow(){}
208 SubanaWindow::add_seq_input(int i, string a_name)
210 Fl_Input *start_input, *end_input;
213 // this remembers what seq index each input is associated with
214 sub_seq_data_instance * something;
215 something = new sub_seq_data_instance;
216 something->sw_ptr = this;
217 something->index = i;
220 // subsequence select, index of first bp wanted
221 start_input = new Fl_Input(150, 85+(i*35), 70, 30, "start index: ");
222 start_input->value("");
223 start_input->callback((Fl_Callback*)sub_start_in_cb1, (void*) something);
225 // subsequence select, index of last bp wanted
226 end_input = new Fl_Input(300, 85+(i*35), 70, 30, "end index: ");
227 end_input->value("");
228 end_input->callback((Fl_Callback*)sub_end_in_cb1, (void*) something);
230 seq_scroll->add(start_input);
231 seq_scroll->add(end_input);
241 void SubanaWindow::print_cb(Fl_Button* o, void* v)
243 SubanaWindow* T=(SubanaWindow*)v;
244 T->print_cb_real(o,v);
248 void SubanaWindow::print_cb_real(Fl_Button* , void*)
250 cout << "ana_name: " << ana_name << endl;
251 cout << "win: " << window << endl;
252 cout << "thres: " << threshold << endl;
253 cout << "seq_num: " << seq_num << endl;
254 //cout << "win_add: " << win_append << end;
255 //cout << "thres_add: " << thres_append << endl;
261 for (i = 0; i < seq_num; i++)
263 //cout << seq_files[i] << endl;
264 //cout << annot_files[i] << endl;
265 //cout << "fasta: " << fasta_indices[i];
266 cout << " start: " << sub_seq_starts[i];
267 cout << " end: " << sub_seq_ends[i] << endl;
268 cout << "blargle!\n";
270 cout << "end of inputs\n" << endl;