Skip to content

Commit

Permalink
First version of the MicW2Graph project
Browse files Browse the repository at this point in the history
  • Loading branch information
sayalaruano committed May 28, 2024
1 parent b0675a0 commit 0c5a2d4
Show file tree
Hide file tree
Showing 557 changed files with 558,083 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class


# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Poetry
poetry.lock
poetry.toml

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

183 changes: 183 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Below are all the sections and options you can have in ~/.streamlit/config.toml.

[global]

# By default, Streamlit checks if the Python watchdog module is available and, if not, prints a warning asking for you to install it. The watchdog module is not required, but highly recommended. It improves Streamlit's ability to detect changes to files in your filesystem.
# If you'd like to turn off this warning, set this to True.
# Default: false
disableWatchdogWarning = true

# If True, will show a warning when you run a Streamlit-enabled script via "python my_script.py".
# Default: true
# showWarningOnDirectExecution = true

# DataFrame serialization.
# Acceptable values: - 'legacy': Serialize DataFrames using Streamlit's custom format. Slow but battle-tested. - 'arrow': Serialize DataFrames using Apache Arrow. Much faster and versatile.
# Default: "arrow"
# dataFrameSerialization = "arrow"


[logger]

# Level of logging: 'error', 'warning', 'info', or 'debug'.
# Default: 'info'
# level = "info"

# String format for logging messages. If logger.datetimeFormat is set, logger messages will default to `%(asctime)s.%(msecs)03d %(message)s`. See [Python's documentation](https://docs.python.org/2.6/library/logging.html#formatter-objects) for available attributes.
# Default: "%(asctime)s %(message)s"
# messageFormat = "%(asctime)s %(message)s"


[client]

# Whether to enable st.cache.
# Default: true
# caching = true

# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
# displayEnabled = true

# Controls whether uncaught app exceptions are displayed in the browser. By default, this is set to True and Streamlit displays app exceptions and associated tracebacks in the browser.
# If set to False, an exception will result in a generic message being shown in the browser, and exceptions and tracebacks will be printed to the console only.
# Default: true
# showErrorDetails = true


[runner]

# Allows you to type a variable or string by itself in a single line of Python code to write it to the app.
# Default: true
# magicEnabled = true

# Install a Python tracer to allow you to stop or pause your script at any point and introspect it. As a side-effect, this slows down your script's execution.
# Default: false
# installTracer = false

# Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
# fixMatplotlib = true

# Run the Python Garbage Collector after each script execution. This can help avoid excess memory use in Streamlit apps, but could introduce delay in rerunning the app script for high-memory-use applications.
# Default: true
# postScriptGC = true

# Handle script rerun requests immediately, rather than waiting for script execution to reach a yield point. Enabling this will make Streamlit much more responsive to user interaction, but it can lead to race conditions in apps that mutate session_state data outside of explicit session_state assignment statements.
# Default: false
fastReruns = true


[server]

# List of folders that should not be watched for changes. This impacts both "Run on Save" and @st.cache.
# Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
# folderWatchBlacklist = []

# Change the type of file watcher used by Streamlit, or turn it off completely.
# Allowed values: * "auto" : Streamlit will attempt to use the watchdog module, and falls back to polling if watchdog is not available. * "watchdog" : Force Streamlit to use the watchdog module. * "poll" : Force Streamlit to always use polling. * "none" : Streamlit will not watch files.
# Default: "auto"
fileWatcherType = "auto"

# Symmetric key used to produce signed cookies. If deploying on multiple replicas, this should be set to the same value across all replicas to ensure they all share the same secret.
# Default: randomly generated secret key.
# cookieSecret = "80f9eb91f1eb64e26f0e46148556bf493ccde5fe27712bbcbebf57948852b5fe"

# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) we are running in the Streamlit Atom plugin.
# headless = false

# Automatically rerun script when the file is modified on disk.
# Default: false
# runOnSave = false

# The address where the server will listen for client and browser connections. Use this if you want to bind the server to a specific address. If set, the server will only be accessible from this address, and not from any aliases (like localhost).
# Default: (unset)
# address =

# The port where the server will listen for browser connections.
# Default: 8501
# port = 8501

# The base path for the URL where Streamlit should be served from.
# Default: ""
# baseUrlPath = ""

# Enables support for Cross-Origin Request Sharing (CORS) protection, for added security.
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` is off at the same time, we will prioritize `server.enableXsrfProtection`.
# Default: true
# enableCORS = true

# Enables support for Cross-Site Request Forgery (XSRF) protection, for added security.
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` is off at the same time, we will prioritize `server.enableXsrfProtection`.
# Default: true
# enableXsrfProtection = true

# Max size, in megabytes, for files uploaded with the file_uploader.
# Default: 200
# maxUploadSize = 200

# Max size, in megabytes, of messages that can be sent via the WebSocket connection.
# Default: 200
# maxMessageSize = 200

# Enables support for websocket compression.
# Default: false
# enableWebsocketCompression = false


[browser]

# Internet address where users should point their browsers in order to connect to the app. Can be IP address or DNS name and path.
# This is used to: - Set the correct URL for CORS and XSRF protection purposes. - Show the URL on the terminal - Open the browser
# Default: "localhost"
# serverAddress = "localhost"

# Whether to send usage statistics to Streamlit.
# Default: true
gatherUsageStats = false

# Port where users should point their browsers in order to connect to the app.
# This is used to: - Set the correct URL for CORS and XSRF protection purposes. - Show the URL on the terminal - Open the browser
# Default: whatever value is set in server.port.
# serverPort = 8501


[mapbox]

# Configure Streamlit to use a custom Mapbox token for elements like st.pydeck_chart and st.map. To get a token for yourself, create an account at https://mapbox.com. It's free (for moderate usage levels)!
# Default: ""
# token = ""


[deprecation]

# Set to false to disable the deprecation warning for the file uploader encoding.
# Default: true
# showfileUploaderEncoding = true

# Set to false to disable the deprecation warning for using the global pyplot instance.
# Default: true
# showPyplotGlobalUse = true


[theme]

# The preset Streamlit theme that your custom theme inherits from. One of "light" or "dark".
# base =

# Primary accent color for interactive elements.
primaryColor = "#110b7a"

# Background color for the main content area.
backgroundColor = "#ffffff"

# Background color used for the sidebar and most interactive widgets.
secondaryBackgroundColor = "#687ea8"

# Color used for almost all text.
textColor = "#262730"

# Font family for all text in the app, except code blocks. One of "sans serif", "serif", or "monospace".
font = "sans serif"
58 changes: 58 additions & 0 deletions MicW2Graph_Home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import utils
import web_utils
import streamlit as st
from streamlit_extras.switch_page_button import switch_page
from css import style
from PIL import Image

# General web settings
im = Image.open("images/favicon.ico")
st.set_page_config(layout="wide", page_title="MicW2Graph", menu_items={}, page_icon=im)
st.session_state.sidebar_state = 'collapsed'
style.load_css()

# Menu options
page = web_utils.show_pages_menu(index=0)
if page == "Exploratory data analysis":
switch_page("exploratory data analysis")
elif page == "Microbial association networks":
switch_page('microbial association networks')
elif page == "Knowledge graph":
switch_page('knowledge graph and subgraphs')
elif page == "Case studies":
switch_page('case studies')

# Read config yaml file
# This will be done only once and all the pages will have access to the data
if 'config' not in st.session_state:
st.session_state.config = utils.read_yaml('config.yml')

# Title of the app
st.markdown("<h1 style='text-align: center; color: #023858;'>MicW2Graph</h1>", unsafe_allow_html=True)
st.markdown("<h3 style='text-align: center; color: #2b8cbe;'>Building a knowledge graph of the wastewater treatment microbiome and its biological context</h3>", unsafe_allow_html=True)
st.markdown("---")

with st.expander('About the project'):
st.write('''
In this project, we investigated the microbiome of the **wastewater treatment** (WWT) process to build **MicW2Graph**, an open-source **knowledge graph** that
integrates WWT metagenomic and metatranscriptomic information with their biological context, including biological processes, environmental and
phenotypic features, chemical compounds, and additional metadata. We developed a workflow to collect meta-omics datasets from **MGnify** and infer
potential interactions among microorganisms through **microbial association networks**. MicW2Graph enables the investigation of research questions
related to WWT, focusing on aspects such as microbial connections, community memberships, and potential ecological functions.
**Credits**
- Developed by [Sebastián Ayala Ruano][myweb]. MicW2Graph was built for the thesis project from the [MSc in Systems Biology][sysbio].
- The data for this project was obtained from [Mgnify](https://www.ebi.ac.uk/metagenomics/api/latest/), using the scripts available in this [GitHub repository][retrieve_info_mgnify].
[sysbio]: https://www.maastrichtuniversity.nl/education/master/systems-biology
[myweb]: https://sayalaruano.github.io/
[retrieve_info_mgnify]: https://github.com/Multiomics-Analytics-Group/Retrieve_info_MGnifyAPI
''')

st.markdown("<h3 style='text-align: center; color: black;'>Schematic summary of the MicW2Graph project</h3>", unsafe_allow_html=True)
st.image('images/Methods_MicW2Graph.svg', use_column_width=True)

# Footer
with st.container():
web_utils.footer()

45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<h1 align="center">
MicW2Graph
</h1>

<p align="center">
<a href="https://github.com/Multiomics-Analytics-Group/MicW2Graph/blob/main/LICENSE">
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/bioregistry" />
</a>
<a href="https://zenodo.org/doi/10.5281/zenodo.10010151">
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.10010151.svg" alt="DOI">
</a>
</p>

<p align="center">
Building a knowledge graph of the wastewater treatment microbiome and its biological context
</p>

## **About the project**
In this project, we investigated the microbiome of the **wastewater treatment** (WWT) process to build **MicW2Graph**, an open-source **knowledge graph** that integrates WWT metagenomic and metatranscriptomic information with their biological context, including biological processes, environmental and phenotypic features, chemical compounds, and additional metadata. We developed a workflow to collect meta-omics datasets from **MGnify** and infer potential interactions among microorganisms through **microbial association networks**. MicW2Graph enables the investigation of research questions related to WWT, focusing on aspects such as microbial connections, community memberships, and potential ecological functions.

The following figure shows the general workflow of MicW2Graph:
<p align="center">
<figure>
<img src="./images/Methods_MicW2Graph.svg" alt="my alt text"/>
<figcaption><strong>Figure 1.</strong> MicW2Graph workflow </a>. </figcaption>
</figure>
</p>

## **Credits**
- Developed by [Sebastián Ayala Ruano][myweb]. MicW2Graph was built for the thesis project from the [MSc in Systems Biology][sysbio].
- The data for this project was obtained from [Mgnify][Mgnify], using the scripts available in this [GitHub repository][retrieve_info_mgnify].

## **Contact**
If you have comments or suggestions about this project, you can [open an issue][issues] in this repository.

[sysbio]: https://www.maastrichtuniversity.nl/education/master/systems-biology
[myweb]: https://sayalaruano.github.io/
[Mgnify]: https://www.ebi.ac.uk/metagenomics/api/latest/
[retrieve_info_mgnify]: https://github.com/Multiomics-Analytics-Group/Retrieve_info_MGnifyAPI
[issues]: https://github.com/Multiomics-Analytics-Group/MicW2Graph/issues/new





Loading

0 comments on commit 0c5a2d4

Please sign in to comment.