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

TypeError due to integer division change in python3 #78

Open
nwespe opened this issue Jul 9, 2020 · 5 comments
Open

TypeError due to integer division change in python3 #78

nwespe opened this issue Jul 9, 2020 · 5 comments

Comments

@nwespe
Copy link

nwespe commented Jul 9, 2020

Hi,
I am running BESST 2.2.8 in a python3 environment and get the following error:

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/bin/runBESST", line 4, in <module>
    __import__('pkg_resources').run_script('BESST==2.2.8', 'runBESST')
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 748, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1517, in run_script
    exec(code, namespace, namespace)
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/BESST-2.2.8-py3.6.egg/EGG-INFO/scripts/runBESST", line 431, in <module>
    main(args)
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/BESST-2.2.8-py3.6.egg/EGG-INFO/scripts/runBESST", line 182, in main
    (G, G_prime) = CG.PE(Contigs, Scaffolds, Information, C_dict, param, small_contigs, small_scaffolds, bam_file)      #Create graph, single out too short contigs/scaffolds and store them in F
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/BESST-2.2.8-py3.6.egg/BESST/CreateGraph.py", line 307, in PE
    GiveScoreOnEdges(G, Scaffolds, small_scaffolds, Contigs, param, Information, plot)
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/BESST-2.2.8-py3.6.egg/BESST/CreateGraph.py", line 490, in GiveScoreOnEdges
    steps = list(range(0, int(max_isize*0.8), max_isize/50))  # isize_range[:int(0.8*len(isize_range)):len(isize_range)/50] # not the upper most values
TypeError: 'float' object cannot be interpreted as an integer

I believe this is due to max_isize/50 returning a float value in python3 instead of a int.

@ksahlin
Copy link
Owner

ksahlin commented Jul 14, 2020

Thanks for the report! Seems that you right, I will fix this asap.

As you note, this is a python3 issue so you can always install BESST in a python2 environment (e.g. with conda) if you want it to complete the run in the meantime.

@nwespe
Copy link
Author

nwespe commented Jul 14, 2020

Much appreciated! We currently run this in python2 but are trying to update everything to python3 now.

@amandaamelo
Copy link

Hi there! I'm having this same issue running on python 3.8 on a virtual environment due do dependency problems. Did you manage to solve this? Do you have any tips on how to fix this? Should I edit the code?

thanks!

@ksahlin
Copy link
Owner

ksahlin commented Jan 4, 2024

Hi @amandaamelo ,

Yes, plese edit line 490 in the file CreateGraph.py (you can see where it is located in the third last row in the error message. In OPs system it was the location /home/ubuntu/anaconda3/lib/python3.6/site-packages/BESST-2.2.8-py3.6.egg/BESST/CreateGraph.py

This line steps = list(range(0, int(max_isize*0.8), max_isize/50)) should be edited to:

steps = list(range(0, int(max_isize*0.8), max_isize//50)). That is, // instead of /.

HTH

@amandaamelo
Copy link

amandaamelo commented Jan 5, 2024 via email

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

3 participants