Skip to content

Commit

Permalink
Fixed the scale method and color bar of heatmap for Cross Test result…
Browse files Browse the repository at this point in the history
… table.
  • Loading branch information
byemaxx committed Aug 10, 2024
1 parent 003f32c commit 1b227d4
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 278 deletions.
5 changes: 5 additions & 0 deletions Docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version: 1.109.11
## Date: 2024-08-10
### Changes:
- Fix: Fixed the scale method and color bar of heatmap for Cross Test result table.

# Version: 1.109.10
## Date: 2024-08-9
### Changes:
Expand Down
23 changes: 15 additions & 8 deletions metax/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def __init__(self, MainWindow):
self.pushButton_get_top_cross_table.clicked.connect(self.get_top_cross_table)

self.tabWidget_3.currentChanged.connect(self.cross_test_tab_change)
self.comboBox_top_heatmap_scale.currentIndexChanged.connect(self.change_event_comboBox_top_heatmap_scale)

### ANOVA
self.pushButton_anova_test.clicked.connect(self.anova_test)
Expand Down Expand Up @@ -1465,6 +1466,11 @@ def cross_test_tab_change(self, index):
else:
self.groupBox_cross_heatmap_plot.setVisible(True)

def change_event_comboBox_top_heatmap_scale(self):
if self.comboBox_top_heatmap_scale.currentText() == 'None':
self.comboBox_top_heatmap_scale_method.setEnabled(False)
else:
self.comboBox_top_heatmap_scale_method.setEnabled(True)

def add_theme_to_combobox(self):
# get all themes
Expand Down Expand Up @@ -4393,7 +4399,7 @@ def plot_top_heatmap(self):
scale = scale, col_cluster = col_luster, row_cluster = row_luster,
cmap = cmap, rename_taxa=rename_taxa, font_size=font_size,
show_all_labels = show_all_labels, rename_sample = rename_sample,
sort_by = sort_by, scale_method = scale_method)
sort_by = sort_by, scale_method = scale_method, return_type = 'fig')

except Exception as e:
error_message = traceback.format_exc()
Expand Down Expand Up @@ -4453,16 +4459,17 @@ def get_top_cross_table(self):

else:
if 'taxa-functions' in table_name:
df_top_cross = HeatmapPlot(self.tfa, **self.heatmap_params_dict).get_top_across_table(df=df, top_number=top_num,
df_top_cross = HeatmapPlot(self.tfa, **self.heatmap_params_dict).plot_top_taxa_func_heatmap_of_test_res(df=df, top_number=top_num,
col_cluster = col_luster, row_cluster = row_luster,
value_type=value_type, pvalue=pvalue,
rename_taxa=rename_taxa, scale = scale, scale_method = scale_method)
value_type=value_type, pvalue=pvalue, rename_taxa=rename_taxa, scale = scale, scale_method = scale_method,
return_type = 'table')
else: # get result of test and anova of [taxa, functions, peptides and custom table]
# get the intensity of the result items which are significant
df_top_cross = HeatmapPlot(self.tfa, **self.heatmap_params_dict).get_top_across_table_basic(df=df, top_number=top_num,
col_cluster = col_luster, row_cluster = row_luster,
value_type=value_type, pvalue=pvalue,
scale = scale, rename_taxa=rename_taxa, scale_method = scale_method)
df_top_cross = HeatmapPlot(self.tfa, **self.heatmap_params_dict).plot_basic_heatmap_of_test_res(df=df, top_number=top_num,
value_type=value_type, pvalue=pvalue, scale = scale, col_cluster = col_luster, row_cluster = row_luster,
rename_taxa=rename_taxa, sort_by = sort_by, scale_method = scale_method, return_type = 'table')


except ValueError as e:
QMessageBox.warning(self.MainWindow, 'Warning', f'No significant results.\n\n{e}')
return None
Expand Down
4 changes: 2 additions & 2 deletions metax/taxafunc_ploter/basic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def plot_corr_sns(
cbar = fig.ax_heatmap.collections[0].colorbar
cbar.set_label('Intensity', rotation=90, labelpad=1)
cbar.ax.yaxis.set_ticks_position('left')
cbar.ax.yaxis.set_label_position('right')
cbar.ax.yaxis.set_label_position('left')
plt.subplots_adjust(left=0.03, bottom=0.095, right=0.5, top=0.96, wspace=0.01, hspace=0.01)

plt.tight_layout()
Expand Down Expand Up @@ -624,7 +624,7 @@ def plot_items_corr_heatmap(
cbar = fig.ax_heatmap.collections[0].colorbar
cbar.set_label("Correlation", rotation=90, labelpad=1)
cbar.ax.yaxis.set_ticks_position('left')
cbar.ax.yaxis.set_label_position('right')
cbar.ax.yaxis.set_label_position('left')
plt.subplots_adjust(left=0.03, bottom=0.095, right=0.5, top=0.96, wspace=0.01, hspace=0.01)

plt.tight_layout()
Expand Down
Loading

0 comments on commit 1b227d4

Please sign in to comment.