User API
The User API lists BioNeuralNet’s key classes, methods, and utilities.
Executables
Certain classes expose a high-level run() method to perform end-to-end workflows:
SubjectRepresentation for integrating embeddings into subject-level data
CorrelatedLouvain or HybridLouvain for clustering
DPMON for disease prediction
Usage Pattern:
Instantiate the class with the relevant data (omics, adjacency, phenotype, etc.).
Call the run() method to perform the pipeline.
Example:
from bioneuralnet.downstream_task import DPMON
dpmon_obj = DPMON(
adjacency_matrix=adjacency_matrix,
omics_list=omics_list,
phenotype_data=phenotype_data,
clinical_data=clinical_data,
model='GAT'
)
predictions = dpmon_obj.run()
Methods:
Below are references to the run() methods:
- SmCCNet.run()[source]
- SubjectRepresentation.run() DataFrame[source]
Executes the Subject Representation workflow. If tuning is enabled, runs hyperparameter tuning and uses the best config to reduce embeddings. Otherwise, uses the default reduction method. :returns:
Enhanced omics data as a DataFrame.
- DPMON.run() DataFrame[source]
Execute the DPMON pipeline for disease prediction.
Steps:
Combining Omics and Phenotype Data: - Merges the provided omics datasets and ensures that the phenotype (phenotype) column is included.
Tuning or Training: - Tuning: If tune=True, performs hyperparameter tuning using Ray Tune and returns an empty DataFrame. - Training: If tune=False, runs standard training to generate predictions.
Predictions: - If training is performed, returns a DataFrame of predictions with ‘Actual’ and ‘Predicted’ columns.
Returns: pd.DataFrame
If tune=False, a DataFrame containing disease phenotype predictions for each sample.
If tune=True, returns an empty DataFrame since no predictions are generated.
Raises:
ValueError: If the input data is improperly formatted or missing.
Exception: For any unforeseen errors encountered during preprocessing, tuning, or training.
Notes:
DPMON relies on internally-generated embeddings (via GNNs), node correlations, and a downstream neural network.
Ensure that the adjacency matrix and omics data are properly aligned and that clinical/phenotype data match the sample indices.
Example:
dpmon = DPMON(adjacency_matrix, omics_list, phenotype_data, clinical_data, model='GCN') predictions = dpmon.run() print(predictions.head())
- CorrelatedLouvain.run(as_dfs: bool = False) dict | list[source]
Run correlated Louvain clustering.
If as_dfs is True, returns a list of adjacency matrices (DataFrames), where each adjacency matrix represents a cluster with more than 2 nodes. Otherwise, returns the partition dictionary.
If tune is True and as_dfs is False, hyperparameter tuning is performed and the best parameters are returned. If tune is True and as_dfs is True, tuning is performed, and then standard detection is run using the tuned parameters.