From b8f176e7e4ef76aed509959b8060111086cec92a Mon Sep 17 00:00:00 2001 From: jonassibbesen Date: Tue, 12 May 2020 15:17:47 -0700 Subject: [PATCH] fix bidirectional path id bug --- src/paths_index.cpp | 7 ++++++- src/paths_index.hpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/paths_index.cpp b/src/paths_index.cpp index 5d9abc3..5d24d74 100644 --- a/src/paths_index.cpp +++ b/src/paths_index.cpp @@ -99,7 +99,12 @@ string PathsIndex::pathName(const uint32_t path_id) const { return sstream.str(); } -uint32_t PathsIndex::pathLength(const uint32_t path_id) const { +uint32_t PathsIndex::pathLength(uint32_t path_id) const { + + if (index_.bidirectional()) { + + path_id = gbwt::Path::encode(path_id, false); + } uint32_t path_length = 0; diff --git a/src/paths_index.hpp b/src/paths_index.hpp index 3f868fe..324508b 100644 --- a/src/paths_index.hpp +++ b/src/paths_index.hpp @@ -26,7 +26,7 @@ class PathsIndex { uint32_t nodeLength(const uint32_t node_id) const; string pathName(const uint32_t path_id) const; - uint32_t pathLength(const uint32_t path_id) const; + uint32_t pathLength(uint32_t path_id) const; double effectivePathLength(const uint32_t path_id, const FragmentLengthDist & fragment_length_dist) const; private: