This question is a kind of follow-up to this one. I am trying to convert a GAM file output from vg map to BAM for analysis and end up with error:[Surjector] could not identify path position of surjected alignment.
The code I used is now adapted to vg version 1.22.0:
vg mod -X 32 graph.vg > graph_mod.vg
vg index -x graph_mod.xg graph_mod.vg
vg prune -k 16 -e 3 graph_mod.vg > graph_prune.vg
vg index -g graph_mod.gcsa -k 16 graph_prune.vg
vg map -d graph_mod -f reads.fastq.gz > graph_reads.gam
vg surject -x graph_mod.xg -b graph_reads.gam > graph_reads.bam
The mapping ran smoothly, and vg surject creates a BAM file, but still stops almost instantly with the mentioned error message. vg paths -L lists the five reference paths in the xg index and in the vg graph itself.
The stack trace file looks like this:
Crash report for vg v1.22.0 "Rotella"
Stack trace (most recent call last) in thread 6167:
#15   Object "", at 0xffffffffffffffff, in
#14   Object "/lib/x86_64-linux-gnu/libc-2.23.so", at 0x7fda8a74b41c, in __clone
#13   Object "/lib/x86_64-linux-gnu/libpthread-2.23.so", at 0x7fda8cfb36b9, in start_thread
#12   Object "/usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0", at 0x7fda8ac3343d, in
#11   Object "/data3/genome_graphs/vg-v1.22.0/bin/vg", at 0xc4c2a8, in void vg::io::for_each_parallel_impl<vg::Alignment>(std::istream&, std::function<void (vg::Alignment&, vg::Alignment&)> const&, std::function<void (vg::Alignment&)> const&, std::function<bool ()> const&, unsigned long) [clone ._omp_fn.0]
    | Source "/data3/genome_graphs/vg-v1.22.0/include/vg/io/stream.hpp", line 210, in operator()
    |   208:                             handle(obj1.ParseFromString(batch->at(i)));
    |   209:                             handle(obj2.ParseFromString(batch->at(i+1)));
    | > 210:                             lambda2(obj1,obj2);
    |   211:                         }
    |   212:                     } // scope obj1 & obj2
      Source "/usr/include/c++/5/functional", line 2267, in _ZN2vg2io22for_each_parallel_implINS_9AlignmentEEEvRSiRKSt8functionIFvRT_S6_EERKS4_IFvS6_EERKS4_IFbvEEm._omp_fn.0 [0xc4c2a8]
       2264:     {
       2265:       if (_M_empty())
       2266:    __throw_bad_function_call();
      >2267:       return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
       2268:     }
       2269:
       2270: #if __cpp_rtti
#10   Object "/data3/genome_graphs/vg-v1.22.0/bin/vg", at 0xa2dc0b, in std::_Function_handler<void (vg::Alignment&, vg::Alignment&), void vg::io::for_each_parallel<vg::Alignment>(std::istream&, std::function<void (vg::Alignment&)> const&, unsigned long)::{lambda(vg::Alignment&, vg::Alignment&)#1}>::_M_invoke(std::_Any_data const&, vg::Alignment&, vg::Alignment&)
    | Source "/usr/include/c++/5/functional", line 1871, in operator()
    |  1869:       _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args)
    |  1870:       {
    | >1871:    (*_Base::_M_get_pointer(__functor))(
    |  1872:        std::forward<_ArgTypes>(__args)...);
    |  1873:       }
    | Source "/data3/genome_graphs/vg-v1.22.0/include/vg/io/stream.hpp", line 312, in operator()
    |   310:                        const std::function<void(T&)>& lambda1,
    |   311:                        size_t batch_size = 256) {
    | > 312:     std::function<void(T&,T&)> lambda2 = [&lambda1](T& o1, T& o2) { lambda1(o1); lambda1(o2); };
    |   313:     std::function<bool(void)> no_wait = [](void) {return true;};
    |   314:     for_each_parallel_impl(in, lambda2, lambda1, no_wait, batch_size);
      Source "/usr/include/c++/5/functional", line 2267, in _M_invoke [0xa2dc0b]
       2264:     {
       2265:       if (_M_empty())
       2266:    __throw_bad_function_call();
      >2267:       return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
       2268:     }
       2269:
       2270: #if __cpp_rtti
#9    Object "/data3/genome_graphs/vg-v1.22.0/bin/vg", at 0xc4c794, in main_surject(int, char**)::{lambda(std::istream&)#4}::operator()(std::istream&) const::{lambda(vg::Alignment&)#2}::operator()(vg::Alignment) const [clone .constprop.285]
      Source "src/subcommand/surject_main.cpp", line 302, in operator() [0xc4c794]
#8    Object "/data3/genome_graphs/vg-v1.22.0/bin/vg", at 0xea2571, in vg::Surjector::surject(vg::Alignment const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool, bool) const
    | Source "src/surjector.cpp", line 26, in ~basic_string
    | Source "/usr/include/c++/5/bits/basic_string.h", line 543, in _M_dispose
    |   541:        */
    |   542:       ~basic_string()
    | > 543:       { _M_dispose(); }
    |   544:
    |   545:       /**
    | Source "/usr/include/c++/5/bits/basic_string.h", line 180, in _M_destroy
    |   178:       {
    |   179:    if (!_M_is_local())
    | > 180:      _M_destroy(_M_allocated_capacity);
    |   181:       }
    | Source "/usr/include/c++/5/bits/basic_string.h", line 185, in deallocate
    |   183:       void
    |   184:       _M_destroy(size_type __size) throw()
    | > 185:       { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
    |   186:
    |   187:       // _M_construct_aux is used to implement the 21.3.1 para 15 which
    | Source "/usr/include/c++/5/bits/alloc_traits.h", line 517, in deallocate
    |   515:       static void
    |   516:       deallocate(allocator_type& __a, pointer __p, size_type __n)
    | > 517:       { __a.deallocate(__p, __n); }
    |   518:
    |   519:       /**
      Source "/usr/include/c++/5/ext/new_allocator.h", line 110, in surject [0xea2571]
        107:       // __p is not permitted to be a null pointer.
        108:       void
        109:       deallocate(pointer __p, size_type)
      > 110:       { ::operator delete(__p); }
        111:
        112:       size_type
        113:       max_size() const _GLIBCXX_USE_NOEXCEPT
#7    Object "/lib/x86_64-linux-gnu/libgcc_s.so.1", at 0x7fda8aa1e486, in _Unwind_Resume
#6    Object "/lib/x86_64-linux-gnu/libgcc_s.so.1", at 0x7fda8aa1df82, in
#5    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21", at 0x7fda8aed3004, in __gxx_personality_v0
#4    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21", at 0x7fda8aed26a8, in
#3    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21", at 0x7fda8aed36b5, in
#2    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21", at 0x7fda8aed584c, in __gnu_cxx::__verbose_terminate_handler()
#1    Object "/lib/x86_64-linux-gnu/libc-2.23.so", at 0x7fda8a67b029, in abort
#0    Object "/lib/x86_64-linux-gnu/libc-2.23.so", at 0x7fda8a679428, in raise
                    
                
                
Thank you! I'm using the graph without added annotation, but the reference annotation is still present. I was just going to post yet another question about that. The reference paths have this format "refseq|NZ_CP020659.1|chromosome" which seems to give
vg paths -Qa hard time. That shouldn't be a problem forvg surject, though, right? Anyway, with updating to the latest version I'm not even getting to the mapping step, as you know.So, I was able to use the graph with the reference paths, but I still get the same error. I'll edit the original question with the workflow adapted to vg 1.22.0.