segfault in metabat2

Issue #31 resolved
Rob Egan created an issue

Esther found a segfault on her dataset and I reproduced it with the latest version.

/global/projectb/scratch/esinger/switchgrass/2014/metagenome/assembly/2ndround/_0031

runMetaBat.sh ./megahit_out/_0031.final.contigs.fa _0031.out.sam.sorted.bam.bam
Executing: 'jgi_summarize_bam_contig_depths --outputDepth _0031.final.contigs.fa.depth.txt --pairedContigs _0031.final.contigs.fa.paired.txt --minContigLength 1000 --minContigDepth 1  _0031.out.sam.sorted.bam.bam' at Mon Aug  7 15:41:41 PDT 2017
Output depth matrix to _0031.final.contigs.fa.depth.txt
Output pairedContigs lower triangle to _0031.final.contigs.fa.paired.txt
minContigLength: 1000
minContigDepth: 1
Output matrix to _0031.final.contigs.fa.depth.txt
Opening 1 bams
Consolidating headers
Allocating pairedContigs matrix: 0 MB over 1 threads
Processing bam files
Thread 0 finished: _0031.out.sam.sorted.bam.bam with 432668 reads and 68226 readsWellMapped
Creating depth matrix file: _0031.final.contigs.fa.depth.txt
Closing most bam files
The data files have no paired contigs to report
Closing last bam file
Finished
Finished jgi_summarize_bam_contig_depths at Mon Aug  7 15:42:03 PDT 2017
Creating depth file for metabat at Mon Aug  7 15:42:03 PDT 2017
Executing: 'metabat2  --inFile ./megahit_out/_0031.final.contigs.fa --outFile _0031.final.contigs.fa.metabat-bins/bin --abdFile _0031.final.contigs.fa.depth.txt' at Mon Aug  7 15:42:03 PDT 2017
MetaBAT 2 (v2.11.2) using minContig 2500, minCV 1.0, minCVSum 1.0, maxP 95%, minS 60, and maxEdges 200.
/usr/common/jgi/assemblers/metabat/prod-0.32.4-1-58-g5a67530/bin/runMetaBat.sh: line 118:  2824 Segmentation fault      $MB $metabatopts --inFile $assembly --outFile $outname --abdFile ${depth}

It looks like one of the vectors is assumed to have data when it is empty, and I'm unsure where the check should go.

Program received signal SIGSEGV, Segmentation fault.
get_orders<unsigned int> (w=..., this=<synthetic pointer>) at src/ranker.h:51
51          w.front() = 0;
(gdb) list
46      }
47  
48      template<class S>
49      void get_orders(vector<S>& w) const {
50          w.resize(sz);
51          w.front() = 0;
52          for (typename vector<S>::iterator i = w.begin(); i != w.end() - 1; ++i)
53              *(i + 1) = *i + 1;
54          std::sort(w.begin(), w.end(), *this);
55      }
(gdb) p w
$1 = (std::vector<unsigned int, std::allocator<unsigned int> > &) @0x7fffffffb9f0: {<std::_Vector_base<unsigned int, std::allocator<unsigned int> >> = {
    _M_impl = {<std::allocator<unsigned int>> = {<__gnu_cxx::new_allocator<unsigned int>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, 
      _M_end_of_storage = 0x0}}, <No data fields>}

Comments (1)

  1. Log in to comment