Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hcph opened this issue Dec 5, 2020 · 5 comments

Comments

@hcph
Copy link

hcph commented Dec 5, 2020

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.

@QinglvWei
Copy link

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

@hcph
Copy link
Author

hcph commented Dec 10, 2020

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

@DebbieCG
Copy link

#34

@liguowang
Copy link

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.

@FanqianYin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants