Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change the encoding into utf-8 #8

Merged
merged 5 commits into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/brendapyrser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ class BRENDA:
"""
Provides methods to parse the BRENDA database (https://www.brenda-enzymes.org/)
"""

def __init__(self, path_to_database):
with open(path_to_database, encoding="iso-8859-1") as file:
with open(path_to_database, encoding="utf-8") as file:
self.__data = file.read()
self.__ec_numbers = [
ec.group(1) for ec in re.finditer("(?<=ID\\t)(.*)(?=\\n)", self.__data)
Expand Down Expand Up @@ -262,8 +261,8 @@ def getReferencesDict(self):
lines = self.__getDataLines("RF")
for line in lines:
line = self.__removeTabs(line)
line, refs = self.__extractDataField(line, ("<", ">"))
references[refs[0]] = line
line, refs = self.__extractDataField(line, ('<', '>'))
references[refs] = line
return references

def printReactionSummary(self):
Expand Down