Skip to content

Commit

Permalink
【Add】 format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhenbin24 committed Dec 7, 2023
1 parent e195717 commit 67150ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions stereo/algorithm/ccd/community_clustering_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ def plot_clustering(self):
if 'unknown' in labels:
labels = labels[labels != 'unknown']
if len(labels) > len(self.cluster_palette):
logger.warning(f"Number of clusters ({len(labels)}) is larger than pallette size. All clusters will be colored gray.")
self.cluster_palette = {l: '#CCCCCC' for l in labels}
logger.warning(f"Number of clusters ({len(labels)}) is larger than pallette size. All clusters will be "
f"colored gray.")
self.cluster_palette = {label: '#CCCCCC' for label in labels}
self.cluster_palette['unknown'] = '#CCCCCC'
plot_spatial(self.adata, annotation=f'tissue_{self.method_key}', palette=self.cluster_palette,
spot_size=self.spot_size, ax=ax, title=f'{self.adata.uns["sample_name"]}')
Expand Down
3 changes: 2 additions & 1 deletion stereo/algorithm/community_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ def plot_all_slices(self, img_name, clustering=False):
annotation = f'tissue_{self.algo_list[0].method_key}' if clustering else self.algo_list[0].annotation
clusters = np.unique(algo.adata.obs[annotation].values)
if len(clusters) > len(cluster_palette):
logger.warning(f"Number of clusters ({len(clusters)}) is larger than pallette size. All clusters will be colored gray.")
logger.warning(f"Number of clusters ({len(clusters)}) is larger than pallette size. All clusters "
f"will be colored gray.")
plot_spatial(algo.adata, annotation=annotation, palette=palette, spot_size=algo.spot_size, ax=ax)
ax.get_legend().remove()
ax.set_title(f'{algo.filename}', fontsize=6, loc='center', wrap=True)
Expand Down
1 change: 1 addition & 0 deletions stereo/plots/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def _action(_, figure: Figure):

return wrapped


def download_only(func):
@wraps(func)
def wrapped(*args, **kwargs):
Expand Down

0 comments on commit 67150ce

Please sign in to comment.