1 #include "mussa_gui_seq.hh"
5 SeqView::setup(string name, int sq_num,
6 vector<Sequence> *some_seqs,
7 list<vector<int> > some_paths, vector<int> some_lens)
15 y_seq_incre = (y_max-10) / (seq_num - 1);
17 fl_font(FL_COURIER, 14);
18 cout << fl_width('A') << endl;
31 list<vector<int> >::iterator pathz_i;
33 int x_start, y_start, x_end, y_end;
35 int window_length, win_i;
40 float center1, center2;
43 fl_font(FL_COURIER, 14);
45 //blatantly stolen from FR2
46 ch_width = fl_width('A'); // monospaced: all characters are same width
49 for(seq_i = seq_num-1; seq_i >= 0; --seq_i)
51 sub_seq = (*S)[seq_i].seq();
52 sub_seq = sub_seq.substr(seq_align_offsets[seq_i]);
53 fl_draw(sub_seq.c_str(), 0+x(), y_loc+y());
58 fl_line_style(FL_SOLID, 1, NULL);
60 for(pathz_i = P.begin(); pathz_i != P.end(); ++pathz_i)
64 window_length = a_path[0];
65 for(i2 = seq_num; i2 > 1; i2--)
69 // ugh, and xor...only want rc coloring if just one of the nodes is rc
70 if ( ((a_path[i2] < 0) || (a_path[i2-1] < 0)) &&
71 !((a_path[i2] < 0) && (a_path[i2-1] < 0)) )
74 offset1 = seq_align_offsets[i2-1];
75 offset2 = seq_align_offsets[i2-2];
79 // no matter the case, any RC node needs an offset
93 // draw the line for each bp in this window that actually matches
94 for(win_i = 0; win_i < window_length; win_i++)
96 x_start = abs((int) (a_path[i2]-rc_1+win_i-offset1) );
97 x_end = abs((int) (a_path[i2-1]-rc_2+win_i-offset2) );
98 fl_line( (x_start+center1)*ch_width, y_loc + 10,
99 (x_end+center2)*ch_width, y_loc+y_seq_incre );
101 y_loc += y_seq_incre;
110 SeqView::debug_draw()
116 list<vector<int> >::iterator pathz_i;
118 int x_start, y_start, x_end, y_end;
120 int window_length, win_i;
126 cout << "debugging...\n";
128 for(seq_i = seq_num-1; seq_i >= 0; --seq_i)
130 sub_seq = (*S)[seq_i].seq();
131 cout << sub_seq << endl;
132 sub_seq = sub_seq.substr(seq_align_offsets[seq_i]);
133 cout << sub_seq << endl;
134 //fl_draw(sub_seq.c_str(), 0+x(), y_loc+y());
135 y_loc += y_seq_incre;
140 SeqView::align_offsets(int align_num)
142 list<vector<int> >::iterator pathz_i;
146 if (P.begin() == P.end())
147 cout << "crud....\n";
149 while(pathz_i != P.end())
151 //cout << (*pathz_i)[0] << endl;
155 // find the path specified
159 while( (i < align_num) && (pathz_i != P.end()) )
167 // now set the alignment offsets - basically where the path starts
168 seq_align_offsets.clear();
169 for(i = 0; i < seq_num; i++)
171 cout << (*pathz_i)[i+1] << endl;
172 seq_align_offsets.push_back( (*pathz_i)[i+1] );
199 x_start,y_start,x_end,y_end
204 if ((a_path[i2] >= 0) && (a_path[i2-1] >= 0))
207 else if ((a_path[i2] < 0) && (a_path[i2-1] < 0))
209 for(win_i = 0; win_i < window_length; win_i++)
210 fl_line(abs((int)((a_path[i2]+window_length+win_i+x())*ch_width)),
212 abs((int)((a_path[i2-1]+window_length+win_i+x())*ch_width)),
213 y_loc+y_seq_incre+y());
219 for(win_i = 0; win_i < window_length; win_i++)
220 fl_line(abs((int)((a_path[i2]+window_length+win_i+x())*ch_width)),
222 abs((int)((a_path[i2-1]+win_i+x())*ch_width)),
223 y_loc+y_seq_incre+y());
229 for(win_i = 0; win_i < window_length; win_i++)
230 fl_line(abs((int)((a_path[i2]+win_i+x())*ch_width)),
232 abs((int)((a_path[i2-1]+window_length+win_i+x())*ch_width)),
233 y_loc+y_seq_incre+y());