| 1629 | } |
| 1630 | |
| 1631 | void ChrCopyNumber::addBAFinfo(SNPinGenome & snpingenome,int indexSNP) { |
| 1632 | |
| 1633 | SNPatChr SNPsatChr = snpingenome.SNP_atChr(indexSNP); |
| 1634 | |
| 1635 | //create a vector with BAF |
| 1636 | createBAF(NA); |
| 1637 | createBAFvalues(); |
| 1638 | //BAFvalues_ |
| 1639 | int totalSNPnumber = SNPsatChr.getSize() ; |
| 1640 | cout << "..Total Number of SNPs: "<< totalSNPnumber <<"\n"; |
| 1641 | int SNPcount = 0; |
| 1642 | float currentBAF = SNPsatChr.getValueAt(SNPcount); |
| 1643 | float currentBAFstatus = SNPsatChr.getStatusAt(SNPcount); |
| 1644 | int getSNPpos = SNPsatChr.getPositionAt(SNPcount); |
| 1645 | float minBAF; |
| 1646 | |
| 1647 | |
| 1648 | for (int i = 0; i<length_; i++) { |
| 1649 | int left = coordinates_[i]; |
| 1650 | int right = getEndAtBin(i); |
| 1651 | if (getSNPpos>=left && getSNPpos <=right) { |
| 1652 | // snpingenome.SNP_atChr(indexSNP).setBinAt(SNPcount,i); |
| 1653 | snpingenome.setBinAt(indexSNP,SNPcount,i); |
| 1654 | |
| 1655 | if (currentBAFstatus !=0 && currentBAF != NA) { //there are values that indicate that this SNP can be heterozygios |
| 1656 | if (BAFvalues_[i] != "") |
| 1657 | BAFvalues_[i] += ";"; |
| 1658 | stringstream ss (stringstream::in | stringstream::out); |
| 1659 | ss << currentBAF; |
| 1660 | BAFvalues_[i] += ss.str(); |
| 1661 | } |
| 1662 | minBAF = BAF_[i]; |
| 1663 | if (minBAF==NA) { |
| 1664 | BAF_[i]=currentBAF; |
| 1665 | } else { |
| 1666 | if (fabs(minBAF-0.5) > fabs(currentBAF-0.5)){ |
| 1667 | BAF_[i]=currentBAF; |
| 1668 | //BAF_[i]=min(minBAF,currentBAF); |
| 1669 | |
| 1670 | } |
| 1671 | |
| 1672 | |
| 1673 | } |
| 1674 | } else if (getSNPpos<left) { |
| 1675 | if (SNPcount+1 < totalSNPnumber) { // EV bug fix: 2013-01-17 |
| 1676 | SNPcount++; |
| 1677 | getSNPpos = SNPsatChr.getPositionAt(SNPcount); |
| 1678 | currentBAF = SNPsatChr.getValueAt(SNPcount); |
| 1679 | currentBAFstatus = SNPsatChr.getStatusAt(SNPcount); |
| 1680 | if (windowSize_ == 0 && step_ == 0) |
| 1681 | { |
| 1682 | i=max(i-2,0); // assuming that the positions of SNPs are sorted |
| 1683 | } |
| 1684 | else |
| 1685 | { |
| 1686 | i=max(-1,i-windowSize_/step_-2); //changed -1 to -2 in version 10.9 |
| 1687 | } |
| 1688 | //cout << SNPcount << " out of "<< totalSNPnumber<<"\n"; |
no test coverage detected