Coverdepth Class Reference

#include <Coverdepth.h>

List of all members.

Public Member Functions

 Coverdepth ()
 Coverdepth (const Noschain &chain, int C=1)
 Coverdepth (const string &cdstr)
 Coverdepth (int *prof, int bb, int ee, char dir)
 ~Coverdepth ()
Coverdepthassign (const Noschain &chain, int C)
Coverdepthappend (const Noschain &chain, int C=1)
int length () const
int begin () const
int end () const
bool empty () const
void clear ()
Noschain exons () const
char strand () const
void setStrand (char dir)
void reverseStrand ()
void trim (const Range &bound)
void erase (const Range &bound)
void erase (int bb, int ee)
void fill (int bb, int ee, int height)
void fillRight (int bb, int ee)
void extendRight (int bb, int len)
void fillLeft (int bb, int ee)
void extendLeft (int ee, int len)
bool findDip (int b, int e, Dip &dip) const throw (NegativeCoverage)
bool searchDip (int b, int e, Dip &dip) const throw (PointOutChain)
pair< float, float > relativeHeight (const Coverdepth &bcp) const
int * derivative (int dx=1)
ostream & toPlot (ostream &ous) const
float averageHeight () const
int area () const
int area (int b, int e) const
int maxHeight () const
pair< int, int > maxAndSum () const
void maxAndSum (int &maxh, int &sum) const
int summary (int &maxc, int &maxi, int &minc, int &mini, int b=0, int e=-1) const
Coverdepthsubprofile (int b, int e, char dir='?') const
void truncateTail (int e)
void truncateHead (int b)

Private Member Functions

int findDropoff (list< pair< double, int > > &derivseg, int s, int f, Dip &dip) const
bool findRightDropoff (list< pair< double, int > > &derivseg, int s, int f, Dip &dip) const
bool findLeftDropoff (list< pair< double, int > > &derivseg, int s, int f, Dip &dip) const
int digDip (int b, int e, vector< Dip > &dips, const int *deriv) const
int findVDip (const list< pair< double, int > > &seg, int b, vector< Dip > &dips) const
int localMax (int &x, int w=10) const
int localMin (int &x, int w=10) const
int indexGenomic2dep (int gpos) const
int indexdep2Genomic (int idx) const
bool makeDip (Dip &dip, const int *deriv, const int s, const int ss, const int ff, int &i) const
void produceDip (Dip &dip, int dipx[], int b) const
void produceVDip (Dip &dip, int dipx[], int b) const

Private Attributes

int * dep
int B
int E
char direction
int * der1

Static Private Attributes

static int dipedgew = 10

Friends

ostream & operator<< (ostream &ous, const Coverdepth &cd)


Detailed Description

use genomic context to operate the coverage information This add about 20% time to combest. Normally it take 60 minutes, now it take 70 minutes after adding this base coverage calculation.

Constructor & Destructor Documentation

Coverdepth::Coverdepth (  )  [inline]

Referenced by subprofile().

Coverdepth::Coverdepth ( const Noschain chain,
int  C = 1 
)

construct profile directly from a chain

References B, Range::begin(), begin(), dep, direction, Range::direction(), E, end(), Range::end(), Noschain::numberOfRanges(), and Noschain::reverse().

Coverdepth::Coverdepth ( const string &  cdstr  ) 

read from stored string object Expected format: 879749-885861(-) 1,1,1,1....

References B, dep, direction, and E.

Coverdepth::Coverdepth ( int *  prof,
int  bb,
int  ee,
char  dir 
) [inline]

directly from computed results

Coverdepth::~Coverdepth (  ) 

References dep, and der1.


Member Function Documentation

Coverdepth & Coverdepth::assign ( const Noschain chain,
int  C 
)

Coverdepth & Coverdepth::append ( const Noschain chain,
int  C = 1 
)

int Coverdepth::length (  )  const [inline]

return the length of the profile. If no profile, then return 0

References B, dep, and E.

Referenced by append(), area(), assign(), averageHeight(), derivative(), exons(), maxAndSum(), maxHeight(), operator<<(), testBaseProfile(), and toPlot().

int Coverdepth::begin (  )  const [inline]

References B.

Referenced by append(), assign(), Coverdepth(), and testBaseProfile().

int Coverdepth::end (  )  const [inline]

References E.

Referenced by assign(), and Coverdepth().

bool Coverdepth::empty (  )  const [inline]

no profile is represented as a zero pointer for dep

References dep.

void Coverdepth::clear (  ) 

References B, dep, direction, and E.

Noschain Coverdepth::exons (  )  const

return the exon structure. I need to use this to compare to the exon structure obtained with the append method in the Noschain class. This is just a debug validation method. It is very expensive as compared to the Noschain. For single exon chain, it always returns the chain on the + direction. So need to reverse it according to the the parent direction.

References B, dep, direction, length(), and Noschain::reverse().

Referenced by testOverlap(), testsubchain(), and ESTAssembly::validProfile().

char Coverdepth::strand (  )  const [inline]

void Coverdepth::setStrand ( char  dir  )  [inline]

References direction.

Referenced by ESTAssembly::ESTAssembly().

void Coverdepth::reverseStrand (  )  [inline]

void Coverdepth::trim ( const Range bound  ) 

use the bound to trim extra bases usually resulted from comparAndFix() function

Parameters:
bound Range in genomic coordinate, bound is a subrange of this Object [B,E]
Outside this range, base cover informaton will be erased.

References B, dep, E, Range::largerEnd(), Range::length(), and Range::smallerEnd().

void Coverdepth::erase ( const Range bound  ) 

make the profile zero inside the bound inclusive The bound is in genomic coordinate.

References B, Range::begin(), dep, Range::direction(), E, Range::end(), and Range::inside().

Referenced by ESTAssembly::fixIntronBound().

void Coverdepth::erase ( int  bb,
int  ee 
)

a version with integer, more easy to use

References B, dep, and E.

void Coverdepth::fill ( int  bb,
int  ee,
int  height 
)

file a region by a specified value

References B, dep, and E.

void Coverdepth::fillRight ( int  bb,
int  ee 
)

use the value at bb to fill the region require: bb < ee

References B, dep, and E.

void Coverdepth::extendRight ( int  bb,
int  len 
)

extend the boundary by len units (bases)

Parameters:
bb is the left index, grow to the right. ==9 grow 3 if ==9===12

References B, dep, and E.

Referenced by ESTAssembly::fixIntronBound().

void Coverdepth::fillLeft ( int  bb,
int  ee 
)

use the vlaue at ee to fill the region. bb, ee in genomic coordinate require bb<ee

References B, dep, and E.

void Coverdepth::extendLeft ( int  ee,
int  len 
)

References B, dep, and E.

Referenced by ESTAssembly::fixIntronBound().

bool Coverdepth::findDip ( int  b,
int  e,
Dip dip 
) const throw (NegativeCoverage)

find a V in the profile if Dip or V not found, then return (-1,-1) if b<e this function will swap the number. Dis will never include introns, stop when seeing introns. Finds the first Dip from the smaller index regardless of direction.

cut off both ends ////////

References B, computeDerivative(), dep, E, L, makeDip(), and max.

Referenced by testBaseProfile().

bool Coverdepth::searchDip ( int  b,
int  e,
Dip dip 
) const throw (PointOutChain)

more suited for wide dips

Parameters:
[b,e] genomic position 1-based. if b>e this function will use [e,b] automatically. This function will also assure [B,E] contains [b,e]. If this is violated this function will die. In production code this should not happen, so now throwing exception.
dip is the output in genomic coordinate.
Returns:
true if found a good.
This one use a partition algorithm, very simple. Inside this function, I defined a new findVDip() that is more suited fro very regular dips that can have narrow bottoms.

The minimal distance of e-b is 30 nt. Below this range, this function will simply return false.

References B, computeDerivative(), dep, digDip(), E, findDropoff(), findVDip(), growZero(), itos(), joinNeighbor(), L, mergeTriple(), and produceDip().

Referenced by ESTAssembly::findDip(), and testDip().

pair< float, float > Coverdepth::relativeHeight ( const Coverdepth bcp  )  const

return the relative expression level of bcp against this profile. The algorithm is the max(ratio) of bcp/this where both are exons. (min,max ratio) of bcp/this, if no common profile region, return (-1,-1). If this model is a star model, then max ratio should be 1, and min ratio should be a small number. This function is intented to be used to compare minor to major (star) models.

References B, dep, E, indexdep2Genomic(), indexGenomic2dep(), max, and min.

Referenced by ESTAssembly::relativeProfileHeight().

int Coverdepth::findDropoff ( list< pair< double, int > > &  derivseg,
int  s,
int  f,
Dip dip 
) const [private]

look for sudden drop on the right side. I will wrint aother one for doing the left side _| This method should be used by searchDip or not? The derivative should not be recomputed. [s,f] is the dep coordinate system, deriv index is [0, f-s] Will do further processing of derivseg. -1 good left dropoff, 1 good right Dropoff, 0 no dropoff found.

Parameters:
dip this is the result in dep coordinate. Must be incremented to be converted to genomic coordiante. dip.incrementPosition(B) does the job.

References findLeftDropoff(), findRightDropoff(), and Dip::fineRatio().

Referenced by searchDip().

bool Coverdepth::findRightDropoff ( list< pair< double, int > > &  derivseg,
int  s,
int  f,
Dip dip 
) const [private]

bool Coverdepth::findLeftDropoff ( list< pair< double, int > > &  derivseg,
int  s,
int  f,
Dip dip 
) const [private]

References average3Iterator(), del(), dep, and LeftDropoff::isGood().

Referenced by findDropoff().

int Coverdepth::digDip ( int  b,
int  e,
vector< Dip > &  dips,
const int *  deriv 
) const [private]

reorganize the find dip so that the derivative array should not be regenerated Also work on single exons, no need to check for intron boundaries. Will not test direction etc, supposedly searchDip did it.

Returns:
the number of dips produced by this method.
Parameters:
dips result in dep coordinate.

cut off both ends ////////

References B, Dip::BLH, dep, Dip::isGood(), makeDip(), and max.

Referenced by searchDip().

int Coverdepth::findVDip ( const list< pair< double, int > > &  seg,
int  b,
vector< Dip > &  dips 
) const [private]

helper method used by searchDip

Parameters:
b is the begining index of the derivative array
dips accumulate results to this container. The result is in dep coorinate need conversion to genomic index.
Returns:
the number of good Dips produced by this function all the dips found are tested by Dip::isGood()

References dep, Dip::isGood(), and produceVDip().

Referenced by searchDip().

int Coverdepth::localMax ( int &  x,
int  w = 10 
) const [private]

h current max value, x coordinate in dep this is most used by searchDip to finalize the candidate Dip

Returns:
the max value

References B, dep, and E.

Referenced by produceDip().

int Coverdepth::localMin ( int &  x,
int  w = 10 
) const [private]

References B, dep, and E.

Referenced by produceDip().

int Coverdepth::indexGenomic2dep ( int  gpos  )  const [inline, private]

convert the external genomic 1-based index into the internal index of the dep array

References B.

Referenced by relativeHeight().

int Coverdepth::indexdep2Genomic ( int  idx  )  const [inline, private]

convert internal index to external 1-based external genomic index. This is the opposite operation as indexGenomic2dep

References B.

Referenced by relativeHeight().

int * Coverdepth::derivative ( int  dx = 1  ) 

compute the derivative of the whole profile. This is rarely useful, is for testing at this point.

References computeDerivative(), dep, der1, and length().

Referenced by testBaseProfile().

ostream & Coverdepth::toPlot ( ostream &  ous  )  const

write gnpuplot tabular input format position =tab=> count

References B, dep, and length().

Referenced by testBaseProfile().

float Coverdepth::averageHeight (  )  const

References dep, and length().

Referenced by ESTAssembly::averageProfileHeight().

int Coverdepth::area (  )  const

References dep, and length().

Referenced by ESTAssemblyid::breakup(), and ESTAssembly::resetNumest().

int Coverdepth::area ( int  b,
int  e 
) const

compute the area under the curve e = -1 to indicate the end of this object. b,e in B coordinate

References B, dep, and E.

int Coverdepth::maxHeight (  )  const

the hightest coverage

References dep, and length().

Referenced by ESTAssembly::maxProfileHeight().

pair< int, int > Coverdepth::maxAndSum (  )  const

produce max and area (sum) with a pair of values

References dep, and length().

Referenced by ESTAssembly::writeModel().

void Coverdepth::maxAndSum ( int &  maxh,
int &  sum 
) const

version use reference

References dep, and length().

int Coverdepth::summary ( int &  maxc,
int &  maxi,
int &  minc,
int &  mini,
int  b = 0,
int  e = -1 
) const

Get several numbers at the same time. min, max, average, area return sum,

References B, dep, E, and max.

Coverdepth * Coverdepth::subprofile ( int  b,
int  e,
char  dir = '?' 
) const

create new profile. The direction is not determined. To compute from exon structure is too expensive. So it has to be set. Default is unknow.

Parameters:
b,e is the range to be used. If b>e, this function will reverse it. If e==-1 this imply e=E. b,e is in genomic index, 1-based. if [b,e] is outside [B,E] then this function will exit(1)
dir instruct the direction of the new profile.

References B, Coverdepth(), dep, and E.

Referenced by ESTAssemblyid::breakup(), ESTAssembly::resetPrefixProfile(), and ESTAssembly::resetSuffixProfile().

void Coverdepth::truncateTail ( int  e  )  [inline]

remove the tail part after e e is the new end. e in Absolute index in the original genomic. Asme as B,E coordinate.

References E.

Referenced by ESTAssembly::resetPrefixProfile(), and ESTAssembly::resetSuffixProfile().

void Coverdepth::truncateHead ( int  b  ) 

remove profile before b, b is the new start

References B, dep, and E.

Referenced by ESTAssembly::resetPrefixProfile(), and ESTAssembly::resetSuffixProfile().

bool Coverdepth::makeDip ( Dip dip,
const int *  deriv,
const int  s,
const int  ss,
const int  ff,
int &  i 
) const [private]

s is for coordinate change to the subarray of derivatives ss,ff is the new range after walking up hill from the left and right respective in the dep coordinates. This is helper function for findDip() and digDip()

i-s converts to derivative coordinates.

Parameters:
i is the current position in dep coordinate
Returns:
true if succesufflly made a Dip. It may fail if reached intron.
Parameters:
dip result in dep coordinate.

now at local minimus of dep

References Dip::BLH, Dip::BRH, dep, Dip::LH, Dip::posBL, Dip::posBR, Dip::posTL, Dip::posTR, and Dip::RH.

Referenced by digDip(), and findDip().

void Coverdepth::produceDip ( Dip dip,
int  dipx[],
int  b 
) const [private]

given the coordinates in the dep system 4 numbers it will generate the Dip object. I will search the +/- 10 nt to find the max min of the dips. The input is just a hint.

Parameters:
dipx is the four numbers in deriv coordinate.
b is the begin position of the deriv array. dipx += (b-B) translates into dep coordinates.
dip result in dep coordinate

References B, Dip::BLH, Dip::BRH, dipedgew, Dip::LH, localMax(), localMin(), Dip::posBL, Dip::posBR, Dip::posTL, Dip::posTR, and Dip::RH.

Referenced by searchDip().

void Coverdepth::produceVDip ( Dip dip,
int  dipx[],
int  b 
) const [private]

Parameters:
b is the beginning index of dep
dipx the three position in dep coordinate

Referenced by findVDip().


Friends And Related Function Documentation

ostream& operator<< ( ostream &  ous,
const Coverdepth cd 
) [friend]

This is used by ESTAssembly::writeModel() to generate the last column of the tabular format Format: B-E (+/-) integer,.... B,E in genomic coordinate integer for the coverage of base at same index (0-based)


Member Data Documentation

int* Coverdepth::dep [private]

int Coverdepth::B [private]

[B, E] determines the outer genomic bound of the profile 1-based index of genomic location. B<E use direction to tell the direction of the model the profile has no direction.

Referenced by append(), area(), assign(), begin(), clear(), Coverdepth(), digDip(), erase(), exons(), extendLeft(), extendRight(), fill(), fillLeft(), fillRight(), findDip(), indexdep2Genomic(), indexGenomic2dep(), length(), localMax(), localMin(), operator<<(), produceDip(), relativeHeight(), searchDip(), subprofile(), summary(), toPlot(), trim(), and truncateHead().

int Coverdepth::E [private]

char Coverdepth::direction [private]

direction set to ? for single exon chain

Referenced by append(), assign(), clear(), Coverdepth(), exons(), operator<<(), reverseStrand(), setStrand(), and strand().

int* Coverdepth::der1 [private]

Referenced by derivative(), and ~Coverdepth().

int Coverdepth::dipedgew = 10 [static, private]

a small number default 10 to search the for the best value of Dip

Referenced by produceDip().


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

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