SEffNet (Side Effect Network embeddings) is a tool that optimizes, trains, and evaluates predictive models for biomedical networks that contain drug-, target- and side effect-information using different network representation learning methods in an attempt to understand the causes of side effects.
This package was developed during the master's thesis of Rana Aldisi.
notebooks
: Notebooks that were used for training and evaluation of models, and interpertation of prediction modelresources
: The graphs and materials that are used for training and testing
seffnet
can be installed on python37+ from the latest code on GitHub with:
$ pip install git+https://github.com/seffnet/seffnet.git
If you've installed seffnet
locally, you can use the default model from the GitHub repository with:
from seffnet.default_predictor import predictor
# Find new relations for a given entity based on its CURIE
results = predictor.find_new_relations(curie='pubchem.compound:5095')
...
You can get the embeddings for phenotype entities with
import itertools as itt
from seffnet.default_predictor import predictor
phenotype_to_embedding = {
node_data['identifier']: predictor.embeddings[node_id]
for node_id, node_data in predictor.node_id_to_info.items()
if node_data['namespace'] == 'umls'
}
# could use sklearn.metrics.pairwise.cosine_similarity on the values in this dict
You can use the default model in the CLI:
$ seffnet predict pubchem.compound:5095
You can predict on new chemicals via their SMILES strings based on their similarity to chemicals included in the network. Warning: we haven't benchmarked how well this actually works yet.
$ seffnet predictc "C1=CC=C(C=C1)C2=CC=C(C=C2)CCO"
You can rebuild all the graphs and maps created for this project by running the following:
$ seffnet rebuild
Note that you need to have RDKit package and environment to be able to run this command
You can train an NRL model using the following:
$ seffnet train --input-path ./resources/basic_graphs/fullgraph_with_chemsim.edgelist --evaluation --method node2vec
- For further CLI options and parameters use --help, -h
Network representation learning models can be optimized with:
$ seffnet optimize --input-path ./resources/basic_graphs/fullgraph_with_chemsim.edgelist --method node2vec
- For further CLI options and parameters use --help, -h
The web application allows users to get results from the model programmatically. Make sure the extra dependencies have been installed as well using the [web] extra. Unfortunately, this doesn't work when installing directly from GitHub, so see the setup.cfg
for the Flask dependencies.
$ pip install -e .[web]
Run development server with:
$ seffnet web --host localhost --port 5000
Run through docker with:
$ docker-compose up
- A user interface can be found at http://localhost:5000
- An auto-generated swagger UI can be found at http://localhost:5000/apidocs
As an example, you can check the chemicals predicted to interact with HDAC6 at http://localhost:5000/predict/uniprot:Q9UBN7?results_type=chemical.