vaquerizaslab/fanc

ZeroDivisionError: division by zero

Opened this issue · 2 comments

Hello, FANC is amazing! I successfully used FANC to analyze A/B compartment. but i also encountered a problem when i want to run the TAD analysis with .hic generated by jucer, and i specified a resolution 50kb, The code I used and the feedback are listed below:

fanc insulation Mpha.hic@50kb Mpha_50kb.insulation -w 50kb

2024-11-25 20:16:38,792 INFO FAN-C version: 0.9.28
2024-11-25 20:16:39,124 INFO Chosen window sizes: 50000
2024-11-25 20:16:39,850 INFO Chr1 (1/11)
Traceback (most recent call last):
File "/opt/software/python/bin/fanc", line 127, in
Fanc()
File "/opt/software/python/bin/fanc", line 93, in init
command([sys.argv[0]] + sys.argv[option_ix:], log_level=log_level, verbosity=verbosity)
File "/opt/software/python/lib/python3.8/site-packages/fanc/commands/fanc_commands.py", line 3801, in insulation
_domain_scores(parser, input_file, output_file, output_format,
File "/opt/software/python/lib/python3.8/site-packages/fanc/commands/fanc_commands.py", line 3853, in _domain_scores
scores = score_class.from_hic(matrix, file_name=output_file,
File "/opt/software/python/lib/python3.8/site-packages/fanc/architecture/domains.py", line 342, in from_hic
values_by_chromosome[w_ix][k] /= bin_window_size ** 2
ZeroDivisionError: division by zero
Closing remaining open files:Mpha_50kb.insulation...done

At the mean time, I also try to use fanc auto to generate .hic using fastq.gz data and validpair data produced by Hicpro, but I encountered the same error: ZeroDivisionError: division by zero.

Thank you very much for your time and assistance. I look forward to your guidance on this matter.

Hi, and thank you.

Can you please try a larger window size? Setting the window size equal to the matrix resolution will effectively add up values along the diagonal of the matrix, which is surely not what you want. Try 10x resolution first, i.e. 500kb.

Best,
Kai

Thank you very much, indeed, I called TAD successfully specifing a resolution 50kb with larger window size(100kb、250kb and 500kb), and I found that TAD boundary are not same in different window size, so under which window size is the TAD boundary result more reliable? Thanks