Need help with graphein?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

257 Stars 32 Forks MIT License 547 Commits 14 Opened issues


Protein Graph Library

Services available


Need anything else?

Contributors list

Binder PyPI version Docs DOI:10.1101/2020.07.15.204701 Project Status: Active – The project has reached a stable, usable state and is being actively developed. CodeFactor Quality Gate Status Bugs Maintainability Rating Reliability Rating Gitter chat License: MIT Code style: black banner

Documentation | Paper | Tutorials | Installation

Protein & Interactomic Graph Library

This package provides functionality for producing geometric representations of protein and RNA structures, and biological interaction networks. We provide compatibility with standard PyData formats, as well as graph objects designed for ease of use with popular deep learning libraries.

What's New?

Example usage

Creating a Protein Graph

Tutorial (Residue-level) Open In Colab | Tutorial - Atomic Open In Colab( | Docs

from graphein.protein.config import ProteinGraphConfig
from graphein.protein.graphs import construct_graph

config = ProteinGraphConfig() g = construct_graph(config=config, pdb_code="3eiy")

Creating a Protein Graph from the AlphaFold Protein Structure Database

Open In Colab Tutorial | Docs ```python from graphein.protein.config import ProteinGraphConfig from graphein.protein.graphs import constructgraph from graphein.protein.utils import downloadalphafold_structure

config = ProteinGraphConfig() fp = downloadalphafoldstructure("Q5VSL9", alignedscore=False) g = constructgraph(config=config, pdb_path=fp) ```

Creating a Protein Mesh

Tutorial | Docs ```python from graphein.protein.config import ProteinMeshConfig from graphein.protein.meshes import create_mesh

verts, faces, aux = createmesh(pdbcode="3eiy", config=config) ```

Creating an RNA Graph

Tutorial | Docs ```python from graphein.rna.graphs import constructrnagraph

Build the graph from a dotbracket & optional sequence

rna = constructrnagraph(dotbracket='..(((((..(((...)))..)))))...', sequence='UUGGAGUACACAACCUGUACACUCUUUC') ```

Creating a Protein-Protein Interaction Graph

Tutorial | Docs ```python from graphein.ppi.config import PPIGraphConfig from graphein.ppi.graphs import computeppigraph from graphein.ppi.edges import addstringedges, addbiogridedges

config = PPIGraphConfig() protein_list = ["CDC42", "CDK1", "KIF23", "PLK1", "RAC2", "RACGAP1", "RHOA", "RHOB"]

g = computeppigraph(config=config, proteinlist=proteinlist, edgeconstructionfuncs=[addstringedges, addbiogridedges] ) ```

Creating a Gene Regulatory Network Graph

Tutorial | Docs ```python from graphein.grn.config import GRNGraphConfig from graphein.grn.graphs import computegrngraph from graphein.grn.edges import addregnetworkedges, addtrrustedges

config = GRNGraphConfig() gene_list = ["AATF", "MYC", "USF1", "SP1", "TP53", "DUSP1"]

g = computegrngraph( genelist=genelist, edgeconstructionfuncs=[ partial(addtrrustedges, trrustfilteringfuncs=config.trrustconfig.filteringfunctions), partial(addregnetworkedges, regnetworkfilteringfuncs=config.regnetworkconfig.filteringfunctions), ], ) ```



The simplest install is via pip. N.B this does not install ML/DL libraries which are required for conversion to their data formats and for generating protein structure meshes with PyTorch 3D. [Further details]

pip install graphein # For base install
pip install graphein[extras] # For additional featurisation dependencies
pip install graphein[dev] # For dev dependencies
pip install graphein[all] # To get the lot

However, there are a number of (optional) utilities (DSSP, PyMol, GetContacts) that are not available via PyPI:

conda install -c salilab dssp # Required for computing secondary structural features
conda install -c schrodinger pymol # Required for PyMol visualisations & mesh generation

GetContacts - used as an alternative way to compute intramolecular interactions

conda install -c conda-forge vmd-python git clone

Add folder to PATH

echo "export PATH=$PATH:pwd/getcontacts" >> ~/.bashrc source ~/.bashrc To test the installation, run:

cd getcontacts/example/5xnd --topology 5xnd_topology.pdb
--trajectory 5xnd_trajectory.dcd
--itypes hb
--output 5xnd_hbonds.tsv

Conda environment

The dev environment includes GPU Builds (CUDA 11.1) for each of the deep learning libraries integrated into graphein.

git clone
cd graphein
conda create env -f environment-dev.yml
pip install -e .

A lighter install can be performed with:

git clone
cd graphein
conda create env -f environment.yml
pip install -e .


We also provide a Dockerfile

Citing Graphein

Please consider citing graphein if it proves useful in your work.

  doi = {10.1101/2020.07.15.204701},
  url = {},
  year = {2020},
  month = jul,
  publisher = {Cold Spring Harbor Laboratory},
  author = {Arian Rokkum Jamasb and Pietro Lio and Tom Blundell},
  title = {Graphein - a Python Library for Geometric Deep Learning and Network Analysis on Protein Structures}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.