Skip to content

Commit 82a4b99

Browse files
authored
Merge pull request #207 from scverse/add_examples
Fixed bug 2.0.7 pl.obsm
2 parents 70e9754 + d64d0bc commit 82a4b99

48 files changed

Lines changed: 636 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build:
1212
- uv pip install .[doc,full]
1313
build:
1414
html:
15-
- uv run sphinx-build -T -W -b html docs $READTHEDOCS_OUTPUT/html
15+
- UV_LINK_MODE=copy uv run sphinx-build -T -W -b html docs $READTHEDOCS_OUTPUT/html
1616

1717
submodules:
1818
include: all

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning][].
88
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
99
[semantic versioning]: https://semver.org/spec/v2.0.0.html
1010

11-
## 2.0.6
11+
## 2.0.8
1212

1313
Major update to accomodate the scverse template {cite}`scverse`.
1414

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
44

55
[project]
66
name = "decoupler"
7-
version = "2.0.7"
7+
version = "2.0.8"
88
description = "Python package to perform enrichment analysis from omics data."
99
readme = "README.md"
1010
license = { file = "LICENSE" }

src/decoupler/bm/_run.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ def benchmark(
310310
Returns
311311
-------
312312
Dataframe containing metric scores.
313+
314+
Example
315+
-------
316+
.. code-block:: python
317+
318+
import decoupler as dc
319+
320+
adata, net = dc.ds.toy_bench()
321+
df = dc.bm.benchmark(adata=adata, net=net, kws_decouple={"tmin": 3})
322+
df
313323
"""
314324
# Validate
315325
assert isinstance(adata, AnnData), "adata must be anndata.AnnData"

src/decoupler/ds/_bulk.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ def hsctgfb(
2323
Returns
2424
-------
2525
AnnData object.
26+
27+
Example
28+
-------
29+
.. code-block:: python
30+
31+
import decoupler as dc
32+
33+
adata = dc.ds.hsctgfb()
34+
adata
2635
"""
2736
# Download
2837
url = (
@@ -70,6 +79,15 @@ def knocktf(
7079
Returns
7180
-------
7281
AnnData object.
82+
83+
Example
84+
-------
85+
.. code-block:: python
86+
87+
import decoupler as dc
88+
89+
adata = dc.ds.knocktf()
90+
adata
7391
"""
7492
assert isinstance(thr_fc, int | float) or thr_fc is None, "thr_fc must be numeric or None"
7593
# Download

src/decoupler/ds/_scell.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ def pbmc3k(
5050
Returns
5151
-------
5252
AnnData object.
53+
54+
Example
55+
-------
56+
.. code-block:: python
57+
58+
import decoupler as dc
59+
60+
adata = dc.ds.pbmc3k()
61+
adata
5362
"""
5463
url = "https://raw.githubusercontent.com/chanzuckerberg/cellxgene/main/example-dataset/pbmc3k.h5ad"
5564
adata = _download_anndata(url, verbose=verbose)
@@ -82,6 +91,15 @@ def covid5k(
8291
Returns
8392
-------
8493
AnnData object.
94+
95+
Example
96+
-------
97+
.. code-block:: python
98+
99+
import decoupler as dc
100+
101+
adata = dc.ds.covid5k()
102+
adata
85103
"""
86104
url = (
87105
"https://ftp.ebi.ac.uk/pub/databases/microarray/data/atlas/"
@@ -148,6 +166,15 @@ def erygast1k(
148166
Returns
149167
-------
150168
AnnData object.
169+
170+
Example
171+
-------
172+
.. code-block:: python
173+
174+
import decoupler as dc
175+
176+
adata = dc.ds.erygast1k()
177+
adata
151178
"""
152179
# How to process from scvelo:
153180
"""

src/decoupler/ds/_spatial.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ def msvisium(
2929
Returns
3030
-------
3131
AnnData object.
32+
33+
Example
34+
-------
35+
.. code-block:: python
36+
37+
import decoupler as dc
38+
39+
adata = dc.ds.msvisium()
40+
adata
3241
"""
3342
url = "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSM8563708&format=file&file=GSM8563708%5FMS377T%5F"
3443
# Download mat

src/decoupler/ds/_toy.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ def toy(
4747
Returns
4848
-------
4949
AnnData and net examples.
50+
51+
Example
52+
-------
53+
.. code-block:: python
54+
55+
import decoupler as dc
56+
57+
adata, net = dc.ds.toy()
58+
adata, net
5059
"""
5160
# Validate
5261
assert isinstance(nobs, int | float) and nobs >= 2, "nobs must be numeric and >= 2"
@@ -128,6 +137,15 @@ def toy_bench(shuffle_r: float = 0.25, seed: int = 42, verbose: bool = False, **
128137
Returns
129138
-------
130139
AnnData and net examples.
140+
141+
Example
142+
-------
143+
.. code-block:: python
144+
145+
import decoupler as dc
146+
147+
adata, net = dc.ds.toy_bench()
148+
adata, net
131149
"""
132150
# Validate
133151
assert isinstance(shuffle_r, int | float) and 0.0 <= shuffle_r <= 1.0, (

src/decoupler/ds/_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ def ensmbl_to_symbol(
1919
Returns
2020
-------
2121
List of gene symbols
22+
23+
Example
24+
-------
25+
.. code-block:: python
26+
27+
import decoupler as dc
28+
29+
dc.ds.ensmbl_to_symbol(genes=["ENSG00000196092", "ENSG00000115415"], organism="hsapiens_gene_ensembl")
2230
"""
2331
url = (
2432
'http://www.ensembl.org/biomart/martservice?query=<?xml version="1.0" encoding="UTF-8"?>'

src/decoupler/mt/_aucell.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def _func_aucell(
8686
If ``None``, the top 5% of features based on their magnitude are selected.
8787
8888
%(returns)s
89+
90+
Example
91+
-------
92+
.. code-block:: python
93+
94+
import decoupler as dc
95+
96+
adata, net = dc.ds.toy()
97+
dc.mt.aucell(adata, net, tmin=3)
8998
"""
9099
nobs, nvar = mat.shape
91100
nsrc = starts.size

0 commit comments

Comments
 (0)