IndexError: cannot do a non-empty take from an empty axes
Closed this issue · 1 comments
Hi,
I got the same error as this issue (#4), but after I pull the latest code and run make clean
and then make
doesn't work. Following is the error log, can you help me?
Thank you!
Zhenmiao
Networkx 1.10 found
Mon Feb 10 10:02:26 2020:Starting scaffolding..
converting bam file to bed file
finished conversion
Mon Feb 10 10:59:28 2020:Finished conversion
Mon Feb 10 10:59:28 2020:Started generating links between contigs
Mean = 1555.2
Stdev = -nan
Mon Feb 10 12:06:29 2020:Finished generating links between contigs
Mon Feb 10 12:06:29 2020:Started bulding of links between contigs
Mon Feb 10 12:06:29 2020:Finished bundling of links between contigs
Mon Feb 10 12:06:29 2020:Started finding and removing repeats
invalidating...k141_3744
/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/fromnumeric.py:3118: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/_methods.py:85: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/_methods.py:140: RuntimeWarning: Degrees of freedom <= 0 for slice
keepdims=keepdims)
/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/_methods.py:110: RuntimeWarning: invalid value encountered in true_divide
arrmean, rcount, out=arrmean, casting='unsafe', subok=False)
/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/_methods.py:132: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
Traceback (most recent call last):
File "/home/zhangzhm/software/MetaCarvel/repeat_filter.py", line 65, in <module>
p_degree = np.percentile(contig_degree.values(),75)
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3707, in percentile
a, q, axis, out, overwrite_input, interpolation, keepdims)
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3826, in _quantile_unchecked
interpolation=interpolation)
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3405, in _ureduce
r = func(a, **kwargs)
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3941, in _quantile_ureduce_func
x1 = take(ap, indices_below, axis=axis) * weights_below
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 189, in take
return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
File "/home/zhangzhm/software/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 56, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
IndexError: cannot do a non-empty take from an empty axes.
Mon Feb 10 12:06:32 2020: Failed to find repeats, terminating scaffolding....
Hi @ZhangZhenmiao! Looking at the log here, what seems strange to me is the stdev
(which I think is the standard deviation of insert sizes, judging by this code -- I could be wrong on this though) being -nan
. I think this might be causing this problem.
For reference, this exact line of code is where the error you're seeing comes up. Tracing up through the code, I suspect there might be a problem with your input BAM file.
If you're still working on this :), could you check that the BAM file (or the alignment.bed file that should have been created when you ran MetaCarvel) looks reasonable? The file might be empty, or have impossible records (e.g. end positions before start positions), or something like that.