BESST
BESST copied to clipboard
TypeError due to integer division change in python3
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.
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.
Much appreciated! We currently run this in python2 but are trying to update everything to python3 now.
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!
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
Thanks, I'll do that and let you know!
Em qui., 4 de jan. de 2024 às 05:11, Kristoffer @.***> escreveu:
Hi @amandaamelo https://github.com/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
— Reply to this email directly, view it on GitHub https://github.com/ksahlin/BESST/issues/78#issuecomment-1876679303, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARSMO4CSXJ6UQ2FGAJNYGP3YMZP2NAVCNFSM4OV24AO2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXGY3DOOJTGAZQ . You are receiving this because you were mentioned.Message ID: @.***>
-- Msc. Amanda Alves de Melo Ximenes CRBio: 117330/04-D Doutoranda no PPG em Genética e Biologia Molecular - UFG Laboratório de Genética e Biodiversidade - ICB/UFG