Skip to content

Commit

Permalink
- New: Added the linkages method and linkage distance for the heatmap…
Browse files Browse the repository at this point in the history
… of corelation plot.
  • Loading branch information
byemaxx committed Jun 10, 2024
1 parent d4c1bd0 commit d56d3d1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 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.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:
Expand Down
20 changes: 11 additions & 9 deletions utils/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.")

Expand Down Expand Up @@ -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...')
Expand Down
19 changes: 16 additions & 3 deletions utils/TaxaFuncPloter/basic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'}
Expand Down
2 changes: 1 addition & 1 deletion utils/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '1.106.0'
__version__ = '1.106.1'
API_version = '1'

0 comments on commit d56d3d1

Please sign in to comment.