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
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/code_oven
/data
/.ipynb_checkpoints
.idea

*.py[cod]

Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/BRENDApyrser.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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