Segmentation fault (core dumped)

Issue #171 resolved
Emily Aguilar created an issue

Everytime I try to run jgi_summarize_bam_contig_depths I get the “segmentation fault (core dumped)” error immediately after trying to run. I’ve run it multiple other times recently and it was fine, but now it won’t run on any new files or old files it previously worked on. Originally I was running it on conda, then saw this wasn’t maintained and installed it instead and am receiving the same error. Any help would be greatly appreciated!

Comments (14)

  1. Rob Egan

    Since you built it yourself, I’d need to take a look at the whole build log from cmake to make. A segfault likely indicates that something is wrong with the bam files which you provided but I’d need to see command line and full output to have an idea what may be the problem.

    does samtools view work on each of your bam files? How many bam files do you have and how large are they, how many contigs in the assembly, how much RAM does your machine have? Can you try running with just 1 thread by running this before you start jgi_summarize_bam_contig_depths:

    export OMP_NUM_THREADS=1

    It is also possible that you built on one platform and executed on another which doesn’t have the same CPU instructions available as the build platform.

  2. Emily Aguilar reporter

    Samtools view did seem to work on the bam files. I’m only working with a single bam file now, which is 63 GB. We tried with export OMP_NUM_THREADS=1 and it didn’t work. And after running grep MemTotal /proc/meminfo to get RAM, my machine has 1056637700 kB or 1056.6 GB.

    For command line and my actual script:
    Here’s the script I’m using:
    jgi_summarize_bam_contig_depths --percentIdentity 97 --outputDepth A1_D2-C1-IF-SED-R1_depth.txt --pairedContigs A1_D2-C1-IF-SED-R1_paired.txt --referenceFASTA A1_D2-C1-IF-SED-R1_contigs.3kb.fna A1_D2-C1-IF-SED-R1.sorted.bam.bai
    And here’s the output error message:
    Minimum percent identity for a mapped read: 0.97
    Output depth matrix to A1_D2-C1-IF-SED-R1_depth.txt
    Output pairedContigs lower triangle to A1_D2-C1-IF-SED-R1_paired.txt
    ./jgi_summarize.sh: line 1: 83688 Segmentation fault (core dumped) jgi_summarize_bam_contig_depths --percentIdentity 97 --outputDepth A1_D2-C1-IF-SED-R1_depth.txt --pairedContigs A1_D2-C1-IF-SED-R1_paired.txt --referenceFASTA A1_D2-C1-IF-SED-R1_contigs.3kb.fna A1_D2-C1-IF-SED-R1.sorted.bam

  3. Rob Egan

    Okay, well if samtools doesn’t work on the bam file then you have a malformed file there. jgi_summarize_bam_contig_depths uses the samtools library to view those files so there is nothing I can do to fix that. I’d suggest repeating your mapping and generate a new one. If, after re-generating your bam, it still doesn’t work, then let me know the command line(s) you used to do the mapping and I might be able to help you fix your processing.

  4. Rob Egan

    Sorry, I misread your previous post. If the bam file is okay, then please let me know the version and how you built it.

    This looks like an older version as the messages don’t match with my code and if you got this from Conda, built by a 3rd party, then it is possible that it is incompatible with your machine, so I recommend building it yourself or getting the image from dockerhub https://hub.docker.com/r/metabat/metabat

  5. Emily Aguilar reporter

    Ok thank you that makes more sense! And yes this conda version shows: version 2.12.1; Aug 31 2017 21:02:54

    I built using:
    conda create -n metabat2 && conda activate metabat2 && conda install bioconda/label/cf201901::metabat2 && metabat2 -h

    I’m working on building myself now and will update further, Thank you!

  6. Rob Egan

    The coda version is sometime we never set up and has never been supported, so yes, please build yourself or use docker. Most of the issues here can be traced to that outdated conda image.

  7. Emily Aguilar reporter

    After building myself on my machine it’s version 2:v2.17-33-ge825481; 2024-05-09T16:56:22
    the jgi_summarize_bam_contig_depths function now works. However, now metabat2 is giving me something similar:
    ./metabat.sh: line 1: 538465 Segmentation fault (core dumped) /home/eaguilarpine/metabat/bin/metabat2 --seed 4 -v -d --numThreads 40 --minCVSum 0 --saveCls --minCV 0.1 --minContig 3000 -i /home/storage/3kbcontigs.fna -a /home/eaguilarpine/67_post/3kbcontigs.depth.txt -o /home/eaguilarpine/67_post/

  8. Emily Aguilar reporter

    I also found this error in from the verbose run: [Error!] Could not write cluster membership to /home/eaguilarpine/67_post/

  9. Rob Egan

    I think that I see the problem, but can’t be sure without the entire command line and log.

    There is a bug with --saveCls when --output is exactly a directory. I’ll fix this but for now, either run without --saveCls or run with --output /home/eaguilarpine/67_post/metabat.bins

  10. Emily Aguilar reporter

    We got rid of the --saveCIs and everything ran smoothly. Thank you so much for the help!

  11. Log in to comment