| 1757 | |
| 1758 | |
| 1759 | void GenomeCopyNumber::calculateCopyNumberProbs_and_exomeLength(int breakPointType) |
| 1760 | { |
| 1761 | //estimationOfExomeSize_ = 0; |
| 1762 | vector<ChrCopyNumber>::iterator it; |
| 1763 | unsigned long long count = 0; |
| 1764 | int endsSize=0; |
| 1765 | string NormalBAF,NormalBAF_XY; |
| 1766 | float normalXYploidy=ploidy_*0.5; //will only use it when the genome is male |
| 1767 | estimationOfGenomeSize_=0; |
| 1768 | if (hasBAF_) |
| 1769 | { |
| 1770 | NormalBAF = getNormalBAFforPloidy(ploidy_); |
| 1771 | NormalBAF_XY=getXYBAFforPloidy(ploidy_);//will only use it when the genome is male |
| 1772 | } |
| 1773 | |
| 1774 | CNVs_.clear(); |
| 1775 | copyNumberProbs_.clear(); |
| 1776 | |
| 1777 | for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) |
| 1778 | { |
| 1779 | float previousLevel = NA; |
| 1780 | int lengthOfPreviousLevel = 0; |
| 1781 | float nextLevel = NA; |
| 1782 | int lengthOfNextLevel = 0; |
| 1783 | it->setIsSmoothed(true); |
| 1784 | string chr = it->getChromosome(); |
| 1785 | cout << "..Annotation of CNVs for "<< chr <<"\n"; |
| 1786 | //will use these three variables to collect CNVs: |
| 1787 | int start = 0; |
| 1788 | int end = NA; |
| 1789 | int cnumber = NA; |
| 1790 | string BAFSym = "-"; |
| 1791 | string BAFprev = "-"; |
| 1792 | string BAFnext = "-"; |
| 1793 | string lBAF = "-"; |
| 1794 | |
| 1795 | float lUncertainty = NA; |
| 1796 | float BAFUncertainty = NA; |
| 1797 | |
| 1798 | float normalLevel=1; |
| 1799 | if (sex_.compare("XY")==0 && (it->getChromosome().find("X")!=string::npos || it->getChromosome().find("Y")!=string::npos)) { |
| 1800 | normalLevel = 0.5; |
| 1801 | } |
| 1802 | for (int i = 0; i<(int)it->getMedianValues().size(); i++) { |
| 1803 | float level = it->getLevelAt(i, ploidy_); |
| 1804 | int fragmentLength = it->getFragmentLengths()[i]; |
| 1805 | if (hasBAF_) { |
| 1806 | BAFSym = it->getBAFsymbPerFrg(i); |
| 1807 | BAFUncertainty = it->getEstimatedBAFuncertaintyAtBin(i); |
| 1808 | // cout << "..Control: read "<< BAFSym << "\n"; |
| 1809 | } |
| 1810 | |
| 1811 | if (level == NA) |
| 1812 | { |
| 1813 | int nextIndex = it->nextNoNAIndex(i, ploidy_,0); |
| 1814 | BAFUncertainty = NA; |
| 1815 | if (nextIndex == NA) { |
| 1816 | nextLevel = NA; |
no test coverage detected