User API¶
The User API lists BioNeuralNet’s key classes, methods, and utilities and summarizes the main entry points exposed at the top-level bioneuralnet namespace.
Top-level Imports¶
After installation, the most common pattern is:
import bioneuralnet as bnn
print(bnn.__version__)
# Core entry points
from bioneuralnet import (
GNNEmbedding,
auto_pysmccnet,
SubjectRepresentation,
DPMON,
DatasetLoader,
CorrelatedPageRank,
CorrelatedLouvain,
HybridLouvain,
load_example,
load_monet,
load_brca,
load_lgg,
load_kipan,
set_seed,
get_logger,
)
Module Reference¶
The following submodules are documented via autosummary:
BioNeuralNet: Graph Neural Network-based Multi-Omics Network Data Analysis. |
Executables¶
Several classes expose a high-level run() method to perform end-to-end workflows:
bioneuralnet.downstream_task.SubjectRepresentationfor integrating embeddings into subject-level representations.bioneuralnet.clustering.CorrelatedLouvainandbioneuralnet.clustering.HybridLouvainfor phenotype-aware clustering and subgraph detection.bioneuralnet.downstream_task.DPMONfor disease prediction using multi-omics networks.
Usage pattern:
Instantiate the class with the relevant data (omics, adjacency, phenotype, etc.).
Call the
run()method to execute 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, metrics, embeddings = dpmon.run()
print("Disease phenotype predictions:\n", predictions)
print("Result metrics:", metrics)
print("Generated Embeddings", embeddings)
Run Methods¶
Direct links to the main run() methods:
- 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.
- Return type:
pd.DataFrame
- DPMON.run() Tuple[pd.DataFrame, object, torch.Tensor | None][source]
Execute the DPMON pipeline.
This method aligns the graph and omics features, optionally performs hyperparameter tuning, and then trains and evaluates the chosen GNN model using either K-fold cross-validation (cv=True) or repeated train/test splits (cv=False). It returns prediction outputs, a metrics/config object, and optionally the learned embeddings.
- Returns:
- A tuple (predictions_df, metrics, embeddings) where:
predictions_df (pd.DataFrame): If cv=False, per-sample predictions with actual vs predicted labels; if cv=True, aggregated CV performance or fold-level results depending on the backend metrics (object): Dictionary or configuration object containing evaluation metrics and, when tuning is enabled, information about the selected hyperparameters. embeddings (torch.Tensor | None): Learned embedding tensor (e.g., node or sample embeddings) if produced by the training routine, otherwise None.
- Return type:
Tuple[pd.DataFrame, object, torch.Tensor | None]
- CorrelatedPageRank.run(seed_nodes: List[Any]) Dict[str, Any][source]
Execute Correlated PageRank clustering.
- Parameters:
seed_nodes (List[Any]) – Nodes to use as the teleport set.
- Returns:
Cluster performance and node list.
- Return type:
Dict
- CorrelatedLouvain.run() Dict[Any, int][source]
Execute the Correlated Louvain algorithm.
- Returns:
Mapping of original nodes to community IDs.
- Return type:
Dict[Any, int]
- HybridLouvain.run(as_dfs: bool = False) Dict[str, Any] | List[DataFrame][source]
Execute the Hybrid Louvain-PageRank algorithm.
- Returns:
best_nodes: nodes of the highest rho subgraph
best_correlation: float
best_iteration: int
iterations: full per-iteration metadata
all_subgraphs: {iteration_index: [nodes]}
- Return type:
Dict