Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sphinxcontrib-bibtex #248

Merged
merged 4 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ default_language_version:
default_stages:
- commit
- push
minimum_pre_commit_version: 2.9.0
minimum_pre_commit_version: 2.9.3
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
rev: v0.800
hooks:
- id: mypy
additional_dependencies: [numpy>=1.15.0, scipy>=1.5.0, pandas]
Expand Down Expand Up @@ -70,13 +70,13 @@ repos:
- id: script-must-have-extension
name: Check executable files use .sh extension
types: [shell, executable]
- id: shellcheck
# - id: shellcheck # TODO: The hook `shellcheck` specifies `additional_dependencies` but is using language `script` which does not install an environment. Perhaps you meant to use a specific language?
- repo: https://github.com/myint/rstcheck
rev: master
rev: 3f92957478422df87bd730abde66f089cc1ee19b
hooks:
- id: rstcheck
- repo: https://github.com/asottile/blacken-docs
rev: v1.9.1
rev: v1.9.2
hooks:
- id: blacken-docs
additional_dependencies: [black==20.8b1]
Expand Down
2 changes: 1 addition & 1 deletion .rstcheck.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[rstcheck]
ignore_messages=Unknown target name:.*|No (directive|role) entry for "(auto)?(class|method|property|function|func|mod|module)" in module "docutils\.parsers\.rst\.languages\.en"\.
ignore_messages=Unknown target name:.*|No (directive|role) entry for "(auto)?(bibliography|class|method|property|function|func|mod|module)" in module "docutils\.parsers\.rst\.languages\.en"\.
report=info
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ sphinx-autodoc-typehints>=1.10.3
sphinx_gallery
sphinx_last_updated_by_git
sphinx_rtd_theme
sphinxcontrib-bibtex>=2.1.0
7 changes: 6 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"sphinx.ext.autosummary",
"sphinx_last_updated_by_git",
"sphinx_gallery.load_style",
"sphinxcontrib.bibtex",
"edit_on_github",
"typed_returns",
]
Expand All @@ -63,7 +64,7 @@
matplotlib=("https://matplotlib.org/", None),
seaborn=("https://seaborn.pydata.org/", None),
joblib=("https://joblib.readthedocs.io/en/latest/", None),
networkx=("https://networkx.github.io/documentation/stable/", None),
networkx=("https://networkx.org/documentation/stable", None),
astropy=("https://docs.astropy.org/en/stable/", None),
esda=("https://pysal.org/esda/", None),
dask=("https://docs.dask.org/en/latest/", None),
Expand Down Expand Up @@ -109,6 +110,10 @@
# 403 Client Error: Forbidden for url: https://www.jstor.org/stable/2332142?origin=crossref
linkcheck_ignore = ["https://doi.org/10.2307/2332142"]

bibtex_bibfiles = ["references.bib"]
bibtex_reference_style = ["author_year"]
bibtex_default_style = "alpha"

# 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".
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Squidpy

auto_examples/index.rst


.. |PyPI| image:: https://img.shields.io/pypi/v/squidpy.svg
:target: https://img.shields.io/pypi/v/squidpy.svg
:alt: PyPI
Expand Down
51 changes: 51 additions & 0 deletions docs/source/references.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@article {celloracle,
author = {Kamimoto, Kenji and Hoffmann, Christy M. and Morris, Samantha A.},
title = {CellOracle: Dissecting cell identity via network inference and in silico gene perturbation},
journal = {bioRxiv},
year = {2020},
publisher = {Cold Spring Harbor Laboratory},
doi = {10.1101/2020.02.17.947416}
}

@article{cellphonedb,
author={Efremova, Mirjana and Vento-Tormo, Miquel and Teichmann, Sarah A and Vento-Tormo, Roser},
title={CellPhoneDB: inferring cell--cell communication from combined expression of multi-subunit ligand--receptor complexes},
journal={Nature protocols},
year={2020},
volume={15},
number={4},
pages={1484--1506},
publisher={Nature Publishing Group},
doi = {10.1038/s41596-020-0292-x}
}

@incollection{pysal,
title={PySAL: A Python library of spatial analytical methods},
author={Rey, Sergio J and Anselin, Luc},
booktitle={Handbook of applied spatial analysis},
pages={175--193},
year={2010},
publisher={Springer},
doi = {10.1007/978-3-642-03647-7_11}
}

@article{omnipath,
title={OmniPath: guidelines and gateway for literature-curated signaling pathway resources},
author={T{\"u}rei, D{\'e}nes and Korcsm{\'a}ros, Tam{\'a}s and Saez-Rodriguez, Julio},
journal={Nature methods},
year={2016},
volume={13},
number={12},
pages={966--967},
publisher={Nature Publishing Group},
doi = {10.1038/nmeth.4077}
}

@techreport{networkx,
title={Exploring network structure, dynamics, and function using NetworkX},
author={Hagberg, Aric and Swart, Pieter and S Chult, Daniel},
year={2008},
place = {United States},
institution={Los Alamos National Lab.(LANL), Los Alamos, NM (United States)},
URL = {https://www.osti.gov/biblio/960616},
}
33 changes: 3 additions & 30 deletions docs/source/references.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
.. |br| raw:: html

<br/>

References
----------

.. [CellOracle20]
Kamimoto, K., Hoffmann, C. M, Morris, S. A., |br|
*Dissecting cell identity via network inference and in silico gene perturbation*, |br|
`bioRxiv 2020.02.17.947416 <https://doi.org/10.1101/2020.02.17.947416>`__.

.. [CellPhoneDB20] Efremova, M., Vento-Tormo, M., Teichmann, S. A. et al., |br|
*CellPhoneDB: inferring cell–cell communication from combined expression of multi-subunit
ligand–receptor complexes.*, |br|
`Nat Protoc 15, 1484–1506 (2020) <https://doi.org/10.1038/s41596-020-0292-x>`__.

.. [Moran50] Rey, Sergio J. and Anselin, Luc, |br|
*PySAL: A Python Library of Spatial Analytical Methods*, |br|
`The Review of Regional Studies, vol. 37, 1, 2007, pp. 17–23 <https://pysal.org/esda/index.html>`__.

.. [OmniPath16] Türei, D., Korcsmáros, T., Saez-Rodriguez, J., |br|
*OmniPath: guidelines and gateway for literature-curated signaling pathway resources.*, |br|
`Nat Methods 13, 966–967 (2016) <https://doi.org/10.1038/nmeth.4077>`__.

.. [Visium] 10X Genomics |br|
`Visium <https://www.10xgenomics.com/products/spatial-gene-expression>`__.
==========

.. [NetworkX08]
Aric A. Hagberg, Daniel A. Schult and Pieter J. Swart, |br|
*Exploring Network Structure, Dynamics, and Function using NetworkX*, |br|
`SciPyProceedings_11 2008 <http://conference.scipy.org/proceedings/SciPy2008/paper_2/>`__.
.. bibliography::
:cited:
13 changes: 7 additions & 6 deletions squidpy/gr/_ligrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def prepare(
complex_policy
Policy on how to handle complexes. Valid options are:

- `{cp.MIN.s!r}` - select gene with the minimum average expression.
This is the same as in [CellPhoneDB20]_.
- `{cp.MIN.s!r}` - select gene with the minimum average expression. This is the same as in
:cite:`cellphonedb`.
- `{cp.ALL.s!r}` - select all possible combinations between `{src!r}` and `{tgt!r}` complexes.

Returns
Expand Down Expand Up @@ -320,7 +320,7 @@ def test(
**kwargs: Any,
) -> Optional[LigrecResult]:
"""
Perform the permutation test as described in [CellPhoneDB20]_.
Perform the permutation test as described in :cite:`cellphonedb`.

Parameters
----------
Expand Down Expand Up @@ -483,7 +483,7 @@ def _filter_interactions_complexes(self, complex_policy: ComplexPolicy) -> None:
Policy on how to handle complexes. Valid options are:

- `{cp.MIN.s!r}` - select gene with the minimum average expression. This is the same as in
[CellPhoneDB20]_.
:cite:`cellphonedb`.
- `{cp.ALL.s!r}` - select all possible combinations between `{src!r}` and `{tgt!r}` complexes.

Returns
Expand Down Expand Up @@ -571,7 +571,8 @@ def prepare(
%(PT_prepare.parameters)s
interactions_params
Keyword arguments for :func:`omnipath.interactions.import_intercell_network` defining the interactions.
These datasets from [OmniPath16]_ are default: `omnipath`, `pathwayextra`, `kinaseextra`, `ligrecextra`.
These datasets from :cite:`omnipath` are used by default: `omnipath`, `pathwayextra`, `kinaseextra` and
`ligrecextra`.
transmitter_params
Keyword arguments for :func:`omnipath.interactions.import_intercell_network` defining the transmitter
side of intercellular connections.
Expand Down Expand Up @@ -668,7 +669,7 @@ def _analysis(
**kwargs: Any,
) -> TempResult:
"""
Run the analysis as described in [CellPhoneDB20]_.
Run the analysis as described in :cite:`cellphonedb`.

This function runs the mean, percent and shuffled analysis.

Expand Down
4 changes: 2 additions & 2 deletions squidpy/gr/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def spatial_neighbors(
coord_type
Type of coordinate system. Can be one of the following:

- `{c.VISIUM!r}`: [Visium]_ coordinates.
- `{c.VISIUM!r}`: Visium coordinates.
- `{c.GENERIC!r}`: generic coordinates.

If `None`, use `{c.VISIUM!r}` if ``spatial_key`` is present in :attr:`anndata.AnnData.obsm`,
otherwise use `{c.GENERIC!r}`.
n_rings
Number of rings of neighbors for [Visium]_ data.
Number of rings of neighbors for Visium data.
n_neigh
Number of neighborhoods to consider for non-Visium data.
radius
Expand Down
4 changes: 2 additions & 2 deletions squidpy/gr/nhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ def centrality_scores(
"""
Compute centrality scores per cluster or cell type.

Inspired by usage in Gene Regulatory Networks (GRNs) in [CellOracle20]_.
Inspired by usage in Gene Regulatory Networks (GRNs) in :cite:`celloracle`.

Parameters
----------
%(adata)s
%(cluster_key)s
score
Centrality measures as described in :class:`networkx.algorithms.centrality` [NetworkX08]_.
Centrality measures as described in :class:`networkx.algorithms.centrality` :cite:`networkx`.
If `None`, use all the options below. Valid options are:

- `{c.CLOSENESS.s!r}` - measure of how close the group is to other nodes.
Expand Down
6 changes: 3 additions & 3 deletions squidpy/gr/ppatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def moran(
%(conn_key)s
genes
List of gene names, as stored in :attr:`anndata.AnnData.var_names`, used to compute Moran's I statistics
[Moran50]_.
:cite:`pysal`.

If `None`, it's computed for `'highly_variable'` in :attr:`anndata.AnnData.var`, if present.
Otherwise, it's computed for all genes.
If `None`, it's computed :attr:`anndata.AnnData.var` ``['highly_variable']``, if present. Otherwise,
it's computed for all genes.
transformation
Transformation to be used, as reported in :class:`esda.Moran`. Default is `"B"`, binary.
%(n_perms)s
Expand Down
2 changes: 1 addition & 1 deletion squidpy/im/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def interactive(
Interactive view of this container. Screenshot of the canvas can be taken by
:meth:`squidpy.pl.Interactive.screenshot`.
"""
from squidpy.pl import Interactive
from squidpy.pl import Interactive # type: ignore[attr-defined]

return Interactive( # type: ignore[no-any-return]
img=self,
Expand Down
2 changes: 1 addition & 1 deletion squidpy/pl/_interactive/_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from squidpy.im import ImageContainer # type: ignore[attr-defined]
from squidpy._docs import d
from squidpy._utils import singledispatchmethod
from squidpy._utils import singledispatchmethod # type: ignore[attr-defined]
from squidpy.pl._utils import _points_inside_triangles
from squidpy.pl._interactive._view import ImageView
from squidpy.pl._interactive._model import ImageModel
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ rst-roles =
attr
paramref
ref
cite
rst-directives =
envvar
exception
Expand Down Expand Up @@ -155,7 +156,7 @@ commands =
[testenv:lint]
description = Perform linting.
basepython = python3.8
deps = pre-commit>=2.9.0
deps = pre-commit>=2.9.3
skip_install = true
commands = pre-commit run --all-files --show-diff-on-failure {posargs:}

Expand Down