Skip to content

Commit

Permalink
final fixes for release
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Jul 30, 2019
1 parent 545d5ab commit 04c8e7c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion brendapy/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parse_proteins_for_ec():

print(f"{len(proteins)} proteins for EC {ec} in BRENDA")
print(f"Protein identifier: {proteins.keys()}")
print("-"*80)
print("-" * 80)
for p in proteins.values():
if p.organism == "Homo sapiens":
print(p)
Expand Down
4 changes: 2 additions & 2 deletions brendapy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def store_item(bid, item):
results[bid] = item
elif bid in {"RN", "RE", "RT", "SN"}:
if isinstance(results[bid], OrderedDict):
results[bid] = { item }
results[bid] = {item}
else:
results[bid].add(item)
elif bid == "RF":
Expand Down Expand Up @@ -311,7 +311,7 @@ def __init__(self, ec, key, data):
"""
self.data = OrderedDict([
('protein_id', key),
('ec', ec),
('ec', ec),
('organism', data['PR'][key]['data']),
])
reference_ids = set(data['PR'][key]['refs'])
Expand Down
30 changes: 11 additions & 19 deletions brendapy/tests/test_brenda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from brendapy import BrendaParser, BrendaProtein
from brendapy.settings import BRENDA_FILE

BRENDA_PARSER = BrendaParser()


def test_parsing():
brenda = BrendaParser()
Expand All @@ -19,18 +21,14 @@ def test_parsing_from_file():

def test_protein1():
""" Test the proteinBRENDA module """
brenda = BrendaParser()

ec = "1.1.1.1"
proteins = brenda.get_proteins(ec)
proteins = BRENDA_PARSER.get_proteins(ec)
assert proteins
assert len(proteins) == 167


def test_protein_detail1():
brenda = BrendaParser()
ec = "1.1.1.1"
proteins = brenda.get_proteins(ec)
proteins = BRENDA_PARSER.get_proteins(ec="1.1.1.1")
protein = proteins[1]

assert protein
Expand All @@ -40,28 +38,22 @@ def test_protein_detail1():


def test_protein_detail2():
brenda = BrendaParser()
ec = "1.1.1.1"
proteins = brenda.get_proteins(ec)
proteins = BRENDA_PARSER.get_proteins("1.1.1.1")
protein = proteins[4]

assert protein
assert protein.organism == "Drosophila melanogaster"
assert 8 in protein.references


brenda_parser = BrendaParser()
@pytest.mark.parametrize("ec", BrendaParser().keys())
def test_proteins_for_ec(ec):
proteins = brenda_parser.get_proteins(ec)
assert proteins is not None


def test_info_dict():
brenda = BrendaParser()
ec = "1.1.1.2"
ec_str = brenda.ec_text[ec]
d = brenda._parse_info_dict(ec, ec_str)
ec_str = BRENDA_PARSER.ec_text[ec]
d = BRENDA_PARSER._parse_info_dict(ec, ec_str)
assert d


@pytest.mark.parametrize("ec", BRENDA_PARSER.keys())
def test_proteins_for_ec(ec):
proteins = BRENDA_PARSER.get_proteins(ec)
assert proteins is not None
2 changes: 1 addition & 1 deletion brendapy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def timed(*args, **kw):
print('%r %2.2f ms' % (method.__name__, (te - ts) * 1000))
return result

return timed
return timed
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ skip_install = True
deps =
pep8
commands =
pep8 --show-source brendapy
pep8 --show-source brendapy --ignore=E501

0 comments on commit 04c8e7c

Please sign in to comment.