| 2120 | } |
| 2121 | |
| 2122 | void GenomeCopyNumber::calculateCopyNumberProbs_and_genomeLength(int breakPointType) { |
| 2123 | estimationOfGenomeSize_ = 0; |
| 2124 | |
| 2125 | vector<ChrCopyNumber>::iterator it; |
| 2126 | unsigned long long count = 0; |
| 2127 | int min_fragment= telo_centromeric_flanks_/step_; |
| 2128 | int endsSize=0; |
| 2129 | string NormalBAF,NormalBAF_XY; |
| 2130 | float normalXYploidy=ploidy_*0.5; //will only use it when the genome is male |
| 2131 | |
| 2132 | if (hasBAF_) { |
| 2133 | NormalBAF = getNormalBAFforPloidy(ploidy_); |
| 2134 | NormalBAF_XY=getXYBAFforPloidy(ploidy_);//will only use it when the genome is male |
| 2135 | } |
| 2136 | |
| 2137 | CNVs_.clear(); |
| 2138 | copyNumberProbs_.clear(); |
| 2139 | |
| 2140 | //check it they are empty: |
| 2141 | cout << "copyNumberProbs_ contains:\n"; |
| 2142 | map<int, double>::iterator itProb; |
| 2143 | for ( itProb=copyNumberProbs_.begin() ; itProb != copyNumberProbs_.end(); itProb++ ) |
| 2144 | cout << (*itProb).first << " => " << (*itProb).second << "\n"; |
| 2145 | |
| 2146 | for ( it=chrCopyNumber_.begin() ; it != chrCopyNumber_.end(); it++ ) { |
| 2147 | float previousLevel = NA; |
| 2148 | int lengthOfPreviousLevel = 0; |
| 2149 | float nextLevel = NA; |
| 2150 | int lengthOfNextLevel = 0; |
| 2151 | it->setIsSmoothed(true); |
| 2152 | string chr = it->getChromosome(); |
| 2153 | cout << "..Annotation of CNVs for "<< chr <<"\n"; |
| 2154 | //will use these three variables to collect CNVs: |
| 2155 | int start = 0; |
| 2156 | int end = NA; |
| 2157 | int cnumber = NA; |
| 2158 | string BAFSym = "-"; |
| 2159 | string BAFprev = "-"; |
| 2160 | string BAFnext = "-"; |
| 2161 | string lBAF = "-"; |
| 2162 | |
| 2163 | float lUncertainty = NA; |
| 2164 | float BAFUncertainty = NA; |
| 2165 | |
| 2166 | float normalLevel=1; |
| 2167 | if (sex_.compare("XY")==0 && (it->getChromosome().find("X")!=string::npos || it->getChromosome().find("Y")!=string::npos)) { |
| 2168 | normalLevel = 0.5; |
| 2169 | } |
| 2170 | |
| 2171 | for (int i = 0; i<(int)it->getMedianValues().size(); i++) { |
| 2172 | float level = it->getLevelAt(i, ploidy_); |
| 2173 | int fragmentLength = it->getFragmentLengths()[i]; |
| 2174 | if (hasBAF_) { |
| 2175 | BAFSym = it->getBAFsymbPerFrg(i); |
| 2176 | BAFUncertainty = it->getEstimatedBAFuncertaintyAtBin(i); |
| 2177 | // cout << "..Control: read "<< BAFSym << "\n"; |
| 2178 | } |
| 2179 |
no test coverage detected