Skip to content

Commit

Permalink
Merge pull request #6 from huidongchen/fix_bugs
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
huidongchen authored Mar 24, 2023
2 parents 1f5a2b4 + fb0b0c6 commit ab48484
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
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

0 comments on commit ab48484

Please sign in to comment.