Skip to content

Commit

Permalink
1. Added more options for the Taxa-Functions Network plot, including …
Browse files Browse the repository at this point in the history
…the color, label, layout, and edge width. etc.

2. Updated the MetaX_Cookbook.md and README.md to reflect the changes.
  • Loading branch information
byemaxx committed Jun 16, 2024
1 parent f9bc6d0 commit c07de73
Show file tree
Hide file tree
Showing 18 changed files with 1,534 additions and 711 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.107.1
## Date: 2024-06-16
### Changes:
- New: Added more options for the Taxa-Functions Network plot, including the color, label, layout, and edge width. etc.

# Version: 1.107.0
## Date: 2024-06-15
### Changes:
Expand Down
Binary file modified Docs/MetaX_Cookbook.assets/peptide2taxafunc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/MetaX_Cookbook.assets/settings_page2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/MetaX_Cookbook.assets/taxa_func_network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/MetaX_Cookbook.assets/tf_link_net.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 46 additions & 22 deletions Docs/MetaX_Cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ Visit **Github** to get more information:

# Module 1. Database Builder

**NOTE:** the result of **<u>MetaLab v2.3</u>** MaxQuant workflow do not need Build Database. However, we do not recommend the result files from this version of MetaLab as input to MetaX, and large amounts of Peptide may be discarded.



- You have to build the database for **the first time** using <u>Database Builder</u>.

**(Option 1) Build Database By MGnify Data**

Make sure to download the correct database type corresponding to your data



<img src="./MetaX_Cookbook.assets/dbbuilder.png" alt="dbbuilder" />
Expand Down Expand Up @@ -115,6 +119,10 @@ Visit **Github** to get more information:

# Module 3. Peptide Annotator

## 1. Result From MAG:

The peptide result form Metagenome-assembled *genomes* (*MAGs*) as the reference database for proteins search, e.g. MetaLab-MAG, and other database like MGnify.

- Annotate the peptide to TaxaFunc before analyzing by <u>**Peptide Annotator**</u>

<img src="./MetaX_Cookbook.assets/peptide2taxafunc.png" alt="peptide2taxafunc" />
Expand Down Expand Up @@ -143,7 +151,20 @@ Visit **Github** to get more information:

<img src="./MetaX_Cookbook.assets/LCA_prop.png" alt="LCA_prop" style="zoom:50%;" />

## 2. Results from MetaLab 2.3:

The peptide result from **<u>MetaLab 2.3</u>** MaxQuant workflow

- Select the **MetaLab** result folder, which contains the **maxquant_search** folder.

- ![peptide2taxafunc_tab2_1](MetaX_Cookbook.assets\peptide2taxafunc_tab2_1.png)

- Then the **Peptide Annotator** will automatically find the **peptides_report.txt**, **BuiltIn.pepTaxa.csv** and **functions.tsv** in the **maxquant_search** folder. Or you can select the files manually.



- Select the **OTFs Save To** to set the location to save the result table.
- ![peptide2taxafunc_tab2_2](MetaX_Cookbook.assets\peptide2taxafunc_tab2_2.png)


# Module 4. OTF Analyzer
Expand Down Expand Up @@ -683,26 +704,27 @@ We can select <u>**meta**</u> <u>**groups**</u> or <u>**samples**</u> (default a

<img src="./MetaX_Cookbook.assets/bar_to_line.png" alt="bar_to_line" />

### Taxa-Func Network

- Select some groups or samples (default all)
- add some taxa, func or taxa-func to focus the window (Optional)

<img src="./MetaX_Cookbook.assets/taxa_func_link_page.png" alt="image-20230728145518517" />

- Plot list only
- Checked the "**Plot List Only**" to show the items only in the list

- Network plot
- The yellow dots are taxa, and the grey dots are functions, the size of the dots presents the intensity
- The red dots are the taxa we focused on
- The green dots are the functions we focused on

<img src="./MetaX_Cookbook.assets/taxa_func_network.png" alt="taxa_func_network" />



# Restore Last TaxaFunc Object
### Taxa-Func Network

- Select some groups or samples (default all)
- add some taxa, func or taxa-func to focus the window (Optional)

<img src="./MetaX_Cookbook.assets/taxa_func_link_page.png" alt="image-20230728145518517" />

- Plot list only
- Checked the "**Plot List Only**" to show the items only in the list

- Network plot
- The yellow dots are taxa, and the grey dots are functions, the size of the dots presents the intensity
- The red dots are the taxa we focused on
- The green dots are the functions we focused on

<img src="./MetaX_Cookbook.assets/taxa_func_network.png" alt="taxa_func_network" />



## 8. Restore Last TaxaFunc Object

- Once you create TaxaFunc, the <u>TaxaFunc Object</u> will save automatically, and you can restore it next time.
- Also, we can export the current MetaX to a file and reload it again.
Expand Down Expand Up @@ -733,7 +755,9 @@ We can select <u>**meta**</u> <u>**groups**</u> or <u>**samples**</u> (default a
- Check the box of **Auto Check Update** to enable or disable check update when launching
- Change to update from the **stable version** or **beta version** by settings
- <img src="MetaX_Cookbook.assets/settings.png" alt="settings" />

- Other Options Settings
- ![settings_page2](C:\Users\max\OneDrive - University of Ottawa\code\TaxaFunc\MetaX\docs\MetaX_Cookbook.assets\settings_page2.png)




Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ MetaX also features <u>statistical modules</u> and <u>plotting tools</u> for ana

![abstract](./Docs/MetaX_Cookbook.assets/abstract.png)
## Taxa-Functions Linkage
Linking Taxa and Functions in different levels of the hierarchy, and different functional categories. e.g., **Species-KO**, **Genus-CAZy**, **Phylum-EC**, etc.

![OTF](./Docs/MetaX_Cookbook.assets/tf_link_net.png)

## Download
### `Desktop Version(Recommended)`:
Expand Down
42 changes: 36 additions & 6 deletions utils/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def __init__(self, MainWindow):
# ploting parameters
self.heatmap_params_dict = {'linkage_method': 'average', 'distance_metric': 'euclidean'}

self.tf_link_net_params_dict = {'taxa_shape': 'circle', 'func_shape': 'rect',
'taxa_color': '#374E55','taxa_focus_color': '#6A6599',
'func_color': '#DF8F44', 'func_focus_color': '#B24745',
'line_opacity': 0.5, 'line_width': 2, 'line_curve': 0.1,
'line_color': '#9aa7b1', 'repulsion': 500
}


# set icon
self.actionTaxaFuncAnalyzer.setIcon(qta.icon('mdi.chart-areaspline'))
Expand Down Expand Up @@ -632,15 +639,19 @@ def show_settings_window(self):
self.settings_dialog.setWindowTitle("Settings")
self.settings_dialog.setModal(False)
layout = QVBoxLayout(self.settings_dialog)
self.settings_dialog.resize(600, 400)
self.settings_dialog.resize(900, 600)

settings_widget = SettingsWidget(self.settings_dialog, self.update_branch, self.auto_check_update)
settings_widget.update_mode_changed.connect(self.on_update_mode_changed)
settings_widget.auto_check_update_changed.connect(self.on_auto_check_update_changed)
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)

layout.addWidget(settings_widget)
self.settings_dialog.setLayout(layout)

# set not pin to top
self.settings_dialog.setWindowFlags(self.settings_dialog.windowFlags() & ~Qt.WindowStaysOnTopHint)

self.settings_dialog.show()

Expand All @@ -659,6 +670,10 @@ def on_auto_check_update_changed(self, auto_check):
def on_heatmap_params_changed(self, params_dict):
self.heatmap_params_dict = params_dict
print(f"Heatmap params changed to: {params_dict}")

def on_tf_link_net_params_changed(self, params_dict):
self.tf_link_net_params_dict = params_dict
print(f"Taxa-func link network params changed to: {params_dict}")

############### basic function End ###############

Expand Down Expand Up @@ -4790,8 +4805,10 @@ def plot_co_expr_network(self):
height = self.spinBox_co_expr_height.value()
focus_list = self.co_expr_focus_list
plot_list_only = self.checkBox_co_expr_plot_list_only.isChecked()


show_labels = self.checkBox_co_expr_show_label.isChecked()
rename_taxa = self.checkBox_co_expr_rename_taxa.isChecked()
font_size = self.spinBox_co_expr_font_size.value()

sample_list = self.tfa.sample_list
if self.radioButton_co_expr_bysample.isChecked():
slected_list = self.comboBox_co_expr_sample.getCheckedItems()
Expand All @@ -4813,9 +4830,13 @@ def plot_co_expr_network(self):
return None


try:
try:
self.show_message('Co-expression network is plotting...\n\n It may take a long time! Please wait...')
pic = NetworkPlot(self.tfa).plot_co_expression_network(df_type= df_type, corr_method=corr_method,
pic = NetworkPlot(self.tfa,
show_labels=show_labels,
rename_taxa=rename_taxa,
font_size=font_size,
).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)
self.save_and_show_js_plot(pic, 'co-expression network')
except ValueError as e:
Expand Down Expand Up @@ -5020,6 +5041,10 @@ def plot_network(self):
sample_list = self.tfa.sample_list
focus_list = self.tfnet_fcous_list
plot_list_only = self.checkBox_tf_link_net_plot_list_only.isChecked()
show_labels = self.checkBox_tf_link_net_show_label.isChecked()
rename_taxa = self.checkBox_tf_link_net_rename_taxa.isChecked()
font_size = self.spinBox_network_font_size.value()


if self.radioButton_network_bysample.isChecked():
slected_list = self.comboBox_network_sample.getCheckedItems()
Expand All @@ -5034,7 +5059,12 @@ def plot_network(self):
# print(f'Plot with selected groups:{groups} and samples:{sample_list}')
try:
self.show_message('Plotting network...')
pic = NetworkPlot(self.tfa).plot_tflink_network(sample_list=sample_list, width=width, height=height, focus_list=focus_list,plot_list_only=plot_list_only)
pic = NetworkPlot(self.tfa,
show_labels=show_labels,
rename_taxa=rename_taxa,
font_size=font_size,
**self.tf_link_net_params_dict
).plot_tflink_network(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, 'taxa-func link Network')
except Exception as e:
error_message = traceback.format_exc()
Expand Down
Loading

0 comments on commit c07de73

Please sign in to comment.