/** Go prev while at < 0, mark end with STOP */ void find_stop(int& min_row, int& min_col) const { while (track(min_row, min_col) != STOP) { if (at(min_row, min_col) >= 0 || min_row == 0 || min_col == 0) { track(min_row, min_col) = STOP; break; } go_prev(min_row, min_col); } }
void MainPage::init_actions() { QWidget *spr1 = new QWidget(); spr1->setSizePolicy( QSizePolicy::Expanding , QSizePolicy::Minimum ); p->go_action = new QAction( SMasterIcons::icon(ICON_SIZE,"tools-media-optical-burn.png") , tr("Go") , this ); p->more_action = new QAction( SMasterIcons::icon(ICON_SIZE,"edit-rename.png") , tr("More") , this ); p->toolbar->addAction( p->more_action ); p->toolbar->addWidget( spr1 ); p->toolbar->addAction( p->go_action ); connect( p->go_action , SIGNAL(triggered()) , SLOT(go_prev()) ); connect( p->more_action , SIGNAL(triggered()) , SLOT(more_prev()) ); }
/** Strip out bad alignment tail. Consider the following alignment: \verbatim TTCCGGTGCTGCGaggga TTCCGGTGCTGCGcctct \endverbatim After tail stripping, it would be changed to \verbatim TTCCGGTGCTGCG TTCCGGTGCTGCG \endverbatim */ void cut_tail(int& first_last, int& second_last) const { int& r_row = first_last; int& r_col = second_last; while (true) { int prev_row = r_row; int prev_col = r_col; go_prev(prev_row, prev_col); if (in(prev_row, prev_col) && at(prev_row, prev_col) < at(r_row, r_col)) { r_row = prev_row; r_col = prev_col; } else { break; } } }
/** Write alignment as list of pairs of indices. \param first_last Last aligned position in first sequence (input) \param second_last Last aligned position in second sequence (input) \param alignment Array of pairs of positions, -1 as gaps */ void export_alignment(int first_last, int second_last, PairAlignment& alignment) const { int row = first_last, col = second_last; while (row != -1 || col != -1) { int tr = track(row, col); if (tr == STOP) { tr = MATCH; } bool print_first = (tr == MATCH || tr == ROW_INC); bool print_second = (tr == MATCH || tr == COL_INC); int a_row = print_first ? row : -1; int a_col = print_second ? col : -1; alignment.push_back(std::make_pair(a_row, a_col)); if (track(row, col) == STOP) { break; } go_prev(row, col); ASSERT_TRUE(in(row, col)); } std::reverse(alignment.begin(), alignment.end()); }
// ignores gap range void track_local(int row, int col) const { if (row == -1 || col == -1) { return; } int min_row = row; int min_col = col; find_opt(min_row, min_col); if (at(min_row, min_col) == 0) { return; } // go right to col for (int j = min_col; j <= col; j++) { track(min_row, j) = COL_INC; } // go bottom to row for (int i = min_row; i <= row; i++) { track(i, col) = ROW_INC; } while (at(min_row, min_col) < 0) { go_prev(min_row, min_col); ASSERT_TRUE(in(min_row, min_col)); } track_local(min_row, min_col); }
void RootMount::goEvent( SProcessEvent * ) { go_prev(); }