Segmentation fault

Issue #123 wontfix
Lee David created an issue

At first I use metawrap. It’s a one-stop toolkit which include metabat2 also. It return error:

########################################################################################################################
#####                                               RUNNING METABAT2                                               #####
########################################################################################################################


------------------------------------------------------------------------------------------------------------------------
-----                                          making contig depth file...                                         -----
------------------------------------------------------------------------------------------------------------------------

Output depth matrix to /NGS/ACHQ/Binning/work_files/metabat_depth.txt
Output matrix to /NGS/ACHQ/Binning/work_files/metabat_depth.txt
Opening 1 bams
Consolidating headers
Processing bam files
Thread 0 finished: ACHQ.bam with 90827001 reads and 26380778 readsWellMapped
Creating depth matrix file: /NGS/ACHQ/Binning/work_files/metabat_depth.txt
Closing most bam files
Closing last bam file
Finished

------------------------------------------------------------------------------------------------------------------------
-----                                       Starting binning with metaBAT2...                                      -----
------------------------------------------------------------------------------------------------------------------------

MetaBAT 2 (v2.12.1) using minContig 1500, minCV 1.0, minCVSum 1.0, maxP 95%, minS 60, and maxEdges 200. 
/NGS/soft/metaWRAP/bin/metawrap-modules/binning.sh: line 296:  4655 Segmentation fault      metabat2 -i ${out}/work_files/assembly.fa -a ${out}/work_files/metabat_depth.txt -o ${out}/metabat2_bins/bin -m $metabat_len -t $threads --unbinned

************************************************************************************************************************
*****                              Something went wrong with running MetaBAT2. Exiting                             *****
************************************************************************************************************************


real    90m58.218s
user    556m41.946s
sys 1m41.809s

BTW, metawrap include concoct and maxbin too. They all success, with same .fa and .fq file, CPU and memory. So I believe metabat2 errors.

Next I just run: (I used assemble .fa and .bam files generated in previously failure try in metawrap. They are OK I think.)

runMetaBat.sh /NGS/ACHQ/Binning/Initial/metabat2/work_files/assembly.fa /NGS/ACHQ/Binning/Initial/metabat2/work_files/final_pure_reads.bam

Returns:

Executing: 'jgi_summarize_bam_contig_depths --outputDepth assembly.fa.depth.txt --pairedContigs assembly.fa.
paired.txt --minContigLength 1000 --minContigDepth 1  /NGS/ACHQ/Binning/Initial/metabat2/work_files/final_pu
re_reads.bam' at Mon Feb  1 03:09:05 UTC 2021
Output depth matrix to assembly.fa.depth.txt
Output pairedContigs lower triangle to assembly.fa.paired.txt
minContigLength: 1000
minContigDepth: 1
Output matrix to assembly.fa.depth.txt
Opening 1 bams
Consolidating headers
Allocating pairedContigs matrix: 1 MB over 1 threads
Processing bam files
Thread 0 finished: final_pure_reads.bam with 90622541 reads and 26146771 readsWellMapped
Creating depth matrix file: assembly.fa.depth.txt
Closing most bam files
Creating pairedContigs matrix file: assembly.fa.paired.txt
Closing last bam file
Finished
Finished jgi_summarize_bam_contig_depths at Mon Feb  1 03:11:07 UTC 2021
Creating depth file for metabat at Mon Feb  1 03:11:07 UTC 2021
Executing: 'metabat2  --inFile /NGS/ACHQ/Binning/Initial/metabat2/work_files/assembly.fa --outFile assembly.
fa.metabat-bins/bin --abdFile assembly.fa.depth.txt' at Mon Feb  1 03:11:07 UTC 2021
MetaBAT 2 (v2.12.1) using minContig 2500, minCV 1.0, minCVSum 1.0, maxP 95%, minS 60, and maxEdges 200. 
/NGS/soft/anaconda3/envs/metawrap-env/bin/runMetaBat.sh: line 118:  4327 Segmentation fault      $MB $metaba
topts --inFile $assembly --outFile $outname --abdFile ${depth}

Generated .depth.txt, .metabat-bins (dir), .paired.txt. But still fail.

I tried alot of ways of metabat. This is only 2 typical attempts. So I believe I tried everything within my ability. Can you please help. If you need anything log, please tell.

Thank you in advance.

Comments (5)

  1. Rob Egan

    Hi,

    Can you please try to compile the latest version on your platform? 2.12.1 is nearly 4 years old, and there have been a number of improvements since then.

    We have no interacation with the developers of metawrap, and a segmentation fault may indicate that whatever platform it was compiled on by them may not be compatible with your platform…. Metabat defaults to compile with all the optimizations of the cpu and builds binaries that are not backwards compatible with older hardware. (i.e. maybe they have a skylake and you have a haswell)?

    If it still segfaults after a new build, then please post the log of a run with -v.

    Thanks,

    Rob

  2. Lee David reporter

    Thank you for the reply.

    I run this on Google Cloud. It’s new rent platform and I don’t know how to compile the latest version, I just run ‘apt update’ and 'apt upgrade' to ensure every package is the latest. Then I run

    runMetaBat.sh -v ./log.out /NGS/ACHQ
    /Binning/Initial/metabat2/work_files/assembly.fa /NGS/ACHQ/Binning/Initial/metabat2/work_files/final_pure_reads.bam
    

    Returns:

    Executing: 'jgi_summarize_bam_contig_depths --outputDepth assembly.fa.depth.txt --pairedContigs assembly.fa.paired.
    txt --minContigLength 1000 --minContigDepth 1  /NGS/ACHQ/Binning/Initial/metabat2/work_files/final_pure_reads.bam' 
    at Thu Feb  4 01:57:34 UTC 2021
    Output depth matrix to assembly.fa.depth.txt
    Output pairedContigs lower triangle to assembly.fa.paired.txt
    minContigLength: 1000
    minContigDepth: 1
    Output matrix to assembly.fa.depth.txt
    Opening 1 bams
    Consolidating headers
    Allocating pairedContigs matrix: 1 MB over 1 threads
    Processing bam files
    Thread 0 finished: final_pure_reads.bam with 90622541 reads and 26146771 readsWellMapped
    Creating depth matrix file: assembly.fa.depth.txt
    Closing most bam files
    Creating pairedContigs matrix file: assembly.fa.paired.txt
    Closing last bam file
    Finished
    Finished jgi_summarize_bam_contig_depths at Thu Feb  4 01:59:35 UTC 2021
    Creating depth file for metabat at Thu Feb  4 01:59:35 UTC 2021
    Executing: 'metabat2  -v ./log.out --inFile /NGS/ACHQ/Binning/Initial/metabat2/work_files/assembly.fa --outFile ass
    embly.fa.metabat-bins./log.out/bin --abdFile assembly.fa.depth.txt' at Thu Feb  4 01:59:35 UTC 2021
    /NGS/soft/anaconda3/envs/metawrap-env/bin/runMetaBat.sh: line 118: 16015 Segmentation fault      $MB $metabatopts -
    -inFile $assembly --outFile $outname --abdFile ${depth}
    

    This time, only .depth.txt and .paired.txt generated. No .metabat-bins (dir). I don’t know where is the log (I expect a log.out in current dir)

    Please tell me where I can find the log file. THANK YOU

  3. Rob Egan

    Hi David,

    Your command line is wrong. But again, I do not think that the binary that you found is functional on the GoogleCloud platform, unless it is built there.

    To compile, follow the instructions in the INSTALL.md. Additionally you should be able to compile by running the commands scripted in the Dockerfile

    For the command line, the usage of: runMetaBat.sh

    $ ./runMetaBat.sh
    ./runMetaBat.sh <select metabat options> assembly.fa sample1.bam [ sample2.bam ...]
    

    where “<select metabat options>” is any of:

    $ ./metabat2
    Allowed options:
      -h [ --help ]                     produce help message
      -i [ --inFile ] arg               Contigs in (gzipped) fasta file format [Mandatory]
      -o [ --outFile ] arg              Base file name and path for each bin. The default output is fasta format.
                                        Use -l option to output only contig names [Mandatory].
      -a [ --abdFile ] arg              A file having mean and variance of base coverage depth (tab delimited;
                                        the first column should be contig names, and the first row will be
                                        considered as the header and be skipped) [Optional].
      -m [ --minContig ] arg (=2500)    Minimum size of a contig for binning (should be >=1500).
      --maxP arg (=95)                  Percentage of 'good' contigs considered for binning decided by connection
                                        among contigs. The greater, the more sensitive.
      --minS arg (=60)                  Minimum score of a edge for binning (should be between 1 and 99). The
                                        greater, the more specific.
      --maxEdges arg (=200)             Maximum number of edges per node. The greater, the more sensitive.
      --pTNF arg (=0)                   TNF probability cutoff for building TNF graph. Use it to skip the
                                        preparation step. (0: auto).
      --noAdd                           Turning off additional binning for lost or small contigs.
      --cvExt                           When a coverage file without variance (from third party tools) is used
                                        instead of abdFile from jgi_summarize_bam_contig_depths.
      -x [ --minCV ] arg (=1)           Minimum mean coverage of a contig in each library for binning.
      --minCVSum arg (=1)               Minimum total effective mean coverage of a contig (sum of depth over
                                        minCV) for binning.
      -s [ --minClsSize ] arg (=200000) Minimum size of a bin as the output.
      -t [ --numThreads ] arg (=0)      Number of threads to use (0: use all cores).
      -l [ --onlyLabel ]                Output only sequence labels as a list in a column without sequences.
      --saveCls                         Save cluster memberships as a matrix format
      --unbinned                        Generate [outFile].unbinned.fa file for unbinned contigs
      --noBinOut                        No bin output. Usually combined with --saveCls to check only contig
                                        memberships
      --seed arg (=0)                   For exact reproducibility. (0: use random seed)
      -d [ --debug ]                    Debug output
      -v [ --verbose ]                  Verbose output
    

    try this:

    runMetaBat.sh -v /NGS/ACHQ/Binning/Initial/metabat2/work_files/assembly.fa /NGS/ACHQ/Binning/Initial/metabat2/work_files/final_pure_reads.bam 2>&1 | tee log.out
    

  4. Log in to comment