Skip to content

Commit

Permalink
- Fix: Resolved an issue where the option to rename sample names did …
Browse files Browse the repository at this point in the history
…not work when plotting the heatmap.

- Change: Refactored the code to comply with PEP standards.
  • Loading branch information
byemaxx committed Nov 26, 2024
1 parent 98551c8 commit f313028
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 63 deletions.
7 changes: 7 additions & 0 deletions Docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Version: 1.118.4
## Date: 2024-11-26
### Changes:
- Fix: Resolved an issue where the option to rename sample names did not work when plotting the heatmap.
- Change: Refactored the code to comply with PEP standards.


# Version: 1.118.3
## Date: 2024-11-19
### Changes:
Expand Down
110 changes: 54 additions & 56 deletions metax/gui/main_gui.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion metax/taxafunc_analyzer/analyzer_utils/basic_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def shapiro_test(self, df: pd.DataFrame, alpha=0.05) :



def get_df_by_mean_and_submeta(self, df, sub_meta:str = 'None', rename_sample:bool = True, plot_mean:bool = False):
def prepare_dataframe_for_heatmap(self, df, sub_meta:str = 'None', rename_sample:bool = True, plot_mean:bool = False):
"""
Prepares a DataFrame for baisc heatmap plotting.
Parameters:
Expand Down
6 changes: 3 additions & 3 deletions metax/taxafunc_ploter/heatmap_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def plot_heatmap_of_all_condition_res(self, df, pvalue:float = 0.05,scale:str|N
dft = self.scale_data(df = dft, scale_by = scale, method = scale_method)

if cmap is None:
cmap = sns.color_palette("vlag", as_cmap=True, n_colors=30)
cmap = sns.color_palette("vlag", as_cmap=True, n_colors=30) # type: ignore

# 标准化颜色映射以使 0 处为白色
from matplotlib.colors import TwoSlopeNorm
Expand Down Expand Up @@ -695,7 +695,7 @@ def plot_heatmap_of_dunnett_test_res(self, df, pvalue:float = 0.05,scale:str|No


if cmap is None:
cmap = sns.color_palette("vlag", as_cmap=True, n_colors=30)
cmap = sns.color_palette("vlag", as_cmap=True, n_colors=30) # type: ignore

col_colors = self.get_distinct_colors(len(dft.columns))
# 标准化颜色映射以使 0 处为白色
Expand Down Expand Up @@ -868,7 +868,7 @@ def scale_data(self, df: pd.DataFrame, scale_by: str|None = None, method: str|No
else: # 'maxmin'
if scale_by == 'row':
max_val = df.abs().max(axis=1)
df = pd.DataFrame([row / max_val.loc[index] if max_val.loc[index] != 0 else row for index, row in df.iterrows()], index=df.index, columns=df.columns)
df = pd.DataFrame([row / max_val.loc[index] if max_val.loc[index] != 0 else row for index, row in df.iterrows()], index=df.index, columns=df.columns) # type: ignore
elif scale_by == 'col':
max_val = df.abs().max()
for col in df.columns:
Expand Down
2 changes: 1 addition & 1 deletion metax/taxafunc_ploter/network_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def plot_tflink_network(
focus_list: list = None,
plot_list_only: bool = False,
list_only_no_link: bool = False,
) -> Tuple[Graph, pd.DataFrame]:
) -> Tuple[Graph, pd.DataFrame, pd.DataFrame]:
"""
Creates a network graph of taxa and functions using Pyecharts.
Expand Down
2 changes: 1 addition & 1 deletion metax/utils/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '1.118.3'
__version__ = '1.118.4'
API_version = '3'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "MetaXTools"
version = "1.118.3"
version = "1.118.4"
description = "MetaXTools is a novel tool for linking peptide sequences with taxonomic and functional information in Metaproteomics."
readme = "README_PyPi.md"
license = { text = "NorthOmics" }
Expand Down

0 comments on commit f313028

Please sign in to comment.