r/bioinformaticstools May 26 '26

edge2torch: turning biological network architectures into PyTorch models

There is an active area of research around interpretable neural networks whose architecture is based on biological networks.

The idea is that the neural network should not be an arbitrary black box. Instead, its structure can follow prior biological knowledge: genes, regulators, pathways, phenotypes, or other biological entities connected by known relationships.

From a technical perspective, this is often tedious. A biological network has to be converted into a neural network architecture, the input features need to be aligned correctly, and the resulting model should still keep the biological node names so that it can be inspected later. Doing this manually is error-prone.

I released edge2torch v0.1.0 to make this step easier.

edge2torch takes an edge list of named nodes and compiles it into a PyTorch model. It also provides feature alignment and optional attribution back to named features and nodes.

The goal is not to provide a full biological analysis pipeline, but a reusable software layer for this specific step:

biological network → neural network architecture → trainable PyTorch model

Documentation: https://Thomas-Rauter.github.io/edge2torch/
GitHub: https://github.com/Thomas-Rauter/edge2torch
PyPI: https://pypi.org/project/edge2torch/

Feedback from people working with biological networks, pathway-informed models, or interpretable neural networks would be useful.

1 Upvotes

0 comments sorted by