From d56d3d1688942cf864f886342212c1156d1fdcd3 Mon Sep 17 00:00:00 2001 From: Qing Date: Sun, 9 Jun 2024 20:17:34 -0400 Subject: [PATCH] - New: Added the linkages method and linkage distance for the heatmap of corelation plot. --- Docs/ChangeLog.md | 5 +++++ utils/GUI.py | 20 +++++++++++--------- utils/TaxaFuncPloter/basic_plot.py | 19 ++++++++++++++++--- utils/version.py | 2 +- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Docs/ChangeLog.md b/Docs/ChangeLog.md index 3c4f9e9..3492142 100644 --- a/Docs/ChangeLog.md +++ b/Docs/ChangeLog.md @@ -1,3 +1,8 @@ +# Version: 1.106.1 +## Date: 2024-06-09 +### Changes: +- New: Added the linkages method and linkage distance for the heatmap of corelation plot. + # Version: 1.106.0 ## Date: 2024-06-09 ### Changes: diff --git a/utils/GUI.py b/utils/GUI.py index 3f831e7..98bf43d 100644 --- a/utils/GUI.py +++ b/utils/GUI.py @@ -335,7 +335,7 @@ def __init__(self, MainWindow): # self.tabWidget_3.removeTab(3) # Hide button of DESeq2 in Group Control Test - self.pushButton_multi_deseq2.hide() + self.pushButton_multi_deseq2.hide() if self.like_times < 3 else None self.pushButton_dunnett_test.clicked.connect(lambda: self.group_control_test('dunnett')) self.pushButton_multi_deseq2.clicked.connect(lambda: self.group_control_test('deseq2')) @@ -912,9 +912,8 @@ def load_basic_Settings(self): if like_times: self.like_times = like_times if self.like_times >= 3: - # self.tabWidget_3.insertTab(3, self.hiddenTab, "Group-Control TEST") - self.pushButton_multi_deseq2.show() - print("Hidden Button of DESeq2 in Group Control Test is shown.") + print("Hidden Button of DESeq2 in Group Control Test is eligible to show.") + # if like_times < 3, the following code will hide the button if self.settings.contains("update_branch"): self.update_branch = self.settings.value("update_branch", "main", type=str) @@ -1397,16 +1396,18 @@ def show_about(self): dialog.exec_() def like_us(self): - if self.like_times < 2: + if 0 <= self.like_times < 2: QMessageBox.information(self.MainWindow, "Thank you!", "Thank you for your support!") self.pushButton_others_plot_line.setText('Plot Bar') self.like_times += 1 - elif self.like_times <3: + + elif self.like_times >= 2: QMessageBox.information(self.MainWindow, "Thank you!", "Wow! You like us again!\n\nYou have unlocked the hidden function!") self.like_times += 1 - # self.tabWidget_3.insertTab(3, self.hiddenTab, "Group-Control TEST") + # now like_times = 3 self.pushButton_multi_deseq2.show() - + print("Hidden Button of DESeq2 in Group Control Test is shown.") + else: QMessageBox.information(self.MainWindow, "Thank you!", "There is no more hidden function.\n\nYou can like us again next time.") @@ -3956,7 +3957,8 @@ def get_title_by_table_name(self, table_name): self.show_message('Correlation is running, please wait...') BasicPlot(self.tfa).plot_corr_sns(df=df, title_name=title_name, cluster= cluster, width=width, height=height, font_size=font_size, - show_all_labels=show_all_labels, theme=theme,rename_sample = rename_sample) + show_all_labels=show_all_labels, theme=theme, + rename_sample = rename_sample, **self.heatmap_params_dict) elif method == 'alpha_div': self.show_message('Alpha diversity is running, please wait...') diff --git a/utils/TaxaFuncPloter/basic_plot.py b/utils/TaxaFuncPloter/basic_plot.py index ae748b3..4b5ea17 100644 --- a/utils/TaxaFuncPloter/basic_plot.py +++ b/utils/TaxaFuncPloter/basic_plot.py @@ -349,8 +349,20 @@ def create_df(self, df, sub_meta:str|None = 'None', plot_samples:bool = False): # plt.close() return ax - def plot_corr_sns(self, df, title_name = 'Table', cluster = False, width=10, height=8, font_size = 10, - show_all_labels = (False,False) , theme:str = None, rename_sample:bool = False): + def plot_corr_sns( + self, + df, + title_name="Table", + cluster=False, + width=10, + height=8, + font_size=10, + show_all_labels=(False, False), + theme: str = None, + rename_sample: bool = False, + linkage_method: str = "average", + distance_metric: str = "euclidean", + ): dft= df.copy() if rename_sample: dft, group_list = self.tfa.add_group_name_for_sample(dft) @@ -370,7 +382,8 @@ def plot_corr_sns(self, df, title_name = 'Table', cluster = False, width=10, hei sns_params = {"linewidths":.01, "cmap":'coolwarm', "cbar_kws":{ "shrink": 0.5}, 'col_cluster':True if cluster else False, 'row_cluster':True if cluster else False, - 'method':'average', 'metric':'euclidean', + 'method':linkage_method, + 'metric':distance_metric, "linecolor":(0/255, 0/255, 0/255, 0.01), "dendrogram_ratio":(.1, .2),"col_colors":color_list, "figsize":(width, height), "xticklabels":True if show_all_labels[0] else "auto", "yticklabels":True if show_all_labels[1] else 'auto'} diff --git a/utils/version.py b/utils/version.py index f0140c7..1ba3211 100644 --- a/utils/version.py +++ b/utils/version.py @@ -1,2 +1,2 @@ -__version__ = '1.106.0' +__version__ = '1.106.1' API_version = '1' \ No newline at end of file