Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs #6

Merged
merged 2 commits into from
Mar 24, 2023
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
20 changes: 10 additions & 10 deletions simba/plotting/_post_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ def entity_barcode(adata_cmp,


def query(adata,
comp1=1,
comp2=2,
comp1=0,
comp2=1,
obsm='X_umap',
layer=None,
color=None,
Expand Down Expand Up @@ -464,9 +464,9 @@ def query(adata,
----------
adata : `Anndata`
Annotated data matrix.
comp1 : `int`, optional (default: 1)
comp1 : `int`, optional (default: 0)
Component used for x axis.
comp2 : `int`, optional (default: 2)
comp2 : `int`, optional (default: 1)
Component used for y axis.
obsm : `str`, optional (default: 'X_umap')
The field to use for plotting
Expand Down Expand Up @@ -583,10 +583,10 @@ def query(adata,
X = adata.X.copy()
X_nn = adata[nn, :].X.copy()
df_plot = pd.DataFrame(index=adata.obs.index,
data=X[:, [comp1-1, comp2-1]],
data=X[:, [comp1, comp2]],
columns=[f'Dim {comp1}', f'Dim {comp2}'])
df_plot_nn = pd.DataFrame(index=adata[nn, :].obs.index,
data=X_nn[:, [comp1-1, comp2-1]],
data=X_nn[:, [comp1, comp2]],
columns=[f'Dim {comp1}', f'Dim {comp2}'])
if show_texts:
if texts is None:
Expand Down Expand Up @@ -666,14 +666,14 @@ def query(adata,
alpha=alpha,
lw=0)
if pin is not None:
ax.scatter(pin[:, 0],
pin[:, 1],
ax.scatter(pin[:, comp1],
pin[:, comp2],
s=20*size,
marker='+',
color='#B33831')
if use_radius:
circle = plt.Circle((pin[:, 0],
pin[:, 1]),
circle = plt.Circle((pin[:, comp1],
pin[:, comp2]),
radius=r,
color='#B33831',
fill=False)
Expand Down
2 changes: 1 addition & 1 deletion simba/tools/_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def discretize(adata,
density=False)
hist_centroids = (hist_edges[0:-1] + hist_edges[1:])/2

kmeans = KMeans(n_clusters=n_bins, random_state=2021).fit(
kmeans = KMeans(n_clusters=n_bins, random_state=2021, n_init='auto').fit(
hist_centroids.reshape(-1, 1),
sample_weight=hist_count)
cluster_centers = np.sort(kmeans.cluster_centers_.flatten())
Expand Down