You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suspect the problematic data is Alejandro A. Schäffer, one of the BLAST authors listed in some of the XML output as:
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (
1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_ref
erence>
This occurs in all the test files where LANG=C makes the test fail (and I think ONLY those files):
$ grep Alejandro xml_2212L_blastn_001.xml xml_2212L_blastp_001.xml xml_2212L_blastx_001.xml xml_2212L_tblastn_001.xml xml_2212L_tblastx_001.xml xml_2218_blastp_001.xml xml_2218_blastp_002.xml
xml_2212L_blastn_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastp_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastx_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastn_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastx_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_002.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
The reference formatting looks like something the NCBI have tweaked with different version of the legacy BLAST tool, and its replacement BLAST+. Also which reference is given will depend on the tool/algorithm used.
Interestingly in some of the BLAST XML files this appears as:
<BlastOutput_reference>Stephen F. Altschul, Thomas L. Madden, Alejandro A. Sch&auml;ffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Here the ä is being used (double escaped) of the lower-case a with dots over it.
It seems the NCBI have never used an explicit encoding in their XML output files, e.g. nothing like this:
<?xml version="1.0" encoding="UTF-8"?>
Once we come to process the reference text, the exact encoding is clearly important here, note:
$ cd Tests/Blast
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
<BlastOutput_program>blastp</BlastOutput_program>
<BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home_local/buildslave/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)
@smsaladi sadly no joy with the explicit encoding in the open call, Linux 64:
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
<BlastOutput_program>blastp</BlastOutput_program>
<BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
Interestingly I can reproduce this on Mac OS X, using a self-compiled Python 3.3.3rc1, Python 3.4.4 or Python 3.5.0,
peter-cocks-mac-pro:Blast pjcock$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
<BlastOutput_program>blastp</BlastOutput_program>
<BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/pjcock/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
It looks like the key difference between our Mac setups is the way Python 3 was installed (mine are compiled from source using --prefix=$HOME and breaks, yours is from Anaconda and works).
peter-cocks-mac-pro:Blast pjcock$ python3.5 --version
Python 3.5.0
$ uname -a
Darwin peter-cocks-mac-pro.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Seeing this again during work to build wheels for Biopython 1.70 under TravisCI (using a quite different setup to our TravisCI continuous integration tests),
======================================================================
ERROR: test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1407, in test_xml_2212L_blastn_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 22, in test_xml_2212L_blastp_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1437, in test_xml_2212L_blastx_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1457, in test_xml_2212L_tblastn_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1477, in test_xml_2212L_tblastx_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1499, in test_xml_2218_blastp_001
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_NCBIXML.py", line 1563, in test_xml_2218_blastp_002
record = next(records)
File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
text = handle.read(BLOCK)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_trees_and_taxa_block (test_Nexus.OldSelfTests)
Basic tree file with TREES and TAXA block
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Nexus.py", line 32, in test_trees_and_taxa_block
nexus1.read('Nexus/bats.nex')
File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
file_contents = fp.read()
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_binary (test_Phylo.IOTests)
Try writing phyloxml to a binary handle; fail on Py3.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 157, in test_convert_phyloxml_binary
trees, out_handle, "phyloxml")
File "/usr/lib/python3.4/unittest/case.py", line 704, in assertRaises
return context.handle('assertRaises', callableObj, args, kwargs)
File "/usr/lib/python3.4/unittest/case.py", line 162, in handle
callable_obj(*args, **kwargs)
File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
return Writer(obj).write(file, encoding=encoding, indent=indent)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
for tree in obj.phylogenies:
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_filename (test_Phylo.IOTests)
Write phyloxml to a given filename.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 170, in test_convert_phyloxml_filename
count = Phylo.write(trees, tmp_filename, "phyloxml")
File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
return Writer(obj).write(file, encoding=encoding, indent=indent)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
for tree in obj.phylogenies:
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_text (test_Phylo.IOTests)
Write phyloxml to a text handle.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 163, in test_convert_phyloxml_text
count = Phylo.write(trees, out_handle, "phyloxml")
File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
return Writer(obj).write(file, encoding=encoding, indent=indent)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
for tree in obj.phylogenies:
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_newick_read_single3 (test_Phylo.IOTests)
Read Nexus file with one tree.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 53, in test_newick_read_single3
tree = Phylo.read(EX_NEXUS2, 'nexus')
File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
tree = next(tree_gen)
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/NexusIO.py", line 38, in parse
nex = Nexus.Nexus(handle)
File "/io/biopython/Bio/Nexus/Nexus.py", line 614, in __init__
self.read(input)
File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
file_contents = fp.read()
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_collapse (test_Phylo.MixinTests)
TreeMixin: collapse() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_collapse_all (test_Phylo.MixinTests)
TreeMixin: collapse_all() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_common_ancestor (test_Phylo.MixinTests)
TreeMixin: common_ancestor() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_depths (test_Phylo.MixinTests)
TreeMixin: depths() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_distance (test_Phylo.MixinTests)
TreeMixin: distance() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_clades (test_Phylo.MixinTests)
TreeMixin: find_clades() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_elements (test_Phylo.MixinTests)
TreeMixin: find_elements() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_terminal (test_Phylo.MixinTests)
TreeMixin: find_elements() with terminal argument.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_get_path (test_Phylo.MixinTests)
TreeMixin: get_path() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_bifurcating (test_Phylo.MixinTests)
TreeMixin: is_bifurcating() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_monophyletic (test_Phylo.MixinTests)
TreeMixin: is_monophyletic() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_ladderize (test_Phylo.MixinTests)
TreeMixin: ladderize() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_prune (test_Phylo.MixinTests)
TreeMixin: prune() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_split (test_Phylo.MixinTests)
TreeMixin: split() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_total_branch_length (test_Phylo.MixinTests)
TreeMixin: total_branch_length() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_trace (test_Phylo.MixinTests)
TreeMixin: trace() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_str (test_Phylo.TreeTests)
Tree.__str__: pretty-print to a string.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Phylo.py", line 257, in test_str
tree = Phylo.read(source, 'phyloxml')
File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
tree = next(tree_gen)
File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
return Parser(file).parse()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1041: ordinal not in range(128)
======================================================================
ERROR: test_phylo (test_PhyloXML.WriterTests)
Round-trip parsing and serialization of phyloxml_examples.xml.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_PhyloXML.py", line 578, in test_phylo
'test_Taxonomy', 'test_Uri',
File "/io/biopython/Tests/test_PhyloXML.py", line 511, in _rewrite_and_call
phx = PhyloXMLIO.read(infile)
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 86, in read
return Parser(file).read()
File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
event, root = next(context)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
data = self._file.read(16 * 1024)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_SeqIO
----------------------------------------------------------------------
Traceback (most recent call last):
File "run_tests.py", line 439, in runTest
suite = loader.loadTestsFromName(name)
File "/usr/lib/python3.4/unittest/loader.py", line 105, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/io/biopython/Tests/test_SeqIO.py", line 477, in <module>
records = list(SeqIO.parse(handle=h, format=t_format))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_dbxref (test_SeqIO_SeqXML.TestDetailedRead)
Read multiple cross references to a single source
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_property (test_SeqIO_SeqXML.TestDetailedRead)
Read property with multiple values
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_empty_description (test_SeqIO_SeqXML.TestDetailedRead)
Check empty description.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_full_characters_set_read (test_SeqIO_SeqXML.TestDetailedRead)
Read full characters set for each type
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_global_species (test_SeqIO_SeqXML.TestDetailedRead)
Check global species.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_source_definition (test_SeqIO_SeqXML.TestDetailedRead)
Check local source.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_species (test_SeqIO_SeqXML.TestDetailedRead)
Check local species.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_minimal_required (test_SeqIO_SeqXML.TestDetailedRead)
Check minimal record.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_special_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Read special XML characters in description.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_unicode_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Test special unicode characters in the description.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_write_rna (test_SeqIO_SeqXML.TestReadAndWrite)
Read and write RNA.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 115, in test_read_write_rna
read1_records = list(SeqIO.parse(test_files["rna"][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_check_SeqIO (test_SeqIO_SeqXML.TestSimpleRead)
Files readable using parser via SeqIO.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 40, in test_check_SeqIO
records = list(SeqIO.parse(test_files[key][0], "seqxml"))
File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
for r in i:
File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
for event, node in self._events:
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
rc = self.getEvent()
File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
buf = self.stream.read(self.bufsize)
File "/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/io/biopython/Tests/test_Tutorial.py", line 256, in test_doctests
(len(failures), ", ".join(failures)))
ValueError: 1 Tutorial doctests failed: test_chapter_phylo_line_00074
----------------------------------------------------------------------
Ran 273 tests in 86.588 seconds
FAILED (failures = 7)
Update: I later added locale reporting to these builds:
For my reference, how to find some of the problem entries with grep tested on Mac OS X.
We have example files with the composed Unicode form (NFC), e.g. for the a-with-umlaut:
$ grep $'\xc3\xa4'*/*.xml
Blast/xml_2212L_blastn_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastp_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastx_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastn_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastx_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_001.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_002.xml: <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
SeqXML/rna_example.xml: <description>åÅüöÖ߸䢣$€香肠</description>
Looking at this with fresh eyes, @smsaladi was right about using the encoding argument to open (under Python 3), I was tricked because with that fix the print can fail with the default locale.
On Mac OS, with my default locale or explicitly using USA settings, things work:
$ LANG=en_US.UTF-8 python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
<BlastOutput_program>blastp</BlastOutput_program>
<BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
However, forcibly using LANG=C so that the default encoding is just ascii, the read fails:
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml'); l=h.read(400)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
So, yes, we should look at opening BLAST XML files (etc?) with a default encoding - but fixing that is likely to expose problems elsewhere in the tests (like the print statement in this trivial test case).
We will probably have to define our own function open_with_encoding or similar in our Python 2/3 compatibility layer Bio._py3k to do this as cleanly as possible to support Python 2.7 where the open function does not expect an encoding argument.
There seems to be a simpler option - open the XML files in binary mode and let the XML parser handle the encoding and conversion from bytes into strings.
Activity
peterjc commentedon Jun 15, 2016
So this is on 64 bit Fedora Linux as part of trying to package Biopython 1.67 - did everything work on Biopython 1.66?
Can you reproduce this outside of the packaging setup? e.g.
Is there anything unusual in the locale settings?
(Right now the closest I have to reproduce this is Python 3.5.0, but I'll update that to Python 3.5.1 just in case that matters)
sagitter commentedon Jun 15, 2016
Hi,
Yes, with Python-3.5 .
I can't try now, I need Fedora 24 at least (it's a beta).
This error is not reproduced outside of the packaging setup on Fedora 23 with Python-3.4.
peterjc commentedon Jun 15, 2016
I can't reproduce this on Python 3.5.1 on CentOS 6.
My guess is something subtle to do with unicode and locales on the Fedora 24 beta - do you understand https://bugzilla.redhat.com/ enough to pull out just bugs filed against the beta?
sagitter commentedon Jun 15, 2016
It looks this bug on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1262082
peterjc commentedon Jun 15, 2016
Can you see what
$LANGis set to on this problem machine? e.g.That might be enough for us to reproduce this.
sagitter commentedon Jun 15, 2016
en_US.UTF-8
peterjc commentedon Jun 20, 2016
Unfortunately that doesn't trigger the problem on my 64-bit CentOS 6 machine:
This machine's original setting:
However, deliberately using
LANG=Cseems to reproduce the exception you reported:peterjc commentedon Jun 20, 2016
I suspect the problematic data is
Alejandro A. Schäffer, one of the BLAST authors listed in some of the XML output as:This occurs in all the test files where
LANG=Cmakes the test fail (and I think ONLY those files):The reference formatting looks like something the NCBI have tweaked with different version of the legacy BLAST tool, and its replacement BLAST+. Also which reference is given will depend on the tool/algorithm used.
Interestingly in some of the BLAST XML files this appears as:
Here the
äis being used (double escaped) of the lower-case a with dots over it.It seems the NCBI have never used an explicit encoding in their XML output files, e.g. nothing like this:
Once we come to process the reference text, the exact encoding is clearly important here, note:
I'm a little confused about byte character
0xc3(not used in the latin-1 encoding), but that does seem to match the exception we're seeing.peterjc commentedon Jun 20, 2016
Regarding this:
Looking at the raw file,
This is clearly consistent with the
b'Sch\xc3\xa4ffer'form (0xC3 0xA4), which suggests UTF-8 encoding rather than latin-1.peterjc commentedon Jun 20, 2016
Minimal test case:
I presume with
LANG=Cthe default encoding breaks, so we need to set UTF-8 explicitly for BLAST XML files? See also https://pythonhosted.org/kitchen/unicode-frustrations.htmlsmsaladi commentedon Jun 20, 2016
Could you try specifying the encoding directly?
LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"LANG=Cdoesn't do anything on my machine, so I can't reproduce the error and test this myself.Details about my setup:
➜ Blast git:(master) python -c "import Bio; print(Bio.version)"
1.66
➜ Blast git:(master) python --version
Python 3.5.1 :: Anaconda 2.4.0 (x86_64)
➜ Blast git:(master) uname -a
Darwin jackfruit.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
peterjc commentedon Jun 20, 2016
@smsaladi sadly no joy with the explicit encoding in the open call, Linux 64:
Interestingly I can reproduce this on Mac OS X, using a self-compiled Python 3.3.3rc1, Python 3.4.4 or Python 3.5.0,
It looks like the key difference between our Mac setups is the way Python 3 was installed (mine are compiled from source using
--prefix=$HOMEand breaks, yours is from Anaconda and works).[-][biopython-1.67] UnicodeDecodeError[/-][+]test_NCBIXML.py UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3[/+]peterjc commentedon Jul 12, 2017
Seeing this again during work to build wheels for Biopython 1.70 under TravisCI (using a quite different setup to our TravisCI continuous integration tests),
e.g. https://travis-ci.org/biopython/biopython-wheels/jobs/252754295
This also affects other tests too:
Update: I later added locale reporting to these builds:
TravisCI: Report locale before testing
peterjc commentedon Jul 12, 2017
For my reference, how to find some of the problem entries with grep tested on Mac OS X.
We have example files with the composed Unicode form (NFC), e.g. for the a-with-umlaut:
e.g. for the u-with-umlaut:
We do not have to worry about the decomposed Unicode form (NFD), used by the Mac OS file system, which we can get using:
And for the
uand umlaut diacritical character in decomposed form:peterjc commentedon Jul 13, 2017
Looking at this with fresh eyes, @smsaladi was right about using the encoding argument to open (under Python 3), I was tricked because with that fix the print can fail with the default locale.
On Mac OS, with my default locale or explicitly using USA settings, things work:
However, forcibly using
LANG=Cso that the default encoding is justascii, the read fails:Adding the open argument that works:
But putting the print in breaks things again:
So, yes, we should look at opening BLAST XML files (etc?) with a default encoding - but fixing that is likely to expose problems elsewhere in the tests (like the print statement in this trivial test case).
We will probably have to define our own function
open_with_encodingor similar in our Python 2/3 compatibility layerBio._py3kto do this as cleanly as possible to support Python 2.7 where theopenfunction does not expect an encoding argument.Open BLAST XML files as binary (for encoding)
peterjc commentedon Jul 13, 2017
There seems to be a simpler option - open the XML files in binary mode and let the XML parser handle the encoding and conversion from bytes into strings.
smsaladi commentedon Jul 13, 2017
34e78d2 is a clever fix -- cool!
Open BLAST XML files as binary (for encoding)
Open BLAST XML files as binary (for encoding)