Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cell2location/plt/plot_expected_vs_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ def plot_expected_vs_obs(
# extract from anndata and convert to numpy if needed
x = data[:, gene1].X
y = data[:, gene2].X
x_mu = mu[:, np.where(data.var_names == gene1)][mu[:, np.where(data.var_names == gene1)] > 0].flatten()
y_mu = mu[:, np.where(data.var_names == gene2)][mu[:, np.where(data.var_names == gene2)] > 0].flatten()
x_mu = mu[:, np.where(np.array(data.var_names == gene1))][
mu[:, np.where(np.array(data.var_names == gene1))] > 0
].flatten()
y_mu = mu[:, np.where(np.array(data.var_names == gene2))][
mu[:, np.where(np.array(data.var_names == gene2))] > 0
].flatten()

from anndata._core.views import SparseCSRView
from scipy.sparse.csr import csr_matrix
Expand Down
2 changes: 1 addition & 1 deletion cell2location/run_colocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def run_colocation(
if sc_spatial_present:
sc.settings.figdir = fig_path

s_ind = sp_data.obs[train_args["sample_name_col"]] == s
s_ind = (sp_data.obs[train_args["sample_name_col"]] == s).values
s_keys = list(sp_data.uns["spatial"].keys())
s_spatial = np.array(s_keys)[[s in i for i in s_keys]][0]

Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/tutorial_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def plot_genes_per_cell_type(slide, genes, ctypes):
# limit color scale at 99.2% quantile of gene expression (computed across cell types)
quantile_across_ct = np.array(
[
np.quantile(slide.layers[n][:, slide.var["SYMBOL"] == genes[j]].toarray(), 0.992)
np.quantile(slide.layers[n][:, (slide.var["SYMBOL"] == genes[j]).values].toarray(), 0.992)
for n in slide.uns["mod"]["factor_names"]
]
)
Expand Down