diff --git a/src/ChrCopyNumber.cpp b/src/ChrCopyNumber.cpp index ca5564a..b9d01c8 100644 --- a/src/ChrCopyNumber.cpp +++ b/src/ChrCopyNumber.cpp @@ -640,6 +640,11 @@ void ChrCopyNumber::calculateRatio(double *a, int degree) { // } //} +bool ChrCopyNumber::ifHasRatio() { + if (ratio_.size()>0) return 1; + return 0; +} + void ChrCopyNumber::recalculateRatio (float constant) { for (int i = 0; ii && ratio_[i]==NA && BAF_[i]!=NA) //set BAF=NA in windows with ratio==NA to remove the noise from windows with low mappability BAF_[i]=NA; if (BAF_[i]==0) //remove windows with 100% AA counts diff --git a/src/ChrCopyNumber.h b/src/ChrCopyNumber.h index bc6f119..13e1833 100644 --- a/src/ChrCopyNumber.h +++ b/src/ChrCopyNumber.h @@ -98,7 +98,7 @@ class ChrCopyNumber bool isMedianCalculated(); bool isSmoothed(); - + bool ifHasRatio(); void fillCGprofile(std::string const& chrFolder); diff --git a/src/GenomeCopyNumber.cpp b/src/GenomeCopyNumber.cpp index adce9d1..3800f42 100644 --- a/src/GenomeCopyNumber.cpp +++ b/src/GenomeCopyNumber.cpp @@ -1099,6 +1099,11 @@ int GenomeCopyNumber::getNumberOfChromosomes() { return chrCopyNumber_.size(); } +bool GenomeCopyNumber::ifHasRatio() { + if (chrCopyNumber_[0].ifHasRatio()) return 1; + return 0; +} + long double GenomeCopyNumber::calculateRSS(int ploidy) { string::size_type pos = 0; diff --git a/src/GenomeCopyNumber.h b/src/GenomeCopyNumber.h index 98fe751..6770891 100644 --- a/src/GenomeCopyNumber.h +++ b/src/GenomeCopyNumber.h @@ -110,6 +110,7 @@ class GenomeCopyNumber bool getWESanalysis(); double getGenomeRefSize(); int getNumberOfChromosomes(); + bool ifHasRatio(); void setPloidy(int ploidy); diff --git a/src/SNPinGenome.cpp b/src/SNPinGenome.cpp index 3c5f96a..9119272 100644 --- a/src/SNPinGenome.cpp +++ b/src/SNPinGenome.cpp @@ -213,18 +213,23 @@ void SNPinGenome::perform(std::string const& mateFile, const std::string& inputF if (!pileup_read) { assignValues(mateFile, inputFormat, minimalTotalLetterCountPerPosition,minimalQualityPerPosition); } - cout << "..Adding BAF info to the " << what << " dataset" << std::endl; - genomeCopyNumber.addBAFinfo(*this); - cout << "..Recalculate breakpoints using BAF profiles" << std::endl; - genomeCopyNumber.calculateBAFBreakpoints(breakPointThreshold,breakPointType); - cout << "..Recalculate median values" << std::endl; - genomeCopyNumber.calculateCopyNumberMedians(minCNAlength, noisyData, CompleteGenomicsData); - - cout << "..Reannotate copy numbers" << std::endl; - if (genomeCopyNumber.getWESanalysis() == false) - {genomeCopyNumber.calculateCopyNumberProbs_and_genomeLength(breakPointType);} - else - {genomeCopyNumber.calculateCopyNumberProbs_and_exomeLength(breakPointType);} + + if (genomeCopyNumber.ifHasRatio()) { + cout << "..Adding BAF info to the " << what << " dataset" << std::endl; + genomeCopyNumber.addBAFinfo(*this); + cout << "..Recalculate breakpoints using BAF profiles" << std::endl; + genomeCopyNumber.calculateBAFBreakpoints(breakPointThreshold,breakPointType); + cout << "..Recalculate median values" << std::endl; + genomeCopyNumber.calculateCopyNumberMedians(minCNAlength, noisyData, CompleteGenomicsData); + + cout << "..Reannotate copy numbers" << std::endl; + if (genomeCopyNumber.getWESanalysis() == false) + {genomeCopyNumber.calculateCopyNumberProbs_and_genomeLength(breakPointType);} + else + {genomeCopyNumber.calculateCopyNumberProbs_and_exomeLength(breakPointType);} + + } + cout << "..Done" << std::endl; } diff --git a/src/freec b/src/freec index 097c42b..9885bd8 100644 Binary files a/src/freec and b/src/freec differ diff --git a/src/main.cpp b/src/main.cpp index 9d57748..4424d66 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -707,8 +707,8 @@ int main(int argc, char *argv[]) snpingenome.setWESanalysis(WESanalysis); SNPinGenome snpingenomeControl; snpingenomeControl.setWESanalysis(WESanalysis); - if (makePileup== "false") { - snpingenome.setCopyNumberFromPileup(true); //use pileup for copy number asessment, not only for BAFs + if (makePileup== "false" && !isHasMiniPileUPcontrol && !isHasMiniPileUPsample) { + snpingenome.setCopyNumberFromPileup(true); //use pileup for copy number assessment, not only for BAFs snpingenomeControl.setCopyNumberFromPileup(true); } @@ -1070,7 +1070,7 @@ int main(int argc, char *argv[]) sampleCopyNumber.printBAF(myName,snpingenome,sample_MateFile); - if (isControlIsPresent && makePileup == "false") { + if (isControlIsPresent && makePileup == "false" && !ifTargeted) { // will output Control data only for WGS data! sampleCopyNumber.calculateSomaticCNVs(controlCopyNumber.getCNVs(),controlCopyNumber.getPloidy()); controlCopyNumber.printBAF(controlName,snpingenomeControl,control_MateFile); controlCopyNumber.printRatio(myName+"_normal_ratio.txt",0,printNA); diff --git a/src/version.h b/src/version.h index f3d2f98..4135a6d 100644 --- a/src/version.h +++ b/src/version.h @@ -3,7 +3,7 @@ #define VERSION_H const double VERSION_OFFSET = 3; -const double FREEC_VERSION = 11.3; +const double FREEC_VERSION = 11.4; const double CONTROL_FREEC_VERSION = FREEC_VERSION - VERSION_OFFSET; #endif