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

Small edits #599

Merged
merged 8 commits into from
Oct 19, 2023
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
5 changes: 3 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ If you run into "RuntimeError: CMake must be installed to build qdldl" ensure th
Run `conda install -c anaconda cmake` and `conda install -c conda-forge lightgbm` to do so.

If you intend to run MedCAT you have to install a language model like:
.. code-block:: console

> \$ python -m spacy download en_core_web_sm
```console
$ python -m spacy download en_core_web_sm
```

## From sources

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ In contrast to a preprocessing function, a tool usually adds an easily interpret

## Plotting

The plotting module ehrapy.pl.\* largely parallels the tl.\* and a few of the pp.\* functions.
The plotting module `ehrapy.pl.\*` largely parallels the `tl.\*` and a few of the `pp.\*` functions.
For most tools and for some preprocessing functions, you will find a plotting function with the same name.

### Generic
Expand Down
2 changes: 1 addition & 1 deletion ehrapy/data/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def heart_failure(encoded: bool = False, columns_obs_only: dict[str, list[str]]
columns_obs_only: Columns to include in obs only and not X.

Returns:
:class:`~anndata.AnnData` object of the MIMIC-II dataset
:class:`~anndata.AnnData` object of the heart failure dataset

Examples:
>>> import ehrapy as ep
Expand Down
4 changes: 2 additions & 2 deletions ehrapy/preprocessing/_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def encode(
>>> # encode all autodetected (non numerical) columns using label encoding
>>> adata_encoded = ep.pp.encode(adata, autodetect=True)

# Example using autodetect with non-default encoding mode:
>>> # Example using autodetect with non-default encoding mode:
>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2()
>>> # encode all auto-detected (non numerical) columns using one hot encoding
>>> adata_encoded = ep.pp.encode(adata, autodetect=True, encodings='one_hot_encoding')

# Example using custom encodings per columns:
>>> # Example using custom encodings per columns:
>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2()
>>> # encode col1 and col2 using label encoding and encode col3 using one hot encoding
Expand Down
2 changes: 1 addition & 1 deletion ehrapy/preprocessing/_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def quantile_norm(
) -> AnnData | None:
"""Apply quantile normalization.

Functionality is provided by ~sklearn.preprocessing.quantile_transform,
Functionality is provided by :func:`~sklearn.preprocessing.quantile_transform`,
see https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.quantile_transform.html for details.

Args:
Expand Down
12 changes: 7 additions & 5 deletions ehrapy/preprocessing/_scanpy_pp_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ def pca(
chunk_size: Number of observations to include in each chunk. Required if `chunked=True` was passed.

Returns:
X_pca: :class:`~scipy.sparse.spmatrix`, :class:`~numpy.ndarray`
If `data` is array-like and `return_info=False` was passed, this function only returns `X_pca`.
:X_pca: :class:`~scipy.sparse.spmatrix`, :class:`~numpy.ndarray`

If `data` is array-like and `return_info=False` was passed, this function only returns `X_pca`...

adata : :class:`~anndata.AnnData`

adata : anndata.AnnData
…otherwise if `copy=True` it returns or else adds fields to `adata`:

`.obsm['X_pca']`
Expand Down Expand Up @@ -155,7 +157,7 @@ def combat(
inplace: Whether to replace adata.X or to return the corrected data

Returns:
Depending on the value of `inplace`, either returns the corrected matrix or or modifies `adata.X`.
Depending on the value of `inplace`, either returns the corrected matrix or modifies `adata.X`.
"""
return sc.pp.combat(adata=adata, key=key, covariates=covariates, inplace=inplace)

Expand Down Expand Up @@ -230,7 +232,7 @@ def neighbors(
copy: Determines whether a copy of `adata` is returned.

Returns:
Depending on `copy`, updates or returns `adata` with the following:
Depending on `copy`, updates or returns `adata` with the following;
See `key_added` parameter description for the storage path of connectivities and distances.

**connectivities** : sparse matrix of dtype `float32`.
Expand Down
7 changes: 4 additions & 3 deletions ehrapy/tools/_scanpy_tl_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ def louvain(
copy: Whether to copy `adata` or modify it inplace.

Returns:
By default (``copy=False``), updates ``adata`` with the following fields:
By default (``copy=False``), updates ``adata`` with the following fields;

``adata.obs['louvain']`` (:class:`pandas.Series`, dtype ``category``)
Array of dim (number of samples) that stores the subgroup id (``'0'``, ``'1'``, ...) for each observation.

Expand Down Expand Up @@ -674,10 +675,10 @@ def paga(
copy: Copy `adata` before computation and return a copy. Otherwise, perform computation in place and return `None`.

Returns:
**connectivities** : :class:`numpy.ndarray` (adata.uns['connectivities'])
**connectivities** :class:`numpy.ndarray` (adata.uns['connectivities'])
The full adjacency matrix of the abstracted graph, weights correspond to confidence in the connectivities of partitions.

**connectivities_tree** : :class:`scipy.sparse.csr_matrix` (adata.uns['connectivities_tree'])
**connectivities_tree** :class:`scipy.sparse.csr_matrix` (adata.uns['connectivities_tree'])
The adjacency matrix of the tree-like subgraph that best explains the topology.

Notes:
Expand Down
Loading