| 173 | } |
| 174 | |
| 175 | void GenomeCopyNumber::initCopyNumber(std::string const& chrLenFileName, int windowSize , int step, std::string targetBed) { |
| 176 | |
| 177 | ThreadPoolManager::getInstance()->lock(); |
| 178 | if (WESanalysis == false) { |
| 179 | if (step == NA) { |
| 180 | step = windowSize; |
| 181 | } |
| 182 | //check if steo value is correct: |
| 183 | if (step <= 0 || step > windowSize) { |
| 184 | cerr << "step should be a positive interger value less than or equal to the window size\n"; |
| 185 | exit(-1); |
| 186 | } |
| 187 | step_=step; |
| 188 | windowSize_ = windowSize; |
| 189 | //reading the file with genome information |
| 190 | std::vector<std::string> names; |
| 191 | std::vector<int> lengths; |
| 192 | readFileWithGenomeInfo(chrLenFileName, names, lengths); |
| 193 | refGenomeSize_ = sum(lengths); |
| 194 | for (int i = 0; i < (int) names.size(); i++) { |
| 195 | ChrCopyNumber chrCopyNumber(windowSize, lengths[i],names[i], step); |
| 196 | chromosomesInd_.insert(pair<string, int> (names[i],i)); |
| 197 | chrCopyNumber_.push_back(chrCopyNumber); |
| 198 | } |
| 199 | } else { |
| 200 | std::vector<std::string> names; |
| 201 | std::vector<int> lengths; |
| 202 | readFileWithGenomeInfo(chrLenFileName, names, lengths); |
| 203 | refGenomeSize_ = sum(lengths); |
| 204 | for (int i = 0; i < (int) names.size(); i++) { |
| 205 | ChrCopyNumber chrCopyNumber(windowSize, lengths[i],names[i], step, targetBed); |
| 206 | chromosomesInd_.insert(pair<string, int> (names[i],i)); |
| 207 | chrCopyNumber_.push_back(chrCopyNumber); |
| 208 | } |
| 209 | } |
| 210 | ThreadPoolManager::getInstance()->unlock(); |
| 211 | } |
| 212 | |
| 213 | void GenomeCopyNumber::finishCopyNumber(long normalCount) { |
| 214 | totalNumberOfPairs_ = normalCount; |
no test coverage detected