Skip to content

Commit

Permalink
- Change: Optimized the Data Overview section to make the layout more…
Browse files Browse the repository at this point in the history
… clear.

- Update README.md
  • Loading branch information
byemaxx committed Dec 5, 2024
1 parent e5cb941 commit 210d87c
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 32 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.119.7
## Date: 2024-12-5
### Changes:
- Change: Optimized the Data Overview section to make the layout more clear.
- Update README.md

# Version: 1.119.6
## Date: 2024-12-5
### Changes:
Expand Down
Binary file added Docs/MetaX_Cookbook.assets/otf_heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ Show all functions of a taxon

- <img src="https://github.com/byemaxx/MetaX/raw/main/Docs/MetaX_Cookbook.assets/taxa_func_link_bar.png" alt="tf_link_bar" style="zoom:50%;" />

**OTF Heatmap**

Show OTFS intensity in groups(samples), e.g., **Species-KO** OTF Heatmap

<img src="https://github.com/byemaxx/MetaX/raw/main/Docs/MetaX_Cookbook.assets/otf_heatmap.png" alt="otf_heatmap" style="zoom:50%;" />

## Download & Installation
- **Desktop Version** (Recommended)
Expand Down
17 changes: 9 additions & 8 deletions metax/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def change_theme(self, theme, silent=False):
padding: 5px;
margin: 2px;
height: 20px;
}}
}}
'''
current_app = QtWidgets.QApplication.instance()
Expand Down Expand Up @@ -4070,7 +4070,7 @@ def plot_trends_cluster(self):
width=width, height=height, title=title
, font_size=font_size, num_col=num_col)
# create a dialog to show the figure
# plt_dialog = PltDialog(self.MainWindow, fig)
# plt_dialog = PltDialog(self.MainWindow, fig) #obsolete
plt_size= (width*50, int(height*num_cluster*50/num_col) )
plt_dialog = ExportablePlotDialog(self.MainWindow,fig, plt_size)
#set title
Expand Down Expand Up @@ -4348,9 +4348,9 @@ def plot_taxa_stats(self):
else:
# BasicPlot(self.tfa).plot_taxa_stats()
theme = self.comboBox_data_overiew_theme.currentText()
pic = BasicPlot(self.tfa).plot_taxa_stats_pie(theme=theme)
pic = BasicPlot(self.tfa).plot_taxa_stats_pie(theme=theme, font_size=8, width=5, height=4)
# Add the new MatplotlibWidget
self.mat_widget_plot_peptide_num = MatplotlibWidget(pic)
self.mat_widget_plot_peptide_num = MatplotlibWidget(pic, width = 5, height = 4)
self.verticalLayout_overview_plot.addWidget(self.mat_widget_plot_peptide_num)

def plot_taxa_stats_new_window(self):
Expand All @@ -4369,9 +4369,10 @@ def plot_taxa_number(self):
QMessageBox.warning(self.MainWindow, 'Warning', 'Please run OTF Analyzer first!')
else:
theme = self.comboBox_data_overiew_theme.currentText()
pic = BasicPlot(self.tfa).plot_taxa_number(theme = theme).get_figure()
pic = BasicPlot(self.tfa).plot_taxa_number(theme = theme, font_size = 8, width = 5,height = 4
).get_figure()

self.mat_widget_plot_taxa_num = MatplotlibWidget(pic)
self.mat_widget_plot_taxa_num = MatplotlibWidget(pic, width = 5, height = 4)
self.verticalLayout_overview_plot.addWidget(self.mat_widget_plot_taxa_num)

def plot_taxa_number_new_window(self):
Expand Down Expand Up @@ -4399,9 +4400,9 @@ def plot_peptide_num_in_func(self):
self.show_message('Plotting peptide number in function...')
BasicPlot(self.tfa).plot_prop_stats(func_name, theme=theme, res_type='show', font_size = font_size)
else:
pic = BasicPlot(self.tfa).plot_prop_stats(func_name, theme=theme)
pic = BasicPlot(self.tfa).plot_prop_stats(func_name, theme=theme, font_size = 8, width=5, height=4)

self.mat_widget_plot_peptide_num_in_func = MatplotlibWidget(pic.get_figure())
self.mat_widget_plot_peptide_num_in_func = MatplotlibWidget(pic.get_figure(), width = 5, height = 4)
self.verticalLayout_overview_func.addWidget(self.mat_widget_plot_peptide_num_in_func)


Expand Down
32 changes: 22 additions & 10 deletions metax/gui/metax_gui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<property name="documentMode">
<bool>false</bool>
Expand Down Expand Up @@ -186,7 +186,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Operational Taxa-Functions (OTF) Table (head 200)</string>
<string>Operational Taxon-Function (OTF) Table (head 200)</string>
</property>
</widget>
</item>
Expand All @@ -205,6 +205,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
Expand All @@ -215,6 +218,15 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="3">
Expand Down Expand Up @@ -246,7 +258,7 @@
<x>0</x>
<y>0</y>
<width>462</width>
<height>531</height>
<height>527</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -3248,8 +3260,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>885</width>
<height>170</height>
<width>665</width>
<height>157</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_50">
Expand Down Expand Up @@ -6810,7 +6822,7 @@
<x>0</x>
<y>0</y>
<width>885</width>
<height>170</height>
<height>168</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_49">
Expand Down Expand Up @@ -7664,8 +7676,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>885</width>
<height>123</height>
<width>620</width>
<height>65</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_57">
Expand Down Expand Up @@ -9600,7 +9612,7 @@
<x>0</x>
<y>0</y>
<width>885</width>
<height>158</height>
<height>155</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_66">
Expand Down Expand Up @@ -10869,7 +10881,7 @@
<x>0</x>
<y>0</y>
<width>991</width>
<height>21</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuTools">
Expand Down
34 changes: 31 additions & 3 deletions metax/gui/metax_gui/matplotlib_figure_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@
from matplotlib.figure import Figure

class MatplotlibWidget(QWidget):
def __init__(self, figure=None, parent=None):
def __init__(self, figure=None, parent=None, width=6, height=4, dpi=100):
"""
A QWidget that embeds a Matplotlib figure with fixed size to prevent deformation.
:param figure: The Matplotlib Figure object. If None, a new Figure is created.
:param parent: The parent QWidget.
:param width: Width of the figure in inches.
:param height: Height of the figure in inches.
:param dpi: Dots per inch (resolution) of the figure.
"""
super(MatplotlibWidget, self).__init__(parent)

self.figure = figure if figure else Figure()
# Create or use the provided figure
self.figure = figure if figure else Figure(figsize=(width, height), dpi=dpi)
self.figure.tight_layout()

# Create the canvas for rendering the figure
self.canvas = FigureCanvas(self.figure)
self.canvas.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

# Set fixed size for the canvas
self.canvas.setFixedSize(width * dpi, height * dpi)

# Create and set layout
self.layout = QHBoxLayout(self)
self.layout.addWidget(self.canvas)
self.layout.addWidget(self.canvas)

def set_size(self, width, height, dpi=None):
"""
Update the size of the Matplotlib figure and canvas.
:param width: New width in inches.
:param height: New height in inches.
:param dpi: Optional new DPI. If not provided, the current DPI is used.
"""
dpi = dpi if dpi else self.figure.get_dpi()
self.figure.set_size_inches(width, height, forward=True)
self.canvas.setFixedSize(width * dpi, height * dpi)
self.canvas.draw()
22 changes: 13 additions & 9 deletions metax/gui/metax_gui/ui_main_window.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'c:\Users\Qing\OneDrive - University of Ottawa\code\TaxaFunc\MetaX\metax\gui\metax_gui\main_window.ui'
# Form implementation generated from reading ui file 'c:\Users\max\OneDrive - University of Ottawa\code\TaxaFunc\MetaX\metax\gui\metax_gui\main_window.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
Expand Down Expand Up @@ -133,6 +133,8 @@ def setupUi(self, metaX_main):
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tableWidget_taxa_func_view.sizePolicy().hasHeightForWidth())
self.tableWidget_taxa_func_view.setSizePolicy(sizePolicy)
self.tableWidget_taxa_func_view.setShowGrid(True)
self.tableWidget_taxa_func_view.setWordWrap(False)
self.tableWidget_taxa_func_view.setObjectName("tableWidget_taxa_func_view")
self.tableWidget_taxa_func_view.setColumnCount(0)
self.tableWidget_taxa_func_view.setRowCount(0)
Expand All @@ -147,7 +149,7 @@ def setupUi(self, metaX_main):
self.toolBox_2.setMaximumSize(QtCore.QSize(1677, 16777215))
self.toolBox_2.setObjectName("toolBox_2")
self.page_2 = QtWidgets.QWidget()
self.page_2.setGeometry(QtCore.QRect(0, 0, 462, 531))
self.page_2.setGeometry(QtCore.QRect(0, 0, 462, 527))
self.page_2.setObjectName("page_2")
self.gridLayout_27 = QtWidgets.QGridLayout(self.page_2)
self.gridLayout_27.setObjectName("gridLayout_27")
Expand Down Expand Up @@ -1652,7 +1654,7 @@ def setupUi(self, metaX_main):
self.scrollArea_2.setWidgetResizable(True)
self.scrollArea_2.setObjectName("scrollArea_2")
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 885, 170))
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 665, 157))
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
self.gridLayout_50 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_2)
self.gridLayout_50.setObjectName("gridLayout_50")
Expand Down Expand Up @@ -3524,7 +3526,7 @@ def setupUi(self, metaX_main):
self.scrollArea_4.setWidgetResizable(True)
self.scrollArea_4.setObjectName("scrollArea_4")
self.scrollAreaWidgetContents_5 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_5.setGeometry(QtCore.QRect(0, 0, 885, 170))
self.scrollAreaWidgetContents_5.setGeometry(QtCore.QRect(0, 0, 885, 168))
self.scrollAreaWidgetContents_5.setObjectName("scrollAreaWidgetContents_5")
self.gridLayout_49 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_5)
self.gridLayout_49.setObjectName("gridLayout_49")
Expand Down Expand Up @@ -3986,7 +3988,7 @@ def setupUi(self, metaX_main):
self.scrollArea_5.setWidgetResizable(True)
self.scrollArea_5.setObjectName("scrollArea_5")
self.scrollAreaWidgetContents_6 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_6.setGeometry(QtCore.QRect(0, 0, 885, 123))
self.scrollAreaWidgetContents_6.setGeometry(QtCore.QRect(0, 0, 620, 65))
self.scrollAreaWidgetContents_6.setObjectName("scrollAreaWidgetContents_6")
self.gridLayout_57 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_6)
self.gridLayout_57.setObjectName("gridLayout_57")
Expand Down Expand Up @@ -5029,7 +5031,7 @@ def setupUi(self, metaX_main):
self.scrollArea_7.setWidgetResizable(True)
self.scrollArea_7.setObjectName("scrollArea_7")
self.scrollAreaWidgetContents_8 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_8.setGeometry(QtCore.QRect(0, 0, 885, 158))
self.scrollAreaWidgetContents_8.setGeometry(QtCore.QRect(0, 0, 885, 155))
self.scrollAreaWidgetContents_8.setObjectName("scrollAreaWidgetContents_8")
self.gridLayout_66 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_8)
self.gridLayout_66.setObjectName("gridLayout_66")
Expand Down Expand Up @@ -5683,7 +5685,7 @@ def setupUi(self, metaX_main):
self.statusbar.setObjectName("statusbar")
metaX_main.setStatusBar(self.statusbar)
self.menuBar = QtWidgets.QMenuBar(metaX_main)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 991, 21))
self.menuBar.setGeometry(QtCore.QRect(0, 0, 991, 23))
self.menuBar.setObjectName("menuBar")
self.menuTools = QtWidgets.QMenu(self.menuBar)
self.menuTools.setObjectName("menuTools")
Expand Down Expand Up @@ -5749,7 +5751,7 @@ def setupUi(self, metaX_main):

self.retranslateUi(metaX_main)
self.stackedWidget.setCurrentIndex(0)
self.tabWidget_TaxaFuncAnalyzer.setCurrentIndex(3)
self.tabWidget_TaxaFuncAnalyzer.setCurrentIndex(1)
self.toolBox_2.setCurrentIndex(0)
self.tabWidget_4.setCurrentIndex(0)
self.tabWidget_3.setCurrentIndex(3)
Expand Down Expand Up @@ -5802,8 +5804,10 @@ def retranslateUi(self, metaX_main):
self.pushButton_load_example_for_analyzer.setText(_translate("metaX_main", "Load Example Data"))
self.label_46.setText(_translate("metaX_main", "Operational Taxa-Functions (OTF) Analyzer"))
self.tabWidget_TaxaFuncAnalyzer.setTabText(self.tabWidget_TaxaFuncAnalyzer.indexOf(self.tab), _translate("metaX_main", "Data Import"))
self.label_26.setText(_translate("metaX_main", "Operational Taxa-Functions (OTF) Table (head 200)"))
self.label_26.setText(_translate("metaX_main", "Operational Taxon-Function (OTF) Table (head 200)"))
self.label_25.setText(_translate("metaX_main", "Meta Table"))
self.tableWidget_meta_view.setSortingEnabled(True)
self.tableWidget_taxa_func_view.setSortingEnabled(True)
self.pushButton_overview_tax_plot_new_window.setText(_translate("metaX_main", "Plot taxa stats in new window"))
self.pushButton_overview_peptide_plot_new_window.setText(_translate("metaX_main", "Plot peptide stats in new window"))
self.label_154.setText(_translate("metaX_main", "Theme"))
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.119.6'
__version__ = '1.119.7'
API_version = '4'
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.119.6"
version = "1.119.7"
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 210d87c

Please sign in to comment.