Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2024
1 parent cc83b1a commit ce57fa9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
6 changes: 3 additions & 3 deletions popv/algorithms/_celltypist.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def predict(self, adata):

adata.obs[self.result_key] = predictions.predicted_labels[out_column]
if adata.uns["_return_probabilities"]:
adata.obs[
self.result_key + "_probabilities"
] = predictions.probability_matrix.max(axis=1).values
adata.obs[self.result_key + "_probabilities"] = (
predictions.probability_matrix.max(axis=1).values
)

def compute_embedding(self, adata):
pass
6 changes: 3 additions & 3 deletions popv/algorithms/_onclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def predict(self, adata):
logging.info(
f'Computing Onclass. Storing prediction in adata.obs["{self.result_key}"]'
)
adata.obs.loc[
adata.obs["_dataset"] == "query", self.cell_ontology_obs_key
] = adata.uns["unknown_celltype_label"]
adata.obs.loc[adata.obs["_dataset"] == "query", self.cell_ontology_obs_key] = (
adata.uns["unknown_celltype_label"]
)

train_idx = adata.obs["_dataset"] == "ref"

Expand Down
24 changes: 11 additions & 13 deletions popv/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,17 @@ def _preprocess(self):
except (
ValueError
): # seurat_v3 tends to error with singularities then use Poisson hvg.
self.adata.var[
"highly_variable"
] = sc.experimental.pp.highly_variable_genes(
self.adata[self.adata.obs["_dataset"] == "ref"].copy(),
n_top_genes=self.hvg,
subset=False,
layer="scvi_counts",
flavor="pearson_residuals",
inplace=False,
batch_key="_batch_annotation",
)[
"highly_variable"
]
self.adata.var["highly_variable"] = (
sc.experimental.pp.highly_variable_genes(
self.adata[self.adata.obs["_dataset"] == "ref"].copy(),
n_top_genes=self.hvg,
subset=False,
layer="scvi_counts",
flavor="pearson_residuals",
inplace=False,
batch_key="_batch_annotation",
)["highly_variable"]
)
self.adata = self.adata[:, self.adata.var["highly_variable"]].copy()

sc.pp.normalize_total(self.adata, target_sum=1e4)
Expand Down
4 changes: 1 addition & 3 deletions popv/reproducibility/_alluvial.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ def get_color_array(
lci = len(color_items)
if rand_seed is not None:
np.random.seed(rand_seed)
cmap = (
cmap if cmap is not None else matplotlib.cm.get_cmap("hsv", lci * 10**3)
)
cmap = cmap if cmap is not None else matplotlib.cm.get_cmap("hsv", lci * 10**3)
color_array = (
colors
if colors is not None
Expand Down

0 comments on commit ce57fa9

Please sign in to comment.