ma-compbio / Phylo-HMRF

MIT License
15 stars 3 forks source link

Error using example input #8

Open cyz0315 opened 4 years ago

cyz0315 commented 4 years ago

I tried to run with example input with command python phylo_hmrf.py -n 20 -p $input_dir -r 1 --reload 0 --chromvec 21,22 --miter 100. $input_dir to Phylo-HMRF-master/example_input.

But I got this error.

out of bound error! 1 out of bound error! 2 out of bound error! 3 ou_optimize_init likelihood -10.2005793894 number in the cluster 12511 8 out of bound error! 1 /home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py:1257: RuntimeWarning: divide by zero encountered in divide ratio1 = lambda1/(2beta1) /home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py:1271: RuntimeWarning: invalid value encountered in double_scalars values[i,1] = ratio1[i](1-beta1_exp[i]*2) + values[p_idx[i],1](beta1_exp[i]2) Traceback (most recent call last): File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 1760, in opts.simu_version, opts.annotation, opts.reload, opts.dtype, opts.miter, opts.resolution, opts.quantile, opts.ref_species, opts.output) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 1738, in run params_vec1, params_vec2, params_vecList, iter_id1, iter_id2, cost_vec, state_vec = tree1.fit_accumulate_test(samples, len_vec, threshold, filename, m_iter) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/base.py", line 307, in fit_accumulate_test self._init(X, lengths=lengths) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 246, in _init self.init_ou_params = self._init_ou_param(X1[0:select_num1], init_label[0:selectnum1], self.means) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 196, in _init_ou_param cur_param, lik = self._ou_optimize_init(x1, mean_values[i]) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 1438, in _ou_optimize_init flag, params1 = self._ou_optimize_init_unit(X, mean_values) File "/home/cheyizhuo/project/cross_Fo_HiC/mycode/Phylo-HMRF-master/phylo_hmrf.py", line 1493, in _ou_optimize_init_unit constraints=con1, tol=1e-6, options={'disp': False}) File "/home/cheyizhuo/miniconda3/envs/py27/lib/python2.7/site-packages/scipy/optimize/_minimize.py", line 458, in minimize constraints, callback=callback, options) File "/home/cheyizhuo/miniconda3/envs/py27/lib/python2.7/site-packages/scipy/optimize/slsqp.py", line 370, in _minimize_slsqp raise ValueError("Objective function must return a scalar") ValueError: Objective function must return a scalar

cyz0315 commented 4 years ago

This problem occurred randomly. It appears when using function _init (line 204 in phylo_hmrf.py), wrong initiation could be generated. If you run this script multiple times, it may succeed.

yangymargaret commented 4 years ago

Hi @cyz0315, Thank you very much for helping identify this problem. I am very sorry for my late reply. I think the problem occurs due to cases of random initiation where the program did not find a solution. The program includes some mechanism of restarting initialization if a solution cannot be found, but it is incomplete. I will update the part of restarting initialization accordingly. Please let me know if you have any other questions. Many thanks!

Best regards! Yang Yang