neherlab / treetime

Maximum likelihood inference of time stamped phylogenies and ancestral reconstruction
MIT License
228 stars 56 forks source link

Attribute error #52

Closed idolawoye closed 6 years ago

idolawoye commented 6 years ago

I installed treetime but when I tried running it I encountered an error which can be found below:

0.00    -TreeAnc: set-up

0.06    -TreeAnc: loading alignment failed...

0.06    -TreeAnc.infer_ancestral_sequences: method: ml

0.06    -TreeAnc inferring the GTR model from the tree...
Traceback (most recent call last):
  File "C:/Users/Idowu/AppData/Local/Programs/Python/Python36/Scripts/ancestral_reconstruction.py", line 4, in <module>
    __import__('pkg_resources').run_script('treetime==0.4.1', 'ancestral_reconstruction.py')
  File "C:\Users\Idowu\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 658, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "C:\Users\Idowu\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 1445, in run_script
    exec(script_code, namespace, namespace)
  File "c:\users\idowu\appdata\local\programs\python\python36\lib\site-packages\treetime-0.4.1-py3.6.egg\EGG-INFO\scripts\ancestral_reconstruction.py", line 92, in <module>
  File "c:\users\idowu\appdata\local\programs\python\python36\lib\site-packages\treetime-0.4.1-py3.6.egg\treetime\treeanc.py", line 719, in infer_ancestral_sequences
  File "c:\users\idowu\appdata\local\programs\python\python36\lib\site-packages\treetime-0.4.1-py3.6.egg\treetime\treeanc.py", line 759, in reconstruct_anc
  File "c:\users\idowu\appdata\local\programs\python\python36\lib\site-packages\treetime-0.4.1-py3.6.egg\treetime\treeanc.py", line 680, in infer_gtr
  File "c:\users\idowu\appdata\local\programs\python\python36\lib\site-packages\treetime-0.4.1-py3.6.egg\treetime\treeanc.py", line 1248, in _ml_anc_joint
AttributeError: 'TreeAnc' object has no attribute 'multiplicity'

Can you kindly help out? Thanks

rneher commented 6 years ago

Your alignment didn't load. see the second line of the output. But thanks for pointing it out -- I have to improve error handling.

idolawoye commented 6 years ago

Do you have any idea why the alignment did not load? I tried phylip and aln file formats so I don't understand why it wont read any of them. I also tried using python by importing TreeAnc from treetime but here is the error that came up:

>>> from treetime import TreeAnc
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from treetime import TreeAnc
ImportError: cannot import name 'TreeAnc'
rneher commented 6 years ago

1) it checks whether it can read them as fasta, phylib-relaxed or nexus. https://github.com/neherlab/treetime/blob/master/treetime/treeanc.py#L271 Try loading your alignment with Bio.AlignIO.read first. 2) are you sure you are using the right python distribution? The previous script evidently loaded TreeAnc

idolawoye commented 6 years ago

Bio.AlignIO.read was able to load the alignment file just fine.

rneher commented 6 years ago

sorry. I only ever tested fasta format. there was an obvious problem reading other formats than fasta. I just pushed a fix in a0ca5b55ea738294ccc3705260e443adde99b3fe. You can either reinstall HEAD, or use fasta format.

idolawoye commented 6 years ago

Alright, thank you.

rneher commented 6 years ago

thanks, my bad! very useful to get these reports.

idolawoye commented 6 years ago

Thanks for helping out too. Will try using a fasta format