Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/bddata.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <algorithm>
#include <fstream>
#include "bddata.h"
#include <cmath>

BDData::BDData() : m_currentWindow( &g_dummyChromosome, 0, 0 )
{
Expand Down Expand Up @@ -119,7 +120,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 != "" && fabs(firstPos - secondPos) < 500) {
continue;
}
if ( firstChrName!="" && secondChrName!="") {
Expand Down Expand Up @@ -180,16 +181,16 @@ void SortRPByChrPos(std::vector <RP_READ> & Reads_RP) { // no interchromosome RP
bool RecipicalOverlap(RP_READ & first, RP_READ & second)
{
int distance = 1000;
if (abs(first.PosA - first.PosA1) > distance) {
if (fabs(first.PosA - first.PosA1) > distance) {
return false;
}
if (abs(first.PosB - first.PosB1) > distance) {
if (fabs(first.PosB - first.PosB1) > distance) {
return false;
}
if (abs(second.PosA - second.PosA1) > distance) {
if (fabs(second.PosA - second.PosA1) > distance) {
return false;
}
if (abs(second.PosB - second.PosB1) > distance) {
if (fabs(second.PosB - second.PosB1) > distance) {
return false;
}
float cutoff = 0.9;
Expand Down Expand Up @@ -424,7 +425,7 @@ void ModifyRP(std::vector <RP_READ> & 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 && fabs(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;
Expand Down Expand Up @@ -718,12 +719,12 @@ void BDData::UpdateBD(ControlState & currentState)
<< "\t" << secondPos2 - g_SpacerBeforeAfter
<< "\t" << currentState.Reads_RP_Discovery[read_index].DB
<< "\t" << secondPos2 - secondPos << "\t"
<< abs((int)secondPos - (int)firstPos) << "\tSupport: " << currentState.Reads_RP_Discovery[read_index].NumberOfIdentical << "\t";
<< fabs((int)secondPos - (int)firstPos) << "\tSupport: " << currentState.Reads_RP_Discovery[read_index].NumberOfIdentical << "\t";
DisplayBDSupportPerSample(currentState.Reads_RP_Discovery[read_index], RPoutputfile);
RPoutputfile << std::endl;
std::cout << "adding " << firstChrName << " " << ( (firstPos > g_SpacerBeforeAfter) ? firstPos - g_SpacerBeforeAfter : 1) << "\t" << firstPos2 - g_SpacerBeforeAfter << "\t" << currentState.Reads_RP_Discovery[read_index].DA << "\t" << firstPos2 - firstPos << "\t"
<< "\t" << secondChrName << " " << ( (secondPos > g_SpacerBeforeAfter) ? secondPos - g_SpacerBeforeAfter : 1) << "\t" << secondPos2 - g_SpacerBeforeAfter << "\t" << currentState.Reads_RP_Discovery[read_index].DB << "\t" << secondPos2 - secondPos << "\t"
<< " to BD events. " << abs((int)secondPos - (int)firstPos) << " Support: " << currentState.Reads_RP_Discovery[read_index].NumberOfIdentical << std::endl;
<< " to BD events. " << fabs((int)secondPos - (int)firstPos) << " Support: " << currentState.Reads_RP_Discovery[read_index].NumberOfIdentical << std::endl;
}
}

Expand Down