From abcb465e910e2f049cf6df86b3021b319d695bb7 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:29:52 +0100 Subject: [PATCH 01/10] Update for bio2bel v0.2.0 --- .travis.yml | 42 ++++++++++------ requirements.txt | 12 ----- setup.py | 43 +++++++++++++--- tox.ini | 125 +++++++++++++++++++++++++---------------------- 4 files changed, 128 insertions(+), 94 deletions(-) delete mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index e31d8e6..97a2a38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,27 +3,39 @@ cache: pip language: python python: - 3.6 -matrix: +stages: + - lint + - docs + - test +env: + - TOXENV=py +jobs: include: - - env: TOXENV=py - - env: TOXENV=docs - - env: TOXENV=manifest - - env: TOXENV=rst-lint + # lint stage + - stage: lint + env: TOXENV=manifest - env: TOXENV=flake8 - - env: TOXENV=doc8 - - env: TOXENV=pylint + - env: TOXENV=vulture + - env: TOXENV=mypy + - env: TOXENV=pyroma + - env: TOXENV=xenon + # docs stage + - stage: docs + env: TOXENV=doc8 + - env: TOXENV=readme + - env: TOXENV=docs + # test stage + - stage: test + env: TOXENV=py +matrix: allow_failures: - - env: TOXENV=flake8 - - env: TOXENV=doc8 - - env: TOXENV=pylint + - env: TOXENV=vulture + - env: TOXENV=mypy install: -- pip install tox -- pip install codecov -- pip install coverage + - sh -c 'if [ "$TOXENV" = "py" ]; then pip install tox codecov; else pip install tox; fi' script: - tox after_success: -- tox -e coverage-report -- codecov + - sh -c 'if [ "$TOXENV" = "py" ]; then tox -e coverage-report; codecov; fi' notifications: slack: pybel:n2KbWKBum3musnBg3L76gGwq diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e735a84..0000000 --- a/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -click -bio2bel>=0.1.4 -compath_utils>=0.1.0 -pybel>=0.11.2 -sqlalchemy -bio2bel_hgnc>=0.1.0 -bio2bel_chebi>=0.1.0 -pandas -tqdm -openpyxl -flask[web] -flask_admin[web] diff --git a/setup.py b/setup.py index 8b9ddde..6c47b0c 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +"""Setup.py for Bio2BEL Reactome.""" + import codecs import os import re @@ -8,14 +10,28 @@ BIO2BEL_MODULE = 'reactome' PACKAGES = setuptools.find_packages(where='src') -META_PATH = os.path.join('src', 'bio2bel_{}'.format(BIO2BEL_MODULE), '__init__.py') +META_PATH = os.path.join('src', f'bio2bel_{BIO2BEL_MODULE}', '__init__.py') +KEYWORDS = ['Biological Expression Language', 'BEL', 'Reactome', 'Systems Biology', 'Networks Biology'] +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Topic :: Scientific/Engineering :: Bio-Informatics', +] INSTALL_REQUIRES = [ 'click', - 'bio2bel>=0.1.0', + 'bio2bel>=0.2.0,<0.3.0', 'compath_utils>=0.1.0', 'bio2bel_hgnc>=0.1.0', 'bio2bel_chebi>=0.1.0', - 'pybel>=0.11.2', + 'pybel>=0.12.0,<0.13.0', 'sqlalchemy', 'pandas', 'tqdm', @@ -23,17 +39,25 @@ 'flask_admin', ] EXTRAS_REQUIRE = { - 'web': ['flask', 'flask_admin'], + 'web': [ + 'flask', + 'flask_admin', + ], + 'docs': [ + 'sphinx', + 'sphinx-rtd-theme', + 'sphinx-click', + ], } ENTRY_POINTS = { 'bio2bel': [ - '{mname} = bio2bel_{mname}'.format(mname=BIO2BEL_MODULE), + f'{BIO2BEL_MODULE} = bio2bel_{BIO2BEL_MODULE}', ], 'compath': [ - '{mname} = bio2bel_{mname}'.format(mname=BIO2BEL_MODULE) + f'{BIO2BEL_MODULE} = bio2bel_{BIO2BEL_MODULE}', ], 'console_scripts': [ - 'bio2bel_{mname} = bio2bel_{mname}.cli:main'.format(mname=BIO2BEL_MODULE), + f'bio2bel_{BIO2BEL_MODULE} = bio2bel_{BIO2BEL_MODULE}.cli:main', ] } @@ -50,7 +74,7 @@ def read(*parts): def find_meta(meta): - """Extract __*meta*__ from META_FILE""" + """Extract __*meta*__ from META_FILE.""" meta_match = re.search( r'^__{meta}__ = ["\']([^"\']*)["\']'.format(meta=meta), META_FILE, re.M @@ -80,8 +104,11 @@ def get_long_description(): maintainer_email=find_meta('email'), license=find_meta('license'), packages=PACKAGES, + classifiers=CLASSIFIERS, + keywords=KEYWORDS, package_dir={'': 'src'}, install_requires=INSTALL_REQUIRES, extras_require=EXTRAS_REQUIRE, entry_points=ENTRY_POINTS, + zip_safe=False, ) diff --git a/tox.ini b/tox.ini index a7fa33b..8ff8634 100644 --- a/tox.ini +++ b/tox.ini @@ -1,35 +1,79 @@ [tox] -envlist = coverage-clean, docs, py, coverage-report, rst-lint, manifest +envlist = + coverage-clean + manifest + flake8 + readme + doc8 + docs + py + coverage-report [testenv] -commands = coverage run -p -m pytest --durations=20 tests {posargs} +commands = coverage run -p -m pytest tests {posargs} +passenv = CI TRAVIS TRAVIS_* deps = coverage pytest -extras = - web + pybel + flask + flask-admin whitelist_externals = /bin/cat /bin/cp /bin/mkdir + /usr/bin/git + /usr/local/bin/hub -[testenv:rst-lint] -commands = rst-lint README.rst +[testenv:coverage-clean] +deps = coverage skip_install = true -deps = - restructuredtext_lint - pygments +commands = coverage erase + +[testenv:coverage-report] +deps = coverage +skip_install = true +commands = + coverage combine + coverage report [testenv:manifest] deps = check-manifest -skip_install = true commands = check-manifest +skip_install = true + +[testenv:vulture] +deps = vulture +skip_install = true +commands = vulture src/bio2bel_reactome/ +description = Run the vulture tool to look for dead code. + +[testenv:xenon] +deps = xenon +skip_install = true +commands = xenon --max-average A --max-modules A --max-absolute B . +description = Run the xenon tool to monitor code complexity. + +[testenv:mypy] +deps = mypy +skip_install = true +commands = mypy --ignore-missing-imports src/bio2bel_reactome/ +description = Run the mypy tool to check static typing on the project. + +[testenv:pyroma] +deps = + pygments + pyroma +skip_install = true +commands = pyroma --min=10 . +description = Run the pyroma tool to check the project's package friendliness. [testenv:docs] changedir = docs deps = sphinx - sphinx_rtd_theme + sphinx-rtd-theme + sphinx-autodoc-typehints commands = mkdir -p {envtmpdir} cp -r source {envtmpdir}/source @@ -38,20 +82,14 @@ commands = cat {envtmpdir}/build/coverage/c.txt cat {envtmpdir}/build/coverage/python.txt -[testenv:coverage-clean] -deps = coverage -skip_install = true -commands = coverage erase - -[testenv:coverage-report] -deps = coverage +[testenv:readme] +commands = rst-lint README.rst skip_install = true -commands = - coverage combine - coverage report +deps = + restructuredtext_lint + pygments [testenv:flake8] -basepython = python3 skip_install = true deps = flake8 @@ -62,41 +100,17 @@ deps = commands = flake8 src/bio2bel_reactome/ tests/ setup.py -[flake8] -ignore = E501 -exclude = - .tox, - .git, - __pycache__, - docs/source/conf.py, - build, - dist, - tests/fixtures/*, - *.pyc, - *.egg-info, - .cache, - .eggs -max-complexity = 10 -import-order-style = google -application-import-names = flake8 -format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s - -[testenv:pylint] -basepython = python3 -deps = - pyflakes - pylint -commands = - pylint src/bio2bel_reactome - [testenv:doc8] -basepython = python3 skip_install = true deps = sphinx doc8 commands = - doc8 docs/source/ + doc8 docs/source/ README.rst + +#################### +# Deployment tools # +#################### [testenv:bumpversion] commands = bumpversion {posargs} @@ -105,7 +119,6 @@ deps = bumpversion [testenv:build] -basepython = python3 skip_install = true deps = wheel @@ -114,7 +127,6 @@ commands = python setup.py -q sdist bdist_wheel [testenv:release] -basepython = python3 skip_install = true deps = {[testenv:build]deps} @@ -124,17 +136,12 @@ commands = twine upload --skip-existing dist/* [testenv:finish] -basepython = python3 skip_install = true -whitelist_externals = - /bin/git - /usr/local/bin/git deps = - {[testenv:build]deps} {[testenv:release]deps} bumpversion commands = bumpversion release {[testenv:release]commands} git push - bumpversion --message "Patch version [skip ci]" patch + bumpversion patch From 7ecf64da3f86f638da9272b246b5bf58678b81f8 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:34:00 +0100 Subject: [PATCH 02/10] Update .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 97a2a38..66e8ba8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,8 @@ matrix: allow_failures: - env: TOXENV=vulture - env: TOXENV=mypy + - env: TOXENV=flake8 + - env: TOXENV=xenon install: - sh -c 'if [ "$TOXENV" = "py" ]; then pip install tox codecov; else pip install tox; fi' script: From a0ac93c7cd19e79a0cefc7d77059d9ac7d2d5ebd Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:40:44 +0100 Subject: [PATCH 03/10] Update formatting --- MANIFEST.in | 2 +- README.rst | 12 ++++++++---- doc8.ini | 2 ++ docs/source/cli.rst | 14 +++++++++++--- 4 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 doc8.ini diff --git a/MANIFEST.in b/MANIFEST.in index 1ed4f1c..3a842ba 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,4 @@ recursive-include docs Makefile global-exclude *.py[cod] __pycache__ *.so *.dylib .DS_Store *.gpickle exclude .bumpversion.cfg -include *.rst *.txt *.yml LICENSE tox.ini .coveragerc +include *.rst *.txt *.yml LICENSE *.ini .coveragerc diff --git a/README.rst b/README.rst index c113619..4bf091b 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,16 @@ Bio2BEL Reactome |build| |coverage| |documentation| |zenodo| ============================================================ This package allows the enrichment of BEL networks with Reactome information by wrapping its RESTful API. -Furthermore, it is integrated in the `ComPath environment `_ for pathway database comparison. +Furthermore, it is integrated in the `ComPath environment `_ for pathway database +comparison. Installation ------------ This code can be installed with :code:`pip3 install git+https://github.com/bio2bel/reactome.git` -These two resources will be installed together with this package and can be quickly loaded by running the following commands in your terminal: +These two resources will be installed together with this package and can be quickly loaded by running the following +commands in your terminal: - :code:`python3 -m bio2bel_hgnc populate` - :code:`python3 -m bio2bel_chebi populate` @@ -60,8 +62,10 @@ Other Command Line Utilities Citation -------- -- Fabregat, Antonio et al. “The Reactome Pathway Knowledgebase.” Nucleic Acids Research 44.Database issue (2016): D481–D487. PMC. Web. 6 Oct. 2017. -- Croft, David et al. “The Reactome Pathway Knowledgebase.” Nucleic Acids Research 42.Database issue (2014): D472–D477. PMC. Web. 6 Oct. 2017. +- Fabregat, Antonio et al. “The Reactome Pathway Knowledgebase.” Nucleic Acids Research 44.Database issue (2016): + D481–D487. PMC. Web. 6 Oct. 2017. +- Croft, David et al. “The Reactome Pathway Knowledgebase.” Nucleic Acids Research 42.Database issue (2014): D472–D477. + PMC. Web. 6 Oct. 2017. .. |build| image:: https://travis-ci.org/bio2bel/reactome.svg?branch=master :target: https://travis-ci.org/bio2bel/reactome diff --git a/doc8.ini b/doc8.ini new file mode 100644 index 0000000..509a0a7 --- /dev/null +++ b/doc8.ini @@ -0,0 +1,2 @@ +[doc8] +max-line-length = 120 diff --git a/docs/source/cli.rst b/docs/source/cli.rst index 41bf79c..8062d5d 100644 --- a/docs/source/cli.rst +++ b/docs/source/cli.rst @@ -2,8 +2,16 @@ Command Line Interface ====================== The command line interface allows you to communicate with the package and perform basic functions such as: -* Populate the database: :code:`python3 -m bio2bel_reactome populate`. By default this command populates the database only with human information. In order to populate all species pathway information you can add the "--not-only-human" argument. By default the database is reset every time is populated. However, another optional parameter "--reset-db=False", allows you to avoid the reset. More logging can be activated by added "-vv" or "-v" as an argument. +* Populate the database: :code:`python3 -m bio2bel_reactome populate`. By default this command populates the database + only with human information. In order to populate all species pathway information you can add the "--not-only-human" + argument. By default the database is reset every time is populated. However, another optional parameter + "--reset-db=False", allows you to avoid the reset. More logging can be activated by added "-vv" or "-v" as an + argument. -* Drop the database: :code:`python3 -m bio2bel_reactome drop`. More logging can be activated by added "-vv" or "-v" as an argument. +* Drop the database: :code:`python3 -m bio2bel_reactome drop`. More logging can be activated by added "-vv" or "-v" as + an argument. -* Export gene sets as an excel file: :code:`python3 -m bio2bel_reactome export`. By default, the excel will contain all pathways from all species. However, you can add the argument "species" and type the name of a particular one to get only those pathways (e.g., "--species='Homo sapiens'""). Since Reactome has a hierarchy pathway structure, you can get only the major pathways with the optional parameter "--top-hierarchy". +* Export gene sets as an excel file: :code:`python3 -m bio2bel_reactome export`. By default, the excel will contain + all pathways from all species. However, you can add the argument "species" and type the name of a particular one to + get only those pathways (e.g., "--species='Homo sapiens'""). Since Reactome has a hierarchy pathway structure, you can + get only the major pathways with the optional parameter "--top-hierarchy". From ebb5d9e5072fa0c1019252de9c4704a006f503e0 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:45:15 +0100 Subject: [PATCH 04/10] Update .flake8 [skip ci] --- .flake8 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..ccea22b --- /dev/null +++ b/.flake8 @@ -0,0 +1,26 @@ +[flake8] +ignore = + C901 # too complex methods +max-line-length = 120 +exclude = + .tox, + .git, + __pycache__, + docs/source/conf.py, + build, + dist, + tests/fixtures/*, + *.pyc, + *.egg-info, + .cache, + .eggs +max-complexity = 10 +import-order-style = pycharm +application-import-names = + bio2bel_reactome + bio2bel_hgnc + bio2bel + compath_utils + pybel + tests +format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s From 794757998484ab3221bbaa3a91742409f7a55e93 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:55:59 +0100 Subject: [PATCH 05/10] Update BEL export --- src/bio2bel_reactome/constants.py | 8 ++--- src/bio2bel_reactome/manager.py | 58 ++++++++++++------------------- src/bio2bel_reactome/models.py | 35 ++++++++----------- 3 files changed, 41 insertions(+), 60 deletions(-) diff --git a/src/bio2bel_reactome/constants.py b/src/bio2bel_reactome/constants.py index c658973..4d7b9b6 100644 --- a/src/bio2bel_reactome/constants.py +++ b/src/bio2bel_reactome/constants.py @@ -16,7 +16,7 @@ # Namespace constants -REACTOME = 'REACTOME' -HGNC = 'HGNC' -UNIPROT = 'UNIPROT' -CHEBI = 'CHEBI' +REACTOME = 'reactome' +HGNC = 'hgnc' +UNIPROT = 'uniprot' +CHEBI = 'chebi' diff --git a/src/bio2bel_reactome/manager.py b/src/bio2bel_reactome/manager.py index 058cbe2..35e5972 100644 --- a/src/bio2bel_reactome/manager.py +++ b/src/bio2bel_reactome/manager.py @@ -2,21 +2,22 @@ """This module populates the tables of bio2bel_reactome.""" -import itertools as itt import logging -from collections import Counter +from collections import Counter, Mapping +from typing import Optional + +import itertools as itt +from sqlalchemy import and_ +from tqdm import tqdm import bio2bel_chebi import bio2bel_hgnc from bio2bel.manager.bel_manager import BELManagerMixin from bio2bel.manager.flask_manager import FlaskMixin from bio2bel.manager.namespace_manager import BELNamespaceManagerMixin -from pybel.manager.models import NamespaceEntry -from pybel import BELGraph -from sqlalchemy import and_ -from tqdm import tqdm - from compath_utils import CompathManager +from pybel import BELGraph +from pybel.manager.models import NamespaceEntry from .constants import MODULE_NAME from .models import Base, Chemical, Pathway, Protein, Species from .parsers import * @@ -24,7 +25,7 @@ log = logging.getLogger(__name__) __all__ = [ - 'Manager' + 'Manager', ] @@ -49,11 +50,8 @@ def __init__(self, *args, **kwargs): def _base(self): return Base - def summarize(self): - """Summarize the database. - - :rtype: dict[str,int] - """ + def summarize(self) -> Mapping[str, int]: + """Summarize the database.""" return dict( pathways=self._count_model(Pathway), proteins=self._count_model(Protein), @@ -61,32 +59,20 @@ def summarize(self): species=self.count_species() ) - def count_pathways(self): - """Count the pathways in the database. - - :rtype: int - """ + def count_pathways(self) -> int: + """Count the pathways in the database.""" return self.session.query(Pathway).count() - def count_chemicals(self): - """Count the chemicals in the database. - - :rtype: int - """ + def count_chemicals(self) -> int: + """Count the chemicals in the database.""" return self.session.query(Chemical).count() - def count_proteins(self): - """Count the proteins in the database. - - :rtype: int - """ + def count_proteins(self) -> int: + """Count the proteins in the database.""" return self.session.query(Protein).count() - def count_species(self): - """Count the species in the database. - - :rtype: int - """ + def count_species(self) -> int: + """Count the species in the database.""" return self.session.query(Species).count() """Custom query methods""" @@ -472,10 +458,10 @@ def to_bel(self) -> BELGraph: """Custom Methods to Populate the DB""" - def _populate_pathways(self, url=None): - """ Populate pathway table + def _populate_pathways(self, url: Optional[str] = None): + """Populate the pathway table. - :param url: Optional[str] url: url from pathway table file + :param url: url from pathway table file """ df = get_pathway_names_df(url=url) diff --git a/src/bio2bel_reactome/models.py b/src/bio2bel_reactome/models.py index 272e587..416d457 100644 --- a/src/bio2bel_reactome/models.py +++ b/src/bio2bel_reactome/models.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -"""Reactome database model""" +"""Reactome database model.""" -from pybel.dsl import abundance, bioprocess, protein from sqlalchemy import Column, ForeignKey, Integer, String, Table from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import backref, relationship +import pybel.dsl +from pybel.dsl import abundance from .constants import CHEBI, HGNC, REACTOME, UNIPROT Base = declarative_base() @@ -71,11 +72,9 @@ class Pathway(Base): def __repr__(self): return self.name - def as_pybel_dict(self): - """Function to serialize to PyBEL node data dictionary. - :rtype: pybel.dsl.bioprocess - """ - return bioprocess( + def to_pybel(self) -> pybel.dsl.BiologicalProcess: + """Function to serialize to PyBEL node data dictionary.""" + return pybel.dsl.BiologicalProcess( namespace=REACTOME, name=str(self.name), identifier=str(self.reactome_id) @@ -128,20 +127,18 @@ class Protein(Base): def __repr__(self): return self.uniprot_id - def as_pybel_dict(self): - """Function to serialize to PyBEL node data dictionary. - :rtype: pybel.dsl.protein - """ + def to_pybel(self) -> pybel.dsl.Protein: + """Function to serialize to PyBEL node data dictionary.""" if self.hgnc_symbol and self.hgnc_id: - return protein( + return pybel.dsl.Protein( namespace=HGNC, name=str(self.hgnc_symbol), identifier=str(self.hgnc_id) ) else: - return protein( + return pybel.dsl.Protein( namespace=UNIPROT, name=str(self.uniprot_id), identifier=str(self.uniprot_id) @@ -156,9 +153,9 @@ def get_pathways_ids(self): class Chemical(Base): - """Chemical Table""" - __tablename__ = CHEMICAL_TABLE_NAME + """Chemical Table.""" + __tablename__ = CHEMICAL_TABLE_NAME id = Column(Integer, primary_key=True) chebi_id = Column(String(64), unique=True, nullable=False) @@ -167,11 +164,9 @@ class Chemical(Base): def __repr__(self): return self.chebi_id - def as_pybel_dict(self): - """Function to serialize to PyBEL node data dictionary. - :rtype: pybel.dsl.abundance - """ - return abundance( + def as_pybel_dict(self) -> pybel.dsl.Abundance: + """Function to serialize to PyBEL node data dictionary.""" + return pybel.dsl.Abundance( namespace=CHEBI, name=str(self.chebi_name), identifier=str(self.chebi_id) From 30db568cafd2e18c130f965767d433e2ab1148d4 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 15:58:32 +0100 Subject: [PATCH 06/10] Update MANIFEST.in --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 3a842ba..bcd9ca2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,4 @@ recursive-include docs Makefile global-exclude *.py[cod] __pycache__ *.so *.dylib .DS_Store *.gpickle exclude .bumpversion.cfg -include *.rst *.txt *.yml LICENSE *.ini .coveragerc +include *.rst *.txt *.yml LICENSE *.ini .coveragerc .flake8 From 4c446ce4244ebc702cb2aa3d52e5f9e303f81b2f Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 16:03:28 +0100 Subject: [PATCH 07/10] Update src/bio2bel_reactome/manager.py --- src/bio2bel_reactome/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bio2bel_reactome/manager.py b/src/bio2bel_reactome/manager.py index 35e5972..9dac144 100644 --- a/src/bio2bel_reactome/manager.py +++ b/src/bio2bel_reactome/manager.py @@ -3,8 +3,8 @@ """This module populates the tables of bio2bel_reactome.""" import logging -from collections import Counter, Mapping -from typing import Optional +from collections import Counter +from typing import Mapping, Optional import itertools as itt from sqlalchemy import and_ From 655a034cf69661f1ff852778b47814c6ae8b1db1 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 13 Nov 2018 16:11:58 +0100 Subject: [PATCH 08/10] Update tests/test_all.py --- tests/test_all.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/test_all.py b/tests/test_all.py index 08b0003..39b8ecd 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- -""" This module contains the tests related with the graph enrichment""" - -from pybel.dsl import abundance, protein +"""This module contains the tests related with the graph enrichment.""" from bio2bel_chebi.manager import Manager as ChebiManager from bio2bel_chebi.models import Chemical -from bio2bel_reactome.constants import CHEBI +from bio2bel_reactome.constants import CHEBI, UNIPROT from bio2bel_reactome.models import Chemical +from pybel.dsl import abundance, protein from tests.constants import DatabaseMixin class TestGlobal(DatabaseMixin): - """Tests the parsing module""" + """Tests the parsing module.""" def test_get_all_human_pathways(self): - """Checks get all human pathways""" + """Check get all human pathways.""" human_pathways = self.manager.get_pathways_by_species('Homo sapiens') xenopus_pathways = self.manager.get_pathways_by_species('Xenopus tropicalis') @@ -33,8 +32,8 @@ def test_protein_exporting(self): self.assertIsNotNone(cd86_uniprot) self.assertEqual( - cd86_uniprot.as_pybel_dict(), - protein(namespace='UNIPROT', name='A0A0G2JXF7', identifier='A0A0G2JXF7') + cd86_uniprot.to_pybel(), + protein(namespace=UNIPROT, name='A0A0G2JXF7', identifier='A0A0G2JXF7') ) def test_chebi_exporting(self): @@ -69,7 +68,6 @@ def test_species_count(self): def test_protein_1(self): """Test protein relationships""" - protein = self.manager.get_protein_by_uniprot_id('P08237') self.assertIsNotNone(protein, 'Protein not found') self.assertEqual(3, len(protein.pathways)) From 5a64d1a5ef24bae052fe5647c89b6b4292387392 Mon Sep 17 00:00:00 2001 From: Charles Hoyt Date: Tue, 13 Nov 2018 16:47:16 +0100 Subject: [PATCH 09/10] =?UTF-8?q?Bump=20version:=200.1.6-dev=20=E2=86=92?= =?UTF-8?q?=200.2.0-dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- docs/source/conf.py | 2 +- src/bio2bel_reactome/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7991b3c..744a399 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.6-dev +current_version = 0.2.0-dev commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))? diff --git a/docs/source/conf.py b/docs/source/conf.py index 9ee8d9d..83ba512 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ copyright = '2018, Daniel Domingo-Fernández and Charles Tapley Hoyt' author = 'Daniel Domingo-Fernández and Charles Tapley Hoyt' -release = '0.1.6-dev' +release = '0.2.0-dev' parsed_version = re.match( '(?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?', diff --git a/src/bio2bel_reactome/__init__.py b/src/bio2bel_reactome/__init__.py index 48281da..75cd9f0 100644 --- a/src/bio2bel_reactome/__init__.py +++ b/src/bio2bel_reactome/__init__.py @@ -18,7 +18,7 @@ from .manager import Manager -__version__ = '0.1.6-dev' +__version__ = '0.2.0-dev' __title__ = 'bio2bel_reactome' __description__ = "A wrapper around Reactome RESTful API" From 81b4d5ff0807f043431b26af37da4b04782a1af0 Mon Sep 17 00:00:00 2001 From: Charles Hoyt Date: Tue, 13 Nov 2018 16:47:28 +0100 Subject: [PATCH 10/10] =?UTF-8?q?Bump=20version:=200.2.0-dev=20=E2=86=92?= =?UTF-8?q?=200.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- docs/source/conf.py | 2 +- src/bio2bel_reactome/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 744a399..737d8d0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.2.0-dev +current_version = 0.2.0 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))? diff --git a/docs/source/conf.py b/docs/source/conf.py index 83ba512..d8e1a22 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ copyright = '2018, Daniel Domingo-Fernández and Charles Tapley Hoyt' author = 'Daniel Domingo-Fernández and Charles Tapley Hoyt' -release = '0.2.0-dev' +release = '0.2.0' parsed_version = re.match( '(?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?', diff --git a/src/bio2bel_reactome/__init__.py b/src/bio2bel_reactome/__init__.py index 75cd9f0..a41ef8c 100644 --- a/src/bio2bel_reactome/__init__.py +++ b/src/bio2bel_reactome/__init__.py @@ -18,7 +18,7 @@ from .manager import Manager -__version__ = '0.2.0-dev' +__version__ = '0.2.0' __title__ = 'bio2bel_reactome' __description__ = "A wrapper around Reactome RESTful API"