thegenemyers / HI.SIM

HiFi error modeler and simulator with ploidy
Other
11 stars 1 forks source link

Floating point exception with certain data set #1

Open sebschmi opened 2 years ago

sebschmi commented 2 years ago

Thank you very much for creating HI.SIM. It works very well in most cases, but on one of my data sets, it crashes.

I get a floating point exception when using HImodel on a certain set of human hifi reads.

Below are the commands used to reproduce the error.

wget https://sra-downloadb.be-md.ncbi.nlm.nih.gov/sos3/sra-pub-run-20/SRR10382244/SRR10382244.1 -O SRR10382244.sra
wget https://sra-downloadb.be-md.ncbi.nlm.nih.gov/sos3/sra-pub-run-20/SRR10382245/SRR10382245.1 -O SRR10382245.sra

fastq-dump --stdout --fasta default SRR10382244.sra > reads.fa
fastq-dump --stdout --fasta default SRR10382245.sra >> reads.fa

FastK -v -T1 -t1 -p -k51 reads.fa
HImodel -v -T56 -g5:1000 -e3 reads
sebschmi commented 2 years ago

I am a bit confused because changing this line: https://github.com/thegenemyers/HI.SIM/blob/d05807c0c941b0978b0edebaace41e91eda33dd6/HImodel.c#L993

to

err   = (10000*err)/((plen-rep) == 0 ? 1 : (plen-rep))

seems to prevent the crash, even though all involved variables seem to be integers. However err is converted to a float a few lines below, so maybe there is some optimisation causing this.