diff --git a/docs/api.md b/docs/api.md index b76f6c7..80fdacc 100644 --- a/docs/api.md +++ b/docs/api.md @@ -2,28 +2,8 @@ ## Preprocessing -```{eval-rst} -.. module:: pycea.pp -.. currentmodule:: pycea - -.. autosummary:: - :toctree: generated - - pp.basic_preproc -``` - ## Tools -```{eval-rst} -.. module:: pycea.tl -.. currentmodule:: pycea - -.. autosummary:: - :toctree: generated - - tl.basic_tool -``` - ## Plotting ```{eval-rst} @@ -34,4 +14,5 @@ :toctree: generated pl.branches + pl.annotation ``` diff --git a/docs/conf.py b/docs/conf.py index 6c81c3a..4aa5dd0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,10 +91,16 @@ } intersphinx_mapping = { - "python": ("https://docs.python.org/3", None), "anndata": ("https://anndata.readthedocs.io/en/stable/", None), + "cycler": ("https://matplotlib.org/cycler/", None), + "matplotlib": ("https://matplotlib.org/stable/", None), "numpy": ("https://numpy.org/doc/stable/", None), "networkx": ("https://networkx.org/documentation/stable/", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), + "python": ("https://docs.python.org/3", None), + "scanpy": ("https://scanpy.readthedocs.io/en/stable/", None), + "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None), + "squidpy": ("https://squidpy.readthedocs.io/en/stable/", None), "treedata": ("https://treedata.readthedocs.io/en/stable/", None), } diff --git a/src/pycea/pl/tree.py b/src/pycea/pl/tree.py index 56dca62..46a8349 100644 --- a/src/pycea/pl/tree.py +++ b/src/pycea/pl/tree.py @@ -10,9 +10,11 @@ import treedata as td from matplotlib.axes import Axes from matplotlib.collections import LineCollection +from scanpy._utils import _doc_params from pycea.utils import get_keyed_edge_data, get_keyed_obs_data +from ._docs import doc_common_plot_args from ._utils import ( _get_categorical_colors, _series_to_rgb_array, @@ -20,6 +22,9 @@ ) +@_doc_params( + common_plot_args=doc_common_plot_args, +) def branches( tdata: td.TreeData, key: str = None, @@ -57,7 +62,7 @@ def branches( Either an numeric width, or a key for an attribute of the edges to set the linewidth. na_linewidth The linewidth to use for edges with missing data. - {doc_common_plot_args} + {common_plot_args} kwargs Additional keyword arguments passed to `matplotlib.collections.LineCollection`. @@ -158,7 +163,7 @@ def annotation( The minimum value for the colormap. na_color The color to use for annotations with missing data. - {doc_common_plot_args} + {common_plot_args} kwargs Additional keyword arguments passed to `matplotlib.pyplot.pcolormesh`. @@ -209,14 +214,14 @@ def annotation( end_lat = start_lat + attrs["depth"] + 2 * np.pi lats = np.linspace(start_lat, end_lat, data.shape[1] + 1) for col in data.columns: - rgb_array.append(_series_to_rgb_array(data[col], cmap, vmin=vmin, vmax=vmax, na_color = na_color)) + rgb_array.append(_series_to_rgb_array(data[col], cmap, vmin=vmin, vmax=vmax, na_color=na_color)) else: for key in keys: if data[key].dtype == "category": colors = _get_categorical_colors(tdata, key, data[key], palette) - rgb_array.append(_series_to_rgb_array(data[key], colors, na_color = na_color)) + rgb_array.append(_series_to_rgb_array(data[key], colors, na_color=na_color)) else: - rgb_array.append(_series_to_rgb_array(data[key], cmap, vmin=vmin, vmax=vmax, na_color = na_color)) + rgb_array.append(_series_to_rgb_array(data[key], cmap, vmin=vmin, vmax=vmax, na_color=na_color)) rgb_array = np.stack(rgb_array, axis=1) # Plot if attrs["polar"]: diff --git a/src/pycea/pp/__init__.py b/src/pycea/pp/__init__.py index 5e7e293..e69de29 100644 --- a/src/pycea/pp/__init__.py +++ b/src/pycea/pp/__init__.py @@ -1 +0,0 @@ -from .basic import basic_preproc diff --git a/src/pycea/pp/basic.py b/src/pycea/pp/basic.py deleted file mode 100644 index 5db1ec0..0000000 --- a/src/pycea/pp/basic.py +++ /dev/null @@ -1,17 +0,0 @@ -from anndata import AnnData - - -def basic_preproc(adata: AnnData) -> int: - """Run a basic preprocessing on the AnnData object. - - Parameters - ---------- - adata - The AnnData object to preprocess. - - Returns - ------- - Some integer value. - """ - print("Implement a preprocessing function here.") - return 0 diff --git a/src/pycea/tl/__init__.py b/src/pycea/tl/__init__.py index 95a32cd..e69de29 100644 --- a/src/pycea/tl/__init__.py +++ b/src/pycea/tl/__init__.py @@ -1 +0,0 @@ -from .basic import basic_tool diff --git a/src/pycea/tl/basic.py b/src/pycea/tl/basic.py deleted file mode 100644 index d215ade..0000000 --- a/src/pycea/tl/basic.py +++ /dev/null @@ -1,17 +0,0 @@ -from anndata import AnnData - - -def basic_tool(adata: AnnData) -> int: - """Run a tool on the AnnData object. - - Parameters - ---------- - adata - The AnnData object to preprocess. - - Returns - ------- - Some integer value. - """ - print("Implement a tool to run on the AnnData object.") - return 0 diff --git a/tests/test_basic.py b/tests/test_basic.py deleted file mode 100644 index c01c90a..0000000 --- a/tests/test_basic.py +++ /dev/null @@ -1,12 +0,0 @@ -import pytest - -import pycea - - -def test_package_has_version(): - assert pycea.__version__ is not None - - -@pytest.mark.skip(reason="This decorator should be removed when test passes.") -def test_example(): - assert 1 == 0 # This test is designed to fail.