| 234 | } |
| 235 | |
| 236 | long SNPinGenome::processPileUPLine(int & positionCount, char* line, string & oldChr, int & sNPpositionToProceed,int minimalTotalLetterCountPerPosition,int & index, int minimalQualityPerPosition, GenomeCopyNumber* p_genomeCopyNumber) { |
| 237 | |
| 238 | if (*line == 0) return 0; |
| 239 | if (line[0] == '#') return 0; |
| 240 | if ( line[0] == '@') return 0; |
| 241 | |
| 242 | //we will count letters after . and , in corresponding positions: |
| 243 | //std::vector<char*> strs(12); |
| 244 | char* strs[64]; |
| 245 | unsigned int strs_cnt = split(line, '\t', strs); |
| 246 | if (strs_cnt <= 4) { |
| 247 | return 0; |
| 248 | } |
| 249 | //string chr = strs[0]; |
| 250 | //if (chr.compare(oldChr)!=0) { |
| 251 | if (strcmp(strs[0], oldChr.c_str()) != 0) { |
| 252 | string chr = strs[0]; |
| 253 | oldChr = chr; |
| 254 | oldChr = strs[0]; |
| 255 | processChrName(chr); |
| 256 | index = findIndex(chr); |
| 257 | positionCount = 0; |
| 258 | if ( index == NA) { |
| 259 | cout << "will skip chr"<<chr<<"\n"; |
| 260 | return 0; |
| 261 | } |
| 262 | sNPpositionToProceed = (*SNP_atChr_)[index].getPositionAt(positionCount); |
| 263 | } |
| 264 | |
| 265 | if ( index == NA) { |
| 266 | return 0; |
| 267 | } |
| 268 | |
| 269 | int currentPosition = atoi(strs[1]); |
| 270 | long valueToReturn = 0; |
| 271 | if (CopyNumberFromPileup_ == true) { |
| 272 | if (WESanalysis_ == false) { |
| 273 | if (p_genomeCopyNumber) { |
| 274 | string chr = strs[0]; |
| 275 | processChrName(chr); |
| 276 | int lindex = p_genomeCopyNumber->findIndex(chr); |
| 277 | if (lindex != NA) { |
| 278 | if (valueToReturn = strccnt(strs[4], '^')) { |
| 279 | ChrCopyNumber& chrCopyNumber = p_genomeCopyNumber->getChrCopyNumberAt(lindex); |
| 280 | int step = p_genomeCopyNumber->getStep(); |
| 281 | for (int i=0; i<valueToReturn; i++) |
| 282 | chrCopyNumber.mappedPlusOneAtI(currentPosition, step); |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } else { |
| 287 | if (p_genomeCopyNumber) { |
| 288 | string chr = strs[0]; |
| 289 | processChrName(chr); |
| 290 | int lindex = p_genomeCopyNumber->findIndex(chr); |
| 291 | if (lindex != NA) { |
| 292 | if (valueToReturn = strccnt(strs[4], '^')) { |
| 293 | ChrCopyNumber& chrCopyNumber = p_genomeCopyNumber->getChrCopyNumberAt(lindex); |
nothing calls this directly
no test coverage detected