From a8a1bdb207527f6e6fa92b302665ec06e58d164e Mon Sep 17 00:00:00 2001 From: Ori Kronfeld Date: Thu, 12 Dec 2024 15:16:27 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3c4471..09226df 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # PopV -PopV uses popular vote of a variety of cell-type transfer tools to classify cell-types in a query dataset based on a test dataset. +PopV uses popular vote of a variety of cell-type transfer tools to classify cell-types in a query dataset based on a test dataset. Using this variety of algorithms, we compute the agreement between those algorithms and use this agreement to predict which cell-types are with a high likelihood the same cell-types observed in the reference. ## Algorithms From c76664e4923c3413f5a960866d439ff8d427ad48 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:17:19 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- README.md | 2 +- docs/notebooks/tabula_sapiens_tutorial.ipynb | 2 +- tabula_sapiens_tutorial.ipynb | 2 +- tests/core/test_models.py | 30 +++++++++----------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 09226df..d3c4471 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # PopV -PopV uses popular vote of a variety of cell-type transfer tools to classify cell-types in a query dataset based on a test dataset. +PopV uses popular vote of a variety of cell-type transfer tools to classify cell-types in a query dataset based on a test dataset. Using this variety of algorithms, we compute the agreement between those algorithms and use this agreement to predict which cell-types are with a high likelihood the same cell-types observed in the reference. ## Algorithms diff --git a/docs/notebooks/tabula_sapiens_tutorial.ipynb b/docs/notebooks/tabula_sapiens_tutorial.ipynb index 03dd337..f380c47 100644 --- a/docs/notebooks/tabula_sapiens_tutorial.ipynb +++ b/docs/notebooks/tabula_sapiens_tutorial.ipynb @@ -1254,4 +1254,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/tabula_sapiens_tutorial.ipynb b/tabula_sapiens_tutorial.ipynb index 2722a92..fb07b36 100644 --- a/tabula_sapiens_tutorial.ipynb +++ b/tabula_sapiens_tutorial.ipynb @@ -1582,4 +1582,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/tests/core/test_models.py b/tests/core/test_models.py index dad6c1d..0a0b3f3 100644 --- a/tests/core/test_models.py +++ b/tests/core/test_models.py @@ -10,7 +10,7 @@ from popv.reproducibility import _accuracy -def _get_test_anndata(cl_obo_folder="resources/ontology/", mode='retrain'): +def _get_test_anndata(cl_obo_folder="resources/ontology/", mode="retrain"): print("UUU", os.getcwd()) save_folder = "tests/tmp_testing/popv_test_results/" fn = save_folder + "annotated_query.h5ad" @@ -180,41 +180,39 @@ def test_celltypist(): def test_annotation(): """Test Annotation and Plotting pipeline.""" adata = _get_test_anndata().adata - popv.annotation.annotate_data( - adata, methods=["svm", "rf"], - save_path="tests/tmp_testing/popv_test_results/") + popv.annotation.annotate_data(adata, methods=["svm", "rf"], save_path="tests/tmp_testing/popv_test_results/") popv.visualization.agreement_score_bar_plot(adata) popv.visualization.prediction_score_bar_plot(adata) popv.visualization.make_agreement_plots(adata, prediction_keys=adata.uns["prediction_keys"], show=False) popv.visualization.celltype_ratio_bar_plot(adata) obo_fn = "resources/ontology/cl.obo" - _accuracy._ontology_accuracy(adata[adata.obs['_dataset']=='ref'], obofile=obo_fn, gt_key='cell_ontology_class', pred_key='popv_prediction') - _accuracy._fine_ontology_sibling_accuracy(adata[adata.obs['_dataset']=='ref'], obofile=obo_fn, gt_key='cell_ontology_class', pred_key='popv_prediction') + _accuracy._ontology_accuracy( + adata[adata.obs["_dataset"] == "ref"], obofile=obo_fn, gt_key="cell_ontology_class", pred_key="popv_prediction" + ) + _accuracy._fine_ontology_sibling_accuracy( + adata[adata.obs["_dataset"] == "ref"], obofile=obo_fn, gt_key="cell_ontology_class", pred_key="popv_prediction" + ) assert "popv_majority_vote_prediction" in adata.obs.columns assert not adata.obs["popv_majority_vote_prediction"].isnull().any() - adata = _get_test_anndata(mode='inference').adata - popv.annotation.annotate_data( - adata, save_path="tests/tmp_testing/popv_test_results/") + adata = _get_test_anndata(mode="inference").adata + popv.annotation.annotate_data(adata, save_path="tests/tmp_testing/popv_test_results/") - adata = _get_test_anndata(mode='fast').adata - popv.annotation.annotate_data( - adata, save_path="tests/tmp_testing/popv_test_results/") + adata = _get_test_anndata(mode="fast").adata + popv.annotation.annotate_data(adata, save_path="tests/tmp_testing/popv_test_results/") def test_annotation_no_ontology(): """Test Annotation and Plotting pipeline without ontology.""" adata = _get_test_anndata(cl_obo_folder=False).adata - popv.annotation.annotate_data( - adata, methods=["svm", "rf"], - save_path="tests/tmp_testing/popv_test_results/") + popv.annotation.annotate_data(adata, methods=["svm", "rf"], save_path="tests/tmp_testing/popv_test_results/") popv.visualization.agreement_score_bar_plot(adata) popv.visualization.prediction_score_bar_plot(adata) popv.visualization.make_agreement_plots(adata, prediction_keys=adata.uns["prediction_keys"]) popv.visualization.celltype_ratio_bar_plot(adata, save_folder="tests/tmp_testing/popv_test_results/") popv.visualization.celltype_ratio_bar_plot(adata, normalize=False) - adata.obs['empty_columns'] = 'a' + adata.obs["empty_columns"] = "a" input_data = adata.obs[["empty_columns", "popv_rf_prediction"]].values.tolist() popv.reproducibility._alluvial.plot(input_data)