| 4197 | return numberOfRemovedExons/totalNumberExons; |
| 4198 | } |
| 4199 | int GenomeCopyNumber::focusOnCapture (std::string const& captureFile) { |
| 4200 | ifstream file (captureFile.c_str()); |
| 4201 | string line; |
| 4202 | //string::size_type pos = 0; |
| 4203 | string currentChr = ""; |
| 4204 | int index = NA; |
| 4205 | int count = 0; |
| 4206 | int mapCount; |
| 4207 | float ratio; |
| 4208 | int endShift = - windowSize_/step_ + 1; |
| 4209 | unsigned long int minRegion = refGenomeSize_; |
| 4210 | refGenomeSize_=0; //will be recalculated!!! |
| 4211 | |
| 4212 | map<int,int> chrRead; |
| 4213 | map<int,int>::iterator itMapChr; |
| 4214 | |
| 4215 | int averageReadLength=400; averageReadLength=150;//from version 6.6 |
| 4216 | |
| 4217 | if (file.is_open()) { |
| 4218 | cout << "..Reading "<< captureFile << "\n"; |
| 4219 | cout << "..Your file must be in .BED format, and it must be sorted\n"; |
| 4220 | |
| 4221 | while (! file.eof() ) { |
| 4222 | getline (file,line); |
| 4223 | if (! line.length()) continue; |
| 4224 | std::vector<std::string> strs = split(line, '\t'); |
| 4225 | if (strs.size()<3) continue; |
| 4226 | |
| 4227 | string chr = strs[0]; |
| 4228 | processChrName(chr); |
| 4229 | int positionS = atoi(strs[1].c_str())-averageReadLength; if (positionS<=0) positionS=1; |
| 4230 | int positionE = atoi(strs[2].c_str())-1; //because it is 1-based |
| 4231 | |
| 4232 | if (positionS >= positionE || positionS<0) continue; |
| 4233 | |
| 4234 | if ( currentChr.compare(chr)!=0 ){ //start reading a new chromosome |
| 4235 | cout << "..Reading capture for chromosome " << chr << "\n"; |
| 4236 | index = findIndex(chr); |
| 4237 | if (index == NA) { |
| 4238 | cout << "skipping chromosome " << chr << "\n"; |
| 4239 | continue; |
| 4240 | } |
| 4241 | //restore all variables for a new chromosome |
| 4242 | currentChr = chr; |
| 4243 | //check if the file is sorted: |
| 4244 | itMapChr=chrRead.find(index); |
| 4245 | if (itMapChr != chrRead.end() ) { |
| 4246 | cerr << "Your .bed file should be sorted. \n..Unable to proceed..\n"; |
| 4247 | exit(-1); |
| 4248 | } |
| 4249 | chrRead[index]=1; |
| 4250 | |
| 4251 | //check is notNprofile_ exists, and create it if it does not exists: |
| 4252 | chrCopyNumber_[index].checkOrCreateNotNprofileWithZeros(); |
| 4253 | //cout << "..Index for chromosome " << currentChr << ": "<< index << "\n"; |
| 4254 | } |
| 4255 | count ++; |
| 4256 |
no test coverage detected