Skip to content

Commit

Permalink
Merge pull request #57 from YosefLab/ori-kron-wis-patch-1
Browse files Browse the repository at this point in the history
dummy PR
  • Loading branch information
canergen authored Dec 13, 2024
2 parents 2d29c9a + c76664e commit 9853e7f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/notebooks/tabula_sapiens_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1254,4 +1254,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
2 changes: 1 addition & 1 deletion tabula_sapiens_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1582,4 +1582,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
30 changes: 14 additions & 16 deletions tests/core/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 9853e7f

Please sign in to comment.