RangeChain Class Reference

#include <Range.h>

Inheritance diagram for RangeChain:

Range

List of all members.

Public Types

typedef list< Range * >
::const_iterator 
const_iterator

Public Member Functions

 RangeChain ()
 RangeChain (const RangeChain &ch)
 RangeChain (const string &raw)
 RangeChain (const Range &r)
 ~RangeChain ()
RangeChainoperator= (const RangeChain &rc)
void add (const Range &r, bool sd=true)
int getOverlap () const
bool exonMerge (const RangeChain &rc)
pair< int, int > length () const
int outerLength () const
Range outerRange () const
int sumLength () const
int exonLength () const
pair< int, int > intronLength () const
int maxIntronLength () const
int begin () const
int end () const
pair< int, int > exonOverlap (const RangeChain &rc) const
int numberOfRanges () const
char direction () const
void order ()
ostream & tableRows (ostream &ous, const string &prefix) const
const_iterator itbegin () const
const_iterator itend () const

Protected Attributes

list< Range * > chain
int sumolp

Friends

ostream & operator<< (ostream &ous, const RangeChain &rc)


Detailed Description

this class merges overlapping Ranges A non-merged chain can be implemented this class is a merged chain of ranges. If ranges overlap then they are merged into one.

Derive this class from the base class Range, the overal range of the chain is a Range [B, E]

If you know that your chain components will not overlap each other you should use some other simple data structure such as vector of Range. Right now this class is useful in checking Chimeras.


Member Typedef Documentation


Constructor & Destructor Documentation

RangeChain::RangeChain (  )  [inline]

RangeChain::RangeChain ( const RangeChain ch  ) 

copy constructor of the same type

References chain, and Range::Range().

RangeChain::RangeChain ( const string &  raw  ) 

This constructor takes a string input. It will parse the strin as a list of Ranges. It is not sorted in any way, but could be in one of the two ways:

if on +, then from small to large. if on -, then from large to small. The following is an example of +

342525-342791,342797-343540,343546-345213,348262-349290

  • direction from large to small

258231-257542,257149-256862,256375-255698

References chain, Range::Range(), split(), and substr().

RangeChain::RangeChain ( const Range r  )  [inline]

References chain, and Range::Range().

RangeChain::~RangeChain (  ) 

use delete to deallocate memory in each list node

References chain.


Member Function Documentation

RangeChain & RangeChain::operator= ( const RangeChain rc  ) 

References chain, Range::Range(), and sumolp.

void RangeChain::add ( const Range r,
bool  sd = true 
)

This is the major accumulator function to build the chain from input Ranges.

Parameters:
sd controls the behavior of this function. The default is true. This parameter has the same meaning as the one in overlap()
This operation will merge the added fragment with existing Ranges in the chain. If sd is true, and the direction of the range element of the chain is in opposite direction as the input range, then this method will simply append the range to the end of the chain. So the chain may end up as heterogenous. The merging will also have a side effect of sorting if sd is set to true.

Before adding each new Range, we dorted the chain with lessByDirection() login. So the chain elements will be -----> then <-----

this one is doing the merging If overlap with any exon then it will merge the underlying exon; otherwise it will append the Range r after the component Range under consideration. This effect is to sort the component Ranges.

There is no sorting action.

References Range::b, chain, del(), direction(), lessRangeByDirectional(), Range::Range(), and sumolp.

Referenced by M8MatchChain::add(), mRNAModelUpdate::addESTCover(), checkUTRChimera(), M8MatchChain::M8MatchChain(), and Tblastn::qcov().

int RangeChain::getOverlap (  )  const [inline]

return the sum of the overlaps while building this chain. The add function keeps track of the overlaps during the operation. If not using the add function, then this number should be zero.

References sumolp.

Referenced by M8MatchChain::queryOverlap().

bool RangeChain::exonMerge ( const RangeChain rc  ) 

merges the underlying Ranges if they are in the same direction.

Returns:
true if merge success; otherwise false
will only carry out this operation if the direction of this object is pure, which means that all the ranges in the chain are in the + or - direction, possibily with a few in the uncertain direction ' '

References chain, and direction().

Referenced by mergeNeighbor().

pair< int, int > RangeChain::length (  )  const

obtain the sum length of all Ranges the firt length is from the plus direction the second length is from the minus direction The length is the length after the merger of individual ranges.

Returns:
length(+,-) directions.
The object could hold object in opposite directions. if all the composing nodes are in the + direction then the length for the second component will be zero.

This method should be removed. Replaced with exonLength. This method should be reserved for the parent length returning the overal length.

Reimplemented from Range.

References chain.

Referenced by Tblastn::qcov(), and M8MatchChain::queryLength().

int RangeChain::outerLength (  )  const

return the overall length of the range This is the original lengh of the parent class.

References chain, max, and min.

Range RangeChain::outerRange (  )  const

return the first and the last as a Range

References chain, and Range::Range().

int RangeChain::sumLength (  )  const

length of all Ranges regardless of direction as oppose to length that returns two lengths

References chain.

Referenced by exonLength(), and mergeNeighbor().

int RangeChain::exonLength (  )  const [inline]

alias for sumLength()

References sumLength().

Referenced by mRNAModelUpdate::ESTCoverage().

pair< int, int > RangeChain::intronLength (  )  const

return the sum of the length of the gaps between all ranges for both the plus and the minus direction.

References chain, and direction().

int RangeChain::maxIntronLength (  )  const

maximum intron length

References chain.

int RangeChain::begin (  )  const [inline]

Returns:
the outer Range begin

Reimplemented from Range.

References chain.

Referenced by mergeNeighbor().

int RangeChain::end (  )  const [inline]

Returns:
the outer Range end

Reimplemented from Range.

References chain.

Referenced by mergeNeighbor().

pair< int, int > RangeChain::exonOverlap ( const RangeChain rc  )  const

compare this object with another RangeChain object and compute the ammount of the overlap of underlying Ranges.

Returns:
(first,second) the first is the overlap of the component Ranges. The second value is the number of ranges that overlap.
using a naive algorithm, cold be improved by indexing in the future if performance is a problem.

References chain, and sumolp.

Referenced by mergeNeighbor().

int RangeChain::numberOfRanges (  )  const [inline]

return the number of Ranges in this chain.

References chain.

Referenced by mergeNeighbor(), and operator<<().

char RangeChain::direction (  )  const

if all of the component Ranges are in the + direction then return +. If all in the - direction then return -. If mixed then return ' '

This also overwrites the parent direction method.

Reimplemented from Range.

References chain.

Referenced by add(), exonMerge(), and intronLength().

void RangeChain::order (  ) 

order the range first by direction then by directional range. This is hard to implement. Need a special function object.

References chain, and RangeLessPtr().

ostream & RangeChain::tableRows ( ostream &  ous,
const string &  prefix 
) const

produce table rows with prefix as prefix. For example the prefix could be a string "tdb\tgenomic" this function will produce tdb genomic exnum ex1b ex1b tdb genomic exnum ex2b ex2b .... tdb genomic exnum exnb exnb

References chain.

Referenced by mergeNeighbor().

const_iterator RangeChain::itbegin (  )  const [inline]

for iterator throught the chain

References chain.

const_iterator RangeChain::itend (  )  const [inline]

References chain.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  ous,
const RangeChain rc 
) [friend]

output using ' | ' as delimiter


Member Data Documentation

list<Range*> RangeChain::chain [protected]

Use the list to kepp track of individual Ranges.

Could be from large to small or from small to large. Depends on the direction of the underlying ranges.

Referenced by add(), begin(), direction(), end(), exonMerge(), exonOverlap(), intronLength(), itbegin(), itend(), length(), maxIntronLength(), numberOfRanges(), operator<<(), operator=(), order(), outerLength(), outerRange(), RangeChain(), sumLength(), tableRows(), and ~RangeChain().

int RangeChain::sumolp [protected]

this is the sum of overlaps during the add() operation.

Referenced by add(), exonOverlap(), getOverlap(), and operator=().


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

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