idr icon indicating copy to clipboard operation
idr copied to clipboard

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Open hcph opened this issue 3 years ago • 5 comments

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.

hcph avatar Dec 05 '20 03:12 hcph

I also meet the same trouble and I don't know how to solve it. have you finished this questions? thanks.

QinglvWei avatar Dec 10 '20 17:12 QinglvWei

NO, but when I use the old version depended on R, everything is OK

hcph avatar Dec 10 '20 23:12 hcph

https://github.com/nboley/idr/issues/34

DebbieCG avatar Dec 29 '20 01:12 DebbieCG

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:

  1. edit line 415 in the file "idr-2.0.2/idr/idr.py". if localIDRs == None or IDRs == None: into if localIDRs.all() == None or IDRs.all() == None. After this change, if all the values in localIDRs and IDRs are None, then replace them with 1.
  2. 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: idrValues txt

Generated file "idrValues.txt".

idrValues.txt

Disclaimer: I am NOT the developer of this "idr" algorithm. Hope the developer can confirm if this fix is appropriate.

liguowang avatar Apr 06 '22 23:04 liguowang

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

FanqianYin avatar May 18 '22 14:05 FanqianYin