TADbit
TADbit copied to clipboard
Error division by zero in find_compartments
Dear,
We have 4 samples (Bos taurus) and 3 of them were analysed successfully. However, for 1 of them, we are getting the following error:
01. Reading valid pairs...
05. Computing eigenvectors...
Filtering bad columns 99
Normalizing by expected values
Normalizing by ICE (1 round)
iterative correction
- copying matrix
- computing biases
rescaling to factor 1
- getting the sum of the matrix
=> 54961.065
- rescaling biases
Processing chromosome chrX
Processing chromosome chr13
Processing chromosome chr12
Processing chromosome chr11
Processing chromosome chr10
Processing chromosome chr17
Processing chromosome chr16
Processing chromosome chr15
Processing chromosome chr14
Processing chromosome chr19
Processing chromosome chr18
Processing chromosome chr26
Processing chromosome chr27
Processing chromosome chr24
Processing chromosome chr25
Processing chromosome chr22
Processing chromosome chr23
Processing chromosome chr20
Processing chromosome chr21
Processing chromosome chr28
Processing chromosome chr29
Processing chromosome chr7
Processing chromosome chr6
Processing chromosome chr5
Processing chromosome chr4
Processing chromosome chr3
Processing chromosome chr2
Processing chromosome chr1
Traceback (most recent call last):
File "createMatrixHiC_11.py", line 141, in <module>
eigenvectors = hic_data.find_compartments(label_compartments="none", perc_zero=99, max_ev=2, verbose=True)
File "/home/shuaibm/miniconda3/envs/TADbit/lib/python2.7/site-packages/pytadbit/hic_data.py", line 860, in find_compartments
if not j in self.bads]
ZeroDivisionError: float division by zero
The command is the following one:
eigenvectors = hic_data.find_compartments(label_compartments="none", perc_zero=99, max_ev=2, verbose=True)
Thank you
Hello,
My feeling is that is failing to correct for the decay in chr1. Maybe one of the diagonals has 0 counts. Can you check if the matrix for chr1 is very sparse? Or try to decrease the resolution.
Regards
David
Hi Andreu, I will add a cuple of suggestions to David's one:
- First it seems that you are using a bias generated with an old version of TADbit. Perhaps you could do the normalization step again? (the difference is that now decay is computed by chromosomes https://github.com/3DGenomes/TADbit/issues/199 )
- Then, and this relates to @david-castillo 's David's point, can you check the length of
hic_data.biasandhic_data.expected, and how they compare tolen(hic_data)