Entering edit mode
5.5 years ago
mac03pat
▴
30
Used this code:
from Bio import AlignIO
AlignIO.convert('aligned_KS1.clw', 'clustal', 'aligned_KS.nexus', 'nexus')
On this file: https://drive.google.com/open?id=1UX7H1sDdRSVT0I3fXb-rGXbfRZx10hGZ
And received this error:
Traceback (most recent call last):
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\MBSProject\KS_tree_builder.py", line 3, in <module>
tree = Phylo.read('aligned_KS.clw', 'phyloxml')
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\site-packages\Bio\Phylo\_io.py", line 63, in read
tree = next(tree_gen)
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\site-packages\Bio\Phylo\_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\site-packages\Bio\Phylo\PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\site-packages\Bio\Phylo\PhyloXMLIO.py", line 297, in __init__
event, root = next(context)
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\xml\etree\ElementTree.py", line 1222, in iterator
yield from pullparser.read_events()
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\xml\etree\ElementTree.py", line 1297, in read_events
raise event
File "C:\Users\mac03\AppData\Local\Programs\Python\Python37\lib\xml\etree\ElementTree.py", line 1269, in feed
self._parser.feed(data)
File "<string>", line None
xml.etree.ElementTree.ParseError: syntax error: line 1, column 0
A new nexus file is created but it's empty.
I am converting to nexus in order to build a phylogenetic tree with this code:
from Bio import Phylo
tree = Phylo.read('aligned_KS.nexus', 'nexus')
tree.ladderize()
Phylo.draw(tree)