I have a file in Stockholm format and I am trying to read it using the Biopython package. The code is as follows :
import numpy as np from Bio import AlignIO alignments = AlignIO.parse("Rfam.seed", "stockholm") for alignment in alignments: print(alignment)
It gets read for some alignments and then throws up following error :
Traceback (most recent call last): File "test.py", line 5, in <module> for alignment in alignments: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Bio/AlignIO/__init__.py", line 394, in parse for a in i: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Bio/AlignIO/StockholmIO.py", line 408, in __next__ line = handle.readline() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 2468: invalid continuation byte
How to resolve this error?