Skip to content

Commit

Permalink
Ruff fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
canergen committed Dec 10, 2023
1 parent 37a63d5 commit cb1a04c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion popv/algorithms/_bbknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(
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,
method_dict: dict | None = None,
classifier_dict: dict | None = None,
embedding_dict: dict | None = None,
) -> None:
Expand Down
16 changes: 8 additions & 8 deletions popv/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,20 @@ def __init__(
f"{self.cl_obo_file} doesn't exist. Check that folder exists."
) from FileNotFoundError

self.check_validity_anndata(self.query_adata, "query")
self.setup_dataset(self.query_adata, "query", add_meta="_query")
self._check_validity_anndata(self.query_adata, "query")
self._setup_dataset(self.query_adata, "query", add_meta="_query")

if self.prediction_mode != "fast":
if self.genes:
self.ref_adata = ref_adata[:, self.genes].copy()
else:
self.ref_adata = ref_adata.copy()
self.setup_dataset(self.ref_adata, "reference")
self.check_validity_anndata(self.ref_adata, "reference")
self._setup_dataset(self.ref_adata, "reference")
self._check_validity_anndata(self.ref_adata, "reference")

self.preprocess()
self._preprocess()

def check_validity_anndata(self, adata, input_type):
def _check_validity_anndata(self, adata, input_type):
assert check_nonnegative_integers(
adata.X
), f"Make sure input {input_type} adata contains raw_counts"
Expand All @@ -230,7 +230,7 @@ def check_validity_anndata(self, adata, input_type):
assert adata.n_obs > 0, f"{input_type} anndata has no cells."
assert adata.n_vars > 0, f"{input_type} anndata has no genes."

def setup_dataset(self, adata, key, add_meta=""):
def _setup_dataset(self, adata, key, add_meta=""):
if isinstance(self.batch_key[key], list):
adata.obs["_batch_annotation"] = (
adata.obs[self.batch_key[key]].astype(str).sum(1).astype("category")
Expand Down Expand Up @@ -268,7 +268,7 @@ def setup_dataset(self, adata, key, add_meta=""):
else:
adata.obs["_ref_subsample"] = False

def preprocess(self):
def _preprocess(self):
if self.genes is None:
self.ref_adata = self.ref_adata[
:, np.intersect1d(self.ref_adata.var_names, self.query_adata.var_names)
Expand Down

0 comments on commit cb1a04c

Please sign in to comment.