Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
byemaxx committed Nov 5, 2024
2 parents 015112e + 18c068e commit bba96c1
Show file tree
Hide file tree
Showing 16 changed files with 442 additions and 181 deletions.
14 changes: 10 additions & 4 deletions Docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Version: 1.116.1
## Date: 2024-10-28
# Version: 1.117.1
## Date: 2024-11-5
### Changes:
- Fix: Fixed the bug of when plot the heatmap of taxa-funcs with t-ststistic and f-statistic, the value still selected as p-value.
- Change: Updated the cookbook.
- New: 1. Added an option to calculate the mean by the domainat value in eache group for plot_mean parameter in DEV Settings. 2. Added a statistics bar plot for basic plot part. 3. Added a attributes table of Taxa-Function result.
- Fix: Fixed the bug of calculating the Functional Redundancy in the T-Test and ANOVA part.


# Version: 1.117.0
## Date: 2024-10-31
### Changes:
- New: added result Table after plotting the network of Taxa-Functions and Co-Expression.

# Version: 1.116.0
## Date: 2024-10-18
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ The desktop version comes fully set up and ready to use, including all required
<br>

### `Command-line version`:
Clone the repository to your local machine and install the required dependencies.
Use [PyPi](https://pypi.org/project/MetaXTools/) to install, then type `metax` in the terminal to launch the GUI.
```bash
python -m pip install MetaXTools
```


## Getting Started
- `Desktop Version(desktop)`:
- Refer to the <a href="https://byemaxx.github.io/MetaX/" target="_blank">MetaX Cookbook</a> for detailed instructions on how to use MetaX wtih the graphical user interface.
- Refer to the <a href="https://byemaxx.github.io/MetaX/" target="_blank">MetaX Cookbook</a> for detailed instructions on how to use MetaX with the graphical user interface.
<br>
- `Command-line version`:
- Read the example documentation in the [Notebook](https://github.com/byemaxx/MetaX/blob/main/Docs/example.ipynb) for detailed instructions and examples.
Expand Down
57 changes: 41 additions & 16 deletions metax/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from metax.taxafunc_ploter.volcano_plot_js import VolcanoPlotJS
from metax.taxafunc_ploter.volcano_plot import VolcanoPlot
from metax.taxafunc_ploter.tukey_plot import TukeyPlot
from metax.taxafunc_ploter.bar_plot_js import BarPlot_js
from metax.taxafunc_ploter.bar_plot_js import BarPlot
from metax.taxafunc_ploter.sankey_plot import SankeyPlot
from metax.taxafunc_ploter.network_plot import NetworkPlot
from metax.taxafunc_ploter.trends_plot import TrendsPlot
Expand Down Expand Up @@ -110,7 +110,7 @@
from ..taxafunc_ploter.volcano_plot_js import VolcanoPlotJS
from ..taxafunc_ploter.volcano_plot import VolcanoPlot
from ..taxafunc_ploter.tukey_plot import TukeyPlot
from ..taxafunc_ploter.bar_plot_js import BarPlot_js
from ..taxafunc_ploter.bar_plot_js import BarPlot
from ..taxafunc_ploter.sankey_plot import SankeyPlot
from ..taxafunc_ploter.network_plot import NetworkPlot
from ..taxafunc_ploter.trends_plot import TrendsPlot
Expand Down Expand Up @@ -733,6 +733,7 @@ def show_settings_window(self):
settings_widget.heatmap_params_dict_changed.connect(self.on_heatmap_params_changed)
settings_widget.tf_link_net_params_dict_changed.connect(self.on_tf_link_net_params_changed)
settings_widget.html_theme_changed.connect(self.on_html_theme_changed)
settings_widget.stat_mean_by_zero_dominant_changed.connect(self.on_stat_mean_by_zero_dominant_changed)
# Other settings
settings_widget.protein_infer_method_changed.connect(self.on_protein_infer_method_changed)

Expand Down Expand Up @@ -764,6 +765,15 @@ def on_tf_link_net_params_changed(self, params_dict):
def on_html_theme_changed(self, theme):
self.html_theme = theme
print(f"HTML theme changed to: {theme}")

def on_stat_mean_by_zero_dominant_changed(self, mode):
# chcek if self.tfa exists
if not hasattr(self, 'tfa'):
print("Please load the data first.")
return

self.tfa.stat_mean_by_zero_dominant = mode
print(f"Stat mean by zero dominant changed to: {mode}")

def on_protein_infer_method_changed(self, method):
#save to settings
Expand Down Expand Up @@ -3639,9 +3649,8 @@ def plot_basic_list(self, plot_type='heatmap'):
plot_percent = self.checkBox_basic_bar_plot_percent.isChecked()
sub_meta = self.comboBox_3dbar_sub_meta.currentText()
use_3d_for_sub_meta = self.checkBox_basic_bar_3d_for_sub_meta.isChecked()
js_bar = self.checkBox_basic_bar_interactive_js.isChecked()

width = width*100
height = height*100
df = df.loc[(df!=0).any(axis=1)]
if len(df) > 100:
reply = QMessageBox.question(self.MainWindow, 'Warning',
Expand All @@ -3650,14 +3659,23 @@ def plot_basic_list(self, plot_type='heatmap'):
if reply == QMessageBox.No:
return None
self.show_message(f'Plotting {plot_type}...')
pic = BarPlot_js(self.tfa, theme=self.html_theme).plot_intensity_bar(df = df, width=width, height=height,
title= '', rename_taxa=rename_taxa,
show_legend=show_legend, font_size=font_size,
rename_sample=rename_sample, plot_mean = plot_mean,
plot_percent = plot_percent, sub_meta = sub_meta,
show_all_labels = show_all_labels, use_3d = use_3d_for_sub_meta)

self.save_and_show_js_plot(pic, title)
if js_bar:
width = width*100
height = height*100
pic = BarPlot(self.tfa, theme=self.html_theme).plot_intensity_bar_js(df = df, width=width, height=height,
title= '', rename_taxa=rename_taxa,
show_legend=show_legend, font_size=font_size,
rename_sample=rename_sample, plot_mean = plot_mean,
plot_percent = plot_percent, sub_meta = sub_meta,
show_all_labels = show_all_labels, use_3d = use_3d_for_sub_meta)

self.save_and_show_js_plot(pic, title)
else:
ax = BarPlot(self.tfa, theme=self.html_theme).plot_intensity_bar_sns(df = df, width=width, height=height,
title= '', rename_taxa=rename_taxa,
show_legend=show_legend, font_size=font_size,
rename_sample=rename_sample, plot_mean = plot_mean,
plot_percent = plot_percent, sub_meta = sub_meta)

elif plot_type == 'get_table':
self.show_message('Getting table...')
Expand Down Expand Up @@ -5170,15 +5188,19 @@ def plot_co_expr(self, plot_type = 'network'):
elif plot_type == 'network':
try:
self.show_message('Co-expression network is plotting...\n\n It may take a long time! Please wait...')
pic = NetworkPlot(self.tfa,
pic, corr_df = NetworkPlot(self.tfa,
show_labels=show_labels,
rename_taxa=rename_taxa,
font_size=font_size,
theme=self.html_theme,
**self.tf_link_net_params_dict
).plot_co_expression_network(df_type= df_type, corr_method=corr_method,
corr_threshold=corr_threshold, sample_list=sample_list, width=width, height=height, focus_list=focus_list, plot_list_only=plot_list_only)
corr_threshold=corr_threshold, sample_list=sample_list,
width=width, height=height, focus_list=focus_list,
plot_list_only=plot_list_only)
self.save_and_show_js_plot(pic, 'co-expression network')
self.update_table_dict(f'co-expression_network({df_type})', corr_df)

except ValueError as e:
if 'sample_list should have at least 2' in str(e):
QMessageBox.warning(self.MainWindow, 'Error', "At least 2 samples are required!")
Expand Down Expand Up @@ -5409,7 +5431,7 @@ def plot_network(self):
try:
self.show_message('Plotting network...')
list_only_no_link = self.checkBox_tf_link_net_plot_list_only_no_link.isChecked()
pic = NetworkPlot(
pic, network_df, attributes_df = NetworkPlot(
self.tfa,
show_labels=show_labels,
rename_taxa=rename_taxa,
Expand All @@ -5425,6 +5447,9 @@ def plot_network(self):
list_only_no_link=list_only_no_link,
)
self.save_and_show_js_plot(pic, 'taxa-func link Network')
self.update_table_dict('taxa-func_network', network_df)
self.update_table_dict('taxa-func_network_attributes', attributes_df)

except Exception as e:
error_message = traceback.format_exc()
self.logger.write_log(f'plot_network error: {error_message}', 'e')
Expand Down Expand Up @@ -5676,7 +5701,7 @@ def plot_tflink_bar(self):
params['sub_meta'] = sub_meta

self.show_message('Plotting bar plot, please wait...')
pic = BarPlot_js(self.tfa, theme=self.html_theme).plot_intensity_bar(**params)
pic = BarPlot(self.tfa, theme=self.html_theme).plot_intensity_bar_js(**params)
self.save_and_show_js_plot(pic, 'Intensity Bar Plot')


Expand Down
72 changes: 43 additions & 29 deletions metax/gui/metax_gui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1122</width>
<height>755</height>
<height>816</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -245,8 +245,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>534</height>
<width>391</width>
<height>80</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -1882,7 +1882,7 @@
<string>Show Labels</string>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
Expand Down Expand Up @@ -2789,8 +2789,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>150</height>
<width>1016</width>
<height>184</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_50">
Expand Down Expand Up @@ -3004,22 +3004,6 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkBox_basic_bar_show_legend">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Show Legend</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="checkBox_basic_heatmap_sankey_title">
<property name="sizePolicy">
Expand Down Expand Up @@ -3280,6 +3264,36 @@
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_104">
<item>
<widget class="QCheckBox" name="checkBox_basic_bar_interactive_js">
<property name="text">
<string>Interactive Bar</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_basic_bar_show_legend">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Show Legend</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -3792,7 +3806,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1020</width>
<width>878</width>
<height>128</height>
</rect>
</property>
Expand Down Expand Up @@ -7467,8 +7481,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1016</width>
<height>105</height>
<width>620</width>
<height>65</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_57">
Expand Down Expand Up @@ -9288,8 +9302,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1016</width>
<height>141</height>
<width>383</width>
<height>68</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_66">
Expand Down Expand Up @@ -9785,8 +9799,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1044</width>
<height>493</height>
<width>313</width>
<height>41</height>
</rect>
</property>
<attribute name="label">
Expand Down
Loading

0 comments on commit bba96c1

Please sign in to comment.