From 84e24e53efd6be37583173451c86bbc62ce0c90d Mon Sep 17 00:00:00 2001 From: marcorusc Date: Fri, 28 Jun 2024 15:07:15 +0200 Subject: [PATCH 1/5] updated file to generate documentation --- .github/workflows/sphinx_autodoc.yaml | 86 ++++++++++----------------- .readthedocs.yaml | 3 + docs/src/api.rst | 29 +++++++-- docs/src/contents.rst | 25 ++++++-- docs/src/index.rst | 49 +++++++++++---- docs/src/requirements.txt | 3 +- 6 files changed, 119 insertions(+), 76 deletions(-) diff --git a/.github/workflows/sphinx_autodoc.yaml b/.github/workflows/sphinx_autodoc.yaml index ee14dc4..5d144ce 100644 --- a/.github/workflows/sphinx_autodoc.yaml +++ b/.github/workflows/sphinx_autodoc.yaml @@ -1,57 +1,35 @@ -name: Sphinx build docs on push +name: Build and Deploy Documentation on: -- push + push: + branches: + - main # or your default branch name jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out main - uses: actions/checkout@main - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.10.13 - - name: Install pandoc - run: sudo apt-get install -y pandoc - - name: Load cached Poetry installation - uses: actions/cache@v2 - with: - path: ~/.local - key: poetry-0 - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: Poetry disable modern-installation - run: poetry config installer.modern-installation false - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v2 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root - - name: Install library - run: poetry install --no-interaction - - name: Build documentation - run: poetry run make html --directory docs/ - - name: Commit files - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - touch docs/_build/html/.nojekyll - git add -f docs/_build/ - git commit -m "Update autodoc" -a - # using https://github.com/marketplace/actions/push-git-subdirectory-as-branch - - name: Deploy - uses: s0/git-publish-subdir-action@develop - env: - REPO: self - BRANCH: gh-pages - FOLDER: docs/_build/html - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.10.13 + - name: Install pandoc + run: sudo apt-get install -y pandoc + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + - name: Install dependencies + run: | + poetry config virtualenvs.create false + poetry install --no-interaction + - name: Build documentation + run: | + cd docs + poetry run make html + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/_build/html diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d92c23a..c1c5282 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,3 +10,6 @@ python: - method: pip path: . - requirements: docs/src/requirements.txt +formats: + - pdf + - epub diff --git a/docs/src/api.rst b/docs/src/api.rst index 866a683..c986027 100644 --- a/docs/src/api.rst +++ b/docs/src/api.rst @@ -1,12 +1,26 @@ -API -=== +API Reference +============= -Import Neko as:: +This page contains the API reference for the Neko package. + +Network Class +------------- + +The main class in Neko is the ``Network`` class. You can import it as follows: + +.. code-block:: python from neko.core.network import Network -Network -------- +Below is a summary of the methods available in the ``Network`` class: + +.. autoclass:: neko.core.network.Network + :members: + :undoc-members: + :show-inheritance: + +Method Details +-------------- .. autosummary:: :toctree: _autosummary @@ -26,3 +40,8 @@ Network neko.core.network.Network.convert_edgelist_into_genesymbol neko.core.network.Network.filter_unsigned_paths neko.core.network.Network.is_connected + +Other Modules +------------- + +.. Add other modules and classes here as your project grows diff --git a/docs/src/contents.rst b/docs/src/contents.rst index 7d4df85..3f20531 100644 --- a/docs/src/contents.rst +++ b/docs/src/contents.rst @@ -1,17 +1,23 @@ +======== Contents ======== .. toctree:: - :maxdepth: 3 - - index - api + :maxdepth: 2 + :caption: User Guide -Notebooks -========= + installation + quickstart + tutorials .. toctree:: :maxdepth: 2 + :caption: API Reference + + api + +.. toctree:: + :maxdepth: 1 :caption: Notebooks notebooks/1_network_building @@ -20,3 +26,10 @@ Notebooks notebooks/4_Connect_upstream notebooks/5_ontology notebooks/6_tissue_mapping + +.. toctree:: + :maxdepth: 1 + :caption: Development + + contributing + changelog diff --git a/docs/src/index.rst b/docs/src/index.rst index b69751e..8f373b5 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -1,7 +1,8 @@ ================== - Neko +Neko ================== +.. image:: https://github.com/sysbio-curie/Neko/actions/workflows/test.yml/badge.svg :target: https://github.com/sysbio-curie/Neko/actions/workflows/test.yml :alt: Tests @@ -9,14 +10,18 @@ :target: https://neko.readthedocs.io :alt: Documentation -Package to extract, visualize, convert and study interactions from database into executable activity flow based model. -Neko, is based on `Omnipath `_, `Pypath `_ and `Atopo `_. +About Neko +---------- + +Neko is a package to extract, visualize, convert and study interactions from databases into executable activity flow based models. +It is based on `Omnipath `_, `Pypath `_ and `Atopo `_. This is a work-in-progress package made in collaboration with Dénes Turei and Asmund Flobak. Current contributors: Marco Ruscone, Eirini Tsirvouli, Andrea Checcoli, Dénes Turei. -Installation: +Installation +------------ All the dependencies are listed in the pyproject.toml file. To install the package, you can use the following command: @@ -24,11 +29,35 @@ All the dependencies are listed in the pyproject.toml file. To install the packa pip install . -CURRENT FEATURES: +Current Features +---------------- version 0.9.0 --------------- - -- Network creation and manipulation: The package allows for the creation of a network of nodes and edges, with various methods for enrichment analysis. This includes adding and removing nodes and edges, loading a network from a SIF (Simple Interaction Format) file, and adding paths to the edge list of the network. -- Connection of nodes: The package provides several methods to connect nodes in the network. This includes connecting all nodes, connecting a subgroup of nodes, connecting all nodes of a network object, and connecting subcomponents of a network object. -- Connection of genes to phenotype: The package provides a method to connect genes to a phenotype based on provided parameters. This includes retrieving phenotype markers, identifying unique Uniprot genes, and connecting them to the network. There is also an option to compress the network by substituting specified genes with the phenotype name. +^^^^^^^^^^^^^ + +- **Network creation and manipulation**: + - Create networks of nodes and edges + - Add and remove nodes and edges + - Load networks from SIF (Simple Interaction Format) files + - Add paths to the edge list of the network + - Various methods for enrichment analysis + +- **Connection of nodes**: + - Connect all nodes + - Connect a subgroup of nodes + - Connect all nodes of a network object + - Connect subcomponents of a network object + +- **Connection of genes to phenotype**: + - Connect genes to a phenotype based on provided parameters + - Retrieve phenotype markers + - Identify unique Uniprot genes and connect them to the network + - Option to compress the network by substituting specified genes with the phenotype name + +.. toctree:: + :maxdepth: 2 + :hidden: + :caption: Contents: + + contents + api diff --git a/docs/src/requirements.txt b/docs/src/requirements.txt index 454d20a..7fb394b 100644 --- a/docs/src/requirements.txt +++ b/docs/src/requirements.txt @@ -1,7 +1,8 @@ numpydoc +sphinx nbsphinx ipython -scikit-learn skranger sphinx_rtd_theme pandoc +ipykernel From b560d70b0d942c001c7b39e64f085e7d2ae96e7e Mon Sep 17 00:00:00 2001 From: marcorusc Date: Fri, 28 Jun 2024 15:10:15 +0200 Subject: [PATCH 2/5] updated README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 22e8020..2902e2e 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ All the dependencies are listed in the pyproject.toml file. To install the packa CURRENT FEATURES: -version 0.9.0 +version 0.9.1 -------------- - Network creation and manipulation: The package allows for the creation of a network of nodes and edges, with various methods for enrichment analysis. This includes adding and removing nodes and edges, loading a network from a SIF (Simple Interaction Format) file, and adding paths to the edge list of the network. From 17ed03d05768e1c0310723848c141b711aa8f4fc Mon Sep 17 00:00:00 2001 From: marcorusc Date: Fri, 28 Jun 2024 15:45:03 +0200 Subject: [PATCH 3/5] updated workflows --- .github/workflows/sphinx_autodoc.yaml | 3 + .github/workflows/test.yaml | 83 ++++++++++++--------------- 2 files changed, 39 insertions(+), 47 deletions(-) diff --git a/.github/workflows/sphinx_autodoc.yaml b/.github/workflows/sphinx_autodoc.yaml index 5d144ce..85cd1f1 100644 --- a/.github/workflows/sphinx_autodoc.yaml +++ b/.github/workflows/sphinx_autodoc.yaml @@ -28,8 +28,11 @@ jobs: run: | cd docs poetry run make html + - name: List contents of build directory + run: ls -R docs/_build/html - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/_build/html + force_orphan: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9203d90..6a1cf53 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,57 +1,46 @@ name: Test on: - push: - branches: [main] - pull_request: - branches: [main] + push: + branches: [main] + pull_request: + branches: [main] jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10'] + os: [ubuntu-latest, macos-latest] - test: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -e {0} + steps: + - uses: actions/checkout@v2 - strategy: - fail-fast: false - matrix: - python: [3.8, 3.9, 3.10] - os: [ubuntu-latest, macos-latest] + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - env: - OS: ${{ matrix.os }} - PYTHON: ${{ matrix.python }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev,test] + pip install pytest pytest-cov codecov - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - cache: pip - cache-dependency-path: '**/pyproject.toml' + - name: Run tests + env: + MPLBACKEND: agg + PLATFORM: ${{ matrix.os }} + run: | + pytest -v --cov=./ --cov-report=xml - - name: Install test dependencies - run: | - python -m pip install --upgrade pip wheel - pip install codecov - - name: Install dependencies - run: | - pip install ".[dev,test]" - - name: Install pip dependencies - run: | - python -m pip install --upgrade pip - - name: Test - env: - MPLBACKEND: agg - PLATFORM: ${{ matrix.os }} - DISPLAY: :42 - run: | - pytest -v --cov --color=yes - - name: Upload coverage - env: - CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }} - run: | - codecov --no-color --required --flags unittests + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml + flags: unittests + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: true From 09dba45cfc4c613497c89a934dca503d2a6894b1 Mon Sep 17 00:00:00 2001 From: marcorusc Date: Fri, 28 Jun 2024 16:08:32 +0200 Subject: [PATCH 4/5] updated documentation workflow --- .github/workflows/sphinx_autodoc.yaml | 22 ++++++++--- docs/src/index.rst | 53 ++++++--------------------- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/.github/workflows/sphinx_autodoc.yaml b/.github/workflows/sphinx_autodoc.yaml index 85cd1f1..eec2878 100644 --- a/.github/workflows/sphinx_autodoc.yaml +++ b/.github/workflows/sphinx_autodoc.yaml @@ -28,11 +28,21 @@ jobs: run: | cd docs poetry run make html + - name: Debug information + run: | + echo "Current directory:" + pwd + echo "Directory contents:" + ls -R + echo "Docs directory contents:" + ls -R docs + - name: List contents of build directory run: ls -R docs/_build/html - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/_build/html - force_orphan: true + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/_build/html + force_orphan: true diff --git a/docs/src/index.rst b/docs/src/index.rst index 8f373b5..df3c3c8 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -1,8 +1,7 @@ ================== -Neko + Neko ================== -.. image:: https://github.com/sysbio-curie/Neko/actions/workflows/test.yml/badge.svg :target: https://github.com/sysbio-curie/Neko/actions/workflows/test.yml :alt: Tests @@ -10,18 +9,14 @@ Neko :target: https://neko.readthedocs.io :alt: Documentation -About Neko ----------- - -Neko is a package to extract, visualize, convert and study interactions from databases into executable activity flow based models. -It is based on `Omnipath `_, `Pypath `_ and `Atopo `_. +Package to extract, visualize, convert and study interactions from database into executable activity flow based model. +Neko, is based on `Omnipath `_, `Pypath `_ and `Atopo `_. This is a work-in-progress package made in collaboration with Dénes Turei and Asmund Flobak. Current contributors: Marco Ruscone, Eirini Tsirvouli, Andrea Checcoli, Dénes Turei. -Installation ------------- +Installation: All the dependencies are listed in the pyproject.toml file. To install the package, you can use the following command: @@ -29,35 +24,11 @@ All the dependencies are listed in the pyproject.toml file. To install the packa pip install . -Current Features ----------------- - -version 0.9.0 -^^^^^^^^^^^^^ - -- **Network creation and manipulation**: - - Create networks of nodes and edges - - Add and remove nodes and edges - - Load networks from SIF (Simple Interaction Format) files - - Add paths to the edge list of the network - - Various methods for enrichment analysis - -- **Connection of nodes**: - - Connect all nodes - - Connect a subgroup of nodes - - Connect all nodes of a network object - - Connect subcomponents of a network object - -- **Connection of genes to phenotype**: - - Connect genes to a phenotype based on provided parameters - - Retrieve phenotype markers - - Identify unique Uniprot genes and connect them to the network - - Option to compress the network by substituting specified genes with the phenotype name - -.. toctree:: - :maxdepth: 2 - :hidden: - :caption: Contents: - - contents - api +CURRENT FEATURES: + +version 0.9.1 +-------------- + +- Network creation and manipulation: The package allows for the creation of a network of nodes and edges, with various methods for enrichment analysis. This includes adding and removing nodes and edges, loading a network from a SIF (Simple Interaction Format) file, and adding paths to the edge list of the network. +- Connection of nodes: The package provides several methods to connect nodes in the network. This includes connecting all nodes, connecting a subgroup of nodes, connecting all nodes of a network object, and connecting subcomponents of a network object. +- Connection of genes to phenotype: The package provides a method to connect genes to a phenotype based on provided parameters. This includes retrieving phenotype markers, identifying unique Uniprot genes, and connecting them to the network. There is also an option to compress the network by substituting specified genes with the phenotype name. From 11772194aa8ec2b81a73b263a0df07f3248ebffb Mon Sep 17 00:00:00 2001 From: marcorusc Date: Fri, 28 Jun 2024 16:16:03 +0200 Subject: [PATCH 5/5] updated path to static --- docs/src/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index 6d964a9..6ca62a1 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -124,7 +124,7 @@ # 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'] +html_static_path = ['../src/_static'] html_show_sphinx = False html_logo = 'neko_logo.png'