void
-SeqView::setup(string name, int sq_num, int win_len,
+SeqView::setup(string name, int sq_num,
vector<Sequence> *some_seqs,
- Nway_Paths *some_paths, vector<int> some_lens)
+ list<vector<int> > some_paths, vector<int> some_lens)
{
ana_name = name;
seq_num = sq_num;
- base_window_len = win_len;
S = some_seqs;
P = some_paths;
seq_lens = some_lens;
fl_font(FL_COURIER, 14);
cout << fl_width('A') << endl;
+
+ align_offsets(0);
}
int window_length, win_i;
int rc_1 = 0;
int rc_2 = 0;
+ string sub_seq;
+ int offset1, offset2;
+ float center1, center2;
- window_length = base_window_len;
fl_font(FL_COURIER, 14);
fl_color(FL_BLACK);
//blatantly stolen from FR2
y_loc = 10;
for(seq_i = seq_num-1; seq_i >= 0; --seq_i)
{
- //a_seq = a_seq;
- fl_draw((*S)[seq_i].c_seq(), 0+x(), y_loc+y());
+ sub_seq = (*S)[seq_i].seq();
+ sub_seq = sub_seq.substr(seq_align_offsets[seq_i]);
+ fl_draw(sub_seq.c_str(), 0+x(), y_loc+y());
y_loc += y_seq_incre;
}
fl_color(FL_RED);
fl_line_style(FL_SOLID, 1, NULL);
- //fl_line(x(),10+y(),20+x(),y_max/2 + y());
-
- //fl_color(FL_RED);
-
- for(pathz_i = P->pathz.begin(); pathz_i != P->pathz.end(); ++pathz_i)
+ for(pathz_i = P.begin(); pathz_i != P.end(); ++pathz_i)
{
a_path = *pathz_i;
y_loc = 0;
- for(i2 = seq_num - 1; i2 > 0; i2--)
+ window_length = a_path[0];
+ for(i2 = seq_num; i2 > 1; i2--)
{
// RC case handling
- // ugh, and xor...only want black if one of the nodes is rc
+ // ugh, and xor...only want rc coloring if just 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);
+ offset1 = seq_align_offsets[i2-1];
+ offset2 = seq_align_offsets[i2-2];
+ center1 = 0.5;
+ center2 = 0.5;
+
// no matter the case, any RC node needs an offset
if (a_path[i2] < 0)
+ {
rc_1 = window_length;
+ offset1 = -offset1;
+ center1 = -center1;
+ }
if (a_path[i2-1] < 0)
+ {
rc_2 = window_length;
- // normal case
+ offset2 = -offset2;
+ center2 = -center2;
+ }
+
+ // draw the line for each bp in this window that actually matches
for(win_i = 0; win_i < window_length; win_i++)
- fl_line(abs((int)((a_path[i2]-rc_1+win_i+x()+0.5)*ch_width)),
- y_loc + 10+y(),
- abs((int)((a_path[i2-1]-rc_2+win_i+x()+0.5)*ch_width)),
- y_loc+y_seq_incre+y());
+ {
+ x_start = abs((int) (a_path[i2]-rc_1+win_i-offset1) );
+ x_end = abs((int) (a_path[i2-1]-rc_2+win_i-offset2) );
+ fl_line( (x_start+center1)*ch_width, y_loc + 10,
+ (x_end+center2)*ch_width, y_loc+y_seq_incre );
+ }
y_loc += y_seq_incre;
- //if ((a_path[i2] < 0) || (a_path[i2-1] < 0))
- //{
- fl_color(FL_RED);
- rc_1 = 0;
- rc_2 = 0;
- //}
+ fl_color(FL_RED);
+ rc_1 = 0;
+ rc_2 = 0;
}
}
}
+
+void
+SeqView::debug_draw()
+{
+ int seq_i;
+ Sequence a_seq;
+ int i, y_loc;
+ vector<int> a_path;
+ list<vector<int> >::iterator pathz_i;
+ int i2;
+ int x_start, y_start, x_end, y_end;
+ double ch_width;
+ int window_length, win_i;
+ int rc_1 = 0;
+ int rc_2 = 0;
+ string sub_seq;
+
+
+ cout << "debugging...\n";
+ y_loc = 10;
+ for(seq_i = seq_num-1; seq_i >= 0; --seq_i)
+ {
+ sub_seq = (*S)[seq_i].seq();
+ cout << sub_seq << endl;
+ sub_seq = sub_seq.substr(seq_align_offsets[seq_i]);
+ cout << sub_seq << endl;
+ //fl_draw(sub_seq.c_str(), 0+x(), y_loc+y());
+ y_loc += y_seq_incre;
+ }
+}
+
+void
+SeqView::align_offsets(int align_num)
+{
+ list<vector<int> >::iterator pathz_i;
+ int i;
+
+
+ if (P.begin() == P.end())
+ cout << "crud....\n";
+ pathz_i = P.begin();
+ while(pathz_i != P.end())
+ {
+ //cout << (*pathz_i)[0] << endl;
+ ++pathz_i;
+ }
+
+ // find the path specified
+ i = 0;
+ pathz_i = P.begin();
+ cout << "fee\n";
+ while( (i < align_num) && (pathz_i != P.end()) )
+ {
+ cout << "fie\n";
+ ++i;
+ ++pathz_i;
+ }
+
+ cout << "foe\n";
+ // 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( (*pathz_i)[i+1] );
+ }
+ cout << "fum\n";
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
x_start = (int) ();
y_start = ;