| 2506 | } |
| 2507 | |
| 2508 | bool getSAMinfo(const char* line, std::string &chr1, std::string &chr2, char& orient1, char& orient2, int &left,int &right, int &insert_size) { |
| 2509 | if (!*line) { |
| 2510 | return false; |
| 2511 | } |
| 2512 | if (line[0] == '@') { |
| 2513 | return false; |
| 2514 | } |
| 2515 | |
| 2516 | char* strs[32]; |
| 2517 | unsigned int strs_cnt = split((char*)line, '\t', strs); |
| 2518 | if (strs_cnt < 7) |
| 2519 | return false; |
| 2520 | |
| 2521 | chr1 = strs[2]; |
| 2522 | chr2 = strs[6]; |
| 2523 | processChrName(chr1); |
| 2524 | processChrName(chr2); |
| 2525 | if (chr1.compare("*")==0 || chr2.compare("*")==0) { |
| 2526 | return false; |
| 2527 | } |
| 2528 | |
| 2529 | if (chr2.compare("=")==0) { |
| 2530 | chr2 = chr1; |
| 2531 | } |
| 2532 | |
| 2533 | unsigned int mask = atoi(strs[1]); |
| 2534 | if (mask & 0x0010) { |
| 2535 | orient1 = 'R'; |
| 2536 | } else { |
| 2537 | orient1 = 'F'; |
| 2538 | } |
| 2539 | |
| 2540 | if (mask & 0x0020) { |
| 2541 | orient2 = 'R'; |
| 2542 | } else { |
| 2543 | orient2 = 'F'; |
| 2544 | } |
| 2545 | |
| 2546 | left = atoi(strs[3]); |
| 2547 | right = atoi(strs[7]); |
| 2548 | |
| 2549 | insert_size = atoi(strs[8]); |
| 2550 | |
| 2551 | if (chr1.compare(chr2)!=0) { |
| 2552 | return false;//Can be avoided, TODO |
| 2553 | } |
| 2554 | return true; |
| 2555 | |
| 2556 | } |
| 2557 | |
| 2558 | bool getSAMinfo(const std::string& line,std::string &chr1,std::string &chr2,std::string &orient1,std::string &orient2,int &left,int &right) { |
| 2559 | if (! line.length()) |
no test coverage detected