diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..bb21740 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,38 @@ +name: Baskerville Docs + +on: + workflow_dispatch: + +defaults: + run: + shell: bash + +permissions: + contents: write +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v3 + + - name: Install dependencies + run: | + cd ${{ github.workspace }}/src/docs + pip install -r requirements.txt + - name: Sphinx build + run: | + cd ${{ github.workspace }}/src/docs/source + rm -f *.rst make.bat + cd ${{ github.workspace }}/src + sphinx-apidoc -F -a -o docs/source baskerville + cd ${{ github.workspace }}/src/docs + make html + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ${{ github.workspace }}/src/docs/build/html + force_orphan: true diff --git a/setup.cfg b/setup.cfg index cb2a2f0..52b40dc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,6 +35,7 @@ install_requires = seaborn~=0.12.2 scikit-learn~=1.2.2 scipy~=1.9.1 + sphinx~=7.2.6 statsmodels~=0.13.5 tabulate~=0.8.10 tensorflow==2.13.0 diff --git a/src/docs/Makefile b/src/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/src/docs/Makefile @@ -0,0 +1,20 @@ +# 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/src/docs/build/.placeholder b/src/docs/build/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/src/docs/make.bat b/src/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/src/docs/make.bat @@ -0,0 +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 diff --git a/src/docs/requirements.txt b/src/docs/requirements.txt new file mode 100644 index 0000000..f654e6e --- /dev/null +++ b/src/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +sphinx_rtd_theme +python-dotenv +google \ No newline at end of file diff --git a/src/docs/source/baskerville.helpers.rst b/src/docs/source/baskerville.helpers.rst new file mode 100644 index 0000000..0288778 --- /dev/null +++ b/src/docs/source/baskerville.helpers.rst @@ -0,0 +1,19 @@ +baskerville.helpers Subpackages of helpers for the Baskerville package. +============================================================================== + +Submodules +---------- + +baskerville.helpers.gcs_utils module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.helpers.gcs_utils + :members: + :undoc-members: + :show-inheritance: + +baskerville.helpers.utils module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.helpers.utils + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/src/docs/source/baskerville.rst b/src/docs/source/baskerville.rst new file mode 100644 index 0000000..90776fb --- /dev/null +++ b/src/docs/source/baskerville.rst @@ -0,0 +1,98 @@ +baskerville package +=================== + + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + baskerville.helpers + baskerville.scripts + +Submodules +---------- + +baskerville.bed module +~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: baskerville.bed + :members: + :undoc-members: + :show-inheritance: + +baskerville.blocks module +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: baskerville.blocks + :members: + :undoc-members: + :show-inheritance: + +baskerville.dataset module +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: baskerville.dataset + :members: + :undoc-members: + :show-inheritance: + +baskerville.dna module +~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.dna + :members: + :undoc-members: + :show-inheritance: + + +baskerville.gene module +~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.gene + :members: + :undoc-members: + :show-inheritance: + +baskerville.layers module +~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.layers + :members: + :undoc-members: + :show-inheritance: + +baskerville.metrics module +~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.metrics + :members: + :undoc-members: + :show-inheritance: + +baskerville.seqnn module +~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.seqnn + :members: + :undoc-members: + :show-inheritance: + +baskerville.snps module +~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.snps + :members: + :undoc-members: + :show-inheritance: + +baskerville.trainer module +~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.trainer + :members: + :undoc-members: + :show-inheritance: + +baskerville.vcf module +~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.vcf + :members: + :undoc-members: + :show-inheritance: + + diff --git a/src/docs/source/baskerville.scripts.rst b/src/docs/source/baskerville.scripts.rst new file mode 100644 index 0000000..e554f74 --- /dev/null +++ b/src/docs/source/baskerville.scripts.rst @@ -0,0 +1,53 @@ +baskerville.scripts Subpackages of scripts for the Baskerville project. +============================================================= + +""" +This package contains scripts for the Baskerville project +that are not part of the main codebase. + +""" +Submodules +========== + +baskerville.scripts.hound_eval_spec module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_eval_spec + :members: + :undoc-members: + :show-inheritance: + +baskerville.scripts.hound_eval module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_eval + :members: + :undoc-members: + :show-inheritance: + +baskerville.scripts.hound_predbed module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_predbed + :members: + :undoc-members: + :show-inheritance: + + +baskerville.scripts.hound_snp module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_snp + :members: + :undoc-members: + :show-inheritance: + +baskerville.scripts.hound_snp_slurm module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_snp_slurm + :members: + :undoc-members: + :show-inheritance: + +baskerville.scripts.hound_train module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. automodule:: baskerville.scripts.hound_train + :members: + :undoc-members: + :show-inheritance: diff --git a/src/docs/source/conf.py b/src/docs/source/conf.py new file mode 100644 index 0000000..319b105 --- /dev/null +++ b/src/docs/source/conf.py @@ -0,0 +1,38 @@ +# 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 +import os +import sys + +# This root should be where docs folder is visible. +sys.path.insert(0, os.path.abspath("../..")) +sys.setrecursionlimit(1500) + +project = "baskerville" +copyright = "2023, David Kelly" +author = "David Kelly" +release = "0.0.1" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "sphinx.ext.githubpages", +] + +templates_path = ["_templates"] +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] diff --git a/src/docs/source/index.rst b/src/docs/source/index.rst new file mode 100644 index 0000000..dc6b601 --- /dev/null +++ b/src/docs/source/index.rst @@ -0,0 +1,16 @@ +Welcome to baskerville's documentation! +======================================= + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + baskerville + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search`