From 64ca9e7ffca80a0cd5797e47a34376565411d48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20H=C3=A9risson?= Date: Fri, 29 May 2026 15:15:02 +0200 Subject: [PATCH 1/2] doc: rm doc folders --- docs/Makefile | 20 -- docs/environment.yml | 11 -- docs/make.bat | 35 ---- docs/source/chemlite.rst | 61 ------ docs/source/conf.py | 73 ------- docs/source/examples.ipynb | 186 ------------------ docs/source/index.rst | 23 --- docs/source/install.rst | 16 -- docs/source/modules.rst | 7 - docsource/Makefile | 20 -- .../rptools.Args.build_args_parser.rst | 6 - docsource/_autosummary/rptools.Args.rst | 32 --- ...ptools.rpcompletion.Args.add_arguments.rst | 6 - .../rptools.rpcompletion.Args.rst | 32 --- ...pcompletion.rpCompletion.rp_completion.rst | 6 - .../rptools.rpcompletion.rpCompletion.rst | 32 --- .../_autosummary/rptools.rpcompletion.rst | 32 --- ...tools.rpextractsink.Args.add_arguments.rst | 6 - .../rptools.rpextractsink.Args.rst | 32 --- ...ls.rpextractsink.rpextractsink.genSink.rst | 6 - .../rptools.rpextractsink.rpextractsink.rst | 33 ---- ...ools.rpextractsink.rpextractsink.write.rst | 6 - .../_autosummary/rptools.rpextractsink.rst | 32 --- .../rptools.rpfba.Args.add_arguments.rst | 6 - docsource/_autosummary/rptools.rpfba.Args.rst | 32 --- ...ptools.rpfba.cobra_format.cobra_suffix.rst | 6 - .../rptools.rpfba.cobra_format.cobraize.rst | 6 - .../rptools.rpfba.cobra_format.rst | 36 ---- .../rptools.rpfba.cobra_format.to_cobra.rst | 6 - .../rptools.rpfba.cobra_format.uncobraize.rst | 6 - ....rpfba.cobra_format.uncobraize_results.rst | 6 - ...tools.rpfba.rpFBA.build_hidden_species.rst | 6 - .../rptools.rpfba.rpFBA.build_results.rst | 6 - .../rptools.rpfba.rpFBA.build_rpsbml.rst | 6 - ...ols.rpfba.rpFBA.check_SBML_compartment.rst | 6 - .../rptools.rpfba.rpFBA.check_SBML_rxnid.rst | 6 - .../rptools.rpfba.rpFBA.cobra_model.rst | 6 - ...ba.rpFBA.complete_heterologous_pathway.rst | 6 - ...fba.rpFBA.create_ignored_species_group.rst | 6 - ...FBA.create_target_consumption_reaction.rst | 6 - .../rptools.rpfba.rpFBA.rp_fraction.rst | 6 - .../_autosummary/rptools.rpfba.rpFBA.rst | 48 ----- .../rptools.rpfba.rpFBA.runCobra.rst | 6 - .../rptools.rpfba.rpFBA.runFBA.rst | 6 - ...rpfba.rpFBA.write_fluxes_to_objectives.rst | 6 - ....rpfba.rpFBA.write_fluxes_to_reactions.rst | 6 - ...rpfba.rpFBA.write_objective_to_pathway.rst | 6 - ...s.rpfba.rpFBA.write_results_to_pathway.rst | 6 - ...ls.rpfba.rpFBA.write_results_to_rpsbml.rst | 6 - docsource/_autosummary/rptools.rpfba.rst | 33 ---- ...s.rplibs.inchikeyMIRIAM.inchikeyMIRIAM.rst | 25 --- .../rptools.rplibs.inchikeyMIRIAM.rst | 33 ---- .../rptools.rplibs.rpCompound.rst | 24 --- .../_autosummary/rptools.rplibs.rpGraph.rst | 24 --- .../rptools.rplibs.rpObject.rpObject.rst | 49 ----- .../_autosummary/rptools.rplibs.rpObject.rst | 33 ---- .../_autosummary/rptools.rplibs.rpPathway.rst | 24 --- .../rptools.rplibs.rpReaction.rst | 24 --- .../_autosummary/rptools.rplibs.rpSBML.rst | 24 --- docsource/_autosummary/rptools.rplibs.rst | 37 ---- .../rptools.rpranker.Args.add_arguments.rst | 6 - .../_autosummary/rptools.rpranker.Args.rst | 32 --- .../rptools.rpranker.rpRanker.rank.rst | 6 - .../rptools.rpranker.rpRanker.rst | 32 --- docsource/_autosummary/rptools.rpranker.rst | 32 --- .../rptools.rpreport.Args.add_arguments.rst | 6 - .../_autosummary/rptools.rpreport.Args.rst | 32 --- ....rpreport.rp_report.get_reactions_data.rst | 6 - .../rptools.rpreport.rp_report.rst | 35 ---- .../rptools.rpreport.rp_report.run_report.rst | 6 - .../rptools.rpreport.rp_report.to_data_js.rst | 6 - ...s.rpreport.rp_report.write_to_one_html.rst | 6 - docsource/_autosummary/rptools.rpreport.rst | 32 --- .../rptools.rpscore.Args.add_arguments.rst | 6 - .../_autosummary/rptools.rpscore.Args.rst | 32 --- ...ols.rpscore.rpScore.encode_and_predict.rst | 6 - ...ls.rpscore.rpScore.feature_template_df.rst | 6 - ...ools.rpscore.rpScore.features_encoding.rst | 6 - .../rptools.rpscore.rpScore.format_files.rst | 6 - ...ols.rpscore.rpScore.load_training_data.rst | 6 - .../rptools.rpscore.rpScore.loading_query.rst | 6 - .../rptools.rpscore.rpScore.loop.rst | 6 - ...ls.rpscore.rpScore.pathways_index_list.rst | 6 - .../rptools.rpscore.rpScore.predict_score.rst | 6 - .../_autosummary/rptools.rpscore.rpScore.rst | 43 ---- ...tools.rpscore.rpScore.score_prediction.rst | 6 - ...pScore.transform_into_pathway_features.rst | 6 - ...ls.rpscore.rpScore.transform_to_matrix.rst | 6 - docsource/_autosummary/rptools.rpscore.rst | 32 --- docsource/_autosummary/rptools.rst | 39 ---- .../_templates/custom-class-template.rst | 34 ---- .../_templates/custom-module-template.rst | 67 ------- docsource/api.rst | 12 -- docsource/conf.py | 69 ------- docsource/conf.py.orig | 55 ------ docsource/index.rst | 23 --- docsource/make.bat | 35 ---- docsource/readme_rpcompletion_shortcut.md | 2 - docsource/readme_rpextractsink_shortcut.md | 2 - docsource/readme_rpfba_shortcut.md | 2 - docsource/readme_rplibs_shortcut.md | 2 - docsource/readme_rpreport_shortcut.md | 2 - docsource/readme_rpthermo_shortcut.md | 2 - docsource/readme_shortcut.md | 2 - docsource/release_shortcut.md | 2 - 105 files changed, 2069 deletions(-) delete mode 100644 docs/Makefile delete mode 100644 docs/environment.yml delete mode 100644 docs/make.bat delete mode 100644 docs/source/chemlite.rst delete mode 100644 docs/source/conf.py delete mode 100644 docs/source/examples.ipynb delete mode 100644 docs/source/index.rst delete mode 100644 docs/source/install.rst delete mode 100644 docs/source/modules.rst delete mode 100644 docsource/Makefile delete mode 100644 docsource/_autosummary/rptools.Args.build_args_parser.rst delete mode 100644 docsource/_autosummary/rptools.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpcompletion.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpcompletion.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpcompletion.rpCompletion.rp_completion.rst delete mode 100644 docsource/_autosummary/rptools.rpcompletion.rpCompletion.rst delete mode 100644 docsource/_autosummary/rptools.rpcompletion.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.rpextractsink.genSink.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.rpextractsink.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.rpextractsink.write.rst delete mode 100644 docsource/_autosummary/rptools.rpextractsink.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.cobra_suffix.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.cobraize.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.to_cobra.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize_results.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.build_hidden_species.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.build_results.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.build_rpsbml.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_compartment.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_rxnid.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.cobra_model.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.complete_heterologous_pathway.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.create_ignored_species_group.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.create_target_consumption_reaction.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.rp_fraction.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.runCobra.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.runFBA.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_objectives.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_reactions.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.write_objective_to_pathway.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_pathway.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_rpsbml.rst delete mode 100644 docsource/_autosummary/rptools.rpfba.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.inchikeyMIRIAM.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpCompound.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpGraph.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpObject.rpObject.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpObject.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpPathway.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpReaction.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rpSBML.rst delete mode 100644 docsource/_autosummary/rptools.rplibs.rst delete mode 100644 docsource/_autosummary/rptools.rpranker.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpranker.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpranker.rpRanker.rank.rst delete mode 100644 docsource/_autosummary/rptools.rpranker.rpRanker.rst delete mode 100644 docsource/_autosummary/rptools.rpranker.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rp_report.get_reactions_data.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rp_report.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rp_report.run_report.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rp_report.to_data_js.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rp_report.write_to_one_html.rst delete mode 100644 docsource/_autosummary/rptools.rpreport.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.Args.add_arguments.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.Args.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.encode_and_predict.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.feature_template_df.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.features_encoding.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.format_files.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.load_training_data.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.loading_query.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.loop.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.pathways_index_list.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.predict_score.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.score_prediction.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.transform_into_pathway_features.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rpScore.transform_to_matrix.rst delete mode 100644 docsource/_autosummary/rptools.rpscore.rst delete mode 100644 docsource/_autosummary/rptools.rst delete mode 100644 docsource/_templates/custom-class-template.rst delete mode 100644 docsource/_templates/custom-module-template.rst delete mode 100644 docsource/api.rst delete mode 100644 docsource/conf.py delete mode 100644 docsource/conf.py.orig delete mode 100644 docsource/index.rst delete mode 100644 docsource/make.bat delete mode 100644 docsource/readme_rpcompletion_shortcut.md delete mode 100644 docsource/readme_rpextractsink_shortcut.md delete mode 100644 docsource/readme_rpfba_shortcut.md delete mode 100644 docsource/readme_rplibs_shortcut.md delete mode 100644 docsource/readme_rpreport_shortcut.md delete mode 100644 docsource/readme_rpthermo_shortcut.md delete mode 100644 docsource/readme_shortcut.md delete mode 100644 docsource/release_shortcut.md diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d0c3cbf..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/environment.yml b/docs/environment.yml deleted file mode 100644 index 1da2f9c..0000000 --- a/docs/environment.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: doc -channels: - - brsynth - - conda-forge - - defaults -dependencies: - - python > 3.6 - - brs_utils - - sphinx-autoapi - - nbsphinx - - ipykernel \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 6247f7e..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/source/chemlite.rst b/docs/source/chemlite.rst deleted file mode 100644 index 5187172..0000000 --- a/docs/source/chemlite.rst +++ /dev/null @@ -1,61 +0,0 @@ -chemlite package -================ - -Submodules ----------- - -chemlite.Args module --------------------- - -.. automodule:: chemlite.Args - :members: - :undoc-members: - :show-inheritance: - -chemlite.Compound module ------------------------- - -.. automodule:: chemlite.Compound - :members: - :undoc-members: - :show-inheritance: - -chemlite.Object module ----------------------- - -.. automodule:: chemlite.Object - :members: - :undoc-members: - :show-inheritance: - -chemlite.Pathway module ------------------------ - -.. automodule:: chemlite.Pathway - :members: - :undoc-members: - :show-inheritance: - -chemlite.Reaction module ------------------------- - -.. automodule:: chemlite.Reaction - :members: - :undoc-members: - :show-inheritance: - -chemlite.constants module -------------------------- - -.. automodule:: chemlite.constants - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: chemlite - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index eb0d32b..0000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,73 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -import sys -sys.path.insert(0, os.path.abspath('../..')) -#sys.path.append(os.path.join(os.path.dirname(__name__), '..')) - -# -- Project information ----------------------------------------------------- - -project = 'chemlite' -copyright = '2021, Joan Hérisson' -author = 'Joan Hérisson' - -# The full version, including alpha/beta/rc tags -release = '2.4.1' - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.viewcode', - 'sphinx.ext.coverage', - 'sphinx.ext.napoleon', - 'autoapi.extension', - 'nbsphinx' -] - -master_doc = 'index' - -# source_suffix = ['.rst', '.md'] - -# -- Sphinx AutoAPI ---------------------------------------------------------- -autoapi_type = "python" -autoapi_dirs = ["../../chemlite"] -autoapi_options = [ - "members", - "undoc-members", - "show-inheritance", -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".ipynb_checkpoints"] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -# html_theme = 'sphinx_rtd_theme' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/source/examples.ipynb b/docs/source/examples.ipynb deleted file mode 100644 index bb0a917..0000000 --- a/docs/source/examples.ipynb +++ /dev/null @@ -1,186 +0,0 @@ -{ - "cells": [ - { - "source": [ - "## Code examples\n", - "\n", - "### Compound\n", - "A compound can be created with only its ID (used as a name), but other infos can be added as well (`smiles`, `InChI`, `InChIKey`, `formula`, chemical `name`)." - ], - "cell_type": "markdown", - "metadata": {}, - "execution_count": null, - "outputs": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "432c98f0-184c-45ae-937c-bedb6b9dab23", - "metadata": {}, - "outputs": [], - "source": [ - "from chemlite import Compound\n", - "\n", - "mnxm13 = Compound(\n", - " id=\"MNXM13\",\n", - " smiles=\"O=C=O\",\n", - " inchi=\"InChI=1S/CO2/c2-1-3\",\n", - " inchikey=\"CURLTUGMZLYLDI-UHFFFAOYSA-N\",\n", - " formula=\"CO2\",\n", - " name=\"CO2\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "### Reaction\n", - "A reaction can be created with only its ID (used as a name), but other infos can be added as well (`reactants`, `products`)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "29351068-a0c6-49af-ab18-158f9b7e607e", - "metadata": {}, - "outputs": [], - "source": [ - "from chemlite import Reaction\n", - "\n", - "rxn_1 = Reaction(id=\"rxn_1\")\n", - "rxn_1.add_reactant(compound_id=\"MNXM12\", stoichio=4)\n", - "rxn_1.add_reactant(compound_id=\"MNXM13\", stoichio=3)\n", - "rxn_1.add_reactant(compound_id=\"MNXM3153\", stoichio=1)\n", - "rxn_1.add_product(compound_id=\"MNXM1\", stoichio=2)\n", - "rxn_1.add_product(compound_id=\"MNXM1307\", stoichio=1)\n", - "rxn_1.add_product(compound_id=\"MNXM40\", stoichio=3)\n", - "\n", - "rxn_2 = Reaction(\n", - " id=\"rxn_2\",\n", - " reactants=\n", - " {\n", - " \"MNXM12\": 3,\n", - " \"MNXM13\": 3,\n", - " \"MNXM2\": 3,\n", - " \"MNXM342\": 1,\n", - " \"MNXM5\": 6\n", - " }\n", - ")\n", - "rxn_2.set_products(\n", - " {\n", - " \"MNXM1\": 9,\n", - " \"MNXM21\": 1,\n", - " \"MNXM40\": 3,\n", - " \"MNXM6\": 6\n", - " }\n", - ")" - ] - }, - { - "cell_type": "markdown", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "Note that a reaction only needs information about compounds ID and stoichiometric coefficient. `Reaction` class does not handle compound content (`InChIKey`, `smiles`...). Neverthless, a reaction needs compounds content to return some information such as reaction SMILES." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mnxm12 = Compound(\n", - " id=\"MNXM12\",\n", - " smiles=\"CC(C)(COP(=O)(O)OP(=O)(O)OCC1OC(n2cnc3c(N)ncnc32)C(O)C1OP(=O)(O)O)C(O)C(O)=NCCC(O)=NCCS\",\n", - " inchi=\"InChI=1S/C21H36N7O16P3S/c1-21(2,16(31)19(32)24-4-3-12(29)23-5-6-48)8-41-47(38,39)44-46(36,37)40-7-11-15(43-45(33,34)35)14(30)20(42-11)28-10-27-13-17(22)25-9-26-18(13)28/h9-11,14-16,20,30-31,48H,3-8H2,1-2H3,(H,23,29)(H,24,32)(H,36,37)(H,38,39)(H2,22,25,26)(H2,33,34,35)\",\n", - " inchikey=\"RGJOEKWQDUBAIZ-UHFFFAOYSA-N\",\n", - " formula=\"C21H32N7O16P3S\",\n", - " name=\"CoA\"\n", - ")\n", - "mnxm1 = Compound(\n", - " id=\"MNXM1\",\n", - " smiles=\"[H+]\",\n", - " inchi=\"InChI=1S/p+1\",\n", - " inchikey=\"GPRLSGONYQIRFK-UHFFFAOYSA-N\"\n", - ")\n", - "mnxm3153 = Compound(\n", - " id=\"MNXM3153\",\n", - " smiles=\"O=C(c1cccc(O)c1)c1c(O)cc(O)cc1O\",\n", - " inchi=\"InChI=1S/C13H10O5/c14-8-3-1-2-7(4-8)13(18)12-10(16)5-9(15)6-11(12)17/h1-6,14-17H\",\n", - " inchikey=\"QWRYPHZJTWQLFX-UHFFFAOYSA-N\",\n", - " formula=\"C13H9O5\"\n", - ")\n", - "mnxm1307 = Compound(\n", - " id=\"MNXM1307\",\n", - " smiles=\"CC(C)(COP(=O)(O)OP(=O)(O)OCC1OC(n2cnc3c(N)ncnc32)C(O)C1OP(=O)(O)O)C(O)C(O)=NCCC(O)=NCCSC(=O)c1cccc(O)c1\",\n", - " inchi=\"InChI=1S/C28H40N7O18P3S/c1-28(2,22(39)25(40)31-7-6-18(37)30-8-9-57-27(41)15-4-3-5-16(36)10-15)12-50-56(47,48)53-55(45,46)49-11-17-21(52-54(42,43)44)20(38)26(51-17)35-14-34-19-23(29)32-13-33-24(19)35/h3-5,10,13-14,17,20-22,26,36,38-39H,6-9,11-12H2,1-2H3,(H,30,37)(H,31,40)(H,45,46)(H,47,48)(H2,29,32,33)(H2,42,43,44)\",\n", - " inchikey=\"JTBCMZVWWNFUFR-UHFFFAOYSA-N\",\n", - " formula=\"C28H36N7O18P3S\",\n", - " name=\"3-hydroxybenzoyl-CoA\"\n", - ")\n", - "mnxm40 = Compound(\n", - " id=\"MNXM40\",\n", - " smiles=\"CC(C)(COP(=O)(O)OP(=O)(O)OCC1OC(n2cnc3c(N)ncnc32)C(O)C1OP(=O)(O)O)C(O)C(O)=NCCC(O)=NCCSC(=O)CC(=O)O\",\n", - " inchi=\"InChI=1S/C24H38N7O19P3S/c1-24(2,19(37)22(38)27-4-3-13(32)26-5-6-54-15(35)7-14(33)34)9-47-53(44,45)50-52(42,43)46-8-12-18(49-51(39,40)41)17(36)23(48-12)31-11-30-16-20(25)28-10-29-21(16)31/h10-12,17-19,23,36-37H,3-9H2,1-2H3,(H,26,32)(H,27,38)(H,33,34)(H,42,43)(H,44,45)(H2,25,28,29)(H2,39,40,41)\",\n", - " inchikey=\"LTYOQGRJFJAKNA-UHFFFAOYSA-N\",\n", - " formula=\"C24H33N7O19P3S\",\n", - " name=\"malonyl-CoA\"\n", - ")\n", - "\n", - "print(rxn_1.get_smiles())\n" - ] - }, - { - "cell_type": "markdown", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "### Pathway\n", - "A pathway is created with only its ID (used as a name)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "265162d8-34e6-4ee2-b85b-7cc18a7fa624", - "metadata": {}, - "outputs": [], - "source": [ - "from chemlite import Pathway\n", - "\n", - "pathway = Pathway(id=\"pathway\")\n", - "pathway.add_reaction(\"rxn_1\")\n", - "pathway.add_reaction(\"rxn_2\")\n", - "\n", - "print(pathway)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index 8d7ad3a..0000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -ChemLite overview -===================== -ChemLite is a generic library to define chemical compounds, reactions and metabolic pathways (a set of reactions). - -How to install -************** -You can simply run ``conda install -c brsynth chemlite`` and start eQuilibrating. For more details, see :ref:`Installation`. - -How to use -********** -You can find a simple example in the :ref:`Example Usage` section. - -.. toctree:: - :hidden: - :numbered: - :maxdepth: 2 - - self - install - examples.ipynb - autoapi/index - - diff --git a/docs/source/install.rst b/docs/source/install.rst deleted file mode 100644 index b7f9ff8..0000000 --- a/docs/source/install.rst +++ /dev/null @@ -1,16 +0,0 @@ -Installation -============ - -ChemLite is available as a conda package and can be installed as follows: - -.. code-block:: python - - conda install -c brsynth chemlite - - -Dependencies -************ - -- python > 3.6 -- brs_utils - diff --git a/docs/source/modules.rst b/docs/source/modules.rst deleted file mode 100644 index abe1b81..0000000 --- a/docs/source/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -chemlite -======== - -.. toctree:: - :maxdepth: 4 - - chemlite diff --git a/docsource/Makefile b/docsource/Makefile deleted file mode 100644 index d4bb2cb..0000000 --- a/docsource/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docsource/_autosummary/rptools.Args.build_args_parser.rst b/docsource/_autosummary/rptools.Args.build_args_parser.rst deleted file mode 100644 index 24f9dc9..0000000 --- a/docsource/_autosummary/rptools.Args.build_args_parser.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.Args.build\_args\_parser -================================ - -.. currentmodule:: rptools.Args - -.. autofunction:: build_args_parser \ No newline at end of file diff --git a/docsource/_autosummary/rptools.Args.rst b/docsource/_autosummary/rptools.Args.rst deleted file mode 100644 index c779d81..0000000 --- a/docsource/_autosummary/rptools.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.Args -============ - -.. automodule:: rptools.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - build_args_parser - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpcompletion.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpcompletion.Args.add_arguments.rst deleted file mode 100644 index 21ad213..0000000 --- a/docsource/_autosummary/rptools.rpcompletion.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpcompletion.Args.add\_arguments -======================================== - -.. currentmodule:: rptools.rpcompletion.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpcompletion.Args.rst b/docsource/_autosummary/rptools.rpcompletion.Args.rst deleted file mode 100644 index 3dc004f..0000000 --- a/docsource/_autosummary/rptools.rpcompletion.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpcompletion.Args -========================= - -.. automodule:: rptools.rpcompletion.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rp_completion.rst b/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rp_completion.rst deleted file mode 100644 index 75a3d26..0000000 --- a/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rp_completion.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpcompletion.rpCompletion.rp\_completion -================================================ - -.. currentmodule:: rptools.rpcompletion.rpCompletion - -.. autofunction:: rp_completion \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rst b/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rst deleted file mode 100644 index 52dfd91..0000000 --- a/docsource/_autosummary/rptools.rpcompletion.rpCompletion.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpcompletion.rpCompletion -================================= - -.. automodule:: rptools.rpcompletion.rpCompletion - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - rp_completion - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpcompletion.rst b/docsource/_autosummary/rptools.rpcompletion.rst deleted file mode 100644 index 5adb377..0000000 --- a/docsource/_autosummary/rptools.rpcompletion.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpcompletion -==================== - -.. automodule:: rptools.rpcompletion - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpcompletion.Args - rptools.rpcompletion.rpCompletion - - diff --git a/docsource/_autosummary/rptools.rpextractsink.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpextractsink.Args.add_arguments.rst deleted file mode 100644 index 82191d7..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpextractsink.Args.add\_arguments -========================================= - -.. currentmodule:: rptools.rpextractsink.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpextractsink.Args.rst b/docsource/_autosummary/rptools.rpextractsink.Args.rst deleted file mode 100644 index 8ef2cc5..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpextractsink.Args -========================== - -.. automodule:: rptools.rpextractsink.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.genSink.rst b/docsource/_autosummary/rptools.rpextractsink.rpextractsink.genSink.rst deleted file mode 100644 index 42c5030..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.genSink.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpextractsink.rpextractsink.genSink -=========================================== - -.. currentmodule:: rptools.rpextractsink.rpextractsink - -.. autofunction:: genSink \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.rst b/docsource/_autosummary/rptools.rpextractsink.rpextractsink.rst deleted file mode 100644 index 0cbe8f9..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.rst +++ /dev/null @@ -1,33 +0,0 @@ -rptools.rpextractsink.rpextractsink -=================================== - -.. automodule:: rptools.rpextractsink.rpextractsink - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - genSink - write - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.write.rst b/docsource/_autosummary/rptools.rpextractsink.rpextractsink.write.rst deleted file mode 100644 index 3b60b36..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.rpextractsink.write.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpextractsink.rpextractsink.write -========================================= - -.. currentmodule:: rptools.rpextractsink.rpextractsink - -.. autofunction:: write \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpextractsink.rst b/docsource/_autosummary/rptools.rpextractsink.rst deleted file mode 100644 index 67571ba..0000000 --- a/docsource/_autosummary/rptools.rpextractsink.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpextractsink -===================== - -.. automodule:: rptools.rpextractsink - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpextractsink.Args - rptools.rpextractsink.rpextractsink - - diff --git a/docsource/_autosummary/rptools.rpfba.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpfba.Args.add_arguments.rst deleted file mode 100644 index 39d5bf1..0000000 --- a/docsource/_autosummary/rptools.rpfba.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.Args.add\_arguments -================================= - -.. currentmodule:: rptools.rpfba.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.Args.rst b/docsource/_autosummary/rptools.rpfba.Args.rst deleted file mode 100644 index b9637ed..0000000 --- a/docsource/_autosummary/rptools.rpfba.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpfba.Args -================== - -.. automodule:: rptools.rpfba.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.cobra_suffix.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.cobra_suffix.rst deleted file mode 100644 index b790252..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.cobra_suffix.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.cobra\_format.cobra\_suffix -========================================= - -.. currentmodule:: rptools.rpfba.cobra_format - -.. autofunction:: cobra_suffix \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.cobraize.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.cobraize.rst deleted file mode 100644 index 416e56a..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.cobraize.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.cobra\_format.cobraize -==================================== - -.. currentmodule:: rptools.rpfba.cobra_format - -.. autofunction:: cobraize \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.rst deleted file mode 100644 index 25451b5..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.rst +++ /dev/null @@ -1,36 +0,0 @@ -rptools.rpfba.cobra\_format -=========================== - -.. automodule:: rptools.rpfba.cobra_format - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - cobra_suffix - cobraize - to_cobra - uncobraize - uncobraize_results - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.to_cobra.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.to_cobra.rst deleted file mode 100644 index 3229f84..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.to_cobra.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.cobra\_format.to\_cobra -===================================== - -.. currentmodule:: rptools.rpfba.cobra_format - -.. autofunction:: to_cobra \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize.rst deleted file mode 100644 index 5fef98c..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.cobra\_format.uncobraize -====================================== - -.. currentmodule:: rptools.rpfba.cobra_format - -.. autofunction:: uncobraize \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize_results.rst b/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize_results.rst deleted file mode 100644 index da48bf2..0000000 --- a/docsource/_autosummary/rptools.rpfba.cobra_format.uncobraize_results.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.cobra\_format.uncobraize\_results -=============================================== - -.. currentmodule:: rptools.rpfba.cobra_format - -.. autofunction:: uncobraize_results \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.build_hidden_species.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.build_hidden_species.rst deleted file mode 100644 index d6c4cbd..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.build_hidden_species.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.build\_hidden\_species -========================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: build_hidden_species \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.build_results.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.build_results.rst deleted file mode 100644 index 8a1e743..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.build_results.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.build\_results -================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: build_results \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.build_rpsbml.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.build_rpsbml.rst deleted file mode 100644 index 7a0df51..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.build_rpsbml.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.build\_rpsbml -================================= - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: build_rpsbml \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_compartment.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_compartment.rst deleted file mode 100644 index a1aaf92..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_compartment.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.check\_SBML\_compartment -============================================ - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: check_SBML_compartment \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_rxnid.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_rxnid.rst deleted file mode 100644 index 582bad5..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.check_SBML_rxnid.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.check\_SBML\_rxnid -====================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: check_SBML_rxnid \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.cobra_model.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.cobra_model.rst deleted file mode 100644 index 2f28475..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.cobra_model.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.cobra\_model -================================ - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: cobra_model \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.complete_heterologous_pathway.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.complete_heterologous_pathway.rst deleted file mode 100644 index c9e1586..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.complete_heterologous_pathway.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.complete\_heterologous\_pathway -=================================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: complete_heterologous_pathway \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.create_ignored_species_group.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.create_ignored_species_group.rst deleted file mode 100644 index 1e185ea..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.create_ignored_species_group.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.create\_ignored\_species\_group -=================================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: create_ignored_species_group \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.create_target_consumption_reaction.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.create_target_consumption_reaction.rst deleted file mode 100644 index 7c3f06d..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.create_target_consumption_reaction.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.create\_target\_consumption\_reaction -========================================================= - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: create_target_consumption_reaction \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.rp_fraction.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.rp_fraction.rst deleted file mode 100644 index 7225c3c..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.rp_fraction.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.rp\_fraction -================================ - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: rp_fraction \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.rst deleted file mode 100644 index d05d2e9..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.rst +++ /dev/null @@ -1,48 +0,0 @@ -rptools.rpfba.rpFBA -=================== - -.. automodule:: rptools.rpfba.rpFBA - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - build_hidden_species - build_results - build_rpsbml - check_SBML_compartment - check_SBML_rxnid - cobra_model - complete_heterologous_pathway - create_ignored_species_group - create_target_consumption_reaction - rp_fraction - runCobra - runFBA - write_fluxes_to_objectives - write_fluxes_to_reactions - write_objective_to_pathway - write_results_to_pathway - write_results_to_rpsbml - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.runCobra.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.runCobra.rst deleted file mode 100644 index 240f9d4..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.runCobra.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.runCobra -============================ - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: runCobra \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.runFBA.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.runFBA.rst deleted file mode 100644 index d395865..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.runFBA.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.runFBA -========================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: runFBA \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_objectives.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_objectives.rst deleted file mode 100644 index 285abf6..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_objectives.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.write\_fluxes\_to\_objectives -================================================= - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: write_fluxes_to_objectives \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_reactions.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_reactions.rst deleted file mode 100644 index f392c58..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.write_fluxes_to_reactions.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.write\_fluxes\_to\_reactions -================================================ - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: write_fluxes_to_reactions \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.write_objective_to_pathway.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.write_objective_to_pathway.rst deleted file mode 100644 index b3c7316..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.write_objective_to_pathway.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.write\_objective\_to\_pathway -================================================= - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: write_objective_to_pathway \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_pathway.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_pathway.rst deleted file mode 100644 index 9155f20..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_pathway.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.write\_results\_to\_pathway -=============================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: write_results_to_pathway \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_rpsbml.rst b/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_rpsbml.rst deleted file mode 100644 index 2c4ef33..0000000 --- a/docsource/_autosummary/rptools.rpfba.rpFBA.write_results_to_rpsbml.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpfba.rpFBA.write\_results\_to\_rpsbml -============================================== - -.. currentmodule:: rptools.rpfba.rpFBA - -.. autofunction:: write_results_to_rpsbml \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpfba.rst b/docsource/_autosummary/rptools.rpfba.rst deleted file mode 100644 index a8175b4..0000000 --- a/docsource/_autosummary/rptools.rpfba.rst +++ /dev/null @@ -1,33 +0,0 @@ -rptools.rpfba -============= - -.. automodule:: rptools.rpfba - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpfba.Args - rptools.rpfba.cobra_format - rptools.rpfba.rpFBA - - diff --git a/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.inchikeyMIRIAM.rst b/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.inchikeyMIRIAM.rst deleted file mode 100644 index e3607e3..0000000 --- a/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.inchikeyMIRIAM.rst +++ /dev/null @@ -1,25 +0,0 @@ -rptools.rplibs.inchikeyMIRIAM.inchikeyMIRIAM -============================================ - -.. currentmodule:: rptools.rplibs.inchikeyMIRIAM - -.. autoclass:: inchikeyMIRIAM - :members: - :show-inheritance: - :inherited-members: - :special-members: __call__, __add__, __mul__ - - - - .. rubric:: Methods - - .. autosummary:: - :nosignatures: - - ~inchikeyMIRIAM.addInChiKey - - - - - - \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.rst b/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.rst deleted file mode 100644 index cfd9dad..0000000 --- a/docsource/_autosummary/rptools.rplibs.inchikeyMIRIAM.rst +++ /dev/null @@ -1,33 +0,0 @@ -rptools.rplibs.inchikeyMIRIAM -============================= - -.. automodule:: rptools.rplibs.inchikeyMIRIAM - - - - - - - - - - - - .. rubric:: Classes - - .. autosummary:: - :toctree: - :template: custom-class-template.rst - :nosignatures: - - inchikeyMIRIAM - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpCompound.rst b/docsource/_autosummary/rptools.rplibs.rpCompound.rst deleted file mode 100644 index f5891d8..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpCompound.rst +++ /dev/null @@ -1,24 +0,0 @@ -rptools.rplibs.rpCompound -========================= - -.. automodule:: rptools.rplibs.rpCompound - - - - - - - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpGraph.rst b/docsource/_autosummary/rptools.rplibs.rpGraph.rst deleted file mode 100644 index e976d77..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpGraph.rst +++ /dev/null @@ -1,24 +0,0 @@ -rptools.rplibs.rpGraph -====================== - -.. automodule:: rptools.rplibs.rpGraph - - - - - - - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpObject.rpObject.rst b/docsource/_autosummary/rptools.rplibs.rpObject.rpObject.rst deleted file mode 100644 index 3c7541c..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpObject.rpObject.rst +++ /dev/null @@ -1,49 +0,0 @@ -rptools.rplibs.rpObject.rpObject -================================ - -.. currentmodule:: rptools.rplibs.rpObject - -.. autoclass:: rpObject - :members: - :show-inheritance: - :inherited-members: - :special-members: __call__, __add__, __mul__ - - - - .. rubric:: Methods - - .. autosummary:: - :nosignatures: - - ~rpObject.get_fba - ~rpObject.get_fba_biomass - ~rpObject.get_fba_fba - ~rpObject.get_fba_fraction - ~rpObject.get_fba_info - ~rpObject.get_fba_pfba - ~rpObject.get_fba_prefix - ~rpObject.get_sep - ~rpObject.get_thermo - ~rpObject.get_thermo_dG - ~rpObject.get_thermo_dG0_prime - ~rpObject.get_thermo_dG_prime - ~rpObject.get_thermo_dGm_prime - ~rpObject.get_thermo_info - ~rpObject.get_thermo_prefix - ~rpObject.set_fba_biomass - ~rpObject.set_fba_fba - ~rpObject.set_fba_fraction - ~rpObject.set_fba_info - ~rpObject.set_fba_pfba - ~rpObject.set_thermo_dG - ~rpObject.set_thermo_dG0_prime - ~rpObject.set_thermo_dG_prime - ~rpObject.set_thermo_dGm_prime - ~rpObject.set_thermo_info - - - - - - \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rplibs.rpObject.rst b/docsource/_autosummary/rptools.rplibs.rpObject.rst deleted file mode 100644 index b7e6e24..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpObject.rst +++ /dev/null @@ -1,33 +0,0 @@ -rptools.rplibs.rpObject -======================= - -.. automodule:: rptools.rplibs.rpObject - - - - - - - - - - - - .. rubric:: Classes - - .. autosummary:: - :toctree: - :template: custom-class-template.rst - :nosignatures: - - rpObject - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpPathway.rst b/docsource/_autosummary/rptools.rplibs.rpPathway.rst deleted file mode 100644 index d1f543e..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpPathway.rst +++ /dev/null @@ -1,24 +0,0 @@ -rptools.rplibs.rpPathway -======================== - -.. automodule:: rptools.rplibs.rpPathway - - - - - - - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpReaction.rst b/docsource/_autosummary/rptools.rplibs.rpReaction.rst deleted file mode 100644 index 955b368..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpReaction.rst +++ /dev/null @@ -1,24 +0,0 @@ -rptools.rplibs.rpReaction -========================= - -.. automodule:: rptools.rplibs.rpReaction - - - - - - - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rpSBML.rst b/docsource/_autosummary/rptools.rplibs.rpSBML.rst deleted file mode 100644 index 24abb7b..0000000 --- a/docsource/_autosummary/rptools.rplibs.rpSBML.rst +++ /dev/null @@ -1,24 +0,0 @@ -rptools.rplibs.rpSBML -===================== - -.. automodule:: rptools.rplibs.rpSBML - - - - - - - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rplibs.rst b/docsource/_autosummary/rptools.rplibs.rst deleted file mode 100644 index 523c13c..0000000 --- a/docsource/_autosummary/rptools.rplibs.rst +++ /dev/null @@ -1,37 +0,0 @@ -rptools.rplibs -============== - -.. automodule:: rptools.rplibs - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rplibs.inchikeyMIRIAM - rptools.rplibs.rpCompound - rptools.rplibs.rpGraph - rptools.rplibs.rpObject - rptools.rplibs.rpPathway - rptools.rplibs.rpReaction - rptools.rplibs.rpSBML - - diff --git a/docsource/_autosummary/rptools.rpranker.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpranker.Args.add_arguments.rst deleted file mode 100644 index d10e50f..0000000 --- a/docsource/_autosummary/rptools.rpranker.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpranker.Args.add\_arguments -==================================== - -.. currentmodule:: rptools.rpranker.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpranker.Args.rst b/docsource/_autosummary/rptools.rpranker.Args.rst deleted file mode 100644 index 117fc99..0000000 --- a/docsource/_autosummary/rptools.rpranker.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpranker.Args -===================== - -.. automodule:: rptools.rpranker.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpranker.rpRanker.rank.rst b/docsource/_autosummary/rptools.rpranker.rpRanker.rank.rst deleted file mode 100644 index 910b8b6..0000000 --- a/docsource/_autosummary/rptools.rpranker.rpRanker.rank.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpranker.rpRanker.rank -============================== - -.. currentmodule:: rptools.rpranker.rpRanker - -.. autofunction:: rank \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpranker.rpRanker.rst b/docsource/_autosummary/rptools.rpranker.rpRanker.rst deleted file mode 100644 index 3d27134..0000000 --- a/docsource/_autosummary/rptools.rpranker.rpRanker.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpranker.rpRanker -========================= - -.. automodule:: rptools.rpranker.rpRanker - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - rank - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpranker.rst b/docsource/_autosummary/rptools.rpranker.rst deleted file mode 100644 index 083231b..0000000 --- a/docsource/_autosummary/rptools.rpranker.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpranker -================ - -.. automodule:: rptools.rpranker - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpranker.Args - rptools.rpranker.rpRanker - - diff --git a/docsource/_autosummary/rptools.rpreport.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpreport.Args.add_arguments.rst deleted file mode 100644 index 9f5e244..0000000 --- a/docsource/_autosummary/rptools.rpreport.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpreport.Args.add\_arguments -==================================== - -.. currentmodule:: rptools.rpreport.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpreport.Args.rst b/docsource/_autosummary/rptools.rpreport.Args.rst deleted file mode 100644 index 03a83cd..0000000 --- a/docsource/_autosummary/rptools.rpreport.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpreport.Args -===================== - -.. automodule:: rptools.rpreport.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpreport.rp_report.get_reactions_data.rst b/docsource/_autosummary/rptools.rpreport.rp_report.get_reactions_data.rst deleted file mode 100644 index a0167de..0000000 --- a/docsource/_autosummary/rptools.rpreport.rp_report.get_reactions_data.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpreport.rp\_report.get\_reactions\_data -================================================ - -.. currentmodule:: rptools.rpreport.rp_report - -.. autofunction:: get_reactions_data \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpreport.rp_report.rst b/docsource/_autosummary/rptools.rpreport.rp_report.rst deleted file mode 100644 index 0b06c02..0000000 --- a/docsource/_autosummary/rptools.rpreport.rp_report.rst +++ /dev/null @@ -1,35 +0,0 @@ -rptools.rpreport.rp\_report -=========================== - -.. automodule:: rptools.rpreport.rp_report - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - get_reactions_data - run_report - to_data_js - write_to_one_html - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpreport.rp_report.run_report.rst b/docsource/_autosummary/rptools.rpreport.rp_report.run_report.rst deleted file mode 100644 index d3c1b56..0000000 --- a/docsource/_autosummary/rptools.rpreport.rp_report.run_report.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpreport.rp\_report.run\_report -======================================= - -.. currentmodule:: rptools.rpreport.rp_report - -.. autofunction:: run_report \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpreport.rp_report.to_data_js.rst b/docsource/_autosummary/rptools.rpreport.rp_report.to_data_js.rst deleted file mode 100644 index 75ddabe..0000000 --- a/docsource/_autosummary/rptools.rpreport.rp_report.to_data_js.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpreport.rp\_report.to\_data\_js -======================================== - -.. currentmodule:: rptools.rpreport.rp_report - -.. autofunction:: to_data_js \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpreport.rp_report.write_to_one_html.rst b/docsource/_autosummary/rptools.rpreport.rp_report.write_to_one_html.rst deleted file mode 100644 index f51e919..0000000 --- a/docsource/_autosummary/rptools.rpreport.rp_report.write_to_one_html.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpreport.rp\_report.write\_to\_one\_html -================================================ - -.. currentmodule:: rptools.rpreport.rp_report - -.. autofunction:: write_to_one_html \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpreport.rst b/docsource/_autosummary/rptools.rpreport.rst deleted file mode 100644 index cbf6bf8..0000000 --- a/docsource/_autosummary/rptools.rpreport.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpreport -================ - -.. automodule:: rptools.rpreport - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpreport.Args - rptools.rpreport.rp_report - - diff --git a/docsource/_autosummary/rptools.rpscore.Args.add_arguments.rst b/docsource/_autosummary/rptools.rpscore.Args.add_arguments.rst deleted file mode 100644 index da405c2..0000000 --- a/docsource/_autosummary/rptools.rpscore.Args.add_arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.Args.add\_arguments -=================================== - -.. currentmodule:: rptools.rpscore.Args - -.. autofunction:: add_arguments \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.Args.rst b/docsource/_autosummary/rptools.rpscore.Args.rst deleted file mode 100644 index 047cc52..0000000 --- a/docsource/_autosummary/rptools.rpscore.Args.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpscore.Args -==================== - -.. automodule:: rptools.rpscore.Args - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - add_arguments - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.encode_and_predict.rst b/docsource/_autosummary/rptools.rpscore.rpScore.encode_and_predict.rst deleted file mode 100644 index 6ad74e5..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.encode_and_predict.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.encode\_and\_predict -============================================ - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: encode_and_predict \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.feature_template_df.rst b/docsource/_autosummary/rptools.rpscore.rpScore.feature_template_df.rst deleted file mode 100644 index 33fc803..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.feature_template_df.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.feature\_template\_df -============================================= - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: feature_template_df \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.features_encoding.rst b/docsource/_autosummary/rptools.rpscore.rpScore.features_encoding.rst deleted file mode 100644 index 8ad4962..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.features_encoding.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.features\_encoding -========================================== - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: features_encoding \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.format_files.rst b/docsource/_autosummary/rptools.rpscore.rpScore.format_files.rst deleted file mode 100644 index 331baa8..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.format_files.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.format\_files -===================================== - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: format_files \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.load_training_data.rst b/docsource/_autosummary/rptools.rpscore.rpScore.load_training_data.rst deleted file mode 100644 index 3fb1706..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.load_training_data.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.load\_training\_data -============================================ - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: load_training_data \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.loading_query.rst b/docsource/_autosummary/rptools.rpscore.rpScore.loading_query.rst deleted file mode 100644 index 6d1d8c1..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.loading_query.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.loading\_query -====================================== - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: loading_query \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.loop.rst b/docsource/_autosummary/rptools.rpscore.rpScore.loop.rst deleted file mode 100644 index 12410ca..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.loop.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.loop -============================ - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: loop \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.pathways_index_list.rst b/docsource/_autosummary/rptools.rpscore.rpScore.pathways_index_list.rst deleted file mode 100644 index d1cd9bb..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.pathways_index_list.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.pathways\_index\_list -============================================= - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: pathways_index_list \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.predict_score.rst b/docsource/_autosummary/rptools.rpscore.rpScore.predict_score.rst deleted file mode 100644 index 1bd1d60..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.predict_score.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.predict\_score -====================================== - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: predict_score \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.rst b/docsource/_autosummary/rptools.rpscore.rpScore.rst deleted file mode 100644 index 4582c83..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.rst +++ /dev/null @@ -1,43 +0,0 @@ -rptools.rpscore.rpScore -======================= - -.. automodule:: rptools.rpscore.rpScore - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :toctree: - :nosignatures: - - encode_and_predict - feature_template_df - features_encoding - format_files - load_training_data - loading_query - loop - pathways_index_list - predict_score - score_prediction - transform_into_pathway_features - transform_to_matrix - - - - - - - - - - - - - - diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.score_prediction.rst b/docsource/_autosummary/rptools.rpscore.rpScore.score_prediction.rst deleted file mode 100644 index 8cfd91c..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.score_prediction.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.score\_prediction -========================================= - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: score_prediction \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.transform_into_pathway_features.rst b/docsource/_autosummary/rptools.rpscore.rpScore.transform_into_pathway_features.rst deleted file mode 100644 index 35dae28..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.transform_into_pathway_features.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.transform\_into\_pathway\_features -========================================================== - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: transform_into_pathway_features \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rpScore.transform_to_matrix.rst b/docsource/_autosummary/rptools.rpscore.rpScore.transform_to_matrix.rst deleted file mode 100644 index ed6e002..0000000 --- a/docsource/_autosummary/rptools.rpscore.rpScore.transform_to_matrix.rst +++ /dev/null @@ -1,6 +0,0 @@ -rptools.rpscore.rpScore.transform\_to\_matrix -============================================= - -.. currentmodule:: rptools.rpscore.rpScore - -.. autofunction:: transform_to_matrix \ No newline at end of file diff --git a/docsource/_autosummary/rptools.rpscore.rst b/docsource/_autosummary/rptools.rpscore.rst deleted file mode 100644 index 2beb2a7..0000000 --- a/docsource/_autosummary/rptools.rpscore.rst +++ /dev/null @@ -1,32 +0,0 @@ -rptools.rpscore -=============== - -.. automodule:: rptools.rpscore - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.rpscore.Args - rptools.rpscore.rpScore - - diff --git a/docsource/_autosummary/rptools.rst b/docsource/_autosummary/rptools.rst deleted file mode 100644 index 98b7362..0000000 --- a/docsource/_autosummary/rptools.rst +++ /dev/null @@ -1,39 +0,0 @@ -rptools -======= - -.. automodule:: rptools - - - - - - - - - - - - - - - - - - - -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: - - rptools.Args - rptools.rpcompletion - rptools.rpextractsink - rptools.rpfba - rptools.rplibs - rptools.rpranker - rptools.rpreport - rptools.rpscore - rptools.rpthermo - - diff --git a/docsource/_templates/custom-class-template.rst b/docsource/_templates/custom-class-template.rst deleted file mode 100644 index f73eda5..0000000 --- a/docsource/_templates/custom-class-template.rst +++ /dev/null @@ -1,34 +0,0 @@ -{{ fullname | escape | underline}} - -.. currentmodule:: {{ module }} - -.. autoclass:: {{ objname }} - :members: - :show-inheritance: - :inherited-members: - :special-members: __call__, __add__, __mul__ - - {% block methods %} - {% if methods %} - .. rubric:: {{ _('Methods') }} - - .. autosummary:: - :nosignatures: - {% for item in methods %} - {%- if not item.startswith('_') %} - ~{{ name }}.{{ item }} - {%- endif -%} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block attributes %} - {% if attributes %} - .. rubric:: {{ _('Attributes') }} - - .. autosummary:: - {% for item in attributes %} - ~{{ name }}.{{ item }} - {%- endfor %} - {% endif %} - {% endblock %} diff --git a/docsource/_templates/custom-module-template.rst b/docsource/_templates/custom-module-template.rst deleted file mode 100644 index 0ef7378..0000000 --- a/docsource/_templates/custom-module-template.rst +++ /dev/null @@ -1,67 +0,0 @@ -{{ fullname | escape | underline}} - -.. automodule:: {{ fullname }} - - {% block attributes %} - {% if attributes %} - .. rubric:: Module attributes - - .. autosummary:: - :toctree: - {% for item in attributes %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block functions %} - {% if functions %} - .. rubric:: {{ _('Functions') }} - - .. autosummary:: - :toctree: - :nosignatures: - {% for item in functions %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block classes %} - {% if classes %} - .. rubric:: {{ _('Classes') }} - - .. autosummary:: - :toctree: - :template: custom-class-template.rst - :nosignatures: - {% for item in classes %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block exceptions %} - {% if exceptions %} - .. rubric:: {{ _('Exceptions') }} - - .. autosummary:: - :toctree: - {% for item in exceptions %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - -{% block modules %} -{% if modules %} -.. autosummary:: - :toctree: - :template: custom-module-template.rst - :recursive: -{% for item in modules %} - {{ item }} -{%- endfor %} -{% endif %} -{% endblock %} - diff --git a/docsource/api.rst b/docsource/api.rst deleted file mode 100644 index 090d422..0000000 --- a/docsource/api.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. - DO NOT DELETE THIS FILE! It contains the all-important `.. autosummary::` directive with `:recursive:` option, without - which API documentation wouldn't get extracted from docstrings by the `sphinx.ext.autosummary` engine. It is hidden - (not declared in any toctree) to remove an unnecessary intermediate page; index.rst instead points directly to the - package page. DO NOT REMOVE THIS FILE! - -.. autosummary:: - :toctree: _autosummary - :template: custom-module-template.rst - :recursive: - - rptools \ No newline at end of file diff --git a/docsource/conf.py b/docsource/conf.py deleted file mode 100644 index 8f9bf4b..0000000 --- a/docsource/conf.py +++ /dev/null @@ -1,69 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -import sys -sys.path.insert(0, os.path.abspath('../rptools')) - - -# -- Project information ----------------------------------------------------- - -project = 'rpTools' -copyright = '2021, Joan Hérisson, Thomas Duigou, Kenza Bazi-Kabbaj, Olivier Telle' -author = 'Joan Hérisson, Thomas Duigou, Kenza Bazi-Kabbaj, Olivier Telle' - -# The full version, including alpha/beta/rc tags -release = '5.4.1' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", - "sphinx.ext.githubpages", - "sphinx.ext.autosummary", # Create neat summary tables for modules/classes/methods etc - "myst_parser" -] - -# Turn on sphinx.ext.autosummary -autosummary_generate = True - -# -- autodoc options --------------------------------------------------- -autodoc_default_options = { - 'undoc-members': True -} - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file diff --git a/docsource/conf.py.orig b/docsource/conf.py.orig deleted file mode 100644 index 5eb086c..0000000 --- a/docsource/conf.py.orig +++ /dev/null @@ -1,55 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'rpTools' -copyright = '2021, Joan Hérisson, Thomas Duigou, Kenza Bazi-Kabbaj, Olivier Telle' -author = 'Joan Hérisson, Thomas Duigou, Kenza Bazi-Kabbaj, Olivier Telle' - -# The full version, including alpha/beta/rc tags -release = '5.4.1' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file diff --git a/docsource/index.rst b/docsource/index.rst deleted file mode 100644 index 28e9262..0000000 --- a/docsource/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -.. rpTools documentation master file, created by - sphinx-quickstart on Tue Sep 14 15:24:05 2021. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to rpTools's documentation! -=================================== - -.. toctree:: - :hidden: - - Home - rpTools - rpCompletion - rpFBA - rpThermo - rpExtractsink - rpLibs - rpReport - API reference <_autosummary/rptools> - Release - -This is an example of Sphinx documentation. Use the left column to navigate. \ No newline at end of file diff --git a/docsource/make.bat b/docsource/make.bat deleted file mode 100644 index 153be5e..0000000 --- a/docsource/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docsource/readme_rpcompletion_shortcut.md b/docsource/readme_rpcompletion_shortcut.md deleted file mode 100644 index f57eaac..0000000 --- a/docsource/readme_rpcompletion_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rpcompletion/README.md -``` diff --git a/docsource/readme_rpextractsink_shortcut.md b/docsource/readme_rpextractsink_shortcut.md deleted file mode 100644 index 55559a9..0000000 --- a/docsource/readme_rpextractsink_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rpextractsink/README.md -``` diff --git a/docsource/readme_rpfba_shortcut.md b/docsource/readme_rpfba_shortcut.md deleted file mode 100644 index f57eaac..0000000 --- a/docsource/readme_rpfba_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rpcompletion/README.md -``` diff --git a/docsource/readme_rplibs_shortcut.md b/docsource/readme_rplibs_shortcut.md deleted file mode 100644 index 246ea70..0000000 --- a/docsource/readme_rplibs_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rplibs/README.md -``` diff --git a/docsource/readme_rpreport_shortcut.md b/docsource/readme_rpreport_shortcut.md deleted file mode 100644 index c742b8d..0000000 --- a/docsource/readme_rpreport_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rpreport/README.md -``` diff --git a/docsource/readme_rpthermo_shortcut.md b/docsource/readme_rpthermo_shortcut.md deleted file mode 100644 index ec90c37..0000000 --- a/docsource/readme_rpthermo_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../rptools/rpthermo/README.md -``` diff --git a/docsource/readme_shortcut.md b/docsource/readme_shortcut.md deleted file mode 100644 index 451beda..0000000 --- a/docsource/readme_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../README.md -``` diff --git a/docsource/release_shortcut.md b/docsource/release_shortcut.md deleted file mode 100644 index 90d8adb..0000000 --- a/docsource/release_shortcut.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../RELEASE -``` From b9cf1a19a9de9aa4d0b7ec9e2d156184989f6a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20H=C3=A9risson?= Date: Fri, 29 May 2026 15:15:13 +0200 Subject: [PATCH 2/2] style: ruff and black --- chemlite/Compound.py | 88 +++++----- chemlite/Object.py | 58 +++---- chemlite/Pathway.py | 154 +++++++++-------- chemlite/Reaction.py | 288 +++++++++++++++----------------- chemlite/__init__.py | 2 +- chemlite/constants.py | 19 +-- setup.py | 68 ++++---- tests/test_Compound.py | 65 +++----- tests/test_Object.py | 60 ++----- tests/test_Pathway.py | 337 +++++++++++++++---------------------- tests/test_Reaction.py | 367 +++++++++++++---------------------------- 11 files changed, 604 insertions(+), 902 deletions(-) diff --git a/chemlite/Compound.py b/chemlite/Compound.py index b6cd539..cf43da3 100644 --- a/chemlite/Compound.py +++ b/chemlite/Compound.py @@ -1,4 +1,5 @@ """A class to represent a chemical species.""" + # The MIT License (MIT) # # Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich. @@ -26,10 +27,7 @@ from typing import ( Dict, ) -from logging import ( - Logger, - getLogger -) +from logging import Logger, getLogger from brs_utils import Cache from chemlite.Object import Object @@ -39,17 +37,14 @@ class Compound(Object): def __init__( self, id: str, - smiles: str = '', - inchi: str = '', - inchikey: str = '', - formula: str = '', - name: str = '', - logger: Logger = getLogger(__name__) + smiles: str = "", + inchi: str = "", + inchikey: str = "", + formula: str = "", + name: str = "", + logger: Logger = getLogger(__name__), ): - super().__init__( - id=id, - logger=logger - ) + super().__init__(id=id, logger=logger) self.set_smiles(smiles) self.set_inchi(inchi) self.set_inchikey(inchikey) @@ -62,11 +57,11 @@ def __init__( # return f'Compound {self.get_id()}' @staticmethod - def from_dict(compound: Dict) -> 'Compound': + def from_dict(compound: Dict) -> "Compound": return Compound(**compound) def _to_dict(self) -> Dict: - '''Return a dictionary with all (with legacy) attributes of the object: + """Return a dictionary with all (with legacy) attributes of the object: - id (legacy) - name - smiles @@ -78,14 +73,11 @@ def _to_dict(self) -> Dict: ------- obj_dict: Dict[str, TypeVar] A dictionary with all (with legacy) attributes - ''' - return { - **super()._to_dict(), - **self.__to_dict() - } + """ + return {**super()._to_dict(), **self.__to_dict()} def __to_dict(self) -> Dict: - '''Return a dictionary with (specific) attributes: + """Return a dictionary with (specific) attributes: - name - smiles - inchi @@ -96,113 +88,113 @@ def __to_dict(self) -> Dict: ------- obj_dict: Dict[str, TypeVar] A dictionary with (specific) attributes of the object - ''' + """ return { - 'name': self.get_name(), - 'smiles': self.get_smiles(), - 'inchi': self.get_inchi(), - 'inchikey': self.get_inchikey(), - 'formula': self.get_formula(), + "name": self.get_name(), + "smiles": self.get_smiles(), + "inchi": self.get_inchi(), + "inchikey": self.get_inchikey(), + "formula": self.get_formula(), } ## READ METHODS def get_name(self) -> str: - '''Returns the name of the compound + """Returns the name of the compound Returns ------- name: str Name of the compound - ''' + """ return self.__name def get_smiles(self) -> str: - '''Returns the SMILES string of the compound + """Returns the SMILES string of the compound Returns ------- smiles: str SMILES of the compound - ''' + """ return self.__smiles def get_inchi(self) -> str: - '''Returns the InChI of the compound + """Returns the InChI of the compound Returns ------- inchi: str Inchi of the compound - ''' + """ return self.__inchi def get_inchikey(self) -> str: - '''Returns the InChIKey of the compound + """Returns the InChIKey of the compound Returns ------- inchikey: str InChIKey of the compound - ''' + """ return self.__inchikey def get_formula(self) -> str: - '''Returns the formula of the compound + """Returns the formula of the compound Returns ------- formula: str Formula of the compound - ''' + """ return self.__formula ## WRITE METHODS def set_name(self, name: str) -> None: - '''Set the name of the compound + """Set the name of the compound Parameters ---------- name: str String to set the compound's name to - ''' + """ self.__name = name def set_smiles(self, smiles: str) -> None: - '''Set the SMILES string of the compound + """Set the SMILES string of the compound Parameters ---------- smiles: str String to set the compound's SMILES string to - ''' + """ self.__smiles = smiles def set_inchi(self, inchi: str) -> None: - '''Set the InChI of the compound + """Set the InChI of the compound Parameters ---------- inchi: str String to set the compound's InChI to - ''' + """ self.__inchi = inchi def set_inchikey(self, inchikey: str) -> None: - '''Set the InChIKey of the compound + """Set the InChIKey of the compound Parameters ---------- inchikey: str String to set the compound's InChIKey to - ''' + """ self.__inchikey = inchikey def set_formula(self, formula: str) -> None: - '''Set the formula of the compound + """Set the formula of the compound Parameters ---------- formula: str String to set the compound's formula to - ''' + """ self.__formula = formula diff --git a/chemlite/Object.py b/chemlite/Object.py index 04467b9..05387a1 100644 --- a/chemlite/Object.py +++ b/chemlite/Object.py @@ -1,4 +1,5 @@ """A class to represent a basic object.""" + # The MIT License (MIT) # # Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich. @@ -23,62 +24,49 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from typing import ( - Dict, - Union, - TypeVar -) -from logging import ( - Logger, - getLogger -) +from typing import Dict, Union, TypeVar +from logging import Logger, getLogger class Object: - def __init__( - self, - id: str, - logger: Logger = getLogger(__name__) - ): + def __init__(self, id: str, logger: Logger = getLogger(__name__)): self.__logger = logger self.set_id(id) def to_string(self) -> str: - '''Returns a string representation of the object + """Returns a string representation of the object Returns ------- string: str The string representation of the object - ''' - return f'{type(self).__name__} {self.get_id()}' + """ + return f"{type(self).__name__} {self.get_id()}" def __str__(self) -> str: - '''Prints a string representation of the object (called by print()) + """Prints a string representation of the object (called by print()) Returns ------- string: str The string representation of the object - ''' + """ return self.to_string() def _to_dict(self, full=False) -> Dict[str, TypeVar]: - '''Return a dictionary with the attributes of the object: + """Return a dictionary with the attributes of the object: - id Returns ------- obj_dict: Dict[str, TypeVar] A dictionary with the attributes of the object - ''' - return { - 'id': self.get_id() - } + """ + return {"id": self.get_id()} def __eq__(self, other) -> bool: - '''Return the equality status of two Object objects + """Return the equality status of two Object objects Parameters ---------- @@ -89,44 +77,44 @@ def __eq__(self, other) -> bool: ------- equal: bool Return true if the two objects are equal, False otherwise - ''' + """ if isinstance(self, other.__class__): return self._to_dict() == other._to_dict() return False ## READ METHODS def get_id(self) -> str: - '''Return the ID of the object + """Return the ID of the object Returns ------- id: str ID of the object - ''' + """ return self.__id def get_logger(self) -> Logger: - '''Return the object's logger + """Return the object's logger Returns ------- logger: Logger The object's logger - ''' + """ return self.__logger ## WRITE METHODS def set_id(self, id: str) -> Union[str, None]: - '''Set the object's id + """Set the object's id Parameters ---------- id: str String to set the object's ID to - ''' + """ if id is None: - raise ValueError('id argument must be different to None for an Object') - elif id == '': - raise ValueError('id argument must not be empty for an Object') + raise ValueError("id argument must be different to None for an Object") + elif id == "": + raise ValueError("id argument must not be empty for an Object") else: self.__id = id diff --git a/chemlite/Pathway.py b/chemlite/Pathway.py index e3abd20..f640275 100644 --- a/chemlite/Pathway.py +++ b/chemlite/Pathway.py @@ -1,4 +1,5 @@ """A class to represent a metabolic pathway.""" + # The MIT License (MIT) # # Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich. @@ -40,38 +41,33 @@ class Pathway(Object): def __init__( - self, - id: str, - cache: Cache = None, - logger: Logger = getLogger(__name__) + self, id: str, cache: Cache = None, logger: Logger = getLogger(__name__) ): - super().__init__( - id=id, - logger=logger - ) + super().__init__(id=id, logger=logger) self.__reactions = {} self.set_target_id(None) - ## OUT METHODS # def __repr__(self): # return dumps(self._to_dict(), indent=4) def to_string(self): - '''Returns the string representation of the pathway + """Returns the string representation of the pathway Returns ------- string: str String representation of the pathway - ''' - return '----------------\n' \ - + f'Pathway {self.get_id()}\n' \ - + '----------------\n' \ - + '\n'.join([rxn.__str__() for rxn in self.get_reactions().values()]) + """ + return ( + "----------------\n" + + f"Pathway {self.get_id()}\n" + + "----------------\n" + + "\n".join([rxn.__str__() for rxn in self.get_reactions().values()]) + ) def _to_dict(self, full=False) -> Dict: - '''Returns a dictionary with all (with legacy) attributes of the pathway: + """Returns a dictionary with all (with legacy) attributes of the pathway: - id (legacy) - reactions - species @@ -80,18 +76,24 @@ def _to_dict(self, full=False) -> Dict: ------- dict: Dict Dictionary with all (with legacy) attributes of the pathway - ''' + """ d = { - 'reactions': {rxn_id: self.get_reaction(rxn_id)._to_dict() for rxn_id in self.get_reactions_ids()}, - 'species': {spe_id: self.get_specie(spe_id)._to_dict() for spe_id in self.get_species_ids()}, - 'target_id': self.get_target_id(), + "reactions": { + rxn_id: self.get_reaction(rxn_id)._to_dict() + for rxn_id in self.get_reactions_ids() + }, + "species": { + spe_id: self.get_specie(spe_id)._to_dict() + for spe_id in self.get_species_ids() + }, + "target_id": self.get_target_id(), } if full: d.update(super()._to_dict()) return d - def __eq__(self: 'Pathway', other: 'Pathway') -> bool: - '''Compare if all reactions of one pathway are + def __eq__(self: "Pathway", other: "Pathway") -> bool: + """Compare if all reactions of one pathway are in the other and vice-versa. Parameters @@ -102,70 +104,76 @@ def __eq__(self: 'Pathway', other: 'Pathway') -> bool: Returns ------- bool - ''' + """ if isinstance(self, other.__class__): return ( all( # all reactions of self are in other rxn in self.get_list_of_reactions() for rxn in other.get_list_of_reactions() - ) and all ( # all reactions of other are in self + ) + and all( # all reactions of other are in self rxn in other.get_list_of_reactions() for rxn in self.get_list_of_reactions() - ) and self.get_target_id() == other.get_target_id() + ) + and self.get_target_id() == other.get_target_id() ) return False ## READ METHODS def get_nb_reactions(self) -> int: - '''Returns the number of reactions of the pathway + """Returns the number of reactions of the pathway Returns ------- nb: int Integer equal to the number of reactions in the pathway - ''' + """ return len(self.get_reactions()) def get_nb_species(self) -> int: - '''Returns the number of species involved in all the reactions of the pathway + """Returns the number of species involved in all the reactions of the pathway Returns ------- nb: int Integer equal to the number of species invloved in the pathway - ''' + """ return len(self.get_species_ids()) def get_species_ids(self) -> List[str]: - '''Returns IDs of the species involved in all the reactions of the pathway + """Returns IDs of the species involved in all the reactions of the pathway Returns ------- ids: List[str] IDs of the species involved in the pathway - ''' + """ # Build the list of species over all reactions - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.get_reactions().values()] + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.get_reactions().values() + ] # Expand the list and remove duplicates (set) - set_of_species = set([spe for species in list_of_list_of_species for spe in species]) + set_of_species = set( + [spe for species in list_of_list_of_species for spe in species] + ) return list(set_of_species) def get_species(self) -> List[Compound]: - '''Returns the species involved in all the reactions of the pathway + """Returns the species involved in all the reactions of the pathway Returns ------- species: List[Compound] Species involved in the pathway - ''' + """ return [self.get_specie(spe_id) for spe_id in self.get_species_ids()] def get_compounds(self) -> List[Compound]: - '''Same as get_species()''' + """Same as get_species()""" return self.get_species() def get_specie(self, spe_id: str) -> Compound: - '''Returns a specific specie involved in the pathway if exists, + """Returns a specific specie involved in the pathway if exists, None otherwise. Parameters @@ -177,30 +185,30 @@ def get_specie(self, spe_id: str) -> Compound: ------- specie: Compound The specie with id 'spe_id' - ''' + """ compound = Cache.get(spe_id) return compound def get_compounds_ids(self) -> List[str]: - '''Same as get_species_ids()''' + """Same as get_species_ids()""" return self.get_species_ids() def get_compound(self, cmpd_id: str) -> Compound: - '''Same as get_specie(cmpd_id)''' + """Same as get_specie(cmpd_id)""" return self.get_specie(cmpd_id) def get_reactions_ids(self) -> List[str]: - '''Returns IDs of reactions of the pathway + """Returns IDs of reactions of the pathway Returns ------- ids: List[str] IDs of reactions of the pathway - ''' + """ return list(self.__reactions.keys()) def get_reaction(self, rxn_id: str) -> Reaction: - '''Returns a specific reaction of the pathway if exists, + """Returns a specific reaction of the pathway if exists, None otherwise. Parameters @@ -212,39 +220,39 @@ def get_reaction(self, rxn_id: str) -> Reaction: ------- reaction: Reaction The reaction with id 'rxn_id' - ''' + """ return self.get_reactions().get(rxn_id, None) def get_reactions(self) -> Dict[str, Reaction]: - '''Returns a dictionary where keys are reaction ids + """Returns a dictionary where keys are reaction ids and values the reactions themselves Returns ------- reactions: Dict[str, Reaction] Reactions of the pathway - ''' + """ return self.__reactions def get_list_of_reactions(self) -> List[Reaction]: - '''Returns a list of the reactions in the pathway + """Returns a list of the reactions in the pathway Returns ------- reactions: Dict[str, Reaction] Reactions of the pathway - ''' + """ return list(self.__reactions.values()) def get_reactants_ids(self) -> List[str]: - '''Returns all reactants involved in the pathway, + """Returns all reactants involved in the pathway, alphabetically sorted Returns ------- reactants: List[str] Reactants of the pathway - ''' + """ return sorted( set( [ @@ -256,14 +264,14 @@ def get_reactants_ids(self) -> List[str]: ) def get_products_ids(self) -> List[str]: - '''Returns all products involved in the pathway, + """Returns all products involved in the pathway, alphabetically sorted Returns ------- products: List[str] Products of the pathway - ''' + """ return sorted( set( [ @@ -273,30 +281,30 @@ def get_products_ids(self) -> List[str]: ] ) ) - + def get_target_id(self) -> str: - '''Returns the target id of the pathway, i.e. the id of the compound that is produced by the pathway + """Returns the target id of the pathway, i.e. the id of the compound that is produced by the pathway Returns ------- target_id: str ID of the target compound of the pathway - ''' + """ return self.__target_id ## WRITE METHODS def set_target_id(self, target_id: str) -> None: - '''Set the target id of the pathway, i.e. the id of the compound that is produced by the pathway + """Set the target id of the pathway, i.e. the id of the compound that is produced by the pathway Parameters ---------- target_id: str ID of the target compound of the pathway - ''' + """ self.__target_id = target_id def rename_compound(self, id: str, new_id: str) -> None: - '''Rename a compound within the pathway. Actually, the + """Rename a compound within the pathway. Actually, the compound is renamed over all reactions Parameters @@ -305,7 +313,7 @@ def rename_compound(self, id: str, new_id: str) -> None: ID of the compound to rename new_id: str ID that the compound has to be renamed to - ''' + """ for rxn in self.get_reactions().values(): if id in rxn.get_species_ids(): # rename compound in cache @@ -319,7 +327,7 @@ def rename_compound(self, id: str, new_id: str) -> None: rxn.rename_compound(id, new_id) def replace_reaction(self, rxn_id: str, rxn: Reaction) -> bool: - '''Replace a reaction in the pathway. Returns True if the + """Replace a reaction in the pathway. Returns True if the replacement has been done, False otherwise Parameters @@ -333,13 +341,15 @@ def replace_reaction(self, rxn_id: str, rxn: Reaction) -> bool: ------- b: bool True if replacement has been done, False otherwise - ''' - self.get_logger().debug(rxn_id+' '+rxn.to_string()) + """ + self.get_logger().debug(rxn_id + " " + rxn.to_string()) if rxn_id in self.get_reactions_ids(): self.add_reaction(rxn, rxn_id) return True else: - self.get_logger().warning(f'Reaction {rxn_id} not found in the pathway, nothing done.') + self.get_logger().warning( + f"Reaction {rxn_id} not found in the pathway, nothing done." + ) return False def add_reaction( @@ -347,7 +357,7 @@ def add_reaction( rxn: Reaction, rxn_id: str = None, ) -> None: - '''Add a reaction in the pathway + """Add a reaction in the pathway Parameters ---------- @@ -355,7 +365,7 @@ def add_reaction( Reaction to add in the pathway new_id: str ID that the compound has to be renamed to - ''' + """ self.get_logger().debug(rxn) # RXN ID @@ -364,7 +374,7 @@ def add_reaction( self.__reactions[rxn_id] = rxn def del_reaction(self, rxn_id: str) -> bool: - '''Remove a reaction from the pathway. Returns True if the + """Remove a reaction from the pathway. Returns True if the replacement has been done, False otherwise Parameters @@ -376,22 +386,24 @@ def del_reaction(self, rxn_id: str) -> bool: ------- b: bool True if deletion has been done, False otherwise - ''' + """ try: del self.__reactions[rxn_id] return True except KeyError: - self.get_logger().error(f'Reaction \'{rxn_id}\' not found in the pathway, nothing deleted.') + self.get_logger().error( + f"Reaction '{rxn_id}' not found in the pathway, nothing deleted." + ) return False ## MISC def net_reaction(self) -> Dict[str, float]: - '''Returns the net reaction (or pseudo-reaction) of the pathway, + """Returns the net reaction (or pseudo-reaction) of the pathway, i.e. the stoichiometric sum of all reactions of the pathway. See Reaction::sum_stoichio for more details. - ''' + """ return Reaction.sum_stoichio(self.get_reactions().values()) def pseudo_reaction(self) -> Reaction: - '''Same as net_reaction()''' + """Same as net_reaction()""" return self.net_reaction() diff --git a/chemlite/Reaction.py b/chemlite/Reaction.py index 463ae79..26edfca 100644 --- a/chemlite/Reaction.py +++ b/chemlite/Reaction.py @@ -1,4 +1,5 @@ """A class to represent a chemical reaction.""" + # The MIT License (MIT) # # Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich. @@ -23,15 +24,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from typing import ( - Dict, - List, - Union -) -from logging import ( - Logger, - getLogger -) +from typing import Dict, List, Union +from logging import Logger, getLogger from json import dumps as json_dumps from copy import deepcopy @@ -42,7 +36,8 @@ class Reaction(Object): - def get_SIDES() -> List: return ['left', 'right'] + def get_SIDES() -> List: + return ["left", "right"] def __init__( self, @@ -50,12 +45,9 @@ def __init__( ec_numbers: Union[List[str], str] = [], reactants: Dict[str, int] = {}, products: Dict[str, int] = {}, - logger: Logger = getLogger(__name__) + logger: Logger = getLogger(__name__), ): - super().__init__( - id=id, - logger=logger - ) + super().__init__(id=id, logger=logger) if isinstance(ec_numbers, list): self.set_ec_numbers(ec_numbers) else: @@ -70,10 +62,8 @@ def __init__( @staticmethod def from_string( - rxn: str, - id: str, - logger: Logger = getLogger(__file__) - ) -> 'Reaction': + rxn: str, id: str, logger: Logger = getLogger(__file__) + ) -> "Reaction": """ Build transformation to complete. @@ -92,22 +82,16 @@ def from_string( transfo: Dict Dictionary of the transformation. """ - logger.debug(f'transfo: {rxn}') + logger.debug(f"transfo: {rxn}") transfo = Reaction.parse(rxn, logger) return Reaction( - id=id, - reactants=transfo['left'], - products=transfo['right'], - logger=logger + id=id, reactants=transfo["left"], products=transfo["right"], logger=logger ) @staticmethod - def parse( - rxn: str, - logger: Logger = getLogger(__file__) - ): + def parse(rxn: str, logger: Logger = getLogger(__file__)): """ Parse the reaction string. @@ -127,27 +111,27 @@ def parse( Dictionary of the transformation. """ transfo = { - 'left': {}, - 'right': {}, - 'format': '', - 'sep_side': '', - 'sep_cmpd': '' + "left": {}, + "right": {}, + "format": "", + "sep_side": "", + "sep_cmpd": "", } # Detect input format - if '>>' in rxn: # SMILES - transfo['format'] = 'smiles' - transfo['sep_side'] = '>>' - transfo['sep_cmpd'] = '.' - elif '=' in rxn: # CMPD IDs - transfo['format'] = 'cid' - transfo['sep_side'] = '=' - transfo['sep_cmpd'] = '+' + if ">>" in rxn: # SMILES + transfo["format"] = "smiles" + transfo["sep_side"] = ">>" + transfo["sep_cmpd"] = "." + elif "=" in rxn: # CMPD IDs + transfo["format"] = "cid" + transfo["sep_side"] = "=" + transfo["sep_cmpd"] = "+" trans = {} - trans['left'], trans['right'] = rxn.split(transfo['sep_side']) + trans["left"], trans["right"] = rxn.split(transfo["sep_side"]) for side in Reaction.get_SIDES(): - for cmpd in trans[side].split(transfo['sep_cmpd']): + for cmpd in trans[side].split(transfo["sep_cmpd"]): # Separate compounds, remove leading and trailing spaces - _list = cmpd.strip().split(' ') + _list = cmpd.strip().split(" ") # Detect stoichio coeff if len(_list) > 1: _coeff = float(_list[0]) @@ -155,33 +139,39 @@ def parse( else: _coeff = 1.0 _cmpd = _list[0] - if not _cmpd in transfo[side]: + if _cmpd not in transfo[side]: transfo[side][_cmpd] = 0 transfo[side][_cmpd] += _coeff - logger.debug('INPUT TRANSFORMATION: '+str(json_dumps(transfo, indent=4))) + logger.debug("INPUT TRANSFORMATION: " + str(json_dumps(transfo, indent=4))) return transfo def to_string(self) -> str: - '''Returns the string representation of the reaction + """Returns the string representation of the reaction Returns ------- string: str String representation of the reaction - ''' - return '{class_name} {rxn_name}: {reactants} = {products}'.format( + """ + return "{class_name} {rxn_name}: {reactants} = {products}".format( class_name=type(self).__name__, rxn_name=self.get_id(), - reactants=' + '.join( - [f'{spe_sto} {spe_id}' for spe_id, spe_sto in self.get_reactants().items()] + reactants=" + ".join( + [ + f"{spe_sto} {spe_id}" + for spe_id, spe_sto in self.get_reactants().items() + ] ), - products=' + '.join( - [f'{spe_sto} {spe_id}' for spe_id, spe_sto in self.get_products().items()] + products=" + ".join( + [ + f"{spe_sto} {spe_id}" + for spe_id, spe_sto in self.get_products().items() + ] ), ) def _to_dict(self, full=False) -> Dict: - '''Returns a dictionary with all (with legacy) attributes of the reaction: + """Returns a dictionary with all (with legacy) attributes of the reaction: - id (legacy) - ec_numbers - reactants @@ -191,55 +181,56 @@ def _to_dict(self, full=False) -> Dict: ------- dict: Dict Dictionary with all (with legacy) attributes of the reaction - ''' + """ d = { - 'reactants': deepcopy(self.get_reactants()), - 'products': deepcopy(self.get_products()), + "reactants": deepcopy(self.get_reactants()), + "products": deepcopy(self.get_products()), } if full: d.update( { **super()._to_dict(), - 'ec_numbers': deepcopy(self.get_ec_numbers()), + "ec_numbers": deepcopy(self.get_ec_numbers()), } ) return d ## READ METHODS def get_ec_numbers(self) -> List[str]: - '''Returns the list of EC numbers of the reaction. + """Returns the list of EC numbers of the reaction. Returns ------- ec_numbers: List[str] List of EC numbers of the reaction - ''' + """ return self.__ec_numbers def get_smiles(self) -> str: - '''Builds and returns the SMILES string of the reaction + """Builds and returns the SMILES string of the reaction Returns ------- smiles: str SMILES string of the reaction - ''' + """ + def get_smi(spe_id: str, spe_sto: float) -> str: check_smiles = ( Cache.get(spe_id) is not None and Cache.get(spe_id).get_smiles() is not None - and Cache.get(spe_id).get_smiles() != '' + and Cache.get(spe_id).get_smiles() != "" ) if check_smiles: _spe_sto = round(spe_sto) _spe_sto = _spe_sto if _spe_sto > 0 else 1 if _spe_sto != spe_sto: self.get_logger().warning( - f'Stoichiometric coefficient of compound {spe_id} ({spe_sto}) has been rounded to {_spe_sto}.' - ) - return [Cache.get(spe_id).get_smiles()]*_spe_sto + f"Stoichiometric coefficient of compound {spe_id} ({spe_sto}) has been rounded to {_spe_sto}." + ) + return [Cache.get(spe_id).get_smiles()] * _spe_sto else: - self.get_logger().warning(f'Compound {spe_id} has no smiles') + self.get_logger().warning(f"Compound {spe_id} has no smiles") return [] ## LEFT @@ -248,7 +239,7 @@ def get_smi(spe_id: str, spe_sto: float) -> str: for spe_id, spe_sto in self.get_reactants().items(): smi += get_smi(spe_id, spe_sto) # build smiles string - left_smi = '.'.join(smi) + left_smi = ".".join(smi) ## RIGHT smi = [] @@ -256,12 +247,12 @@ def get_smi(spe_id: str, spe_sto: float) -> str: for spe_id, spe_sto in self.get_products().items(): smi += get_smi(spe_id, spe_sto) # build smiles string - right_smi = '.'.join(smi) + right_smi = ".".join(smi) - return left_smi + '>>' + right_smi + return left_smi + ">>" + right_smi def get_reactants(self) -> Dict[str, int]: - '''Returns a dictionary (alphabetically sorted) where + """Returns a dictionary (alphabetically sorted) where keys are IDs of products and values are the stoichiometric coefficient in the reaction @@ -269,14 +260,14 @@ def get_reactants(self) -> Dict[str, int]: ------- products: Dict[str, int] Stoichiometric dictionary of products - ''' + """ try: return dict(sorted(self.__reactants.items(), key=lambda item: item[0])) except AttributeError: return None def get_reactant(self, cmpd_id: str) -> int: - '''Returns the stoichiometric coefficient (> 0) of the + """Returns the stoichiometric coefficient (> 0) of the reactant compound with ID = 'cmpd_id' Parameters @@ -288,47 +279,47 @@ def get_reactant(self, cmpd_id: str) -> int: ------- sto_coeff: Dict[str, int] Stoichiometric coefficient of the reactant compound of ID 'cmpd_id' - ''' + """ try: return self.__reactants[cmpd_id] except (KeyError, TypeError): return 0 def get_nb_reactants(self) -> int: - '''Returns the number of reactants of the reaction + """Returns the number of reactants of the reaction Returns ------- nb: int Number of reactants of the reaction - ''' + """ try: return len(self.get_reactants()) except TypeError: return 0 def get_reactants_ids(self) -> List[str]: - '''Returns the list of reactants IDs + """Returns the list of reactants IDs Returns ------- reactants_ids: List[str] List of reactants IDs - ''' + """ return list(self.get_reactants().keys()) def get_reactants_compounds(self) -> List[Compound]: - '''Returns the list of compounds that are reactants of the reaction + """Returns the list of compounds that are reactants of the reaction Returns ------- reactants: List[Compound] List of compounds that are reactants of the reaction - ''' + """ return [Cache.get(compound_id) for compound_id in self.get_reactants_ids()] def get_products(self) -> Dict[str, int]: - '''Returns a dictionary (alphabetically sorted) where + """Returns a dictionary (alphabetically sorted) where keys are IDs of products and values are the stoichiometric coefficient in the reaction @@ -336,14 +327,14 @@ def get_products(self) -> Dict[str, int]: ------- products: Dict[str, int] Stoichiometric dictionary of products - ''' + """ try: return dict(sorted(self.__products.items(), key=lambda item: item[0])) except AttributeError: return None def get_product(self, cmpd_id: str) -> int: - '''Returns the stoichiometric coefficient (> 0) of the + """Returns the stoichiometric coefficient (> 0) of the product compound with ID = 'cmpd_id' Parameters @@ -355,55 +346,55 @@ def get_product(self, cmpd_id: str) -> int: ------- sto_coeff: Dict[str, int] Stoichiometric coefficient of the product compound of ID 'cmpd_id' - ''' + """ try: return self.__products[cmpd_id] except (KeyError, TypeError): return 0 def get_nb_products(self) -> int: - '''Returns the number of products of the reaction + """Returns the number of products of the reaction Returns ------- nb: int Number of products of the reaction - ''' + """ try: return len(self.get_products()) except TypeError: return 0 def get_products_ids(self) -> List[str]: - '''Returns the list of products IDs + """Returns the list of products IDs Returns ------- products_ids: List[str] List of products IDs - ''' + """ return list(self.get_products().keys()) def get_products_compounds(self) -> List[Compound]: - '''Returns the list of compounds that are products of the reaction + """Returns the list of compounds that are products of the reaction Returns ------- products: List[Compound] List of compounds that are products of the reaction - ''' + """ return [Cache.get(compound_id) for compound_id in self.get_products_ids()] def get_left(self) -> Dict[str, int]: - '''Same as get_reactants()''' + """Same as get_reactants()""" return self.get_reactants() def get_right(self) -> Dict[str, int]: - '''Same as get_products()''' + """Same as get_products()""" return self.get_products() def get_species(self) -> Dict: - '''Combines the result of both get_reactants() and get_products() but + """Combines the result of both get_reactants() and get_products() but stoichiometric coefficients for reactants are negative (< 0). Returns @@ -411,29 +402,26 @@ def get_species(self) -> Dict: species: Dict[str, int] Stoichiometric (alphabetically sorted) dictionary of species in the reaction. - ''' + """ return { **{spe_id: -spe_sto for spe_id, spe_sto in self.get_reactants().items()}, **self.get_products(), } def get_species_ids(self) -> List[str]: - '''Returns the list of species IDs + """Returns the list of species IDs Returns ------- species_ids: List[str] List of species IDs - ''' + """ return list( - set( - list(self.get_reactants().keys()) - + list(self.get_products().keys()) - ) + set(list(self.get_reactants().keys()) + list(self.get_products().keys())) ) def get_specie(self, cmpd_id: str) -> Dict: - '''Return informations about a specie within the current reaction + """Return informations about a specie within the current reaction Parameters ---------- @@ -444,69 +432,69 @@ def get_specie(self, cmpd_id: str) -> Dict: ------- infos: Dict Informations - ''' + """ return { - 'reactant': self.get_reactant(cmpd_id), - 'product': self.get_product(cmpd_id) + "reactant": self.get_reactant(cmpd_id), + "product": self.get_product(cmpd_id), } def get_species_compounds(self) -> List[Compound]: - '''Returns the list of compounds in the reaction + """Returns the list of compounds in the reaction Returns ------- compounds: List[Compound] List of compounds in the reaction - ''' + """ return [Cache.get(spe_id) for spe_id in self.get_species_ids()] def get_nb_species(self) -> int: - '''Returns the number of species of the reaction + """Returns the number of species of the reaction Returns ------- nb: int Number of species of the reaction - ''' + """ return len(self.get_species_ids()) ## WRITE METHODS def set_ec_numbers(self, numbers: List[str]) -> None: - '''Set the EC numbers of the reaction + """Set the EC numbers of the reaction Parameters ---------- numbers: List[str] List of string to set the reaction's EC numbers to - ''' + """ self.__ec_numbers = deepcopy(numbers) def add_ec_number(self, number: str) -> None: - '''Add an EC number to the reaction + """Add an EC number to the reaction Parameters ---------- number: str String to add in the reaction's EC numbers - ''' - if number is not None and number != '': + """ + if number is not None and number != "": self.__ec_numbers += [number] def set_reactants(self, compounds: Dict[str, int]) -> None: - '''Set the reactants of the reaction + """Set the reactants of the reaction Parameters ---------- compounds: Dict[str, int] Stoichiometric dictionary to set the reactions's reactants to - ''' + """ self.__reactants = {} if compounds is not None: for spe_id, spe_sto in compounds.items(): self.set_reactant(spe_id, spe_sto) def set_reactant(self, cmpd_id: str, stoichio: int) -> None: - '''Set the stoichiometric coefficient of the reactant compound + """Set the stoichiometric coefficient of the reactant compound with ID 'cmpd_id'. Do nothing if 'cmpd_id' is None or empty string Parameters @@ -515,10 +503,10 @@ def set_reactant(self, cmpd_id: str, stoichio: int) -> None: ID of the reactant compound stoichio: int Stoichiometric coefficient to set the reactant compound to - ''' - if cmpd_id is None or cmpd_id == '': + """ + if cmpd_id is None or cmpd_id == "": return None - self.logger.warning(f'Compound ID passed is equal to {cmpd_id}') + self.logger.warning(f"Compound ID passed is equal to {cmpd_id}") if self.get_reactants() is None: self.__reactants = {} self.__reactants[cmpd_id] = abs(stoichio) @@ -527,20 +515,20 @@ def set_reactant(self, cmpd_id: str, stoichio: int) -> None: Compound(id=cmpd_id) def set_products(self, compounds: Dict) -> None: - '''Set the products of the reaction + """Set the products of the reaction Parameters ---------- compounds: Dict[str, int] Stoichiometric dictionary to set the reactions's products to - ''' + """ self.__products = {} if compounds is not None: for spe_id, spe_sto in compounds.items(): self.set_product(spe_id, spe_sto) def set_product(self, cmpd_id: str, stoichio: int) -> None: - '''Set the stoichiometric coefficient of the product compound + """Set the stoichiometric coefficient of the product compound with ID 'cmpd_id'. Do nothing if 'cmpd_id' is None or empty string Parameters @@ -549,10 +537,10 @@ def set_product(self, cmpd_id: str, stoichio: int) -> None: ID of the product compound stoichio: int Stoichiometric coefficient to set the product compound to - ''' - if cmpd_id is None or cmpd_id == '': + """ + if cmpd_id is None or cmpd_id == "": return None - self.logger.warning(f'Compound ID passed is equal to {cmpd_id}') + self.logger.warning(f"Compound ID passed is equal to {cmpd_id}") if self.get_products() is None: self.__products = {} self.__products[cmpd_id] = abs(stoichio) @@ -560,12 +548,8 @@ def set_product(self, cmpd_id: str, stoichio: int) -> None: # add to Cache Compound(id=cmpd_id) - def rename_compound( - self, - id: str, - new_id: str - ) -> None: - '''Rename a compound in the reaction. + def rename_compound(self, id: str, new_id: str) -> None: + """Rename a compound in the reaction. Parameters ---------- @@ -573,7 +557,7 @@ def rename_compound( ID of the compound to rename new_id: str String to set the compound's ID to - ''' + """ # Reactants species = {} @@ -598,7 +582,7 @@ def add_reactant( compound_id: str, stoichio: int, ) -> None: - '''Add the compound with ID 'compound_id' and + """Add the compound with ID 'compound_id' and stoichiometric coefficient 'stoichio' to the reaction's list of reactants @@ -608,10 +592,9 @@ def add_reactant( ID of the reactant compound to add stoichio: int Stoichiometric coefficient of the reactant compound to add - ''' + """ self.set_reactant( - cmpd_id=compound_id, - stoichio=self.get_reactant(compound_id)+abs(stoichio) + cmpd_id=compound_id, stoichio=self.get_reactant(compound_id) + abs(stoichio) ) def add_product( @@ -619,7 +602,7 @@ def add_product( compound_id: str, stoichio: int, ) -> None: - '''Add the compound with ID 'compound_id' and + """Add the compound with ID 'compound_id' and stoichiometric coefficient 'stoichio' to the reaction's list of products @@ -629,36 +612,27 @@ def add_product( ID of the product compound to add stoichio: int Stoichiometric coefficient of the product compound to add - ''' + """ self.set_product( - cmpd_id=compound_id, - stoichio=self.get_product(compound_id)+abs(stoichio) + cmpd_id=compound_id, stoichio=self.get_product(compound_id) + abs(stoichio) ) def mult_stoichio_coeff(self, mult: float) -> None: - '''Multiply stoichiometric coefficients of all species of the reaction by 'mult' + """Multiply stoichiometric coefficients of all species of the reaction by 'mult' Parameters ---------- mult: float Integer to multiply all stoichiometric coefficients with - ''' + """ for spe_id in self.get_reactants().keys(): - self.set_reactant( - spe_id, - self.get_reactant(spe_id)*mult - ) + self.set_reactant(spe_id, self.get_reactant(spe_id) * mult) for spe_id in self.get_products().keys(): - self.set_product( - spe_id, - self.get_product(spe_id)*mult - ) + self.set_product(spe_id, self.get_product(spe_id) * mult) @staticmethod - def sum_stoichio( - reactions: List['Reaction'] - ) -> Dict[str, int]: - '''Make the sum of stoichiometric coefficients + def sum_stoichio(reactions: List["Reaction"]) -> Dict[str, int]: + """Make the sum of stoichiometric coefficients of all species in all reactions in the passed list and returns a stoichiometric dictionary of the pseudo-reaction. If a compound is both a reactant of a reaction of the list (coeff < 0) @@ -675,7 +649,7 @@ def sum_stoichio( ------- stoichio: Dict[str, int] Stoichiometric dictionary of summed stoichiometric coefficients (pseudo-reaction) - ''' + """ l_reactants = [rxn.get_reactants() for rxn in reactions] l_products = [rxn.get_products() for rxn in reactions] @@ -699,4 +673,6 @@ def sum_stoichio( else: species[spe_id] = spe_sto - return {spe_id: spe_sto for (spe_id, spe_sto) in species.items() if spe_sto != 0} + return { + spe_id: spe_sto for (spe_id, spe_sto) in species.items() if spe_sto != 0 + } diff --git a/chemlite/__init__.py b/chemlite/__init__.py index c496de4..5bd600d 100644 --- a/chemlite/__init__.py +++ b/chemlite/__init__.py @@ -4,4 +4,4 @@ from chemlite.Object import Object from chemlite._version import __version__ -__all__ = ['Pathway', 'Reaction', 'Compound', 'Object', __version__] +__all__ = ["Pathway", "Reaction", "Compound", "Object", __version__] diff --git a/chemlite/constants.py b/chemlite/constants.py index bf0eee2..dd19abb 100644 --- a/chemlite/constants.py +++ b/chemlite/constants.py @@ -1,4 +1,5 @@ """A file to define constants""" + # The MIT License (MIT) # # Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich. @@ -25,19 +26,7 @@ # default thermo values DEFAULT_THERMO = { - "dG0_prime": { - "value": float('nan'), - "error": float('nan'), - "unit": '' - }, - "dGm_prime": { - "value": float('nan'), - "error": float('nan'), - "unit": '' - }, - "dG_prime": { - "value": float('nan'), - "error": float('nan'), - "unit": '' - } + "dG0_prime": {"value": float("nan"), "error": float("nan"), "unit": ""}, + "dGm_prime": {"value": float("nan"), "error": float("nan"), "unit": ""}, + "dG_prime": {"value": float("nan"), "error": float("nan"), "unit": ""}, } diff --git a/setup.py b/setup.py index 2b14410..fe1e852 100644 --- a/setup.py +++ b/setup.py @@ -1,60 +1,54 @@ from setuptools import setup from os import path as os_path - ## INFOS ## -package = 'chemlite' -descr = 'Library to define chemical compounds, reactions, pathways' -url = 'https://github.com/brsynth/chemlite' -authors = 'Joan Hérisson' -corr_author = 'joan.herisson@univ-evry.fr' +package = "chemlite" +descr = "Library to define chemical compounds, reactions, pathways" +url = "https://github.com/brsynth/chemlite" +authors = "Joan Hérisson" +corr_author = "joan.herisson@univ-evry.fr" ## LONG DESCRIPTION with open( - os_path.join( - os_path.dirname(os_path.realpath(__file__)), - 'README.md' - ), - 'r', - encoding='utf-8' + os_path.join(os_path.dirname(os_path.realpath(__file__)), "README.md"), + "r", + encoding="utf-8", ) as f: long_description = f.read() + def get_version(): with open( - os_path.join( - os_path.dirname(os_path.realpath(__file__)), - 'CHANGELOG.md' - ), - 'r' + os_path.join(os_path.dirname(os_path.realpath(__file__)), "CHANGELOG.md"), "r" ) as f: lines = f.readlines() for line in lines: - if line.startswith('##'): + if line.startswith("##"): from re import search + m = search("\[(.+)\]", line) if m: return m.group(1) + setup( - name = package, - version = get_version(), - author = authors, - author_email = corr_author, - description = descr, - long_description = long_description, - long_description_content_type = 'text/markdown', - url = url, - packages = [package], - package_dir = {package: package}, - include_package_data = True, - test_suite = 'pytest', - license = 'MIT', - classifiers = [ - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', + name=package, + version=get_version(), + author=authors, + author_email=corr_author, + description=descr, + long_description=long_description, + long_description_content_type="text/markdown", + url=url, + packages=[package], + package_dir={package: package}, + include_package_data=True, + test_suite="pytest", + license="MIT", + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", ], - python_requires = '>=3.7', + python_requires=">=3.7", ) - diff --git a/tests/test_Compound.py b/tests/test_Compound.py index 516cd10..689524d 100644 --- a/tests/test_Compound.py +++ b/tests/test_Compound.py @@ -11,45 +11,39 @@ from chemlite import Compound HERE = os_path.dirname(os_path.realpath(__file__)) -DATA_PATH = os_path.join(HERE, 'data') +DATA_PATH = os_path.join(HERE, "data") + class Test_Compound(TestCase): def setUp(self): - with open(os_path.join(DATA_PATH, 'compounds.json'), 'r') as fp: + with open(os_path.join(DATA_PATH, "compounds.json"), "r") as fp: compounds = jsload(fp) - self.compound_dict = compounds['MNXM23'] + self.compound_dict = compounds["MNXM23"] self.compound = Compound(**self.compound_dict) def test_from_dict(self): - self.assertEqual( - self.compound, - Compound.from_dict(self.compound_dict) - ) + self.assertEqual(self.compound, Compound.from_dict(self.compound_dict)) def test_to_string(self): self.assertEqual( - self.compound.to_string(), - f'Compound {self.compound_dict["id"]}' + self.compound.to_string(), f'Compound {self.compound_dict["id"]}' ) def test__to_dict(self): - self.assertDictEqual( - self.compound._to_dict(), - self.compound_dict - ) + self.assertDictEqual(self.compound._to_dict(), self.compound_dict) def test_eq(self): self.assertEqual( self.compound, Compound( - smiles=self.compound_dict['smiles'], - inchi=self.compound_dict['inchi'], - inchikey=self.compound_dict['inchikey'], - id=self.compound_dict['id'], - formula=self.compound_dict['formula'], - name=self.compound_dict['name'] - ) + smiles=self.compound_dict["smiles"], + inchi=self.compound_dict["inchi"], + inchikey=self.compound_dict["inchikey"], + id=self.compound_dict["id"], + formula=self.compound_dict["formula"], + name=self.compound_dict["name"], + ), ) # def test_not_eq_toomuch(self): @@ -67,32 +61,25 @@ def test_not_eq_notenough(self): self.assertNotEqual( self.compound, Compound( - inchi=self.compound_dict['inchi'], - inchikey=self.compound_dict['inchikey'], - id=self.compound_dict['id'] - ) + inchi=self.compound_dict["inchi"], + inchikey=self.compound_dict["inchikey"], + id=self.compound_dict["id"], + ), ) def test_eq_wrong_type(self): - self.assertNotEqual( - self.compound, - 0 - ) + self.assertNotEqual(self.compound, 0) def test_get(self): - for attr in ['smiles', 'inchi', 'inchikey', 'name', 'formula']: - with self.subTest(f'test_get_{attr}', attr=attr): + for attr in ["smiles", "inchi", "inchikey", "name", "formula"]: + with self.subTest(f"test_get_{attr}", attr=attr): self.assertEqual( - getattr(self.compound, f'get_{attr}')(), - self.compound_dict[attr] + getattr(self.compound, f"get_{attr}")(), self.compound_dict[attr] ) def test_set(self): - new_str = 'new_str' - for attr in ['smiles', 'inchi', 'inchikey', 'name', 'formula']: - with self.subTest(f'test_set_{attr}', attr=attr): + new_str = "new_str" + for attr in ["smiles", "inchi", "inchikey", "name", "formula"]: + with self.subTest(f"test_set_{attr}", attr=attr): setattr(self.compound, attr, new_str), - self.assertEqual( - getattr(self.compound, attr), - new_str - ) + self.assertEqual(getattr(self.compound, attr), new_str) diff --git a/tests/test_Object.py b/tests/test_Object.py index 6e4ac5a..77a62fc 100644 --- a/tests/test_Object.py +++ b/tests/test_Object.py @@ -13,74 +13,46 @@ class Test_Object(TestCase): def setUp(self): self.id = "MNXM23" - self.object = Object( - id=self.id - ) + self.object = Object(id=self.id) def test___init___empty_id(self): with pytest_raises(ValueError): - Object('').get_id(), + Object("").get_id(), def test___init___none_id(self): with pytest_raises(ValueError): Object(None).get_id(), def test_to_string(self): - id = 'obj_id' - self.assertEqual( - Object(id).to_string(), - f'Object {id}' - ) + id = "obj_id" + self.assertEqual(Object(id).to_string(), f"Object {id}") def test___str__(self): - id = 'obj_id' - self.assertEqual( - Object(id).__str__(), - f'Object {id}' - ) + id = "obj_id" + self.assertEqual(Object(id).__str__(), f"Object {id}") def test_eq(self): - id = 'obj_id' + id = "obj_id" obj = Object(id) - self.assertEqual( - obj, - Object(id=id) - ) + self.assertEqual(obj, Object(id=id)) def test_eq_diffid(self): - id = 'obj_id' + id = "obj_id" obj = Object(id) - self.assertNotEqual( - obj, - Object(id=id+'diff') - ) + self.assertNotEqual(obj, Object(id=id + "diff")) def test_eq_diff_type(self): - id = 'obj_id' + id = "obj_id" obj = Object(id) - self.assertNotEqual( - obj, - 0 - ) + self.assertNotEqual(obj, 0) def test_get(self): - self.assertEqual( - self.object.get_id(), - self.id - ) + self.assertEqual(self.object.get_id(), self.id) def test_set_id(self): - new_id = 'new_id' + new_id = "new_id" self.object.set_id(new_id) - self.assertEqual( - self.object.get_id(), - new_id - ) + self.assertEqual(self.object.get_id(), new_id) def test__to_dict(self): - self.assertDictEqual( - self.object._to_dict(), - { - 'id': self.id - } - ) + self.assertDictEqual(self.object._to_dict(), {"id": self.id}) diff --git a/tests/test_Pathway.py b/tests/test_Pathway.py index d6b1e78..d8ca4f3 100644 --- a/tests/test_Pathway.py +++ b/tests/test_Pathway.py @@ -16,84 +16,49 @@ ) HERE = os_path.dirname(os_path.realpath(__file__)) -DATA_PATH = os_path.join(HERE, 'data') +DATA_PATH = os_path.join(HERE, "data") + class Test_Pathway(TestCase): def setUp(self): self.species = {} - self.target_id = 'TARGET_0000000001' - with open(os_path.join(DATA_PATH, 'compounds.json'), 'r') as fp: + self.target_id = "TARGET_0000000001" + with open(os_path.join(DATA_PATH, "compounds.json"), "r") as fp: species = jsload(fp) for spe_id in species: self.species[spe_id] = Compound(**species[spe_id]) - self.reactants = { - "CMPD_0000000003": 1, - "MNXM4": 1 - } - self.products = { - self.target_id: 1, - "MNXM1": 2 - } + self.reactants = {"CMPD_0000000003": 1, "MNXM4": 1} + self.products = {self.target_id: 1, "MNXM1": 2} self.rxn = Reaction( id="rxn_4", - ec_numbers=[ - "1.13.11.1" - ], + ec_numbers=["1.13.11.1"], reactants=self.reactants, - products=self.products + products=self.products, ) self.reactions = { self.rxn.get_id(): self.rxn, "rxn_3": Reaction( id="rxn_3", - ec_numbers=[ - "4.1.1.63" - ], - reactants={ - "CMPD_0000000010": 1, - "MNXM1": 1 - }, - products={ - "CMPD_0000000003": 1, - "MNXM13": 1 - } + ec_numbers=["4.1.1.63"], + reactants={"CMPD_0000000010": 1, "MNXM1": 1}, + products={"CMPD_0000000003": 1, "MNXM13": 1}, ), "rxn_2": Reaction( id="rxn_2", - ec_numbers=[ - "1.14.13.23" - ], - reactants={ - "CMPD_0000000025": 1, - "MNXM4": 1, - "MNXM6": 1, - "MNXM1": 1 - }, - products={ - "CMPD_0000000010": 1, - "MNXM2": 1, - "MNXM5": 1 - } + ec_numbers=["1.14.13.23"], + reactants={"CMPD_0000000025": 1, "MNXM4": 1, "MNXM6": 1, "MNXM1": 1}, + products={"CMPD_0000000010": 1, "MNXM2": 1, "MNXM5": 1}, ), "rxn_1": Reaction( id="rxn_1", - ec_numbers=[ - "4.1.3.45" - ], - reactants={ - "MNXM337": 1 - }, - products={ - "CMPD_0000000025": 1, - "MNXM23": 1 - } - ) + ec_numbers=["4.1.3.45"], + reactants={"MNXM337": 1}, + products={"CMPD_0000000025": 1, "MNXM23": 1}, + ), } - self.id = 'pathway' - self.pathway = Pathway( - id=self.id - ) + self.id = "pathway" + self.pathway = Pathway(id=self.id) for rxn in self.reactions.values(): self.pathway.add_reaction(rxn) self.pathway.set_target_id(self.target_id) @@ -101,7 +66,7 @@ def setUp(self): ## READ METHODS def test_rename_compound(self): old_id = self.rxn.get_reactants_ids()[0] - new_id = 'NEW_CMPD_ID' + new_id = "NEW_CMPD_ID" self.pathway.rename_compound(old_id, new_id) self.assertTrue( new_id in self.pathway.get_reaction(self.rxn.get_id()).get_species_ids() @@ -113,177 +78,168 @@ def test_rename_compound(self): def test_replace_reaction(self): _rxn = deepcopy(self.rxn) rxn = Reaction(_rxn.get_id()) - self.assertEqual( - self.pathway.get_reaction(self.rxn.get_id()), - _rxn - ) - self.assertTrue( - self.pathway.replace_reaction( - self.rxn.get_id(), - rxn - ) - ) - self.assertNotEqual( - self.pathway.get_reaction(self.rxn.get_id()), - _rxn - ) + self.assertEqual(self.pathway.get_reaction(self.rxn.get_id()), _rxn) + self.assertTrue(self.pathway.replace_reaction(self.rxn.get_id(), rxn)) + self.assertNotEqual(self.pathway.get_reaction(self.rxn.get_id()), _rxn) def test_replace_reaction_wrong_rxnid(self): self.assertFalse( - self.pathway.replace_reaction( - 'wrong_rxn_id', - Reaction(id='test') - ) + self.pathway.replace_reaction("wrong_rxn_id", Reaction(id="test")) ) def test_get_id(self): - self.assertEqual( - self.pathway.get_id(), - self.id - ) + self.assertEqual(self.pathway.get_id(), self.id) def test_get_nb_reactions(self): - self.assertEqual( - self.pathway.get_nb_reactions(), - len(self.reactions) - ) + self.assertEqual(self.pathway.get_nb_reactions(), len(self.reactions)) def test_get_nb_species(self): # build the list of all species from all reactions - species = [rxn.get_products_compounds()+rxn.get_reactants_compounds() for rxn in self.pathway.get_list_of_reactions()] + species = [ + rxn.get_products_compounds() + rxn.get_reactants_compounds() + for rxn in self.pathway.get_list_of_reactions() + ] # build a set from flatten species list of lists species = set([y.get_id() for x in species for y in x]) - self.assertEqual( - self.pathway.get_nb_species(), - len(species) - ) + self.assertEqual(self.pathway.get_nb_species(), len(species)) def test_get_species(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] - list_of_species = list(set([spe for species in list_of_list_of_species for spe in species])) + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] + list_of_species = list( + set([spe for species in list_of_list_of_species for spe in species]) + ) self.assertListEqual( self.pathway.get_species(), - [self.pathway.get_specie(spe_id) for spe_id in list_of_species] + [self.pathway.get_specie(spe_id) for spe_id in list_of_species], ) def test_get_species_ids(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] self.assertListEqual( self.pathway.get_species_ids(), - list(set([spe for species in list_of_list_of_species for spe in species])) + list(set([spe for species in list_of_list_of_species for spe in species])), ) def test_get_species_from_id(self): - self.assertEqual( - self.pathway.get_specie('MNXM23'), - self.species['MNXM23'] - ) + self.assertEqual(self.pathway.get_specie("MNXM23"), self.species["MNXM23"]) def test_get_species_from_id_wrong_key(self): - self.assertEqual( - self.pathway.get_specie('WRONG_KEY'), - None - ) + self.assertEqual(self.pathway.get_specie("WRONG_KEY"), None) def test_get_compounds_ids(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] self.assertListEqual( self.pathway.get_compounds_ids(), - list(set([spe for species in list_of_list_of_species for spe in species])) + list(set([spe for species in list_of_list_of_species for spe in species])), ) def test_get_compounds(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] - list_of_species = list(set([spe for species in list_of_list_of_species for spe in species])) + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] + list_of_species = list( + set([spe for species in list_of_list_of_species for spe in species]) + ) self.assertListEqual( self.pathway.get_compounds(), - [self.pathway.get_specie(spe_id) for spe_id in list_of_species] + [self.pathway.get_specie(spe_id) for spe_id in list_of_species], ) def test_get_compound(self): - self.assertEqual( - self.pathway.get_compound('MNXM23'), - self.species['MNXM23'] - ) + self.assertEqual(self.pathway.get_compound("MNXM23"), self.species["MNXM23"]) def test_get_reactions(self): - self.assertDictEqual( - self.pathway.get_reactions(), - self.reactions - ) + self.assertDictEqual(self.pathway.get_reactions(), self.reactions) def test_get_list_of_reactions(self): self.assertListEqual( - self.pathway.get_list_of_reactions(), - list(self.reactions.values()) + self.pathway.get_list_of_reactions(), list(self.reactions.values()) ) def test_get_reaction(self): - self.assertEqual( - self.pathway.get_reaction('rxn_4'), - self.rxn - ) + self.assertEqual(self.pathway.get_reaction("rxn_4"), self.rxn) def test_get_reaction_wrong_id(self): - self.assertEqual( - self.pathway.get_reaction('WRONG_ID'), - None - ) + self.assertEqual(self.pathway.get_reaction("WRONG_ID"), None) def test_reaction_ids(self): self.assertEqual( self.pathway.get_reactions_ids(), - [rxn.get_id() for rxn in self.reactions.values()] + [rxn.get_id() for rxn in self.reactions.values()], ) def test_add_reaction(self): - rxn = Reaction(id='rxn') + rxn = Reaction(id="rxn") self.pathway.add_reaction(rxn) self.assertListEqual( list(self.pathway.get_reactions().values()), - list(self.reactions.values()) + [rxn] + list(self.reactions.values()) + [rxn], ) self.assertListEqual( self.pathway.get_reactions_ids(), - [rxn.get_id() for rxn in self.reactions.values()] + [rxn.get_id()] + [rxn.get_id() for rxn in self.reactions.values()] + [rxn.get_id()], ) def test_add_reaction_with_id(self): - rxn = Reaction(id='rxn') - other_id = 'other_' + rxn.get_id() + rxn = Reaction(id="rxn") + other_id = "other_" + rxn.get_id() self.pathway.add_reaction(rxn, other_id) self.assertListEqual( list(self.pathway.get_reactions().values()), - list(self.reactions.values()) + [rxn] + list(self.reactions.values()) + [rxn], ) self.assertListEqual( self.pathway.get_reactions_ids(), - [rxn.get_id() for rxn in self.reactions.values()] + [other_id] + [rxn.get_id() for rxn in self.reactions.values()] + [other_id], ) def test__to_dict(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] - list_of_species = list(set([spe for species in list_of_list_of_species for spe in species])) + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] + list_of_species = list( + set([spe for species in list_of_list_of_species for spe in species]) + ) self.assertDictEqual( self.pathway._to_dict(full=False), { - 'reactions': {rxn.get_id(): rxn._to_dict() for rxn in self.reactions.values()}, - 'species': {spe.get_id(): spe._to_dict() for spe in [self.species[spe_id] for spe_id in list_of_species]}, - 'target_id': self.target_id - } + "reactions": { + rxn.get_id(): rxn._to_dict() for rxn in self.reactions.values() + }, + "species": { + spe.get_id(): spe._to_dict() + for spe in [self.species[spe_id] for spe_id in list_of_species] + }, + "target_id": self.target_id, + }, ) def test__to_dict_full(self): - list_of_list_of_species = [rxn.get_species_ids() for rxn in self.reactions.values()] - list_of_species = list(set([spe for species in list_of_list_of_species for spe in species])) + list_of_list_of_species = [ + rxn.get_species_ids() for rxn in self.reactions.values() + ] + list_of_species = list( + set([spe for species in list_of_list_of_species for spe in species]) + ) self.assertDictEqual( self.pathway._to_dict(full=True), { - 'reactions': {rxn.get_id(): rxn._to_dict() for rxn in self.reactions.values()}, - 'species': {spe.get_id(): spe._to_dict() for spe in [self.species[spe_id] for spe_id in list_of_species]}, - 'id': self.id, - 'target_id': self.target_id - } + "reactions": { + rxn.get_id(): rxn._to_dict() for rxn in self.reactions.values() + }, + "species": { + spe.get_id(): spe._to_dict() + for spe in [self.species[spe_id] for spe_id in list_of_species] + }, + "id": self.id, + "target_id": self.target_id, + }, ) def test_to_string(self): @@ -291,117 +247,90 @@ def test_to_string(self): # print(rxn) self.assertEqual( self.pathway.to_string(), - '----------------\n' + - f'Pathway {self.pathway.get_id()}\n' + - '----------------\n' + - '\n'.join([rxn.to_string() for rxn in self.reactions.values()]) + "----------------\n" + + f"Pathway {self.pathway.get_id()}\n" + + "----------------\n" + + "\n".join([rxn.to_string() for rxn in self.reactions.values()]), ) def test_eq(self): reactions = [] for rxn in self.reactions.values(): reactions.append(deepcopy(rxn)) - pathway = Pathway(id='pathway_test') + pathway = Pathway(id="pathway_test") for i in range(len(reactions)): - index = len(reactions)-i-1 + index = len(reactions) - i - 1 # change id reactions[index].set_id(i) # add reaction in the reverse order pathway.add_reaction(rxn=reactions[index]) pathway.set_target_id(self.target_id) - self.assertEqual( - self.pathway, - pathway - ) + self.assertEqual(self.pathway, pathway) def test_not_equal_reactions(self): pathway = deepcopy(Pathway(id=self.id)) - pathway.add_reaction(Reaction(id='test_1')) + pathway.add_reaction(Reaction(id="test_1")) pathway.set_target_id(self.target_id) - self.assertNotEqual( - self.pathway, - pathway - ) + self.assertNotEqual(self.pathway, pathway) def test_del_reaction(self): - self.assertTrue( - self.pathway.del_reaction( - self.rxn.get_id() - ) - ) + self.assertTrue(self.pathway.del_reaction(self.rxn.get_id())) self.assertListEqual( self.pathway.get_reactions_ids(), - [ - rxn.get_id() - for rxn - in list(self.reactions.values())[1:]] + [rxn.get_id() for rxn in list(self.reactions.values())[1:]], ) def test_del_reaction_wrong_id(self): - self.assertFalse( - self.pathway.del_reaction('WRONG') - ) + self.assertFalse(self.pathway.del_reaction("WRONG")) self.assertListEqual( self.pathway.get_reactions_ids(), - [rxn.get_id() for rxn in self.reactions.values()] + [rxn.get_id() for rxn in self.reactions.values()], ) def test_eq_not_equal(self): - self.assertNotEqual( - self.pathway, - Pathway(id=self.id) - ) + self.assertNotEqual(self.pathway, Pathway(id=self.id)) def test_eq_wrong_type(self): - self.assertNotEqual( - self.pathway, - 0 - ) + self.assertNotEqual(self.pathway, 0) def test_net_reaction(self): self.assertEqual( self.pathway.net_reaction(), { - 'MNXM4': -2, + "MNXM4": -2, self.target_id: 1, - 'MNXM13': 1, - 'MNXM6': -1, - 'MNXM2': 1, - 'MNXM5': 1, - 'MNXM337': -1, - 'MNXM23': 1 - } + "MNXM13": 1, + "MNXM6": -1, + "MNXM2": 1, + "MNXM5": 1, + "MNXM337": -1, + "MNXM23": 1, + }, ) def test_pseudo_reaction(self): self.assertEqual( self.pathway.pseudo_reaction(), { - 'MNXM4': -2, + "MNXM4": -2, self.target_id: 1, - 'MNXM13': 1, - 'MNXM6': -1, - 'MNXM2': 1, - 'MNXM5': 1, - 'MNXM337': -1, - 'MNXM23': 1 - } + "MNXM13": 1, + "MNXM6": -1, + "MNXM2": 1, + "MNXM5": 1, + "MNXM337": -1, + "MNXM23": 1, + }, ) def test_get_reactants(self): species = [] for rxn in self.reactions.values(): species += rxn.get_reactants_ids() - self.assertListEqual( - self.pathway.get_reactants_ids(), - sorted(set(species)) - ) + self.assertListEqual(self.pathway.get_reactants_ids(), sorted(set(species))) def test_get_products(self): species = [] for rxn in self.reactions.values(): species += rxn.get_products_ids() - self.assertListEqual( - self.pathway.get_products_ids(), - sorted(set(species)) - ) + self.assertListEqual(self.pathway.get_products_ids(), sorted(set(species))) diff --git a/tests/test_Reaction.py b/tests/test_Reaction.py index be68913..21b2725 100644 --- a/tests/test_Reaction.py +++ b/tests/test_Reaction.py @@ -10,120 +10,88 @@ from json import load as jsload from brs_utils import Cache -from chemlite import ( - Reaction, - Compound -) +from chemlite import Reaction, Compound HERE = os_path.dirname(os_path.realpath(__file__)) -DATA_PATH = os_path.join(HERE, 'data') +DATA_PATH = os_path.join(HERE, "data") class Test_Reaction(TestCase): def setUp(self): self.species = {} - with open(os_path.join(DATA_PATH, 'compounds.json'), 'r') as fp: + with open(os_path.join(DATA_PATH, "compounds.json"), "r") as fp: species = jsload(fp) for spe_id in species: self.species[spe_id] = Compound(**species[spe_id]) - self.reactants = { - "CMPD_0000000010": 1, - "MNXM1": 1 - } - self.products = { - "CMPD_0000000003": 1, - "MNXM13": 1 - } - with open(os_path.join(DATA_PATH, 'reactions.json'), 'r') as fp: + self.reactants = {"CMPD_0000000010": 1, "MNXM1": 1} + self.products = {"CMPD_0000000003": 1, "MNXM13": 1} + with open(os_path.join(DATA_PATH, "reactions.json"), "r") as fp: self.reactions = jsload(fp) - self.ec_numbers = [ - "4.1.1.63" - ] + self.ec_numbers = ["4.1.1.63"] self.id = "rxn" self.rxn = Reaction( id=self.id, ec_numbers=self.ec_numbers, reactants=self.reactants, - products=self.products + products=self.products, ) def test___init__ec_number(self): - ec_number = '1.1.2' - rxn = Reaction( - id='rxn_test', - ec_numbers=ec_number - ) - self.assertListEqual( - rxn.get_ec_numbers(), - [ec_number] - ) + ec_number = "1.1.2" + rxn = Reaction(id="rxn_test", ec_numbers=ec_number) + self.assertListEqual(rxn.get_ec_numbers(), [ec_number]) def test_to_string(self): self.assertEqual( self.rxn.to_string(), - f'Reaction {self.rxn.get_id()}: {self.reactions["int"]["string"]}' + f'Reaction {self.rxn.get_id()}: {self.reactions["int"]["string"]}', ) def test_to_string_0(self): self.rxn.set_products({}) self.rxn.set_reactants({}) - self.assertEqual( - self.rxn.to_string(), - f'Reaction {self.rxn.get_id()}: = ' - ) + self.assertEqual(self.rxn.to_string(), f"Reaction {self.rxn.get_id()}: = ") def test__to_dict(self): self.assertEqual( self.rxn._to_dict(full=False), { - 'reactants': self.reactants, - 'products': self.products, - } + "reactants": self.reactants, + "products": self.products, + }, ) def test__to_dict_full(self): self.assertEqual( self.rxn._to_dict(full=True), { - 'ec_numbers': self.ec_numbers, - 'reactants': self.reactants, - 'products': self.products, - 'id': self.id - } + "ec_numbers": self.ec_numbers, + "reactants": self.reactants, + "products": self.products, + "id": self.id, + }, ) def test_eq1(self): rxn = deepcopy(self.rxn) - self.assertEqual( - rxn, - self.rxn - ) + self.assertEqual(rxn, self.rxn) def test_eq2(self): rxn = Reaction( - id='rxn_test_eq2', + id="rxn_test_eq2", reactants=self.rxn.get_reactants(), - products=self.rxn.get_products() - ) - self.assertEqual( - rxn, - self.rxn + products=self.rxn.get_products(), ) + self.assertEqual(rxn, self.rxn) def test_not_eq(self): rxn = deepcopy(self.rxn) - rxn.add_reactant(compound_id='c', stoichio=1) - self.assertNotEqual( - rxn, - self.rxn - ) + rxn.add_reactant(compound_id="c", stoichio=1) + self.assertNotEqual(rxn, self.rxn) def test_eq_wrong_type(self): - self.assertNotEqual( - self.rxn, - 0 - ) + self.assertNotEqual(self.rxn, 0) # def test_get_reactants_None(self): # self.rxn.set_reactants(None) @@ -133,271 +101,180 @@ def test_eq_wrong_type(self): # ) def test_get_reactants_ids(self): - self.assertListEqual( - self.rxn.get_reactants_ids(), - list(self.reactants.keys()) - ) + self.assertListEqual(self.rxn.get_reactants_ids(), list(self.reactants.keys())) def test_get_products_ids(self): - self.assertListEqual( - self.rxn.get_products_ids(), - list(self.products.keys()) - ) + self.assertListEqual(self.rxn.get_products_ids(), list(self.products.keys())) def test_get_reactants_compounds(self): self.assertListEqual( self.rxn.get_reactants_compounds(), - [self.species[spe_id] for spe_id in self.reactants.keys()] + [self.species[spe_id] for spe_id in self.reactants.keys()], ) def test_get_smiles(self): - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_cmpd_wo_smiles_L(self): - self.rxn.add_reactant( - compound_id='CMPD_0000000003_wo_smiles', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.rxn.add_reactant(compound_id="CMPD_0000000003_wo_smiles", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_cmpd_wo_smiles_R(self): - self.rxn.add_product( - compound_id='CMPD_0000000003_wo_smiles', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.rxn.add_product(compound_id="CMPD_0000000003_wo_smiles", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_w_cmpd_not_in_cache(self): - self.rxn.add_reactant( - compound_id='CMPD_NOT_IN_CACHE', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.rxn.add_reactant(compound_id="CMPD_NOT_IN_CACHE", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_w_smile_None_L(self): - self.rxn.add_reactant( - compound_id='CMPD_0000000003_w_smiles_None', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.rxn.add_reactant(compound_id="CMPD_0000000003_w_smiles_None", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_w_smile_None_R(self): - self.rxn.add_product( - compound_id='CMPD_0000000003_w_smiles_None', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) + self.rxn.add_product(compound_id="CMPD_0000000003_w_smiles_None", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) def test_get_smiles_w_all_cmpds_wo_smiles(self): - self.rxn.add_reactant( - compound_id='CMPD_0000000003_wo_smiles', - stoichio=1 - ) - self.rxn.add_product( - compound_id='CMPD_0000000004_wo_smiles', - stoichio=1 - ) - self.assertEqual( - self.rxn.get_smiles(), - self.reactions['smiles']['string'] - ) - + self.rxn.add_reactant(compound_id="CMPD_0000000003_wo_smiles", stoichio=1) + self.rxn.add_product(compound_id="CMPD_0000000004_wo_smiles", stoichio=1) + self.assertEqual(self.rxn.get_smiles(), self.reactions["smiles"]["string"]) + def test_get_smiles_w_floating_coeff(self): - rxn = Reaction.from_string( - id='test', - rxn=self.reactions['float']['string'] - ) + rxn = Reaction.from_string(id="test", rxn=self.reactions["float"]["string"]) self.assertEqual( rxn.get_smiles(), - '[H]Oc1c([H])c([H])c([H])c([H])c1O[H].O=C=O.[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H]>>[H]OC(=O)c1c([H])c([H])c(O[H])c(O[H])c1[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H]' + "[H]Oc1c([H])c([H])c([H])c([H])c1O[H].O=C=O.[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H]>>[H]OC(=O)c1c([H])c([H])c(O[H])c(O[H])c1[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H].[H]N=C(O[H])C1=C([H])N(C2([H])OC([H])(C([H])([H])OP(=O)(O[H])OP(=O)(O[H])OC([H])([H])C3([H])OC([H])(n4c([H])nc5c(N([H])[H])nc([H])nc54)C([H])(OP(=O)(O[H])O[H])C3([H])O[H])C([H])(O[H])C2([H])O[H])C([H])=C([H])C1([H])[H]", ) def test_from_string(self): - rxn = Reaction.from_string( - id='test', - rxn=self.reactions['float']['string'] - ) - self.assertEqual( - sum(rxn.get_specie('MNXM6').values()), - 4 - ) + rxn = Reaction.from_string(id="test", rxn=self.reactions["float"]["string"]) + self.assertEqual(sum(rxn.get_specie("MNXM6").values()), 4) def test_from_string_smiles(self): rxn = Reaction.from_string( - id='test', - rxn='[H][O][C](=[O])[C](=[O])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([H])[O][H]>>[H]OC(=O)C(=O)C([H])(O[H])C([H])(O[H])C([H])([H])C([H])=O.[H]O[H].[H]O[H]' + id="test", + rxn="[H][O][C](=[O])[C](=[O])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([O][H])[C]([H])([H])[O][H]>>[H]OC(=O)C(=O)C([H])(O[H])C([H])(O[H])C([H])([H])C([H])=O.[H]O[H].[H]O[H]", ) - self.assertEqual( - sum(rxn.get_specie('[H]O[H]').values()), - 2 - ) - + self.assertEqual(sum(rxn.get_specie("[H]O[H]").values()), 2) + def test_parse(self): self.assertEqual( - Reaction.parse(self.reactions['float']['string']), - self.reactions['float']['dict'] + Reaction.parse(self.reactions["float"]["string"]), + self.reactions["float"]["dict"], ) def test_get_products_compounds(self): self.assertListEqual( self.rxn.get_products_compounds(), - [self.species[spe_id] for spe_id in self.products.keys()] + [self.species[spe_id] for spe_id in self.products.keys()], ) def test_get_species_compounds(self): self.assertListEqual( sorted([spe.get_id() for spe in self.rxn.get_species_compounds()]), - sorted(list(set(list(self.reactants.keys()) + list(self.products.keys())))) + sorted(list(set(list(self.reactants.keys()) + list(self.products.keys())))), ) def test_get_left(self): - self.assertDictEqual( - self.rxn.get_left(), - self.reactants - ) + self.assertDictEqual(self.rxn.get_left(), self.reactants) def test_get_right(self): - self.assertDictEqual( - self.rxn.get_right(), - self.products - ) + self.assertDictEqual(self.rxn.get_right(), self.products) def test_get_nb_species(self): self.assertEqual( - self.rxn.get_nb_species(), - len(self.reactants) + len(self.products) + self.rxn.get_nb_species(), len(self.reactants) + len(self.products) ) def test_add_ec_number(self): - ec_number = '1.2' + ec_number = "1.2" self.rxn.add_ec_number(ec_number) - self.assertListEqual( - self.rxn.get_ec_numbers(), - self.ec_numbers + [ec_number] - ) + self.assertListEqual(self.rxn.get_ec_numbers(), self.ec_numbers + [ec_number]) def test_add_reactant(self): for spe_sto in [3, -3]: with self.subTest(spe_sto=spe_sto): rxn = deepcopy(self.rxn) rxn.add_reactant( - compound_id=self.species['MNXM337'].get_id(), - stoichio=spe_sto + compound_id=self.species["MNXM337"].get_id(), stoichio=spe_sto ) self.assertDictEqual( rxn.get_reactants(), { **self.rxn.get_reactants(), - **{self.species['MNXM337'].get_id(): abs(spe_sto)} - } + **{self.species["MNXM337"].get_id(): abs(spe_sto)}, + }, ) def test_set_reactant(self): self.rxn.set_reactants(None) - self.rxn.add_reactant('cmpd', 1) + self.rxn.add_reactant("cmpd", 1) def test_set_product(self): self.rxn.set_products(None) - self.rxn.add_product('cmpd', 1) + self.rxn.add_product("cmpd", 1) def test_set_product_already_exist(self): - self.rxn.add_product('MNXM13', 1) + self.rxn.add_product("MNXM13", 1) self.assertEqual( - Cache.get('MNXM13').get_smiles(), - self.species['MNXM13'].get_smiles() + Cache.get("MNXM13").get_smiles(), self.species["MNXM13"].get_smiles() ) def test_add_reactant_wo_id(self): cmpd_sto = 4 rxn = deepcopy(self.rxn) - rxn.add_reactant(stoichio=cmpd_sto, compound_id='') - self.assertDictEqual( - rxn.get_reactants(), - self.rxn.get_reactants() - ) + rxn.add_reactant(stoichio=cmpd_sto, compound_id="") + self.assertDictEqual(rxn.get_reactants(), self.rxn.get_reactants()) def test_add_reactant_with_id_none(self): cmpd_sto = 4 rxn = deepcopy(self.rxn) rxn.add_reactant(stoichio=cmpd_sto, compound_id=None) - self.assertListEqual( - rxn.get_reactants_ids(), - self.rxn.get_reactants_ids() - ) + self.assertListEqual(rxn.get_reactants_ids(), self.rxn.get_reactants_ids()) def test_add_product_with_id_none(self): cmpd_sto = 4 rxn = deepcopy(self.rxn) rxn.add_product(stoichio=cmpd_sto, compound_id=None) - self.assertListEqual( - rxn.get_products_ids(), - self.rxn.get_products_ids() - ) + self.assertListEqual(rxn.get_products_ids(), self.rxn.get_products_ids()) def test_add_reactant_withall_none(self): cmpd_sto = 4 rxn = deepcopy(self.rxn) rxn.add_reactant(stoichio=cmpd_sto, compound_id=None) - self.assertDictEqual( - rxn.get_reactants(), - self.rxn.get_reactants() - ) + self.assertDictEqual(rxn.get_reactants(), self.rxn.get_reactants()) def test_add_product(self): for spe_sto in [3, -3]: with self.subTest(spe_sto=spe_sto): rxn = deepcopy(self.rxn) rxn.add_product( - compound_id=self.species['MNXM337'].get_id(), - stoichio=spe_sto + compound_id=self.species["MNXM337"].get_id(), stoichio=spe_sto ) self.assertDictEqual( rxn.get_products(), { **self.rxn.get_products(), - **{self.species['MNXM337'].get_id(): abs(spe_sto)} - } + **{self.species["MNXM337"].get_id(): abs(spe_sto)}, + }, ) def test_rename_compound_reactant(self): - old_id = self.species['MNXM1'].get_id() - new_id = 'new_cmpd_id' + old_id = self.species["MNXM1"].get_id() + new_id = "new_cmpd_id" self.rxn.rename_compound(old_id, new_id) reactants_ids = list(self.reactants.keys()) reactants_ids[reactants_ids.index(old_id)] = new_id - self.assertEqual( - self.rxn.get_reactants_ids(), - reactants_ids - ) + self.assertEqual(self.rxn.get_reactants_ids(), reactants_ids) def test_rename_compound_product(self): - old_id = self.species['MNXM13'].get_id() - new_id = 'new_cmpd_id' + old_id = self.species["MNXM13"].get_id() + new_id = "new_cmpd_id" self.rxn.rename_compound(old_id, new_id) products_ids = list(self.products.keys()) products_ids[products_ids.index(old_id)] = new_id - self.assertEqual( - self.rxn.get_products_ids(), - products_ids - ) + self.assertEqual(self.rxn.get_products_ids(), products_ids) def test_mult_stoichio_coeff(self): mult = 2 @@ -405,70 +282,56 @@ def test_mult_stoichio_coeff(self): self.assertDictEqual( self.rxn.get_species(), { - **{spe_id: -mult * self.reactants[spe_id] for spe_id in self.reactants.keys()}, - **{spe_id: mult * self.products[spe_id] for spe_id in self.products.keys()} - } + **{ + spe_id: -mult * self.reactants[spe_id] + for spe_id in self.reactants.keys() + }, + **{ + spe_id: mult * self.products[spe_id] + for spe_id in self.products.keys() + }, + }, ) def test_sum_stoichio(self): - reactants_1 = { - 'MNXM4': 1, - 'MNXM337': 1, - 'MNXM3': 2 - } + reactants_1 = {"MNXM4": 1, "MNXM337": 1, "MNXM3": 2} reactants_2 = { - 'MNXM4': 1, - 'MNXM337': 1, + "MNXM4": 1, + "MNXM337": 1, } reactants_3 = { - 'MNXM4': 2, - 'MNXM6': 1, - 'MNXM5': 1, - } - products_1 = { - 'MNXM2': 1, - 'MNXM5': 1, - 'MNXM23': 1 - } - products_2 = { - 'MNXM13': 1, - 'MNXM6': 3, - 'MNXM5': 1, - 'MNXM3': 1 - } - products_3 = { - 'TARGET_0000000001': 1, - 'MNXM2': 1, - 'MNXM5': 1, - 'MNXM3': 1 + "MNXM4": 2, + "MNXM6": 1, + "MNXM5": 1, } + products_1 = {"MNXM2": 1, "MNXM5": 1, "MNXM23": 1} + products_2 = {"MNXM13": 1, "MNXM6": 3, "MNXM5": 1, "MNXM3": 1} + products_3 = {"TARGET_0000000001": 1, "MNXM2": 1, "MNXM5": 1, "MNXM3": 1} rxn_1 = Reaction( - id='rxn_1', + id="rxn_1", reactants=reactants_1, products=products_1, ) rxn_2 = Reaction( - id='rxn_2', + id="rxn_2", reactants=reactants_2, products=products_2, ) rxn_3 = Reaction( - id='rxn_3', + id="rxn_3", reactants=reactants_3, products=products_3, ) self.assertDictEqual( - Reaction.sum_stoichio( - [rxn_1, rxn_2, rxn_3] - ), + Reaction.sum_stoichio([rxn_1, rxn_2, rxn_3]), { - 'MNXM4': -4, - 'MNXM337': -2, - 'MNXM6': 2, - 'MNXM2': 2, - 'MNXM5': 2, - 'TARGET_0000000001': 1, - 'MNXM13': 1, - 'MNXM23': 1 - } + "MNXM4": -4, + "MNXM337": -2, + "MNXM6": 2, + "MNXM2": 2, + "MNXM5": 2, + "TARGET_0000000001": 1, + "MNXM13": 1, + "MNXM23": 1, + }, )