Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <[email protected]>
  • Loading branch information
Zethson committed Jan 6, 2025
1 parent 4903d6a commit bb6d188
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 92 deletions.
8 changes: 4 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

<!-- Please fill in the appropriate checklist below (delete whatever is not relevant). These are the most common things requested on pull requests (PRs). -->

- [ ] This comment contains a description of changes (with reason)
- [ ] Referenced issue is linked
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] Documentation in `docs` is updated
- [ ] This comment contains a description of changes (with reason)
- [ ] Referenced issue is linked
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] Documentation in `docs` is updated

**Description of changes**

Expand Down
28 changes: 14 additions & 14 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or
electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or
electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

## Features

- Exploratory and targeted analysis of Electronic Health Records
- Quality control & preprocessing
- Visualization & Exploration
- Clustering & trajectory inference
- Exploratory and targeted analysis of Electronic Health Records
- Quality control & preprocessing
- Visualization & Exploration
- Clustering & trajectory inference

## Installation

Expand Down
18 changes: 9 additions & 9 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ in the cookiecutter-scverse template.

Please write documentation for new or changed features and use-cases. This project uses [sphinx][] with the following features:

- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text
- Google-style docstrings
- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
- [Sphinx autodoc typehints][], to automatically reference annotated input and output types
- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/)
- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text
- Google-style docstrings
- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
- [Sphinx autodoc typehints][], to automatically reference annotated input and output types
- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/)

See the [scanpy developer docs](https://scanpy.readthedocs.io/en/latest/dev/documentation.html) for more information
on how to write documentation.
Expand All @@ -144,10 +144,10 @@ These notebooks come from [pert-tutorials](https://github.com/theislab/ehrapy-tu

#### Hints

- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only
if you do so can sphinx automatically create a link to the external documentation.
- If building the documentation fails because of a missing link that is outside your control, you can add an entry to
the `nitpick_ignore` list in `docs/conf.py`
- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only
if you do so can sphinx automatically create a link to the external documentation.
- If building the documentation fails because of a missing link that is outside your control, you can add an entry to
the `nitpick_ignore` list in `docs/conf.py`

#### Building the docs locally

Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ medRxiv 2023.12.11.23299816; doi: https://doi.org/10.1101/2023.12.11.23299816 ](

# Indices and tables

- {ref}`genindex`
- {ref}`modindex`
- {ref}`search`
- {ref}`genindex`
- {ref}`modindex`
- {ref}`search`

[scanpy genome biology (2018)]: https://doi.org/10.1186/s13059-017-1382-0
8 changes: 4 additions & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ pip install ehrapy[medcat]

Available language models are

- en_core_web_md (python -m spacy download en_core_web_md)
- en-core-sci-sm (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_sm-0.4.0.tar.gz>)
- en-core-sci-md (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_md-0.4.0.tar.gz>)
- en-core-sci-lg (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_lg-0.4.0.tar.gz>)
- en_core_web_md (python -m spacy download en_core_web_md)
- en-core-sci-sm (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_sm-0.4.0.tar.gz>)
- en-core-sci-md (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_md-0.4.0.tar.gz>)
- en-core-sci-lg (pip install <https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_lg-0.4.0.tar.gz>)

[github repo]: https://github.com/theislab/ehrapy
[pip]: https://pip.pypa.io
Expand Down
5 changes: 5 additions & 0 deletions ehrapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
__email__ = "[email protected]"
__version__ = "0.9.0"

import os

# https://docs.scipy.org/doc/scipy/dev/api-dev/array_api.html
os.environ["SCIPY_ARRAY_API"] = "1"

from ehrapy._settings import EhrapyConfig, ehrapy_settings

settings: EhrapyConfig = ehrapy_settings
Expand Down
48 changes: 9 additions & 39 deletions ehrapy/core/meta_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
from datetime import datetime

import session_info
from rich import print
from scanpy.logging import _versions_dependencies

Expand All @@ -17,23 +16,7 @@ def print_versions(): # pragma: no cover
>>> import ehrapy as ep
>>> ep.print_versions()
"""
try:
session_info.show(
dependencies=True,
html=False,
excludes=[
"builtins",
"stdlib_list",
"importlib_metadata",
"jupyter_core"
# Special module present if test coverage being calculated
# https://gitlab.com/joelostblom/session_info/-/issues/10
"$coverage",
],
)
except AttributeError:
print("[bold yellow]Unable to fetch versions for one or more dependencies.")
pass
print_header()


def print_version_and_date(*, file=None): # pragma: no cover
Expand All @@ -47,26 +30,13 @@ def print_version_and_date(*, file=None): # pragma: no cover


def print_header(*, file=None): # pragma: no cover
"""Versions that might influence the numerical results.
"""Versions that might influence the numerical results."""
from session_info2 import session_info

Matplotlib and Seaborn are excluded from this.
"""
_DEPENDENCIES_NUMERICS = [
"scanpy",
"anndata",
"umap",
"numpy",
"scipy",
"pandas",
("sklearn", "scikit-learn"),
"statsmodels",
("igraph", "python-igraph"),
"leidenalg",
"pynndescent",
]
sinfo = session_info(os=True, cpu=True, gpu=True, dependencies=True)

modules = ["ehrapy"] + _DEPENDENCIES_NUMERICS
print(
" ".join(f"{mod}=={ver}" for mod, ver in _versions_dependencies(modules)),
file=file or sys.stdout,
)
if file is not None:
print(sinfo, file=file)
return

return sinfo
3 changes: 2 additions & 1 deletion ehrapy/tools/feature_ranking/_rank_features_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections.abc import Iterable
from typing import TYPE_CHECKING, Literal

import anndata as ad
import numpy as np
import pandas as pd
import scanpy as sc
Expand Down Expand Up @@ -446,7 +447,7 @@ def rank_features_groups(
X_to_keep = np.zeros((len(adata), 1))
var_to_keep = pd.DataFrame({"dummy": [0]})

adata_minimal = sc.AnnData(
adata_minimal = ad.AnnData(
X=X_to_keep,
obs=adata.obs,
var=var_to_keep,
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ classifiers = [
]

dependencies = [
"session-info",
"session-info2",
"lamin_utils",
"rich",
"scanpy[leiden]",
Expand Down Expand Up @@ -135,7 +135,8 @@ filterwarnings = [
"ignore:X converted to numpy array with dtype object:UserWarning",
"ignore:`flavor='seurat_v3'` expects raw count data, but non-integers were found:UserWarning",
"ignore:All-NaN slice encountered:RuntimeWarning",
"ignore:Observation names are not unique. To make them unique, call `.obs_names_make_unique`.:UserWarning"
"ignore:Observation names are not unique. To make them unique, call `.obs_names_make_unique`.:UserWarning",
"ignore:Trying to modify attribute .var of view"
]
minversion = 6.0
norecursedirs = [ '.*', 'build', 'dist', '*.egg', 'data', '__pycache__']
Expand Down
4 changes: 2 additions & 2 deletions tests/anndata/test_anndata_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def setup_binary_df_to_anndata() -> DataFrame:
col2_val = ["another_str" + str(idx) for idx in range(100)]
col3_val = [0 for _ in range(100)]
col4_val = [1.0 for _ in range(100)]
col5_val = [0.0 if idx % 2 == 0 else np.NaN for idx in range(100)]
col5_val = [0.0 if idx % 2 == 0 else np.nan for idx in range(100)]
col6_val = [idx % 2 for idx in range(100)]
col7_val = [float(idx % 2) for idx in range(100)]
col8_val = [idx % 3 if idx % 3 in {0, 1} else np.NaN for idx in range(100)]
col8_val = [idx % 3 if idx % 3 in {0, 1} else np.nan for idx in range(100)]
df = DataFrame(
{
"col1": col1_val,
Expand Down
20 changes: 10 additions & 10 deletions tests/preprocessing/test_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ def test_norm_power_kwargs(array_type, adata_to_norm):
num1_norm = np.array([201.03636, 1132.8341, 1399.3877], dtype=np.float32)
num2_norm = np.array([-1.8225479, 5.921072, 3.397709], dtype=np.float32)

assert np.allclose(adata_norm.X[:, 3], num1_norm)
assert np.allclose(adata_norm.X[:, 4], num2_norm)
assert np.allclose(adata_norm.X[:, 3], num1_norm, rtol=1e-02, atol=1e-02)
assert np.allclose(adata_norm.X[:, 4], num2_norm, rtol=1e-02, atol=1e-02)


@pytest.mark.parametrize("array_type", ARRAY_TYPES)
Expand Down Expand Up @@ -540,14 +540,14 @@ def test_norm_power_group(array_type, adata_mini):
)
col2_norm = np.array(
[
-1.34342372,
-0.44542197,
0.44898626,
1.33985944,
-1.34344617,
-0.4453993,
0.44900845,
1.33983703,
-1.3650659,
-0.41545486,
0.45502198,
1.3254988,
-1.3427324,
-0.4461177,
0.44829938,
1.3405508,
],
dtype=np.float32,
)
Expand Down

0 comments on commit bb6d188

Please sign in to comment.