Skip to content
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
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build:
- uv pip install .[doc,full]
build:
html:
- uv run sphinx-build -T -W -b html docs $READTHEDOCS_OUTPUT/html
- UV_LINK_MODE=copy uv run sphinx-build -T -W -b html docs $READTHEDOCS_OUTPUT/html

submodules:
include: all
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning][].
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html

## 2.0.6
## 2.0.8

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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [ "hatchling" ]

[project]
name = "decoupler"
version = "2.0.7"
version = "2.0.8"
description = "Python package to perform enrichment analysis from omics data."
readme = "README.md"
license = { file = "LICENSE" }
Expand Down
10 changes: 10 additions & 0 deletions src/decoupler/bm/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@ def benchmark(
Returns
-------
Dataframe containing metric scores.

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy_bench()
df = dc.bm.benchmark(adata=adata, net=net, kws_decouple={"tmin": 3})
df
"""
# Validate
assert isinstance(adata, AnnData), "adata must be anndata.AnnData"
Expand Down
18 changes: 18 additions & 0 deletions src/decoupler/ds/_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ def hsctgfb(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.hsctgfb()
adata
"""
# Download
url = (
Expand Down Expand Up @@ -70,6 +79,15 @@ def knocktf(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.knocktf()
adata
"""
assert isinstance(thr_fc, int | float) or thr_fc is None, "thr_fc must be numeric or None"
# Download
Expand Down
27 changes: 27 additions & 0 deletions src/decoupler/ds/_scell.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def pbmc3k(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.pbmc3k()
adata
"""
url = "https://raw.githubusercontent.com/chanzuckerberg/cellxgene/main/example-dataset/pbmc3k.h5ad"
adata = _download_anndata(url, verbose=verbose)
Expand Down Expand Up @@ -82,6 +91,15 @@ def covid5k(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.covid5k()
adata
"""
url = (
"https://ftp.ebi.ac.uk/pub/databases/microarray/data/atlas/"
Expand Down Expand Up @@ -148,6 +166,15 @@ def erygast1k(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.erygast1k()
adata
"""
# How to process from scvelo:
"""
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/ds/_spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def msvisium(
Returns
-------
AnnData object.

Example
-------
.. code-block:: python

import decoupler as dc

adata = dc.ds.msvisium()
adata
"""
url = "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSM8563708&format=file&file=GSM8563708%5FMS377T%5F"
# Download mat
Expand Down
18 changes: 18 additions & 0 deletions src/decoupler/ds/_toy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def toy(
Returns
-------
AnnData and net examples.

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
adata, net
"""
# Validate
assert isinstance(nobs, int | float) and nobs >= 2, "nobs must be numeric and >= 2"
Expand Down Expand Up @@ -128,6 +137,15 @@ def toy_bench(shuffle_r: float = 0.25, seed: int = 42, verbose: bool = False, **
Returns
-------
AnnData and net examples.

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy_bench()
adata, net
"""
# Validate
assert isinstance(shuffle_r, int | float) and 0.0 <= shuffle_r <= 1.0, (
Expand Down
8 changes: 8 additions & 0 deletions src/decoupler/ds/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ def ensmbl_to_symbol(
Returns
-------
List of gene symbols

Example
-------
.. code-block:: python

import decoupler as dc

dc.ds.ensmbl_to_symbol(genes=["ENSG00000196092", "ENSG00000115415"], organism="hsapiens_gene_ensembl")
"""
url = (
'http://www.ensembl.org/biomart/martservice?query=<?xml version="1.0" encoding="UTF-8"?>'
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_aucell.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ def _func_aucell(
If ``None``, the top 5% of features based on their magnitude are selected.

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.aucell(adata, net, tmin=3)
"""
nobs, nvar = mat.shape
nsrc = starts.size
Expand Down
10 changes: 10 additions & 0 deletions src/decoupler/mt/_consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ def consensus(
Returns
-------
Consensus enrichment scores and p-values.

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.decouple(adata, net, tmin=3)
dc.mt.consensus(adata)
"""
# Validate
assert isinstance(result, dict | AnnData), "scores must be dict or anndata.AnnData"
Expand Down
13 changes: 13 additions & 0 deletions src/decoupler/mt/_decouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ def decouple(
%(empty)s
%(bsize)s
%(verbose)s

Returns
-------
Dictionary of results or as ``.obsm`` keys in the provided AnnData.

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.decouple(adata, net, tmin=3)
"""
# Validate
_mdict = {m.name: m for m in _methods}
Expand Down
8 changes: 8 additions & 0 deletions src/decoupler/mt/_gsea.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ def _func_gsea(
%(seed)s

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc
adata, net = dc.ds.toy()
dc.mt.gsea(adata, net, tmin=3)
"""
nobs, nvar = mat.shape
assert isinstance(times, int | float) and times >= 0, "times must be numeric and >= 0"
Expand Down
8 changes: 8 additions & 0 deletions src/decoupler/mt/_gsva.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ def _func_gsva(
will be regarded as 'highly' activated.

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc
adata, net = dc.ds.toy()
dc.mt.gsva(adata, net, tmin=3)
"""
if isinstance(mat, sps.csr_matrix):
m = "gsva - Converting sparse matrix to dense format before density transformation"
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_mdt.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ def _func_mdt(
kwargs
All other keyword arguments are passed to ``xgboost.XGBRegressor``.
%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.mdt(adata, net, tmin=3)
"""
_check_import(xgboost, "xgboost")
nobs = mat.shape[0]
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_mlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ def _func_mlm(
%(tval)s

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.mlm(adata, net, tmin=3)
"""
# Get dims
n_features, n_fsets = adj.shape
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_ora.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ def _func_ora(
Number indicating the background size.

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.ora(adata, net, tmin=3)
"""
nobs, nvar = mat.shape
nsrc = starts.size
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_udt.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ def _func_udt(
kwargs
All other keyword arguments are passed to ``xgboost.XGBRegressor``.
%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.udt(adata, net, tmin=3)
"""
_check_import(xgboost, "xgboost")
nobs = mat.shape[0]
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_ulm.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ def _func_ulm(
%(tval)s

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.ulm(adata, net, tmin=3)
"""
# Get degrees of freedom
n_var, n_src = adj.shape
Expand Down
8 changes: 8 additions & 0 deletions src/decoupler/mt/_viper.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ def _func_viper(
If ``pleiotropy``, number higher than 1 indicating the penalty for the pleiotropic interactions. 1 = no penalty.

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc
adata, net = dc.ds.toy()
dc.mt.viper(adata, net, tmin=3)
"""
# Get number of batches
n_samples = mat.shape[0]
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_waggr.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ def _func_waggr(
%(seed)s

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.waggr(adata, net, tmin=3)
"""
assert isinstance(fun, str) or callable(fun), "fun must be str or callable"
if isinstance(fun, str):
Expand Down
9 changes: 9 additions & 0 deletions src/decoupler/mt/_zscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ def _func_zscore(
Which flavor to use when calculating the z-score, either KSEA or RoKAI.

%(returns)s

Example
-------
.. code-block:: python

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.zscore(adata, net, tmin=3)
"""
assert isinstance(flavor, str) and flavor in ["KSEA", "RoKAI"], "flavor must be str and KSEA or RoKAI"
nobs, nvar = mat.shape
Expand Down
Loading
Loading