diff --git a/Docs/ChangeLog.md b/Docs/ChangeLog.md
index 6416b49..4bef56c 100644
--- a/Docs/ChangeLog.md
+++ b/Docs/ChangeLog.md
@@ -1,3 +1,9 @@
+# Version: 1.107.5
+## Date: 2024-06-18
+### Changes:
+- Fix: Fixed the bug of when plot the Taxa-Functions Network, the fcous list items which are not linked to any other items were not removed.
+- Change: Changed the default label width of the Taxa-Functions Network plot to 300 characters, then the label will be broken into multiple lines if the label is too long.
+
# Version: 1.107.4
## Date: 2024-06-17
### Changes:
diff --git a/utils/GUI.py b/utils/GUI.py
index a1a4e7a..e7dfee7 100644
--- a/utils/GUI.py
+++ b/utils/GUI.py
@@ -167,7 +167,8 @@ def __init__(self, MainWindow):
'taxa_color': '#374E55','taxa_focus_color': '#6A6599',
'func_color': '#DF8F44', 'func_focus_color': '#B24745',
'line_opacity': 0.5, 'line_width': 3, 'line_curve': 0,
- 'line_color': '#9aa7b1', 'repulsion': 500, 'font_weight': 'bold'
+ 'line_color': '#9aa7b1', 'repulsion': 500, 'font_weight': 'bold',
+ 'label_position':"bottom", 'text_width' : 300, 'gravity' : 0.2
}
@@ -516,7 +517,7 @@ def get_table_by_df_type(self, df_type:str | None = None,
dft = self.tfa.replace_if_two_index(dft)
return dft
- def get_list_by_df_type(self, df_type:str) -> list:
+ def get_list_by_df_type(self, df_type:str, remove_no_linked:bool=False, silent:bool=False) -> list|None:
'''
return the list of df_type, ignore capital case
df_type: str, one of ['taxa', 'functions', 'taxa-functions', 'peptides', 'proteins', 'custom']
@@ -532,6 +533,10 @@ def get_list_by_df_type(self, df_type:str) -> list:
res_list = list_dict.get(df_type, None)
if res_list is None:
raise ValueError(f"Invalid df_type: {df_type}")
+
+ if remove_no_linked and df_type in ['taxa', 'functions', 'taxa-functions']:
+ res_list = self.remove_no_linked_taxa_and_func_after_filter_tflink(res_list, type=df_type, silent=silent)
+
return res_list
def change_event_checkBox_basic_plot_table(self):
@@ -2718,30 +2723,6 @@ def update_func_taxa_group_to_combobox(self):
-
- #! This function seems not used
- # def show_others_linked(self):
- # func = self.comboBox_others_func.currentText().strip()
- # taxa = self.comboBox_others_taxa.currentText().strip()
- # self.logger.write_log(f'show_others_linked: func: {func}, taxa: {taxa}')
- # try:
- # if not func and not taxa:
- # QMessageBox.warning(self.MainWindow, 'Warning', 'Please select function or taxa!')
- # elif func and taxa:
- # QMessageBox.warning(self.MainWindow, 'Warning', 'Please select only one of function or taxa!')
- # elif not func:
- # df = self.tfa.taxa_func_df.loc[taxa, :]
- # func = df.index.tolist()
- # self.comboBox_others_func.clear()
- # self.comboBox_others_func.addItems(func)
- # else:
- # df = self.tfa.func_taxa_df.loc[func, :]
- # taxa = df.index.tolist()
- # self.comboBox_others_taxa.clear()
- # self.comboBox_others_taxa.addItems(taxa)
- # except Exception as e:
- # self.logger.write_log(f'show_others_linked error: {e}', 'e')
- # QMessageBox.warning(self.MainWindow, 'Warning', f"No Linked Taxa-Func for your Input! please check your input.\n\n{e}")
def update_combobox_and_label(self, current_text, type, label, comboBox):
if not current_text:
@@ -2772,7 +2753,7 @@ def update_combobox_and_label(self, current_text, type, label, comboBox):
comboBox.addItem('')
comboBox.addItems(items)
except Exception as e:
- QMessageBox.warning(self.MainWindow, 'Warning', f"No Linked Taxa-Func for your Input! please check your input.\n\n{e}")
+ QMessageBox.warning(self.MainWindow, 'Warning', f"No Linked Taxa-Functions for your Input!\n\n{e}")
def remove_pep_num_str_and_strip(self, text):
text = text.strip()
@@ -3102,7 +3083,11 @@ def check_if_in_list(str_selected, df_type):
search_results.extend(matches)
# Remove duplicates from search_results in case there are overlapping matches
search_results = [x for i, x in enumerate(search_results) if i == search_results.index(x)]
-
+
+ # Remove No Linked Taxa-Functions if aim_list is 'tfnet'
+ if search_results and aim_list == 'tfnet':
+ search_results = self.remove_no_linked_taxa_and_func_after_filter_tflink(search_results, type= df_type.lower())
+
# show the search results in a new window, allowing user to select the valid items
if search_results:
self.input_window = InputWindow(self.MainWindow, input_mode=False)
@@ -4919,19 +4904,23 @@ def deseq2_plot_sankey(self):
- # Others Functions #
+ # Taxa-Functions Linkages Functions #
# network
def update_tfnet_select_list(self):
df_type = self.comboBox_tfnet_table.currentText()
if df_type == 'Taxa-Functions':
self.comboBox_tfnet_select_list.clear()
- self.comboBox_tfnet_select_list.addItems(self.taxa_func_list)
+ # remove no linked items to avoid error when plot focus list only
+ taxa_func_list = self.get_list_by_df_type('Taxa-Functions', remove_no_linked=True, silent=True)
+ self.comboBox_tfnet_select_list.addItems(taxa_func_list)
elif df_type == 'Taxa':
self.comboBox_tfnet_select_list.clear()
- self.comboBox_tfnet_select_list.addItems(self.taxa_list)
+ taxa_list = self.get_list_by_df_type('Taxa', remove_no_linked=True, silent=True)
+ self.comboBox_tfnet_select_list.addItems(taxa_list)
elif df_type == 'Functions':
self.comboBox_tfnet_select_list.clear()
- self.comboBox_tfnet_select_list.addItems(self.func_list)
+ func_list = self.get_list_by_df_type('Functions', remove_no_linked=True, silent=True)
+ self.comboBox_tfnet_select_list.addItems(func_list)
def add_a_list_to_tfnet_focus_list(self):
df_type = self.comboBox_tfnet_table.currentText()
@@ -5147,7 +5136,7 @@ def get_sample_list_tflink(self):
sample_list = selected_samples
return sample_list
- def remove_no_linked_taxa_and_func_after_filter_tflink(self, check_list:list | None = None, type:str = 'taxa'):
+ def remove_no_linked_taxa_and_func_after_filter_tflink(self, check_list:list | None = None, type:str = 'taxa', silent:bool = False) -> list[str] | None:
# keep taxa and func only in the taxa_func_linked_dict and remove others
if check_list is None:
print(f'check_list is {check_list}, return None')
@@ -5163,14 +5152,24 @@ def remove_no_linked_taxa_and_func_after_filter_tflink(self, check_list:list | N
elif type == 'taxa-functions':
return check_list
else:
- raise ValueError('type should be taxa, functions or taxa-functions!')
+ raise ValueError(f'type should be taxa, functions or taxa-functions! but got: {type}')
- if removed:
- QMessageBox.warning(
- self.MainWindow,
- 'Warning',
- f'{len(removed)} {type} are removed from the list because they do not have links!\n{len(check_list)} {type} are kept!'
- )
+ if removed and not silent:
+ removed_str = '\n'.join(removed)
+ if len(removed) > 10:
+ self.input_window = InputWindow(self.MainWindow)
+ self.input_window.setWindowTitle('Warning')
+ self.input_window.text_edit.setText(
+ f"[{len(removed)}] {type} are removed from the list because they do not have links!\n[{len(check_list)}] {type} are kept!\n\nRemoved {type}:\n{removed_str}"
+ )
+ self.input_window.exec_()
+
+ else:
+ QMessageBox.warning(
+ self.MainWindow,
+ 'Warning',
+ f'[{len(removed)}] {type} are removed from the list because they do not have links!\n[{len(check_list)}] {type} are kept!\n\nRemoved {type}:\n{removed_str}'
+ )
return check_list
diff --git a/utils/MetaX_GUI/MainWindow.ui b/utils/MetaX_GUI/MainWindow.ui
index 68d4e27..2377049 100644
--- a/utils/MetaX_GUI/MainWindow.ui
+++ b/utils/MetaX_GUI/MainWindow.ui
@@ -239,8 +239,8 @@
0
0
- 496
- 377
+ 391
+ 80
@@ -5270,7 +5270,7 @@
-
- false
+ true
@@ -7192,7 +7192,7 @@
-
- false
+ true
1
diff --git a/utils/MetaX_GUI/Setting.ui b/utils/MetaX_GUI/Setting.ui
index 4803340..1f01903 100644
--- a/utils/MetaX_GUI/Setting.ui
+++ b/utils/MetaX_GUI/Setting.ui
@@ -24,8 +24,8 @@
0
0
- 246
- 37
+ 748
+ 367
@@ -94,29 +94,6 @@
-
-
-
-
-
- Taxa Color
-
-
-
- -
-
-
- 1
-
-
- 1.000000000000000
-
-
- 0.100000000000000
-
-
- 0.000000000000000
-
-
-
-
-
@@ -156,13 +133,37 @@
- -
-
+
-
+
- #DF8F44
+ Taxa Shape
+ -
+
+
-
+
+ bold
+
+
+ -
+
+ normal
+
+
+ -
+
+ bolder
+
+
+ -
+
+ lighter
+
+
+
+
-
@@ -170,6 +171,20 @@
+ -
+
+
+ Repulsion
+
+
+
+ -
+
+
+ Focus Taxa Color
+
+
+
-
@@ -177,38 +192,67 @@
- -
-
+
-
+
- #B24745
+ Line Curve
- -
-
+
-
+
- #6A6599
+ #9aa7b1
- -
-
+
-
+
- Line Width
+ #DF8F44
- -
-
+
-
+
+
+ 1
+
+
+ 1.000000000000000
+
+
+ 0.100000000000000
+
+
+ 0.000000000000000
+
+
+
+ -
+
+
+ 100000
+
+
+ 10
+
+
+ 500
+
+
+
+ -
+
- Taxa Shape
+ Font Weight
- -
-
+
-
+
- Function Shape
+ #B24745
@@ -219,10 +263,19 @@
- -
-
-
- Focus Taxa Color
+
-
+
+
+ 1
+
+
+ 1.000000000000000
+
+
+ 0.100000000000000
+
+
+ 0.500000000000000
@@ -265,13 +318,6 @@
- -
-
-
- Line opacity
-
-
-
-
@@ -279,26 +325,31 @@
- -
-
+
-
+
- Line Curve
+ Taxa Color
- -
-
-
- 1
-
-
- 1.000000000000000
+
-
+
+
+ Line opacity
-
- 0.100000000000000
+
+
+ -
+
+
+ #6A6599
-
- 0.500000000000000
+
+
+ -
+
+
+ Line Width
@@ -318,64 +369,99 @@
- -
-
-
- #9aa7b1
-
-
-
- -
-
+
-
+
- Repulsion
-
-
-
- -
-
-
- 100000
-
-
- 10
-
-
- 500
+ Function Shape
- -
-
+
-
+
- Font Weight
+ Label Postion
- -
-
+
-
+
-
- bold
+ bottom
-
- normal
+ top
-
- bolder
+ right
-
- lighter
+ left
+
+
+ -
+
+ inside
+
+
+ -
+
+ insideLeft
+
+
+ -
+
+ insideRight
+ -
+
+
+ Text Width
+
+
+
+ -
+
+
+ 9999
+
+
+ 10
+
+
+ 300
+
+
+
+ -
+
+
+ Gravity
+
+
+
+ -
+
+
+ 1.000000000000000
+
+
+ 0.100000000000000
+
+
+ 0.200000000000000
+
+
+
-
diff --git a/utils/MetaX_GUI/Settings.py b/utils/MetaX_GUI/Settings.py
index e1fde9c..3da8e40 100644
--- a/utils/MetaX_GUI/Settings.py
+++ b/utils/MetaX_GUI/Settings.py
@@ -51,7 +51,11 @@ def __init__(self, parent=None, update_branch="main", auto_check_update=True):
self.ui.lineEdit_tf_link_net_line_color.textChanged.connect(self.handle_tf_link_network_changed)
self.ui.spinBox_tf_link_net_repulsion.valueChanged.connect(self.handle_tf_link_network_changed)
self.ui.comboBox_tf_link_net_font_weight.currentTextChanged.connect(self.handle_tf_link_network_changed)
-
+ self.ui.comboBox_tf_link_net_label_position.currentTextChanged.connect(self.handle_tf_link_network_changed)
+ self.ui.spinBox_tf_link_net_text_width.valueChanged.connect(self.handle_tf_link_network_changed)
+ self.ui.doubleSpinBox_tf_link_net_gravity.valueChanged.connect(self.handle_tf_link_network_changed)
+
+
def init_ui(self, update_mode, auto_check_update):
if update_mode == "main":
self.ui.radioButton_update_stable.setChecked(True)
@@ -82,14 +86,15 @@ def handle_tf_link_network_changed(self):
"taxa_focus_color": self.ui.lineEdit_tf_link_net_taxa_focus_color.text(),
"func_color": self.ui.lineEdit_tf_link_net_func_color.text(),
"func_focus_color": self.ui.lineEdit_tf_link_net_func_focus_color.text(),
-
"line_opacity": self.ui.doubleSpinBox_tf_link_net_line_opacity.value(),
"line_width": self.ui.doubleSpinBox_tf_link_net_line_width.value(),
"line_curve": self.ui.doubleSpinBox_tf_link_net_line_curve.value(),
"line_color": self.ui.lineEdit_tf_link_net_line_color.text(),
-
'repulsion': self.ui.spinBox_tf_link_net_repulsion.value(),
- 'font_weight': self.ui.comboBox_tf_link_net_font_weight.currentText()
+ 'font_weight': self.ui.comboBox_tf_link_net_font_weight.currentText(),
+ 'label_position': self.ui.comboBox_tf_link_net_label_position.currentText(),
+ 'text_width': self.ui.spinBox_tf_link_net_text_width.value(),
+ 'gravity': self.ui.doubleSpinBox_tf_link_net_gravity.value(),
}
self.tf_link_net_params_dict_changed.emit(network_params_dict)
diff --git a/utils/MetaX_GUI/Ui_MainWindow.py b/utils/MetaX_GUI/Ui_MainWindow.py
index b194a2e..8f51c6b 100644
--- a/utils/MetaX_GUI/Ui_MainWindow.py
+++ b/utils/MetaX_GUI/Ui_MainWindow.py
@@ -145,7 +145,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, 496, 377))
+ self.page_2.setGeometry(QtCore.QRect(0, 0, 391, 80))
self.page_2.setObjectName("page_2")
self.gridLayout_27 = QtWidgets.QGridLayout(self.page_2)
self.gridLayout_27.setObjectName("gridLayout_27")
@@ -2764,7 +2764,7 @@ def setupUi(self, metaX_main):
self.label_162.setObjectName("label_162")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_162)
self.spinBox_co_expr_font_size = QtWidgets.QSpinBox(self.tab_5)
- self.spinBox_co_expr_font_size.setEnabled(False)
+ self.spinBox_co_expr_font_size.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -3779,7 +3779,7 @@ def setupUi(self, metaX_main):
self.label_163.setObjectName("label_163")
self.horizontalLayout_69.addWidget(self.label_163)
self.spinBox_network_font_size = QtWidgets.QSpinBox(self.tab_9)
- self.spinBox_network_font_size.setEnabled(False)
+ self.spinBox_network_font_size.setEnabled(True)
self.spinBox_network_font_size.setMinimum(1)
self.spinBox_network_font_size.setProperty("value", 10)
self.spinBox_network_font_size.setObjectName("spinBox_network_font_size")
diff --git a/utils/MetaX_GUI/Ui_Setting.py b/utils/MetaX_GUI/Ui_Setting.py
index 5665757..bde7ffc 100644
--- a/utils/MetaX_GUI/Ui_Setting.py
+++ b/utils/MetaX_GUI/Ui_Setting.py
@@ -20,7 +20,7 @@ def setupUi(self, Settings):
self.toolBox = QtWidgets.QToolBox(Settings)
self.toolBox.setObjectName("toolBox")
self.page = QtWidgets.QWidget()
- self.page.setGeometry(QtCore.QRect(0, 0, 246, 37))
+ self.page.setGeometry(QtCore.QRect(0, 0, 748, 367))
self.page.setObjectName("page")
self.gridLayout_3 = QtWidgets.QGridLayout(self.page)
self.gridLayout_3.setObjectName("gridLayout_3")
@@ -52,16 +52,6 @@ def setupUi(self, Settings):
self.gridLayout_4.addWidget(self.label, 0, 0, 1, 1)
self.gridLayout_6 = QtWidgets.QGridLayout()
self.gridLayout_6.setObjectName("gridLayout_6")
- self.label_7 = QtWidgets.QLabel(self.page_2)
- self.label_7.setObjectName("label_7")
- self.gridLayout_6.addWidget(self.label_7, 0, 2, 1, 1)
- self.doubleSpinBox_tf_link_net_line_curve = QtWidgets.QDoubleSpinBox(self.page_2)
- self.doubleSpinBox_tf_link_net_line_curve.setDecimals(1)
- self.doubleSpinBox_tf_link_net_line_curve.setMaximum(1.0)
- self.doubleSpinBox_tf_link_net_line_curve.setSingleStep(0.1)
- self.doubleSpinBox_tf_link_net_line_curve.setProperty("value", 0.0)
- self.doubleSpinBox_tf_link_net_line_curve.setObjectName("doubleSpinBox_tf_link_net_line_curve")
- self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_line_curve, 2, 3, 1, 1)
self.comboBox_tf_link_net_taxa_sahpe = QtWidgets.QComboBox(self.page_2)
self.comboBox_tf_link_net_taxa_sahpe.setObjectName("comboBox_tf_link_net_taxa_sahpe")
self.comboBox_tf_link_net_taxa_sahpe.addItem("")
@@ -72,36 +62,66 @@ def setupUi(self, Settings):
self.comboBox_tf_link_net_taxa_sahpe.addItem("")
self.comboBox_tf_link_net_taxa_sahpe.addItem("")
self.gridLayout_6.addWidget(self.comboBox_tf_link_net_taxa_sahpe, 0, 1, 1, 1)
- self.lineEdit_tf_link_net_func_color = QtWidgets.QLineEdit(self.page_2)
- self.lineEdit_tf_link_net_func_color.setObjectName("lineEdit_tf_link_net_func_color")
- self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_func_color, 1, 3, 1, 1)
+ self.label_5 = QtWidgets.QLabel(self.page_2)
+ self.label_5.setObjectName("label_5")
+ self.gridLayout_6.addWidget(self.label_5, 0, 0, 1, 1)
+ self.comboBox_tf_link_net_font_weight = QtWidgets.QComboBox(self.page_2)
+ self.comboBox_tf_link_net_font_weight.setObjectName("comboBox_tf_link_net_font_weight")
+ self.comboBox_tf_link_net_font_weight.addItem("")
+ self.comboBox_tf_link_net_font_weight.addItem("")
+ self.comboBox_tf_link_net_font_weight.addItem("")
+ self.comboBox_tf_link_net_font_weight.addItem("")
+ self.gridLayout_6.addWidget(self.comboBox_tf_link_net_font_weight, 3, 5, 1, 1)
self.lineEdit_tf_link_net_taxa_color = QtWidgets.QLineEdit(self.page_2)
self.lineEdit_tf_link_net_taxa_color.setObjectName("lineEdit_tf_link_net_taxa_color")
self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_taxa_color, 0, 3, 1, 1)
+ self.label_15 = QtWidgets.QLabel(self.page_2)
+ self.label_15.setObjectName("label_15")
+ self.gridLayout_6.addWidget(self.label_15, 2, 4, 1, 1)
+ self.label_9 = QtWidgets.QLabel(self.page_2)
+ self.label_9.setObjectName("label_9")
+ self.gridLayout_6.addWidget(self.label_9, 0, 4, 1, 1)
self.label_10 = QtWidgets.QLabel(self.page_2)
self.label_10.setObjectName("label_10")
self.gridLayout_6.addWidget(self.label_10, 1, 2, 1, 1)
+ self.label_14 = QtWidgets.QLabel(self.page_2)
+ self.label_14.setObjectName("label_14")
+ self.gridLayout_6.addWidget(self.label_14, 2, 2, 1, 1)
+ self.lineEdit_tf_link_net_line_color = QtWidgets.QLineEdit(self.page_2)
+ self.lineEdit_tf_link_net_line_color.setObjectName("lineEdit_tf_link_net_line_color")
+ self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_line_color, 3, 3, 1, 1)
+ self.lineEdit_tf_link_net_func_color = QtWidgets.QLineEdit(self.page_2)
+ self.lineEdit_tf_link_net_func_color.setObjectName("lineEdit_tf_link_net_func_color")
+ self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_func_color, 1, 3, 1, 1)
+ self.doubleSpinBox_tf_link_net_line_curve = QtWidgets.QDoubleSpinBox(self.page_2)
+ self.doubleSpinBox_tf_link_net_line_curve.setDecimals(1)
+ self.doubleSpinBox_tf_link_net_line_curve.setMaximum(1.0)
+ self.doubleSpinBox_tf_link_net_line_curve.setSingleStep(0.1)
+ self.doubleSpinBox_tf_link_net_line_curve.setProperty("value", 0.0)
+ self.doubleSpinBox_tf_link_net_line_curve.setObjectName("doubleSpinBox_tf_link_net_line_curve")
+ self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_line_curve, 2, 3, 1, 1)
+ self.spinBox_tf_link_net_repulsion = QtWidgets.QSpinBox(self.page_2)
+ self.spinBox_tf_link_net_repulsion.setMaximum(100000)
+ self.spinBox_tf_link_net_repulsion.setSingleStep(10)
+ self.spinBox_tf_link_net_repulsion.setProperty("value", 500)
+ self.spinBox_tf_link_net_repulsion.setObjectName("spinBox_tf_link_net_repulsion")
+ self.gridLayout_6.addWidget(self.spinBox_tf_link_net_repulsion, 2, 5, 1, 1)
+ self.label_16 = QtWidgets.QLabel(self.page_2)
+ self.label_16.setObjectName("label_16")
+ self.gridLayout_6.addWidget(self.label_16, 3, 4, 1, 1)
self.lineEdit_tf_link_net_func_focus_color = QtWidgets.QLineEdit(self.page_2)
self.lineEdit_tf_link_net_func_focus_color.setObjectName("lineEdit_tf_link_net_func_focus_color")
self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_func_focus_color, 1, 5, 1, 1)
- self.lineEdit_tf_link_net_taxa_focus_color = QtWidgets.QLineEdit(self.page_2)
- self.lineEdit_tf_link_net_taxa_focus_color.setObjectName("lineEdit_tf_link_net_taxa_focus_color")
- self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_taxa_focus_color, 0, 5, 1, 1)
- self.label_11 = QtWidgets.QLabel(self.page_2)
- self.label_11.setObjectName("label_11")
- self.gridLayout_6.addWidget(self.label_11, 2, 0, 1, 1)
- self.label_5 = QtWidgets.QLabel(self.page_2)
- self.label_5.setObjectName("label_5")
- self.gridLayout_6.addWidget(self.label_5, 0, 0, 1, 1)
- self.label_6 = QtWidgets.QLabel(self.page_2)
- self.label_6.setObjectName("label_6")
- self.gridLayout_6.addWidget(self.label_6, 1, 0, 1, 1)
self.label_8 = QtWidgets.QLabel(self.page_2)
self.label_8.setObjectName("label_8")
self.gridLayout_6.addWidget(self.label_8, 1, 4, 1, 1)
- self.label_9 = QtWidgets.QLabel(self.page_2)
- self.label_9.setObjectName("label_9")
- self.gridLayout_6.addWidget(self.label_9, 0, 4, 1, 1)
+ self.doubleSpinBox_tf_link_net_line_opacity = QtWidgets.QDoubleSpinBox(self.page_2)
+ self.doubleSpinBox_tf_link_net_line_opacity.setDecimals(1)
+ self.doubleSpinBox_tf_link_net_line_opacity.setMaximum(1.0)
+ self.doubleSpinBox_tf_link_net_line_opacity.setSingleStep(0.1)
+ self.doubleSpinBox_tf_link_net_line_opacity.setProperty("value", 0.5)
+ self.doubleSpinBox_tf_link_net_line_opacity.setObjectName("doubleSpinBox_tf_link_net_line_opacity")
+ self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_line_opacity, 3, 1, 1, 1)
self.comboBox_tf_link_net_func_shape = QtWidgets.QComboBox(self.page_2)
self.comboBox_tf_link_net_func_shape.setObjectName("comboBox_tf_link_net_func_shape")
self.comboBox_tf_link_net_func_shape.addItem("")
@@ -112,22 +132,21 @@ def setupUi(self, Settings):
self.comboBox_tf_link_net_func_shape.addItem("")
self.comboBox_tf_link_net_func_shape.addItem("")
self.gridLayout_6.addWidget(self.comboBox_tf_link_net_func_shape, 1, 1, 1, 1)
- self.label_12 = QtWidgets.QLabel(self.page_2)
- self.label_12.setObjectName("label_12")
- self.gridLayout_6.addWidget(self.label_12, 3, 0, 1, 1)
self.label_13 = QtWidgets.QLabel(self.page_2)
self.label_13.setObjectName("label_13")
self.gridLayout_6.addWidget(self.label_13, 3, 2, 1, 1)
- self.label_14 = QtWidgets.QLabel(self.page_2)
- self.label_14.setObjectName("label_14")
- self.gridLayout_6.addWidget(self.label_14, 2, 2, 1, 1)
- self.doubleSpinBox_tf_link_net_line_opacity = QtWidgets.QDoubleSpinBox(self.page_2)
- self.doubleSpinBox_tf_link_net_line_opacity.setDecimals(1)
- self.doubleSpinBox_tf_link_net_line_opacity.setMaximum(1.0)
- self.doubleSpinBox_tf_link_net_line_opacity.setSingleStep(0.1)
- self.doubleSpinBox_tf_link_net_line_opacity.setProperty("value", 0.5)
- self.doubleSpinBox_tf_link_net_line_opacity.setObjectName("doubleSpinBox_tf_link_net_line_opacity")
- self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_line_opacity, 3, 1, 1, 1)
+ self.label_7 = QtWidgets.QLabel(self.page_2)
+ self.label_7.setObjectName("label_7")
+ self.gridLayout_6.addWidget(self.label_7, 0, 2, 1, 1)
+ self.label_12 = QtWidgets.QLabel(self.page_2)
+ self.label_12.setObjectName("label_12")
+ self.gridLayout_6.addWidget(self.label_12, 3, 0, 1, 1)
+ self.lineEdit_tf_link_net_taxa_focus_color = QtWidgets.QLineEdit(self.page_2)
+ self.lineEdit_tf_link_net_taxa_focus_color.setObjectName("lineEdit_tf_link_net_taxa_focus_color")
+ self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_taxa_focus_color, 0, 5, 1, 1)
+ self.label_11 = QtWidgets.QLabel(self.page_2)
+ self.label_11.setObjectName("label_11")
+ self.gridLayout_6.addWidget(self.label_11, 2, 0, 1, 1)
self.doubleSpinBox_tf_link_net_line_width = QtWidgets.QDoubleSpinBox(self.page_2)
self.doubleSpinBox_tf_link_net_line_width.setDecimals(1)
self.doubleSpinBox_tf_link_net_line_width.setMinimum(0.1)
@@ -135,28 +154,40 @@ def setupUi(self, Settings):
self.doubleSpinBox_tf_link_net_line_width.setProperty("value", 3.0)
self.doubleSpinBox_tf_link_net_line_width.setObjectName("doubleSpinBox_tf_link_net_line_width")
self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_line_width, 2, 1, 1, 1)
- self.lineEdit_tf_link_net_line_color = QtWidgets.QLineEdit(self.page_2)
- self.lineEdit_tf_link_net_line_color.setObjectName("lineEdit_tf_link_net_line_color")
- self.gridLayout_6.addWidget(self.lineEdit_tf_link_net_line_color, 3, 3, 1, 1)
- self.label_15 = QtWidgets.QLabel(self.page_2)
- self.label_15.setObjectName("label_15")
- self.gridLayout_6.addWidget(self.label_15, 2, 4, 1, 1)
- self.spinBox_tf_link_net_repulsion = QtWidgets.QSpinBox(self.page_2)
- self.spinBox_tf_link_net_repulsion.setMaximum(100000)
- self.spinBox_tf_link_net_repulsion.setSingleStep(10)
- self.spinBox_tf_link_net_repulsion.setProperty("value", 500)
- self.spinBox_tf_link_net_repulsion.setObjectName("spinBox_tf_link_net_repulsion")
- self.gridLayout_6.addWidget(self.spinBox_tf_link_net_repulsion, 2, 5, 1, 1)
- self.label_16 = QtWidgets.QLabel(self.page_2)
- self.label_16.setObjectName("label_16")
- self.gridLayout_6.addWidget(self.label_16, 3, 4, 1, 1)
- self.comboBox_tf_link_net_font_weight = QtWidgets.QComboBox(self.page_2)
- self.comboBox_tf_link_net_font_weight.setObjectName("comboBox_tf_link_net_font_weight")
- self.comboBox_tf_link_net_font_weight.addItem("")
- self.comboBox_tf_link_net_font_weight.addItem("")
- self.comboBox_tf_link_net_font_weight.addItem("")
- self.comboBox_tf_link_net_font_weight.addItem("")
- self.gridLayout_6.addWidget(self.comboBox_tf_link_net_font_weight, 3, 5, 1, 1)
+ self.label_6 = QtWidgets.QLabel(self.page_2)
+ self.label_6.setObjectName("label_6")
+ self.gridLayout_6.addWidget(self.label_6, 1, 0, 1, 1)
+ self.label_17 = QtWidgets.QLabel(self.page_2)
+ self.label_17.setObjectName("label_17")
+ self.gridLayout_6.addWidget(self.label_17, 4, 0, 1, 1)
+ self.comboBox_tf_link_net_label_position = QtWidgets.QComboBox(self.page_2)
+ self.comboBox_tf_link_net_label_position.setObjectName("comboBox_tf_link_net_label_position")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.comboBox_tf_link_net_label_position.addItem("")
+ self.gridLayout_6.addWidget(self.comboBox_tf_link_net_label_position, 4, 1, 1, 1)
+ self.label_18 = QtWidgets.QLabel(self.page_2)
+ self.label_18.setObjectName("label_18")
+ self.gridLayout_6.addWidget(self.label_18, 4, 2, 1, 1)
+ self.spinBox_tf_link_net_text_width = QtWidgets.QSpinBox(self.page_2)
+ self.spinBox_tf_link_net_text_width.setMaximum(9999)
+ self.spinBox_tf_link_net_text_width.setSingleStep(10)
+ self.spinBox_tf_link_net_text_width.setProperty("value", 300)
+ self.spinBox_tf_link_net_text_width.setObjectName("spinBox_tf_link_net_text_width")
+ self.gridLayout_6.addWidget(self.spinBox_tf_link_net_text_width, 4, 3, 1, 1)
+ self.label_19 = QtWidgets.QLabel(self.page_2)
+ self.label_19.setObjectName("label_19")
+ self.gridLayout_6.addWidget(self.label_19, 4, 4, 1, 1)
+ self.doubleSpinBox_tf_link_net_gravity = QtWidgets.QDoubleSpinBox(self.page_2)
+ self.doubleSpinBox_tf_link_net_gravity.setMaximum(1.0)
+ self.doubleSpinBox_tf_link_net_gravity.setSingleStep(0.1)
+ self.doubleSpinBox_tf_link_net_gravity.setProperty("value", 0.2)
+ self.doubleSpinBox_tf_link_net_gravity.setObjectName("doubleSpinBox_tf_link_net_gravity")
+ self.gridLayout_6.addWidget(self.doubleSpinBox_tf_link_net_gravity, 4, 5, 1, 1)
self.gridLayout_4.addLayout(self.gridLayout_6, 2, 3, 1, 1)
self.gridLayout_8 = QtWidgets.QGridLayout()
self.gridLayout_8.setObjectName("gridLayout_8")
@@ -218,7 +249,6 @@ def retranslateUi(self, Settings):
self.toolBox.setItemText(self.toolBox.indexOf(self.page), _translate("Settings", "General"))
self.label_4.setText(_translate("Settings", "Taxa-Functions Link Network"))
self.label.setText(_translate("Settings", "HeatMap"))
- self.label_7.setText(_translate("Settings", "Taxa Color"))
self.comboBox_tf_link_net_taxa_sahpe.setItemText(0, _translate("Settings", "circle"))
self.comboBox_tf_link_net_taxa_sahpe.setItemText(1, _translate("Settings", "rect"))
self.comboBox_tf_link_net_taxa_sahpe.setItemText(2, _translate("Settings", "roundRect"))
@@ -226,16 +256,21 @@ def retranslateUi(self, Settings):
self.comboBox_tf_link_net_taxa_sahpe.setItemText(4, _translate("Settings", "diamond"))
self.comboBox_tf_link_net_taxa_sahpe.setItemText(5, _translate("Settings", "pin"))
self.comboBox_tf_link_net_taxa_sahpe.setItemText(6, _translate("Settings", "arrow"))
- self.lineEdit_tf_link_net_func_color.setText(_translate("Settings", "#DF8F44"))
+ self.label_5.setText(_translate("Settings", "Taxa Shape"))
+ self.comboBox_tf_link_net_font_weight.setItemText(0, _translate("Settings", "bold"))
+ self.comboBox_tf_link_net_font_weight.setItemText(1, _translate("Settings", "normal"))
+ self.comboBox_tf_link_net_font_weight.setItemText(2, _translate("Settings", "bolder"))
+ self.comboBox_tf_link_net_font_weight.setItemText(3, _translate("Settings", "lighter"))
self.lineEdit_tf_link_net_taxa_color.setText(_translate("Settings", "#374E55"))
+ self.label_15.setText(_translate("Settings", "Repulsion"))
+ self.label_9.setText(_translate("Settings", "Focus Taxa Color"))
self.label_10.setText(_translate("Settings", "Func Color"))
+ self.label_14.setText(_translate("Settings", "Line Curve"))
+ self.lineEdit_tf_link_net_line_color.setText(_translate("Settings", "#9aa7b1"))
+ self.lineEdit_tf_link_net_func_color.setText(_translate("Settings", "#DF8F44"))
+ self.label_16.setText(_translate("Settings", "Font Weight"))
self.lineEdit_tf_link_net_func_focus_color.setText(_translate("Settings", "#B24745"))
- self.lineEdit_tf_link_net_taxa_focus_color.setText(_translate("Settings", "#6A6599"))
- self.label_11.setText(_translate("Settings", "Line Width"))
- self.label_5.setText(_translate("Settings", "Taxa Shape"))
- self.label_6.setText(_translate("Settings", "Function Shape"))
self.label_8.setText(_translate("Settings", "Focus Func Color"))
- self.label_9.setText(_translate("Settings", "Focus Taxa Color"))
self.comboBox_tf_link_net_func_shape.setItemText(0, _translate("Settings", "rect"))
self.comboBox_tf_link_net_func_shape.setItemText(1, _translate("Settings", "circle"))
self.comboBox_tf_link_net_func_shape.setItemText(2, _translate("Settings", "roundRect"))
@@ -243,16 +278,22 @@ def retranslateUi(self, Settings):
self.comboBox_tf_link_net_func_shape.setItemText(4, _translate("Settings", "diamond"))
self.comboBox_tf_link_net_func_shape.setItemText(5, _translate("Settings", "pin"))
self.comboBox_tf_link_net_func_shape.setItemText(6, _translate("Settings", "arrow"))
- self.label_12.setText(_translate("Settings", "Line opacity"))
self.label_13.setText(_translate("Settings", "Line Color"))
- self.label_14.setText(_translate("Settings", "Line Curve"))
- self.lineEdit_tf_link_net_line_color.setText(_translate("Settings", "#9aa7b1"))
- self.label_15.setText(_translate("Settings", "Repulsion"))
- self.label_16.setText(_translate("Settings", "Font Weight"))
- self.comboBox_tf_link_net_font_weight.setItemText(0, _translate("Settings", "bold"))
- self.comboBox_tf_link_net_font_weight.setItemText(1, _translate("Settings", "normal"))
- self.comboBox_tf_link_net_font_weight.setItemText(2, _translate("Settings", "bolder"))
- self.comboBox_tf_link_net_font_weight.setItemText(3, _translate("Settings", "lighter"))
+ self.label_7.setText(_translate("Settings", "Taxa Color"))
+ self.label_12.setText(_translate("Settings", "Line opacity"))
+ self.lineEdit_tf_link_net_taxa_focus_color.setText(_translate("Settings", "#6A6599"))
+ self.label_11.setText(_translate("Settings", "Line Width"))
+ self.label_6.setText(_translate("Settings", "Function Shape"))
+ self.label_17.setText(_translate("Settings", "Label Postion"))
+ self.comboBox_tf_link_net_label_position.setItemText(0, _translate("Settings", "bottom"))
+ self.comboBox_tf_link_net_label_position.setItemText(1, _translate("Settings", "top"))
+ self.comboBox_tf_link_net_label_position.setItemText(2, _translate("Settings", "right"))
+ self.comboBox_tf_link_net_label_position.setItemText(3, _translate("Settings", "left"))
+ self.comboBox_tf_link_net_label_position.setItemText(4, _translate("Settings", "inside"))
+ self.comboBox_tf_link_net_label_position.setItemText(5, _translate("Settings", "insideLeft"))
+ self.comboBox_tf_link_net_label_position.setItemText(6, _translate("Settings", "insideRight"))
+ self.label_18.setText(_translate("Settings", "Text Width"))
+ self.label_19.setText(_translate("Settings", "Gravity"))
self.label_2.setText(_translate("Settings", "Linkage Method"))
self.comboBox_heatmap_linkage_method.setCurrentText(_translate("Settings", "average"))
self.comboBox_heatmap_linkage_method.setItemText(0, _translate("Settings", "average"))
diff --git a/utils/TaxaFuncPloter/network_plot.py b/utils/TaxaFuncPloter/network_plot.py
index 8101791..2cee8bd 100644
--- a/utils/TaxaFuncPloter/network_plot.py
+++ b/utils/TaxaFuncPloter/network_plot.py
@@ -20,7 +20,10 @@ def __init__(self, tfobj,
co_network_focus_color="#B24745",
co_network_normal_color="#79af97",
font_weight="normal",
- theme="white"
+ theme="white",
+ label_position="bottom",
+ text_width = 300,
+ gravity = 0.2
):
@@ -48,6 +51,9 @@ def __init__(self, tfobj,
self.co_network_normal_color = co_network_normal_color
self.theme = theme
+ self.label_position = label_position
+ self.text_width = text_width
+ self.gravity = gravity
def modify_focus_list(self, focus_list):
@@ -219,21 +225,21 @@ def plot_tflink_network(self, sample_list:list = None, width:int = 12, height:in
links,
categories,
repulsion=self.repulsion,
+ gravity= self.gravity,
is_focusnode=True,
is_layout_animation=True,
- friction=0.6,
linestyle_opts=opts.LineStyleOpts(
curve=self.line_curve, opacity=self.line_opacity, width=self.line_width, color=self.line_color
),
- # itemstyle_opts=opts.ItemStyleOpts(border_width=0.5, border_color="rgba(0,0,0,0.5)", opacity=0.8),
- gravity=0.05,
label_opts=opts.LabelOpts(
is_show=self.show_labels,
- position="right",
+ position=self.label_position,
color="auto",
formatter="{b}",
font_size=self.font_size,
- font_weight=self.font_weight
+ font_weight=self.font_weight,
+ overflow = 'break',
+ text_width = self.text_width
),
)
.set_global_opts(
@@ -393,15 +399,18 @@ def plot_co_expression_network(self, df_type:str= 'taxa', corr_method:str = 'pea
nodes,
links,
categories=categories,
+ gravity= self.gravity,
repulsion=self.repulsion,
is_layout_animation=True,
label_opts=opts.LabelOpts(
is_show=self.show_labels,
font_size=self.font_size,
- position="right",
+ position=self.label_position,
color="auto",
formatter="{b}",
- font_weight=self.font_weight
+ font_weight=self.font_weight,
+ overflow = 'break',
+ text_width = self.text_width
),
linestyle_opts=opts.LineStyleOpts(
opacity=self.line_opacity,
diff --git a/utils/version.py b/utils/version.py
index df4e6d1..fc032ef 100644
--- a/utils/version.py
+++ b/utils/version.py
@@ -1,2 +1,2 @@
-__version__ = '1.107.4'
+__version__ = '1.107.5'
API_version = '1'
\ No newline at end of file