idr
idr copied to clipboard
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Hello! After I install the idr-2.0.2 and run idr --samples tests/data/peak1 tests/data/peak2, the error comes: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() How could I fix this? Wish your reply, thanks.
I also meet the same trouble and I don't know how to solve it. have you finished this questions? thanks.
NO, but when I use the old version depended on R, everything is OK
https://github.com/nboley/idr/issues/34
I have the same problem (Python 3.8.3). The error message "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" means that you should not evaluate a numpy array in a Boolean context.
Below is how I fixed this issue:
- edit line 415 in the file "idr-2.0.2/idr/idr.py".
if localIDRs == None or IDRs == None:
intoif localIDRs.all() == None or IDRs.all() == None
. After this change, if all the values inlocalIDRs
andIDRs
areNone
, then replace them with1
. - rerun
python3 setup.py install
Test:
python3 ./idr-2.0.2/bin/idr --samples ./idr-2.0.2/tests/data/peak1 ./idr-2.0.2/tests/data/peak2 --plot
Screen output:
Initial parameter values: [0.10 1.00 0.20 0.50] Final parameter values: [1.57 1.26 0.89 0.41] Number of reported peaks - 50537/50537 (100.0%)
Number of peaks passing IDR cutoff of 0.05 - 12748/50537 (25.2%)
Generated figure:
Generated file "idrValues.txt".
Disclaimer: I am NOT the developer of this "idr" algorithm. Hope the developer can confirm if this fix is appropriate.
When I re-install the latest version idr-2.0.3, I solved this problem. Here is where you can find https://github.com/nboley/idr/archive/refs/tags/2.0.3.zip