Skip to content

Commit

Permalink
fixed import error in docs workflow (#35)
Browse files Browse the repository at this point in the history
* fixed import error; added paste2 into the documentation as well
  • Loading branch information
anushka255 authored Aug 29, 2024
1 parent a77fd32 commit 3638d83
Show file tree
Hide file tree
Showing 21 changed files with 1,600 additions and 431 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ jobs:

- name: Install Python dependencies
run: |
pip install sphinx myst-parser sphinx-autodoc-typehints nbsphinx sphinx-gallery sphinx-rtd-theme
pip install sphinx myst-parser sphinx-autodoc-typehints nbsphinx sphinx-gallery sphinx-rtd-theme sphinx-autodoc-annotation
- uses: actions/checkout@v2

- name: Install Package
run: |
pip install .
- name: Install Pandoc
run: sudo apt-get install -y pandoc

- name: Setup Envvars
run: |
if [[ $GITHUB_REF = "refs/tags/"* ]] ; then echo "PASTE3_VERSION=${GITHUB_REF/refs\/tags\//}" ; else echo "PASTE3_VERSION=" ; fi >> $GITHUB_ENV
Expand All @@ -34,10 +41,10 @@ jobs:
run: |
# Unless we add a .nojekyll to the base of the deployment folder, the underscores in foldernames
# like _static/ etc. pose problems on GH Pages.
cd docs && sphinx-apidoc -f -o src ../src/paste -H Modules && make html && touch _build/html/.nojekyll
cd docs && sphinx-apidoc -f -o src ../src/paste3 -H Modules && make html && touch build/html/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html
folder: docs/build/html
branch: gh-pages
70 changes: 35 additions & 35 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%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
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%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
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
28 changes: 28 additions & 0 deletions docs/paste3/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Setting up the environment

1. Clone the repository and enter it:
```shell
git clone [email protected]:raphael-group/paste3.git
cd paste3
```
2. Create and activate a conda environment using the provided `environment.yml` file:
```shell
conda env create --file environment.yml
conda activate paste
```
The command prompt will change to indicate the new conda environment by prepending `(paste)`.
3. When you are done using the package, deactivate the `paste` environment and return to `(base)` by entering the following command:
```shell
conda deactivate
```

# Installation

1. Enter the `paste3` repository cloned before setting up the environment
```shell
cd paste3
```
2. Install the package:
```shell
pip install .
```
8 changes: 0 additions & 8 deletions docs/requirements.txt

This file was deleted.

Binary file added docs/source/_static/images/paste2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 51 additions & 11 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
API
===
import paste3
.. automodule:: paste3

Import Paste as::
PASTE Alignment
~~~~~~~~~~~~~~~~~~

from paste.visualization import plot_slice, stack_slices_pairwise, stack_slices_center
from paste.paste import pairwise_align, center_align
from paste.helper import filter_for_common_genes, match_spots_using_spatial_heuristic, match_spots_using_spatial_heuristic, apply_trsf
.. autosummary::
:toctree: api

.. automodule:: paste
paste.pairwise_align
paste.center_align

Alignment
~~~~~~~~~
PASTE2 Alignment
~~~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: api

PASTE.pairwise_align
PASTE.center_align
paste2.partial_pairwise_align_given_cost_matrix
paste2.partial_pairwise_align_histology
paste2.partial_pairwise_align
paste2.partial_fused_gromov_wasserstein
paste2.gwgrad_partial

Visualization
~~~~~~~~~~~~~
Expand All @@ -28,6 +34,42 @@ Visualization
visualization.stack_slices_center
visualization.plot_slice

Projection
~~~~~~~~~~~~~

.. autosummary::
:toctree: api

projection.partial_stack_slices_pairwise
projection.partial_procrustes_analysis

Model Selection
~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: api

model_selection.create_graph
model_selection.generate_graph_from_labels
model_selection.edge_inconsistency_score
model_selection.calculate_convex_hull_edge_inconsistency
model_selection.plot_edge_curve
model_selection.select_overlap_fraction_plotting


GLMPCA
~~~~~~~

.. autosummary::
:toctree: api

glmpca.ortho
glmpca.mat_binom_dev
glmpca.glmpca_init
glmpca.est_nb_theta
glmpca.glmpca


Miscellaneous
~~~~~~~~~~~~~

Expand All @@ -36,6 +78,4 @@ Miscellaneous

helper.filter_for_common_genes
helper.match_spots_using_spatial_heuristic
helper.apply_trsf


6 changes: 0 additions & 6 deletions docs/source/api/paste.PASTE.center_align.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.PASTE.pairwise_align.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.helper.apply_trsf.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.helper.filter_for_common_genes.rst

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.visualization.plot_slice.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.visualization.stack_slices_center.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/api/paste.visualization.stack_slices_pairwise.rst

This file was deleted.

65 changes: 13 additions & 52 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# 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 --------------------------------------------------------------

from pathlib import Path


# 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 sys
import os
HERE = Path(__file__).parent
sys.path.insert(0, str(HERE.parent.parent) + '/src')
sys.path.insert(0, os.path.abspath(HERE.parent.parent))

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'paste3'
copyright = '2022, Raphael Lab'
Expand All @@ -27,15 +19,12 @@
# The full version, including alpha/beta/rc tags
release = '1.2.0'


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#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 = [
"myst_parser",
'sphinx.ext.autosummary',
'sphinx.ext.autosummary',
"sphinx.ext.autodoc",
'sphinx.ext.napoleon',
"sphinx_autodoc_typehints",
Expand All @@ -44,41 +33,13 @@
"sphinx.ext.viewcode"
]

# Moves Type hints from function header into description
autodoc_typehints = "description"


# 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 = []

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = False


language = 'python'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#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_theme = "sphinx_rtd_theme"
html_static_path = ['_static']

html_show_sourcelink = False
html_show_sphinx = False



nbsphinx_thumbnails = {
"notebooks/getting-started": "_static/images/breast_stack_2d.png",
}
Loading

0 comments on commit 3638d83

Please sign in to comment.