MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / calculateBreakpoints_general

Function calculateBreakpoints_general

src/myFunc.cpp:714–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714int calculateBreakpoints_general(double threshold, int length, const vector<float>& ratio,vector<int>& bpfinal, int normal_length_dummy, int breakPointType, const std::string& chr) {
715
716#ifdef PROFILE_TRACE
717 time_t t0 = time(NULL);
718#endif
719 if (ratio.size()==0) {
720 cout << "..You have zero windows with reads. Will try to continue anyway..\n" ;
721 ThreadPoolManager::getInstance()->unlock();
722 return -1;
723 }
724 const int maxValue = 3;
725 float absoluteMax = *max_element(ratio.begin(),ratio.end());
726// const float minL = 0.5;
727
728 //define a vector to stock centered ratio:
729 vector <float> Y;
730 //vector to define shift
731 vector <int> shift (length);
732 vector <int> shift_bp;
733 shift[0] = 0;
734
735 bool isLogRat = 0;
736
737// const float miniC = float(.001);
738// const float maxiC = float(0.001); //.05
739 for (int i = 0; i < length; i++) {
740 if (ratio[i]!=NA) {
741 if (i!=0)
742 shift[i]=shift[i-1];
743
744 if (isLogRat) {
745 if (ratio[i] < maxValue)
746 Y.push_back(log(ratio[i]));
747 else
748 Y.push_back(log((ratio[i]-maxValue)/(absoluteMax-maxValue)+maxValue));
749 } else {
750 if (ratio[i] < maxValue)
751 Y.push_back(ratio[i]);
752 else
753 Y.push_back((ratio[i]-maxValue)/(absoluteMax-maxValue)+maxValue);
754 }
755 shift_bp.push_back(shift[i]);
756 } else {
757 if (i!=0)
758 shift[i]=shift[i-1]+1;
759 else
760 shift[i]=1;
761 }
762 }
763 int n = Y.size();
764 shift.clear();
765//test - this block should be deleted.
766 //for (int i = 2700; i < 3000; i++) {
767 // Y[i] = 1;
768 //}
769
770 //k = maximum number of breakpoints to find: (default:
771 //20 percent of points for now) //CHANGED...

Callers 2

calculateBreakpointsMethod · 0.85

Calls 6

get_medianFunction · 0.85
get_max_indexFunction · 0.85
findnextbreakpointFunction · 0.85
unlockMethod · 0.80
lockMethod · 0.80

Tested by

no test coverage detected