jsh58 / Genrich

Detecting sites of genomic enrichment
MIT License
182 stars 27 forks source link

Segmentation fault #16

Closed JPascualAnaya closed 5 years ago

JPascualAnaya commented 5 years ago

Hi there, I am having a segfault problem when running Genrich on two BAM files (replicates) from an ATAC-seq. Each file is around 7G

The exact command and stderr:

$ Genrich -t EbNo3-A1_trimgalore_A1_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam,EbNo3-A2_trimgalore_A2_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam -j -o EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.narrowPeak -f EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.log -E $BOWTIE2_INDEXES/effective_size.Genrich.bed
Segmentation fault

Like @ShuangHe33 I've tried to debug it:

$ ~/Software/gdb-8.2.1/bin/gdb Genrich
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Genrich...done.
(gdb) run -t EbNo3-A1_trimgalore_A1_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam,EbNo3-A2_trimgalore_A2_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam -j -o EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.narrowPeak -f EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.log -E $BOWTIE2_INDEXES/effective_size.Genrich.bed
Starting program: /home/champi/Software/bin/Genrich -t EbNo3-A1_trimgalore_A1_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam,EbNo3-A2_trimgalore_A2_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.nsorted.bam -j -o EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.narrowPeak -f EbNo3-A_trimgalore_vs_eb3.2_bowtie2.paired.mapped.q30.rmdup.genrich.log -E $BOWTIE2_INDEXES/effective_size.Genrich.bed

Program received signal SIGSEGV, Segmentation fault.
0x0000000000407b25 in saveInterval (c=0x2aaaab2b1650, start=<optimized out>, end=251, qname=0x629420 "K00114:809:HTL3FBBXX:3:1101:13646:22186", count=<optimized out>, 
    bed=bed@entry=..., bedOpt=false, gzOut=false, ctrl=false, sample=0, errCount=0x7fffffffc8dc, verbose=false) at Genrich.c:2537
2537      if (c->diff->cov[start] == INT16_MAX) {
(gdb)

But have no idea about what it means...

I'm going to try feeding it with SAM files, but since I'm using Genrich on multiple files at the same time, I can't use directly the stdout from samtools, and need to convert BAM --> SAM, which is not ideal due to space limitations.

Any idea of the reason for the Segmentation fault?

Cheers, Juan

Originally posted by @JPascualAnaya in https://github.com/jsh58/Genrich/issues/7#issuecomment-491129343

dariober commented 5 years ago

I just came across the same problem while using the latest version of the repository (0e93bbf) AND using the -j option. It works fine without -j.

Works fine also the release version v0.5 with or without -j.

jsh58 commented 5 years ago

Juan,

Thanks for the question and opening the issue. Here are a few comments/questions/ideas:

@dariober, not sure I follow you. There is an error with the latest commit but not the latest release? What is the error? Can you run valgrind?

John Gaspar

JPascualAnaya commented 5 years ago

Hi John,

Thanks for your response.

To answer your questions, as you say, BAM>SAM did not help. gcc version:

$ gcc --version
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

There were no warnings when compiling Genrich.

And I just followed @dariober 's suggestion and now it seems to be working. So, when I cloned the git repository, compiled and run, Genrich stopped with a segmentation fault. After downloading the source code from here https://github.com/jsh58/Genrich/releases (v0.5) and then compiling, it seems to be working.

When it finishes I will compile again from the git repository and run valgrind with it. I'll post the output here and see if that helps you find what's wrong with the repository.

jsh58 commented 5 years ago

Juan,

I think I found and fixed the bug. This was introduced with my previous commit and so is consistent with v0.5 not having the issue, and with it occurring only when not in verbose mode. If you update the clone (git pull) and recompile, there should not be an issue.

Sorry for the trouble. Thanks for letting me know!

John Gaspar

JPascualAnaya commented 5 years ago

Hi John,

It run without an issue now. Thank you very much for your help!

Juan