Skip to content

Commit fc985d6

Browse files
committed
fw first
1 parent b55a3b7 commit fc985d6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/kreeq.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -906,19 +906,19 @@ void DBG::DBGgraphToGFA() {
906906

907907
phmap::parallel_flat_hash_map<uint64_t, std::tuple<DBGkmer32,uint32_t,bool>> residualEdges; // hash, kmer, G' node, node side
908908

909-
auto extend = [&,this] (std::pair<uint64_t, DBGkmer32color> node, std::string &seed, uint8_t side) {
909+
auto extend = [&,this] (std::pair<uint64_t, DBGkmer32color> node, std::string &seed, int8_t side) {
910910

911-
if ((side ? node.second.bwCount() : node.second.fwCount()) > 1) {
911+
if ((side ? node.second.fwCount() : node.second.bwCount()) > 1) {
912912
std::cout<<"Branching node side, cannot extend. Terminating."<<std::endl;
913913
exit(EXIT_FAILURE);
914-
}else if ((side ? node.second.bwCount() : node.second.fwCount()) == 0){
914+
}else if ((side ? node.second.fwCount() : node.second.bwCount()) == 0){
915915
std::cout<<"Dead end, cannot extend. Terminating."<<std::endl;
916916
exit(EXIT_FAILURE);
917917
}
918918

919919
uint64_t key, baseCounter = 0;
920920
bool isFw = isKeyFw(node.first);
921-
isFw = side ? !isFw : isFw;
921+
isFw = side ? isFw : !isFw;
922922

923923
while (true) {
924924

@@ -1001,15 +1001,15 @@ void DBG::DBGgraphToGFA() {
10011001
std::string frontSequence = reverseHash(pair->first); // we grow the sequence in both directions
10021002
std::string backSequence = revCom(reverseHash(pair->first));
10031003

1004-
uint8_t edgeCounts[2] = {pair->second.fwCount(), pair->second.bwCount()};
1004+
uint8_t edgeCounts[2] = {pair->second.bwCount(), pair->second.fwCount()};
10051005

10061006
if (edgeCounts[0] == 1 || edgeCounts[1] == 1) { // we are at a branch, otherwise we are in the middle, nothing can be merged safely
10071007

1008-
for (uint8_t side = 0; side < 2; ++side) {
1008+
for (int8_t side = 1; side >= 0; --side) {
10091009

10101010
if (edgeCounts[side] == 1) { // we can extend if we are at a branch and this the non branching side
10111011

1012-
extend(*pair, (!side ? frontSequence : backSequence), side);
1012+
extend(*pair, (side ? frontSequence : backSequence), side);
10131013
// std::cout<<"sequence: "<<(!side ? frontSequence : backSequence)<<std::endl;
10141014

10151015

0 commit comments

Comments
 (0)