Downstream Tasks
================

BioNeuralNet's core innovation is the generation of low-dimensional embeddings that unlock a variety of downstream applications. By reducing the complexity of multi-omics data, these embeddings not only boost computational efficiency but also improve the accuracy of predictive models and enable exploratory analyses.

Overview
--------

The embeddings generated by Graph Neural Networks (GNNs) serve as a transformative feature of BioNeuralNet. They allow users to:

- **Predict Disease Outcomes**: Using the end-to-end DPMON pipeline.
- **Enhance Subject Representation**: By integrating embeddings back into omics data, thus enriching patient-level profiles.
- **Facilitate Other Downstream Analyses**: Such as clustering, biomarker discovery, and visualization.

.. image:: _static/Overview.png
   :align: center
   :alt: Overview of Downstream Tasks
   :width: 70%

DPMON: Disease Prediction Pipeline
----------------------------------

The **DPMON** module provides a seamless, end-to-end workflow for disease prediction. It combines the network adjacency matrix, GNN-based embeddings, and subject-level data to deliver robust predictions. With built-in hyperparameter tuning, DPMON adapts to your data for optimal performance.

.. image:: _static/DPMON.png
   :align: center
   :alt: Disease Prediction with DPMON
   :width: 80%

Example Usage:

.. code-block:: python
   
   from bioneuralnet.downstream_task import DPMON
   import pandas as pd

   # Prepare data
   phenotype_data = pd.read_csv("phenotype_data.csv")
   omics_list = [
      pd.read_csv("omics_data1.csv"),
      pd.read_csv("omics_data2.csv")
   ]
   clinical_data = pd.read_csv("clinical_data.csv")
   network = pd.read_csv("network.csv")

   # Initialize DPMON for disease prediction
   dpmon = DPMON(
      adjacency_matrix=network,
      omics_list=omics_list,
      phenotype_data=phenotype_data,
      clinical_data=clinical_data,
      model="GAT"
   )

   # Run the pipeline
   predictions = dpmon.run()
   print("Disease Predictions:", predictions)

Subject Representation & Embedding Integration
-----------------------------------------------

Beyond disease prediction, the learned embeddings can be re-integrated into subject-level data to enrich the feature set. This enhanced subject representation supports downstream tasks such as:

- **Biomarker Discovery**: Identifying key omics features that drive disease.
- **Enhanced Clustering**: Grouping patients more effectively based on integrated data.
- **Data Visualization**: Leveraging low-dimensional representations for intuitive plotting and network analysis.

.. image:: _static/SubjectRepresentation.png
   :align: center
   :alt: Subject Representation Workflow
   :width: 70%

Unlocking Downstream Applications
---------------------------------

By lowering the dimensionality, BioNeuralNet's embeddings simplify complex multi-omics data into actionable insights. This approach:

- **Accelerates Predictive Modeling**: Making it easier to integrate with machine learning frameworks.
- **Improves Interpretability**: Allowing users to trace back the contribution of each omics feature.
- **Enables Custom Workflows**: While we support key pipelines like DPMON out-of-the-box, the embeddings can also be used in custom downstream applications.

Other downstream tasks include, but are not limited to:

- **Predictive Analytics**
- **Community Detection in Networks**
- **Interactive Data Exploration**

Get Started
-----------

BioNeuralNet is designed not only to provide robust downstream pipelines but also to empower researchers to develop their own custom analyses. With the combination of disease prediction, subject representation, and other downstream tools, users can seamlessly integrate these components into their broader multi-omics workflows.

For further details, check out our tutorials (see :doc:`tutorials/example_1` and :doc:`tutorials/example_2`) which showcase these capabilities in action.

References
----------
For more in-depth information on the methodologies and models, please refer to the related documentation pages and our published works.

Return to :doc:`../index`
