tfwillems / HipSTR

Genotype and phase short tandem repeats using Illumina whole-genome sequencing data
GNU General Public License v2.0
94 stars 31 forks source link

SIGFPE on downsampled data #13

Closed holtgrewe closed 8 years ago

holtgrewe commented 8 years ago

I sampled down the data to 10 STRs and I'm seeting the following

Program received signal SIGFPE, Arithmetic exception.

Opening gdb shows me that a 0 % 0 division takes place

#0  0x0000000000441c70 in StutterModel::log_stutter_pmf (this=0x1e70d80, sample_bps=0, read_bps=0) at stutter_model.cpp:32
32    if (bp_diff % motif_len_ != 0){
(gdb) p bp_diff
$1 = 0
(gdb) p motif_len_
$2 = 0
(gdb) l
27    Returns the read's log-likeliood given that it contains exactly the provided number of base pairs
28  */
29  double StutterModel::log_stutter_pmf(int sample_bps, int read_bps){
30    double log_pmf;
31    int bp_diff = read_bps - sample_bps;
32    if (bp_diff % motif_len_ != 0){
33      int eff_diff = bp_diff - (bp_diff/motif_len_);
34      if (eff_diff < 0)
35        log_pmf = out_log_down_ + out_log_nostep_ + out_log_step_*(-eff_diff-1);
36      else
holtgrewe commented 8 years ago

I was stupid and added a trailing comma when listing the BAM file, I guess. The program did not catch this user error (just a suggestion)

tfwillems commented 8 years ago

It looks like this issue is arising because you have an STR with a period/motif length of 0. As a result, this results in a % 0 operation on line 32. I don't believe it is due to a trailing ",", as I tested this and it doesn't seem to have an effect. Can you attach a copy of the region file you're using to run HipSTR?

tfwillems commented 8 years ago

Closing this issue for now, as I believe it's due to incorrectly formatted input files. Added some checks to prevent the use of these input files in commit 733e7e7b642af5b688cfc5000ac27887ef7f3072