Skip to content

Commit 84c761f

Browse files
committed
Fixing conflicts
2 parents 64c1da6 + 8302d22 commit 84c761f

File tree

12 files changed

+196
-12
lines changed

12 files changed

+196
-12
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ jobs:
1919
pip install -r requirements.txt -r requirements-dev.txt
2020
- name: Run pre-commit
2121
uses: pre-commit/[email protected]
22+
- name: Check for Sphinx doc warnings
23+
run: |
24+
cd docs
25+
make html SPHINXOPTS="-W --keep-going"
2226
- name: Test with pytest and coverage
2327
run: |
2428
pytest -v --cov=sgkit --cov-report=term-missing

.github/workflows/docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.8'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements.txt -r requirements-dev.txt
23+
- name: Build Sphinx documentation
24+
run: |
25+
cd docs
26+
make html SPHINXOPTS="-W --keep-going"
27+
- name: Commit documentation changes to gh-pages branch
28+
run: |
29+
git clone https://github.com/pystatgen/sgkit.git --branch gh-pages --single-branch gh-pages
30+
cp -r docs/_build/html/* gh-pages/
31+
cd gh-pages
32+
git config --local user.email "[email protected]"
33+
git config --local user.name "GitHub Action"
34+
git add .
35+
git commit -m "Update documentation" -a || true # Ignore error if no changes present
36+
- name: Push changes
37+
uses: ad-m/github-push-action@master
38+
with:
39+
branch: gh-pages
40+
directory: gh-pages
41+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@ dmypy.json
132132
.vscode
133133
.idea
134134
.DS_Store
135-
._.DS_Store
135+
136+
# sgkit
137+
docs/generated

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ To check code coverage and get a coverage report, run
1818
pytest --cov=sgkit --cov-report term-missing
1919
```
2020

21+
To check that the documentation builds without warnings, run
22+
23+
```bash
24+
cd docs
25+
make clean html SPHINXOPTS="-W --keep-going"
26+
```
27+
2128
### Code standards
2229

2330
Use [pre-commit](https://pre-commit.com/) to check or enforce the coding standards. Install the git hook using:

docs/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
.PHONY: clean
18+
clean:
19+
rm -rf $(BUILDDIR)/*
20+
rm -rf generated/*
21+
22+
# Catch-all target: route all unknown targets to Sphinx using the new
23+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
24+
%: Makefile
25+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. currentmodule:: sgkit
2+
3+
#############
4+
API reference
5+
#############
6+
7+
This page provides an auto-generated summary of sgkits's API.
8+
9+
Top-level functions
10+
===================
11+
12+
.. autosummary::
13+
:toctree: generated/
14+
15+
create_genotype_call_dataset
16+
gwas_linear_regression

docs/conf.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
16+
sys.path.insert(0, os.path.abspath(".."))
17+
18+
print("python exec:", sys.executable)
19+
print("sys.path:", sys.path)
20+
21+
import sgkit # noqa: F401 isort:skip
22+
23+
# -- Project information -----------------------------------------------------
24+
25+
project = "sgkit"
26+
copyright = "2020, sgkit developers"
27+
author = "sgkit developers"
28+
29+
30+
# -- General configuration ---------------------------------------------------
31+
32+
# Add any Sphinx extension module names here, as strings. They can be
33+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
34+
# ones.
35+
extensions = [
36+
"sphinx.ext.autodoc",
37+
"sphinx.ext.autosummary",
38+
"sphinx.ext.githubpages",
39+
"sphinx.ext.intersphinx",
40+
"sphinx.ext.napoleon",
41+
]
42+
43+
# Add any paths that contain templates here, relative to this directory.
44+
templates_path = ["_templates"]
45+
46+
# List of patterns, relative to source directory, that match files and
47+
# directories to ignore when looking for source files.
48+
# This pattern also affects html_static_path and html_extra_path.
49+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
50+
51+
autosummary_generate = True
52+
53+
intersphinx_mapping = {
54+
"xarray": ("http://xarray.pydata.org/en/stable/", None),
55+
"zarr": ("https://zarr.readthedocs.io/en/stable", None),
56+
}
57+
58+
59+
# -- Options for HTML output -------------------------------------------------
60+
61+
# The theme to use for HTML and HTML Help pages. See the documentation for
62+
# a list of builtin themes.
63+
#
64+
html_theme = "sphinx_rtd_theme"
65+
66+
# Add any paths that contain custom static files (such as style sheets) here,
67+
# relative to this directory. They are copied after the builtin static files,
68+
# so a file named "default.css" will overwrite the builtin "default.css".
69+
# html_static_path = ["_static"]

docs/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sgkit: Statistical genetics toolkit in Python
2+
=============================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
api
9+
10+
11+
Indices and tables
12+
==================
13+
14+
* :ref:`genindex`
15+
* :ref:`search`

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ pytest-datadir
66
hypothesis
77
statsmodels
88
zarr
9+
sphinx
10+
sphinx_rtd_theme

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fail_under = 100
3939

4040
[tool:pytest]
4141
addopts = --doctest-modules --ignore=validation
42+
norecursedirs = .eggs docs
4243

4344
[flake8]
4445
ignore =

sgkit/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def create_genotype_call_dataset(
4949
5050
Returns
5151
-------
52-
xr.Dataset
52+
:class:`xarray.Dataset`
5353
The dataset of genotype calls.
5454
5555
"""

sgkit/stats/association.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,17 @@ def gwas_linear_regression(
160160
along the sample (row) dimension but not the column dimension (i.e.
161161
they must be tall and skinny).
162162
163+
Returns
164+
-------
165+
:class:`xarray.Dataset`
166+
Dataset containing (N = num variants, O = num traits):
167+
beta : (N, O) array-like
168+
Beta values associated with each variant and trait
169+
t_value : (N, O) array-like
170+
T statistics for each beta
171+
p_value : (N, O) array-like
172+
P values as float in [0, 1]
173+
163174
Warnings
164175
--------
165176
Regression statistics from this implementation are only valid when an
@@ -181,16 +192,7 @@ def gwas_linear_regression(
181192
Bayesian Mixed-Model Analysis Increases Association Power in Large Cohorts.”
182193
Nature Genetics 47 (3): 284–90.
183194
184-
Returns
185-
-------
186-
Dataset
187-
Dataset containing (N = num variants, O = num traits):
188-
beta : (N, O) array-like
189-
Beta values associated with each variant and trait
190-
t_value : (N, O) array-like
191-
T statistics for each beta
192-
p_value : (N, O) array-like
193-
P values as float in [0, 1]
195+
194196
"""
195197
if isinstance(covariates, str):
196198
covariates = [covariates]

0 commit comments

Comments
 (0)