| 3791 | */ |
| 3792 | |
| 3793 | int GenomeCopyNumber::processRead(InputFormat inputFormat, MateOrientation matesOrientation, const char* line_buffer, int & prevInd,std::string targetBed, std::string mateFileName) |
| 3794 | { |
| 3795 | |
| 3796 | int read_Size =150; // in case it is not initialized (e.g. for Pileup files) |
| 3797 | |
| 3798 | if (!*line_buffer) { |
| 3799 | return 0; |
| 3800 | } |
| 3801 | |
| 3802 | int valueToReturn = 0; |
| 3803 | |
| 3804 | if (inputFormat == SAM_INPUT_FORMAT && matesOrientation != SINGLE_END_SORTED_SAM) { |
| 3805 | if (line_buffer[0] == '@') |
| 3806 | return 0; |
| 3807 | if (WESanalysis == true) { |
| 3808 | string chr1, chr2; |
| 3809 | char orient1, orient2; |
| 3810 | int left,right, insert_size; |
| 3811 | |
| 3812 | if (getSAMinfo(line_buffer,chr1,chr2,orient1,orient2,left,right, insert_size)) { |
| 3813 | char orient1_2_str[] = {orient1, orient2, 0}; |
| 3814 | char orient2_1_str[] = {orient2, orient1, 0}; |
| 3815 | MateOrientation orient1_2 = getMateOrientation(orient1_2_str); |
| 3816 | MateOrientation orient2_1 = getMateOrientation(orient2_1_str); |
| 3817 | if ((matesOrientation == orient1_2 && right-left>0) || (matesOrientation == orient2_1 && right-left<0)) { |
| 3818 | left = min(left, right); |
| 3819 | right = left + abs(insert_size); |
| 3820 | int index = findIndex(chr1); |
| 3821 | if (index!=NA && chrCopyNumber_[index].getExons_Countchr() != 0) { |
| 3822 | bool leftIsInTheWindow = false; |
| 3823 | int l = 0; |
| 3824 | // try around this value first |
| 3825 | for (l=prevInd-1; l<=prevInd+30 && l<chrCopyNumber_[index].getExons_Countchr();l++ ) { |
| 3826 | if ((left - 1 < chrCopyNumber_[index].getEndAtBin(l) && (left > (chrCopyNumber_[index].getCoordinateAtBin(l) - insert_size)))) { |
| 3827 | leftIsInTheWindow = true; |
| 3828 | prevInd=l; |
| 3829 | break; |
| 3830 | } |
| 3831 | } |
| 3832 | if (!leftIsInTheWindow) { |
| 3833 | //start from the beginning of the chromosome |
| 3834 | for (l=0; left>=chrCopyNumber_[index].getCoordinateAtBin(l)- 30*insert_size && l<chrCopyNumber_[index].getExons_Countchr();l++ ) { |
| 3835 | if ((left - 1 < chrCopyNumber_[index].getEndAtBin(l) && (left > (chrCopyNumber_[index].getCoordinateAtBin(l) - insert_size)))) { |
| 3836 | leftIsInTheWindow = true; |
| 3837 | prevInd=l; |
| 3838 | break; |
| 3839 | } |
| 3840 | } |
| 3841 | } |
| 3842 | if (leftIsInTheWindow == false) { |
| 3843 | valueToReturn = 0; |
| 3844 | return valueToReturn; |
| 3845 | } |
| 3846 | if ((right > chrCopyNumber_[index].getCoordinateAtBin(l)) && (leftIsInTheWindow == true)) { |
| 3847 | step_ = chrCopyNumber_[index].getEndAtBin(l) - chrCopyNumber_[index].getCoordinateAtBin(l) + insert_size +1; |
| 3848 | chrCopyNumber_[index].mappedPlusOneAtI(left,step_, l); |
| 3849 | valueToReturn = 1; |
| 3850 | step_ = 0; |
nothing calls this directly
no test coverage detected