#include <boxchain.h>
Public Types | |
| typedef multiset< Alignsegex *, ltAlignsegexEndYPtr > ::iterator | bestiterator |
| typedef multiset< Alignsegex *, ltAlignsegexEndYPtr > ::reverse_iterator | bestreverse_iterator |
| typedef multimap< int, Alignsegex * >::iterator | mmiterator |
Public Member Functions | |
| ~Linkbox () | |
| Linkbox (const list< Alignseg > &asg, const bioseq *qseq, const bioseq *tseq) | |
| Boxchain * | bestChain (Dynaln &aln) |
| int | connect (Alignsegex *as1, Alignsegex *as2, Dynaln &aln) |
| void | show_best (ostream &ous) const |
| void | show_start2match (ostream &ous) const |
| void | removeChain (Alignsegex *p) |
| void | repairEnds (const int window=4, const float frac=0.15) |
Static Public Member Functions | |
| static void | setMatrix (const Matrix *mt) |
| static void | setBlastParameter (const BlastParameter *p) |
Private Member Functions | |
| void | cleanUpBest (bestiterator bi) |
Private Attributes | |
| set< int > | xpoints |
| multimap< int, Alignsegex * > | start2match |
| multimap< int, Alignsegex * > | end2match |
| multiset< Alignsegex *, ltAlignsegexEndYPtr > | best |
| const bioseq * | xseq |
| const bioseq * | yseq |
Static Private Attributes | |
| static const BlastParameter * | blparam = 0 |
| static const Matrix * | matrix = 0 |
| typedef multiset<Alignsegex*, ltAlignsegexEndYPtr>::iterator Linkbox::bestiterator |
| typedef multiset<Alignsegex*, ltAlignsegexEndYPtr>::reverse_iterator Linkbox::bestreverse_iterator |
| typedef multimap<int, Alignsegex*>::iterator Linkbox::mmiterator |
| Linkbox::~Linkbox | ( | ) |
References start2match.
Makes a copy of each object in the asg list.
References end2match, repairEnds(), start2match, and xpoints.
Return the pointer to the last element of the best chain. The Last pointer which can be used to construct the best alighment.
the alignment machine should be passed to this object so that it will not be create again for each run.
References best, cleanUpBest(), connect(), end2match, I, removeChain(), start2match, xpoints, xseq, and yseq.
| int Linkbox::connect | ( | Alignsegex * | as1, | |
| Alignsegex * | as2, | |||
| Dynaln & | aln | |||
| ) |
return 0 if no connection is made 1 extend the end of as1 2 extend the start of as2 3 either 1 or 2 is fine, on the same diagonal as1 is the one on the candidate list as2 is the new box
This function is the key for the performance of the gapped alignment phase. There are a lot of theory behind this.
old functions we need to rewrite them void Linkbox::showBest(ostream &ous) const { bestiterator i=best.begin(); while (i != best.end()) { ous << static_cast<Match>(**i) << " " << (*i)->getMaxScore() << " | "; ++i; } ous << endl; --i; Alignsegex* p=*i; ous << "Best Chain at the END:\n"; while (p != 0) { ous << *p << "\n"; p = p->previous(); } ous << "<<=<<=<<=<<=>>=>>=>>\n"; }
References blparam, BlastParameter::gapAlignDropOff, BlastParameter::gapExtend, BlastParameter::gapOpen, bioseq::getcode(), Alignseg::getEndX(), Alignseg::getEndY(), Alignsegex::getMaxScore(), Alignseg::getScore(), Alignseg::getX(), Alignseg::getY(), Dynaln::global(), matrix, Matrix::score(), Alignsegex::setConnectPath(), Alignsegex::setMaxScore(), Alignsegex::setPrevious(), Dynaln::setseq(), bioseq::subsequence(), xseq, and yseq.
Referenced by bestChain().
| void Linkbox::show_best | ( | ostream & | ous | ) | const |
References best.
| void Linkbox::show_start2match | ( | ostream & | ous | ) | const |
References start2match, bioseq::substring(), xseq, and yseq.
| void Linkbox::removeChain | ( | Alignsegex * | p | ) |
remove Alignsegex* from start2match and end2match, then update the set<int> xpoint and reduced the target range of the box to reflect the new boundary of the section. For finding multiple best chains.
References end2match, Alignseg::getEndX(), Alignseg::getX(), Alignsegex::previous(), start2match, and xpoints.
Referenced by bestChain().
| void Linkbox::repairEnds | ( | const int | window = 4, |
|
| const float | frac = 0.15 | |||
| ) |
shorten the ends when there is short overlapp with the next promissing alignment.
window controls the search square, frac is the fraction of the overlap as compared to both alignments to be considered for shrinkage. These two parameters should be part of the BlastParameter data structure.
When hit extension use -1 as stopper then this function is not needed, the performance of the program will improve if this is not used.
References bioseq::getcode(), matrix, max, start2match, W, xseq, and yseq.
Referenced by Linkbox().
| static void Linkbox::setMatrix | ( | const Matrix * | mt | ) | [inline, static] |
| static void Linkbox::setBlastParameter | ( | const BlastParameter * | p | ) | [inline, static] |
| void Linkbox::cleanUpBest | ( | bestiterator | bi | ) | [private] |
use multimap version not so good Alignsegex* Linkbox::bestModel() { set<int>::const_iterator xit=xpoints.begin(); typedef multimap<int, Alignsegex*>::const_iterator I; mmiterator bi, bilargest; // best iterator pair<mmiterator, mmiterator> bip; // best range int Ey, maxscore;
if (!best.empty()) best.clear(); I b, e; while (xit != xpoints.end()) { check start of X pair<I, I> b = start2match.equal_range(*xit); if (b.first != b.second) { for (I i=b.first; i != b.second; i++) { bi=best.lower_bound(i->second->getY()); if (bi != best.begin()) { --bi; // now bi is less than i->second-> y of begin because the value of the multimap is not ordered we have to find the largest one to use. supposedly, the last element is the largest! we are doing a search just to be sure. this search is usually very short bilargest=bi; Ey=bi->second->getEndY(); maxscore=bi->second->geMaxScore(); --bi; while (bi != best.begin() && bi->second->getEndY() == Ey) { if (bi->second->getMaxScore() > maxscore) { bilargest=bi; maxscore=bi->second->getMaxScore(); } --bi; } i-second->attachTo(bilargest->second); } } }
check for end of X pair<I, I> e = end2match.equal_range(*xit); // end of match if (e.first != e.second) { for (I j=e.first; j != e.second; j++) { if (best.empty()) { best.insert(make_pair(j->second->getEndY(), j->second)); continue; } bi=best.upper_bound(j->second->getEndY()); if (bi == best.begin()) { // it is the first element bi=best.insert(make_pair(j->second->getEndY(), j->second)); cleanUPBest(bi); } else { --bi; bilargest=bi; Ey=bi->second->getEndY(); maxscore=bi->second->geMaxScore(); --bi; while (bi != best.begin() && bi->second->getEndY() == Ey) { if (bi->second->getMaxScore() > maxscore) { bilargest=bi; maxscore=bi->second->getMaxScore(); } --bi; } if (bilargest->second->getMaxScore() < j->second->getMaxScore()) { bi=best.insert(make_pair(j->second->getEndY(), j->second)); cleanUpBest(bi); } } } } ++xit; } if (best.empty()) { cerr << "empty result trying to find best chain!\n"; exit(1); } return best.rbegin()->second; }
References best.
Referenced by bestChain().
set<int> Linkbox::xpoints [private] |
Referenced by bestChain(), Linkbox(), and removeChain().
multimap<int, Alignsegex*> Linkbox::start2match [private] |
Referenced by bestChain(), Linkbox(), removeChain(), repairEnds(), show_start2match(), and ~Linkbox().
multimap<int, Alignsegex*> Linkbox::end2match [private] |
Referenced by bestChain(), Linkbox(), and removeChain().
multiset<Alignsegex*, ltAlignsegexEndYPtr> Linkbox::best [private] |
Referenced by bestChain(), cleanUpBest(), and show_best().
const bioseq* Linkbox::xseq [private] |
Referenced by bestChain(), connect(), repairEnds(), and show_start2match().
const bioseq* Linkbox::yseq [private] |
Referenced by bestChain(), connect(), repairEnds(), and show_start2match().
const BlastParameter * Linkbox::blparam = 0 [static, private] |
Referenced by connect(), and setBlastParameter().
const Matrix * Linkbox::matrix = 0 [static, private] |
Referenced by connect(), repairEnds(), and setMatrix().
1.5.6