Skip to content

Commit

Permalink
bug fix pwm clustering plot
Browse files Browse the repository at this point in the history
  • Loading branch information
nkempynck committed Jan 27, 2025
1 parent f20b0a4 commit b060190
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/crested/pl/patterns/_modisco_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ def clustermap_with_pwm_logos(

# Subset the pattern_dict to match filtered columns
selected_patterns = [pattern_dict[str(i)] for i in np.where(above_threshold)[0]]
selected_indices = list(np.where(above_threshold)[0])

data = pd.DataFrame(pattern_matrix)

Expand All @@ -456,6 +457,7 @@ def clustermap_with_pwm_logos(

# Reorder selected_patterns based on clustering
reordered_patterns = [selected_patterns[i] for i in col_order]
reordered_indices = [selected_indices[i] for i in col_order]

# Compute space for x-tick images
original_height = figsize[1]
Expand Down Expand Up @@ -508,7 +510,7 @@ def clustermap_with_pwm_logos(
ax = g.ax_heatmap
ax.xaxis.tick_bottom()
ax.set_xticks(np.arange(pattern_matrix.shape[1]) + 0.5)
ax.set_xticklabels([f"{i}" for i in col_order], rotation=90)
ax.set_xticklabels([str(i) for i in reordered_indices], rotation=90)
for tick in ax.get_xticklabels():
tick.set_verticalalignment("top")

Expand Down

0 comments on commit b060190

Please sign in to comment.