From 9cc21f24aa9be084d4351193cd15e81090c98bbf Mon Sep 17 00:00:00 2001 From: Lauren Mogil Date: Tue, 30 Oct 2018 20:50:07 +0000 Subject: [PATCH] typecast abs() to long int to resolve ambiguity in g++ 7.3.0 --- src/bddata.cpp | 12 ++++++------ src/genotyping.cpp | 2 +- src/pindel.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bddata.cpp b/src/bddata.cpp index 84a147c3..66589524 100644 --- a/src/bddata.cpp +++ b/src/bddata.cpp @@ -119,7 +119,7 @@ void BDData::loadBDFile(const std::string& filename) firstPos += g_SpacerBeforeAfter; // ??? ask Kai secondPos += g_SpacerBeforeAfter; - if (firstChrName == secondChrName && secondChrName != "" && abs(firstPos - secondPos) < 500) { + if (firstChrName == secondChrName && secondChrName != "" && abs((long int)(firstPos - secondPos)) < 500) { continue; } if ( firstChrName!="" && secondChrName!="") { @@ -180,16 +180,16 @@ void SortRPByChrPos(std::vector & Reads_RP) { // no interchromosome RP bool RecipicalOverlap(RP_READ & first, RP_READ & second) { int distance = 1000; - if (abs(first.PosA - first.PosA1) > distance) { + if (abs((long int)(first.PosA - first.PosA1)) > distance) { return false; } - if (abs(first.PosB - first.PosB1) > distance) { + if (abs((long int)(first.PosB - first.PosB1)) > distance) { return false; } - if (abs(second.PosA - second.PosA1) > distance) { + if (abs((long int)(second.PosA - second.PosA1)) > distance) { return false; } - if (abs(second.PosB - second.PosB1) > distance) { + if (abs((long int)(second.PosB - second.PosB1)) > distance) { return false; } float cutoff = 0.9; @@ -424,7 +424,7 @@ void ModifyRP(std::vector & Reads_RP) Reads_RP[first].PosB = Reads_RP[first].PosB + Reads_RP[first].ReadLength; Reads_RP[first].PosB1 = Reads_RP[first].PosB1 + Reads_RP[first].ReadLength; } - if (Reads_RP[first].ChrNameA == Reads_RP[first].ChrNameB && abs(Reads_RP[first].PosA - Reads_RP[first].PosB) < 500) { + if (Reads_RP[first].ChrNameA == Reads_RP[first].ChrNameB && abs((long int)(Reads_RP[first].PosA - Reads_RP[first].PosB)) < 500) { Reads_RP[first].Visited = true; } //std::cout << "Final: " << Reads_RP[first].ChrNameA << " " << Reads_RP[first].DA << " " << Reads_RP[first].PosA << "\t" << Reads_RP[first].ChrNameB << " " << Reads_RP[first].DB << " " << Reads_RP[first].PosB << std::endl; diff --git a/src/genotyping.cpp b/src/genotyping.cpp index 04decbbd..546b1b0e 100644 --- a/src/genotyping.cpp +++ b/src/genotyping.cpp @@ -124,7 +124,7 @@ void doGenotyping (ControlState & CurrentState, UserDefinedSettings* userSetting // step 4 for each variant, do genotyping for (unsigned SV_index =0; SV_index < AllSV4Genotyping.size(); SV_index++) { // step 4.1 if type == DEL, GenotypeDel - if (AllSV4Genotyping[SV_index].ChrA == AllSV4Genotyping[SV_index].ChrB && abs(AllSV4Genotyping[SV_index].PosA - AllSV4Genotyping[SV_index].PosB) < SV_Genotype_Cutoff) { + if (AllSV4Genotyping[SV_index].ChrA == AllSV4Genotyping[SV_index].ChrB && abs((long int)(AllSV4Genotyping[SV_index].PosA - AllSV4Genotyping[SV_index].PosB)) < SV_Genotype_Cutoff) { std::cout << "Skip One SV " << OneSV.Type << " " << OneSV.ChrA << " " << OneSV.PosA << " " << OneSV.CI_A << " " << OneSV.ChrB << " " << OneSV.PosB << " " << OneSV.CI_B << std::endl; diff --git a/src/pindel.cpp b/src/pindel.cpp index 337b535e..44f70733 100644 --- a/src/pindel.cpp +++ b/src/pindel.cpp @@ -1554,7 +1554,7 @@ void MergeInterChr(ControlState& currentState, UserDefinedSettings *usersettings continue; } if (All[index_a].FirstChrName == All[index_b].FirstChrName && All[index_a].SecondChrName == All[index_b].SecondChrName) { - if (abs(All[index_a].FirstPos - All[index_b].FirstPos) < 10 && abs(All[index_a].SecondPos - All[index_b].SecondPos) < 10 && All[index_a].NumSupport + All[index_b].NumSupport >= cutoff) { + if (abs((long int)(All[index_a].FirstPos - All[index_b].FirstPos)) < 10 && abs((long int)(All[index_a].SecondPos - All[index_b].SecondPos)) < 10 && All[index_a].NumSupport + All[index_b].NumSupport >= cutoff) { INToutputfile << "chr\t" << All[index_a].FirstChrName << "\tpos\t" << unsigned((All[index_a].FirstPos + All[index_b].FirstPos) / 2) << "\tchr\t" << All[index_a].SecondChrName << "\tpos\t" << unsigned((All[index_a].SecondPos + All[index_b].SecondPos) / 2) << "\tseq\t" << All[index_a].InsertedSequence << "\tsupport\t" << All[index_a].NumSupport + All[index_b].NumSupport << "\tINFOR\t"