From 851007c0282f9eab240d442b65b95a0b1bb118f0 Mon Sep 17 00:00:00 2001 From: Lukas Heumos Date: Wed, 16 Oct 2024 14:03:38 +0200 Subject: [PATCH] Augur scsim warnings (#670) * Augur scsim warnings Signed-off-by: zethson * Submodules Signed-off-by: zethson --------- Signed-off-by: zethson --- .gitignore | 2 ++ pertpy/data/_datasets.py | 2 +- pertpy/tools/_augur.py | 4 ++-- pyproject.toml | 3 ++- tests/tools/test_augur.py | 3 +-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 51eae12d..5cdcc395 100644 --- a/.gitignore +++ b/.gitignore @@ -155,3 +155,5 @@ lightning_logs/* */lightning_logs/* node_modules + +test.ipynb diff --git a/pertpy/data/_datasets.py b/pertpy/data/_datasets.py index ddd6d0bb..4fe7904d 100644 --- a/pertpy/data/_datasets.py +++ b/pertpy/data/_datasets.py @@ -66,7 +66,7 @@ def sc_sim_augur() -> AnnData: # pragma: no cover output_file_path = settings.datasetdir / output_file_name if not Path(output_file_path).exists(): _download( - url="https://figshare.com/ndownloader/files/31645886", + url="https://figshare.com/ndownloader/files/49828902", output_file_name=output_file_name, output_path=settings.datasetdir, is_zip=False, diff --git a/pertpy/tools/_augur.py b/pertpy/tools/_augur.py index bd226f6f..17615ef8 100644 --- a/pertpy/tools/_augur.py +++ b/pertpy/tools/_augur.py @@ -25,11 +25,11 @@ explained_variance_score, f1_score, make_scorer, - mean_squared_error, precision_score, r2_score, recall_score, roc_auc_score, + root_mean_squared_error, ) from sklearn.model_selection import StratifiedKFold, cross_validate from sklearn.preprocessing import LabelEncoder @@ -440,7 +440,7 @@ def set_scorer( "augur_score": make_scorer(self.ccc_score), "r2": make_scorer(r2_score), "ccc": make_scorer(self.ccc_score), - "neg_mean_squared_error": make_scorer(mean_squared_error), + "neg_mean_squared_error": make_scorer(root_mean_squared_error), "explained_variance": make_scorer(explained_variance_score), } ) diff --git a/pyproject.toml b/pyproject.toml index c48ff25c..92d0af5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,7 +125,8 @@ addopts = [ ] markers = [ "conda: marks a subset of tests to be ran on the Bioconda CI.", - "extra: marks tests that require extra dependencies." + "extra: marks tests that require extra dependencies.", + "slow: mark test as slow to run" ] minversion = 6.0 norecursedirs = [ '.*', 'build', 'dist', '*.egg', 'data', '__pycache__'] diff --git a/tests/tools/test_augur.py b/tests/tools/test_augur.py index 55fda674..04df97e8 100644 --- a/tests/tools/test_augur.py +++ b/tests/tools/test_augur.py @@ -6,7 +6,6 @@ import pytest import scanpy as sc from pertpy.tools._augur import Params -from sklearn.ensemble import RandomForestRegressor CWD = Path(__file__).parent.resolve() @@ -145,7 +144,7 @@ def test_select_variance(adata): """Test select variance implementation.""" adata = ag_rfc.load(adata) sc.pp.highly_variable_genes(adata) - adata_cell_type = adata[adata.obs["cell_type"] == "CellTypeA"] + adata_cell_type = adata[adata.obs["cell_type"] == "CellTypeA"].copy() ad = ag_rfc.select_variance(adata_cell_type, var_quantile=0.5, span=0.3, filter_negative_residuals=False) assert 3672 == len(ad.var.index[ad.var["highly_variable"]])