#include <Coverdepth.h>
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 () | |
| Coverdepth & | assign (const Noschain &chain, int C) |
| Coverdepth & | append (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 |
| Coverdepth * | subprofile (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) |
| 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 | ) |
| Coverdepth::Coverdepth | ( | int * | prof, | |
| int | bb, | |||
| int | ee, | |||
| char | dir | |||
| ) | [inline] |
directly from computed results
| Coverdepth & Coverdepth::assign | ( | const Noschain & | chain, | |
| int | C | |||
| ) |
References B, Range::begin(), begin(), dep, Range::direction(), direction, E, end(), Range::end(), Range::largerEnd(), length(), Range::length(), Noschain::numberOfRanges(), Noschain::reverse(), and Range::smallerEnd().
| Coverdepth & Coverdepth::append | ( | const Noschain & | chain, | |
| int | C = 1 | |||
| ) |
accumulator, right now only from chains
References B, begin(), dep, Range::direction(), direction, E, Range::end(), Range::largerEnd(), length(), max, Noschain::numberOfRanges(), Noschain::reverse(), and Range::smallerEnd().
Referenced by testOverlap().
| int Coverdepth::length | ( | ) | const [inline] |
return the length of the profile. If no profile, then return 0
Referenced by append(), area(), assign(), averageHeight(), derivative(), exons(), maxAndSum(), maxHeight(), operator<<(), testBaseProfile(), and toPlot().
| int Coverdepth::begin | ( | ) | const [inline] |
| int Coverdepth::end | ( | ) | const [inline] |
| bool Coverdepth::empty | ( | ) | const [inline] |
no profile is represented as a zero pointer for dep
References dep.
| 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] |
| void Coverdepth::reverseStrand | ( | ) | [inline] |
| void Coverdepth::trim | ( | const Range & | bound | ) |
use the bound to trim extra bases usually resulted from comparAndFix() function
| bound | Range in genomic coordinate, bound is a subrange of this Object [B,E] |
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 | |||
| ) |
| void Coverdepth::fill | ( | int | bb, | |
| int | ee, | |||
| int | height | |||
| ) |
| void Coverdepth::fillRight | ( | int | bb, | |
| int | ee | |||
| ) |
| void Coverdepth::extendRight | ( | int | bb, | |
| int | len | |||
| ) |
extend the boundary by len units (bases)
| bb | is the left index, grow to the right. ==9 grow 3 if ==9===12 |
Referenced by ESTAssembly::fixIntronBound().
| void Coverdepth::fillLeft | ( | int | bb, | |
| int | ee | |||
| ) |
| void Coverdepth::extendLeft | ( | int | ee, | |
| int | len | |||
| ) |
| 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
| [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. |
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.
| 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] |
| 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.
| 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
| 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. |
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
Referenced by produceDip().
| int Coverdepth::localMin | ( | int & | x, | |
| int | w = 10 | |||
| ) | const [private] |
| 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 |
| int Coverdepth::area | ( | ) | const |
Referenced by ESTAssemblyid::breakup(), and ESTAssembly::resetNumest().
| int Coverdepth::area | ( | int | b, | |
| int | e | |||
| ) | const |
| int Coverdepth::maxHeight | ( | ) | const |
| pair< int, int > Coverdepth::maxAndSum | ( | ) | const |
produce max and area (sum) with a pair of values
Referenced by ESTAssembly::writeModel().
| void Coverdepth::maxAndSum | ( | int & | maxh, | |
| int & | sum | |||
| ) | const |
| int Coverdepth::summary | ( | int & | maxc, | |
| int & | maxi, | |||
| int & | minc, | |||
| int & | mini, | |||
| int | b = 0, |
|||
| int | e = -1 | |||
| ) | const |
| 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.
| 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
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.
| i | is the current position in dep coordinate |
| 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.
| 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.
| 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] |
| b | is the beginning index of dep | |
| dipx | the three position in dep coordinate |
Referenced by findVDip().
| 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)
int* Coverdepth::dep [private] |
This is the most important data for this object 0 is where intron is located
Referenced by append(), area(), assign(), averageHeight(), clear(), Coverdepth(), derivative(), digDip(), empty(), erase(), exons(), extendLeft(), extendRight(), fill(), fillLeft(), fillRight(), findDip(), findLeftDropoff(), findRightDropoff(), findVDip(), length(), localMax(), localMin(), makeDip(), maxAndSum(), maxHeight(), operator<<(), relativeHeight(), searchDip(), subprofile(), summary(), toPlot(), trim(), truncateHead(), and ~Coverdepth().
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] |
Referenced by append(), area(), assign(), clear(), Coverdepth(), end(), erase(), extendLeft(), extendRight(), fill(), fillLeft(), fillRight(), findDip(), length(), localMax(), localMin(), operator<<(), relativeHeight(), searchDip(), subprofile(), summary(), trim(), truncateHead(), and truncateTail().
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().
1.5.6