Skip to content

Commit

Permalink
Pre-commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
canergen committed Dec 10, 2023
1 parent cbe3c51 commit 5fb8aa7
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 97 deletions.
14 changes: 7 additions & 7 deletions popv/algorithms/_bbknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
class BBKNN:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
result_key: Optional[str] = "popv_knn_on_bbknn_prediction",
embedding_key: Optional[str] = "X_bbknn_umap_popv",
method_dict: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
result_key: str | None = "popv_knn_on_bbknn_prediction",
embedding_key: str | None = "X_bbknn_umap_popv",
method_dict: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
10 changes: 5 additions & 5 deletions popv/algorithms/_celltypist.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
class CELLTYPIST:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
result_key: Optional[str] = "popv_celltypist_prediction",
method_dict: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
result_key: str | None = "popv_celltypist_prediction",
method_dict: dict | None = None,
classifier_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
14 changes: 7 additions & 7 deletions popv/algorithms/_harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
class HARMONY:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
result_key: Optional[str] = "popv_knn_on_harmony_prediction",
embedding_key: Optional[str] = "X_umap_harmony_popv",
method_dict: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
result_key: str | None = "popv_knn_on_harmony_prediction",
embedding_key: str | None = "X_umap_harmony_popv",
method_dict: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after Harmony integration.
Expand Down
14 changes: 7 additions & 7 deletions popv/algorithms/_onclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
class ONCLASS:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
layers_key: Optional[str] = None,
max_iter: Optional[int] = 30,
cell_ontology_obs_key: Optional[str] = None,
result_key: Optional[str] = "popv_onclass_prediction",
seen_result_key: Optional[str] = "popv_onclass_seen",
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
layers_key: str | None = None,
max_iter: Optionalint] = 30,
cell_ontology_obs_key: str | None = None,
result_key: str | None = "popv_onclass_prediction",
seen_result_key: str | None = "popv_onclass_seen",
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
10 changes: 5 additions & 5 deletions popv/algorithms/_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
class RF:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
layers_key: Optional[str] = None,
result_key: Optional[str] = "popv_rf_prediction",
classifier_dict: Optional[str] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
layers_key: str | None = None,
result_key: str | None = "popv_rf_prediction",
classifier_dict: str | None = {},
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
16 changes: 8 additions & 8 deletions popv/algorithms/_scaffold_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class NEW_ALGORITHM:
# Remove embedding key if not an integration method.
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
layers_key: Optional[str] = None,
result_key: Optional[str] = "popv_knn_on_scanorama_prediction",
embedding_key: Optional[str] = "X_umap_scanorma_popv",
method_dict: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
layers_key: str | None = None,
result_key: str | None = "popv_knn_on_scanorama_prediction",
embedding_key: str | None = "X_umap_scanorma_popv",
method_dict: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
14 changes: 7 additions & 7 deletions popv/algorithms/_scanorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
class SCANORAMA:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
result_key: Optional[str] = "popv_knn_on_scanorama_prediction",
embedding_key: Optional[str] = "X_umap_scanorma_popv",
method_dict: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
result_key: str | None = "popv_knn_on_scanorama_prediction",
embedding_key: str | None = "X_umap_scanorma_popv",
method_dict: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
20 changes: 10 additions & 10 deletions popv/algorithms/_scanvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class SCANVI_POPV:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
n_epochs_unsupervised: Optional[int] = None,
n_epochs_semisupervised: Optional[int] = None,
save_folder: Optional[str] = None,
result_key: Optional[str] = "popv_scanvi_prediction",
embedding_key: Optional[str] = "X_scanvi_umap_popv",
model_kwargs: Optional[dict] = {},
classifier_kwargs: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
n_epochs_unsupervised: int | None = None,
n_epochs_semisupervised: int | None = None,
save_folder: str | None = None,
result_key: str | None = "popv_scanvi_prediction",
embedding_key: str | None = "X_scanvi_umap_popv",
model_kwargs: dict | None = None,
classifier_kwargs: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute classifier in scANVI model and predict labels.
Expand Down
18 changes: 9 additions & 9 deletions popv/algorithms/_scvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
class SCVI_POPV:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
max_epochs: Optional[int] = None,
save_folder: Optional[str] = None,
result_key: Optional[str] = "popv_knn_on_scvi_prediction",
embedding_key: Optional[str] = "X_scvi_umap_popv",
model_kwargs: Optional[dict] = {},
classifier_dict: Optional[dict] = {},
embedding_dict: Optional[dict] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
max_epochs: int | None = None,
save_folder: str | None = None,
result_key: str | None = "popv_knn_on_scvi_prediction",
embedding_key: str | None = "X_scvi_umap_popv",
model_kwargs: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
"""
Class to compute KNN classifier after scVI integration.
Expand Down
10 changes: 5 additions & 5 deletions popv/algorithms/_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
class SVM:
def __init__(
self,
batch_key: Optional[str] = "_batch_annotation",
labels_key: Optional[str] = "_labels_annotation",
layers_key: Optional[str] = None,
result_key: Optional[str] = "popv_svm_prediction",
classifier_dict: Optional[str] = {},
batch_key: str | None = "_batch_annotation",
labels_key: str | None = "_labels_annotation",
layers_key: str | None = None,
result_key: str | None = "popv_svm_prediction",
classifier_dict: str | None = {},
) -> None:
"""
Class to compute KNN classifier after BBKNN integration.
Expand Down
8 changes: 4 additions & 4 deletions popv/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

def annotate_data(
adata: anndata.AnnData,
methods: Optional[list] = None,
save_path: Optional[str] = None,
methods_kwargs: Optional[dict] = None,
methods: list | None = None,
save_path: str | None = None,
methods_kwargs: dict | None = None,
) -> None:
"""
Annotate an AnnData dataset preprocessed by preprocessing.Process_Query by using the annotation pipeline.
Expand Down Expand Up @@ -127,7 +127,7 @@ def compute_consensus(adata: anndata.AnnData, prediction_keys: list) -> None:
def ontology_vote_onclass(
adata: anndata.AnnData,
prediction_keys: list,
save_key: Optional[str] = "popv_prediction",
save_key: str | None = "popv_prediction",
):
"""
Compute prediction using ontology aggregation method.
Expand Down
28 changes: 14 additions & 14 deletions popv/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ def __init__(
ref_adata: anndata.AnnData,
ref_labels_key: str = "cell_ontology_class",
ref_batch_key: str = "donor_method",
query_labels_key: Optional[str] = None,
query_batch_key: Optional[str] = None,
query_layers_key: Optional[str] = None,
prediction_mode: Optional[str] = "retrain",
cl_obo_folder: Optional[Union[List, str, bool]] = None,
unknown_celltype_label: Optional[str] = "unknown",
n_samples_per_label: Optional[int] = 300,
pretrained_scvi_path: Optional[str] = None,
save_path_trained_models: Optional[str] = "tmp/",
hvg: Optional[int] = 4000,
accelerator: Optional[str] = "cuda",
devices: Optional[Union[int, str]] = "auto",
compute_embedding: Optional[bool] = True,
return_probabilities: Optional[bool] = True,
query_labels_key: str | None = None,
query_batch_key: str | None = None,
query_layers_key: str | None = None,
prediction_mode: str | None = "retrain",
cl_obo_folder: Union[List, str, bool] | None = None,
unknown_celltype_label: str | None = "unknown",
n_samples_per_label: int | None = 300,
pretrained_scvi_path: str | None = None,
save_path_trained_models: str | None = "tmp/",
hvg: int | None = 4000,
accelerator: str | None = "cuda",
devices: Union[int, str] | None = "auto",
compute_embedding: bool = True,
return_probabilities: bool = True,
) -> None:
"""
Processes the query and reference dataset in preperation for the annotation pipeline.
Expand Down
18 changes: 9 additions & 9 deletions popv/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def _sample_report(adata, cell_type_key, score_key, pred_keys):

def agreement_score_bar_plot(
adata,
popv_prediction_key: Optional[str] = "popv_prediction",
consensus_score_key: Optional[str] = "popv_prediction_score",
save_folder: Optional[str] = None,
popv_prediction_key: str | None = "popv_prediction",
consensus_score_key: str | None = "popv_prediction_score",
save_folder: str | None = None,
):
"""
Create bar-plot of prediction scores in query cells after running popv.
Expand Down Expand Up @@ -142,8 +142,8 @@ def agreement_score_bar_plot(

def prediction_score_bar_plot(
adata,
popv_prediction_score: Optional[str] = "popv_prediction_score",
save_folder: Optional[str] = None,
popv_prediction_score: str | None = "popv_prediction_score",
save_folder: str | None = None,
):
"""
Create bar-plot of prediction scores in query cells after running popv.
Expand Down Expand Up @@ -181,8 +181,8 @@ def prediction_score_bar_plot(

def celltype_ratio_bar_plot(
adata,
popv_prediction: Optional[str] = "popv_prediction",
save_folder: Optional[str] = None,
popv_prediction: str | None = "popv_prediction",
save_folder: str | None = None,
):
"""
Create bar-plot of celltype rations in query as well as reference cells after running popv.
Expand Down Expand Up @@ -223,8 +223,8 @@ def celltype_ratio_bar_plot(
def make_agreement_plots(
adata,
prediction_keys: list,
popv_prediction_key: Optional[str] = "popv_prediction",
save_folder: Optional[str] = None,
popv_prediction_key: str | None = "popv_prediction",
save_folder: str | None = None,
):
"""
Create plot of confusion matrix for different popv methods and consensus prediction.
Expand Down

0 comments on commit 5fb8aa7

Please sign in to comment.