Linkbox Class Reference

#include <boxchain.h>

List of all members.

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)
BoxchainbestChain (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 bioseqxseq
const bioseqyseq

Static Private Attributes

static const BlastParameterblparam = 0
static const Matrixmatrix = 0


Detailed Description

This object implements the algorithm to find the best link of all the boxes. Later should be converted to a template class to deal with different kind of boxes

Member Typedef Documentation

typedef multiset<Alignsegex*, ltAlignsegexEndYPtr>::iterator Linkbox::bestiterator

typedef multiset<Alignsegex*, ltAlignsegexEndYPtr>::reverse_iterator Linkbox::bestreverse_iterator

typedef multimap<int, Alignsegex*>::iterator Linkbox::mmiterator


Constructor & Destructor Documentation

Linkbox::~Linkbox (  ) 

References start2match.

Linkbox::Linkbox ( const list< Alignseg > &  asg,
const bioseq qseq,
const bioseq tseq 
)

Makes a copy of each object in the asg list.

References end2match, repairEnds(), start2match, and xpoints.


Member Function Documentation

Boxchain * Linkbox::bestChain ( Dynaln aln  ) 

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

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]

References matrix.

Referenced by main().

static void Linkbox::setBlastParameter ( const BlastParameter p  )  [inline, static]

References blparam.

Referenced by main().

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().


Member Data Documentation

set<int> Linkbox::xpoints [private]

Referenced by bestChain(), Linkbox(), and removeChain().

multimap<int, Alignsegex*> Linkbox::start2match [private]

multimap<int, Alignsegex*> Linkbox::end2match [private]

Referenced by bestChain(), Linkbox(), and removeChain().

Referenced by bestChain(), cleanUpBest(), and show_best().

const bioseq* Linkbox::xseq [private]

const bioseq* Linkbox::yseq [private]

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().


The documentation for this class was generated from the following files:

Generated on Wed Aug 10 11:57:12 2011 for Softwares from Orpara by  doxygen 1.5.6