HiCExplorer
HiCExplorer copied to clipboard
hicInterIntraTAD: ZeroDivisionError: division by zero
hicInterIntraTAD seems to be very useful; however, I immediately ran into the division by zero error. Is it possible to account for such (likely, frequent) events?
ERROR:hicexplorer.hicInterIntraTAD:division by zeroTraceback (most recent call last):
File "/home/mdozmorov/miniconda3/envs/HiCExplorer/lib/python3.7/site-packages/hicexplorer/hicInterIntraTAD.py", line 224, in computeInterIntraTADs
inter_left_density = inter_left_number_of_contacts_nnz / inter_left_number_of_contacts
ZeroDivisionError: division by zero
$ hicInfo --version
hicInfo 3.7.2
$ python --version
Python 3.7.12
The command itself:
hicInterIntraTAD --matrix ${MATRIX} \
--tadDomains ${TADDOMAINS} \
--outFileName ${OUTFILENAME} \
--outFileNameRatioPlot ${OUTPLOT} \
--threads 24
Thanks, Mikhail
Hi Mikhail,
Thanks for reporting this bug. I will take care to fix it.
Best,
Joachim
Hi @joachimwolff
I have the same issue, did you get any chances to fix this bug?
thx
Hi @joachimwolff
reading the code, I have simply conditioned the code at line 213 (and line 224 ) and set the inter_right_density
and inter_left_density
to 0 when inter_right_number_of_contacts
(inter_left_number_of_contacts
) is 0.
For instance:
inter_right_density = 0
if inter_right_number_of_contacts > 0:
inter_right_density = inter_right_number_of_contacts_nzz / inter_right_number_of_contacts
do you see an issue with this fix?