@@ -110,7 +110,7 @@ gbwt::vector_type predecessors(const xg::XG& xg_index, const Path& path) {
110
110
cerr << " Look for predecessors of node " << first_node << " " << is_reverse << " which is first in alt path" << endl;
111
111
#endif
112
112
113
- xg_index.follow_edges (xg_index.get_handle (first_node), true , [&] (handle_t next) {
113
+ xg_index.follow_edges (xg_index.get_handle (first_node), !is_reverse , [&] (handle_t next) {
114
114
if (xg_index.get_id (next) != first_node) {
115
115
result.push_back (gbwt::Node::encode (xg_index.get_id (next), xg_index.get_is_reverse (next)));
116
116
}
@@ -533,7 +533,15 @@ int main_index(int argc, char** argv) {
533
533
return 1 ;
534
534
}
535
535
VGset graphs (file_names);
536
- graphs.to_xg (*xg_index, false , Paths::is_alt, index_haplotypes ? &alt_paths : nullptr );
536
+ graphs.to_xg (*xg_index);
537
+ if (index_haplotypes) {
538
+ xg_index->for_each_path_handle ([&](path_handle_t path_handle) {
539
+ string path_name = xg_index->get_path_name (path_handle);
540
+ if (Paths::is_alt (path_name)) {
541
+ alt_paths[path_name] = path_from_path_handle (*xg_index, path_handle);
542
+ }
543
+ });
544
+ }
537
545
if (show_progress) {
538
546
cerr << " Built base XG index" << endl;
539
547
}
@@ -733,7 +741,7 @@ int main_index(int argc, char** argv) {
733
741
xg_index->for_each_path_handle ([&](path_handle_t path_handle) {
734
742
path_handles[path_rank++] = path_handle;
735
743
});
736
- for (path_rank = 1 ; path_rank < path_handles. size (); ++path_rank ) {
744
+ for (path_rank = 1 ; path_rank <= max_path_rank; path_rank++ ) {
737
745
string path_name = xg_index->get_path_name (path_handles[path_rank]);
738
746
string vcf_contig_name = path_to_vcf.count (path_name) ? path_to_vcf[path_name] : path_name;
739
747
if (show_progress) {
0 commit comments