Skip to content

Commit

Permalink
update stdout log
Browse files Browse the repository at this point in the history
  • Loading branch information
Congm12 committed Apr 22, 2018
1 parent 200199b commit 51ccd55
Showing 1 changed file with 7 additions and 42 deletions.
49 changes: 7 additions & 42 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ See LICENSE for licensing.
using namespace std;

int main(int argc, char* argv[]){
time_t CurrentTime;
string CurrentTimeStr;

bool success=parse_arguments(argc, argv);

if(success){
Expand Down Expand Up @@ -65,47 +68,9 @@ int main(int argc, char* argv[]){
OutputNewGenome(SegmentGraph, Components, RefSequence, RefName, Output_Prefix+"_genome.fa");
}

/*sort(SegmentGraph.vEdges.begin(), SegmentGraph.vEdges.end(), [](Edge_t a, Edge_t b){return a.Weight>b.Weight;});
ofstream output3(Output_Prefix+"_discordantedges.txt", ios::out);
output3<<"# ";
for(int i=0; i<argc; i++)
output3<<argv[i]<<" ";
output3<<endl;
output3<<"# Ind1\tNode1\tHead1\tInd2\tNode2\tHead2\tWeight\n";
for(int i=0; i<SegmentGraph.vEdges.size(); i++){
int ind1=SegmentGraph.vEdges[i].Ind1, ind2=SegmentGraph.vEdges[i].Ind2;
if(SegmentGraph.vNodes[ind1].Chr!=SegmentGraph.vNodes[ind2].Chr || (SegmentGraph.vNodes[ind2].Position-SegmentGraph.vNodes[ind1].Position-SegmentGraph.vNodes[ind1].Length>Concord_Dist_Pos && ind2-ind1>20) || SegmentGraph.vEdges[i].Head1!=false || SegmentGraph.vEdges[i].Head2!=true){
bool flag=false;
pair<int,int> pos1=Node_NewChr[SegmentGraph.vEdges[i].Ind1], pos2=Node_NewChr[SegmentGraph.vEdges[i].Ind2];
if(pos1.first==pos2.first && pos1.second<pos2.second && SegmentGraph.vEdges[i].Head1==(Components[pos1.first][pos1.second]<0) && SegmentGraph.vEdges[i].Head2==(Components[pos2.first][pos2.second]>0))
flag=true;
else if(pos1.first==pos2.first && pos1.second>pos2.second && SegmentGraph.vEdges[i].Head2==(Components[pos2.first][pos2.second]<0) && SegmentGraph.vEdges[i].Head1==(Components[pos1.first][pos1.second]>0))
flag=true;
if(flag){
map<Edge_t, vector< pair<int,int> > >::iterator itmap=ExactBP.find(SegmentGraph.vEdges[i]);
vector< pair<int,int> > BP;
if(itmap==ExactBP.end() || itmap->second.size()==0){
int bp1,bp2;
bp1=(SegmentGraph.vEdges[i].Head1?SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Position:(SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Position+SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Length));
bp2=(SegmentGraph.vEdges[i].Head2?SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Position:(SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Position+SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Length));
BP.push_back(make_pair(bp1,bp2));
}
else
BP=itmap->second;
for(int k=0; k<BP.size(); k++){
if(SegmentGraph.vEdges[i].Head1)
output3<<SegmentGraph.vEdges[i].Ind1<<'\t'<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Chr<<','<<BP[k].first<<","<<(SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Position+SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Length-BP[k].first)<<"\tH\t";
else
output3<<SegmentGraph.vEdges[i].Ind1<<'\t'<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Chr<<','<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Position<<","<<(BP[k].first-SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind1].Position)<<"\tT\t";
if(SegmentGraph.vEdges[i].Head2)
output3<<SegmentGraph.vEdges[i].Ind2<<'\t'<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Chr<<','<<BP[k].second<<","<<(SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Position+SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Length-BP[k].second)<<"\tH\t";
else
output3<<SegmentGraph.vEdges[i].Ind2<<'\t'<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Chr<<','<<SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Position<<","<<(BP[k].second-SegmentGraph.vNodes[SegmentGraph.vEdges[i].Ind2].Position)<<"\tT\t";
output3<<SegmentGraph.vEdges[i].Weight<<endl;
}
}
}
}
output3.close();*/
time(&CurrentTime);
CurrentTimeStr=ctime(&CurrentTime);
cout<<"["<<CurrentTimeStr.substr(0, CurrentTimeStr.size()-1)<<"] Done."<<endl;

}
}

0 comments on commit 51ccd55

Please sign in to comment.