Graphein

repository·master·Indexed 22 days ago

https://github.com/a-r-j/graphein

A specialized library for generating geometric graph representations of biological structures, including proteins, RNA, and molecules, for use in deep learning workflows. It features support for AlphaFold2 data, molecular graphs from SMILES, RNA graphs from dotbracket notation, and protein mesh generation. Graphein includes integrated PyTorch Geometric dataloaders and provides worked datasets for tasks such as Protein-Protein Interaction Site Prediction (PPISP) and the Protein Structural Change Database (PSCDB).

Tokens
21.4K
Snippets
72
Records
101
Agent score
78%

What's inside Graphein

  1. Overview of Graphein

    master
    Graphein is a Python library designed for constructing graph and surface-mesh representations of protein structures for computational analysis. It is built to support feature engineering in machine learning workflows by providing flexible, scalable graph construction and pre-processing tools for experimental structure files. The library is optimized for high-throughput network-based and graph-theoretic analyses of protein structures.
  2. Overview of Graphein's graph representations

    master

    Graphein is a Python package designed to produce various graph-based representations of biomolecular structures. It provides compatibility with standard geometric deep learning library formats, allowing you to export graphs to:

    • NetworkX (nx.Graph)
    • PyTorch Geometric (pytorch_geometric.data.Data)
    • DGL (dgl.DGLGraph)

    It also provides specialized graph objects optimized for use with popular deep learning libraries.

  3. Overview of Graphein worked datasets

    master

    Graphein provides several worked examples of creating graph datasets from protein structures. These datasets are designed for various machine learning tasks, including node classification (e.g., predicting interaction sites), edge prediction (e.g., predicting bound conformations), and graph classification (e.g., predicting structural rearrangement classes).

    Key dataset categories include:

    • PPISP: Protein-Protein Interaction Site Prediction (node-classification).
    • PSCDB: Protein Structural Change Database (edge-prediction or graph-classification).
    • PROTEINS_{LIGANDS / METAL / NUCLEOTIDES / NUCLEIC}: Collections of non-redundant protein interactions sourced from ccPDB.
  4. Construct Protein-Protein Interaction (PPI) graphs

    master
    The graphein.ppi module provides tools for constructing graphs representing Protein-Protein Interactions. You can build these graphs using high-level graph construction functions, define specific edges, and extract graph or node features. The module also supports parsing interaction data from databases like BioGrid and STRINGDB.
  5. Graphein Release History and New Features

    master

    Graphein has introduced several major capabilities across its versions:

    • Datasets & PDB Integration: Support for FoldComp Datasets and creating datasets directly from the PDB (v1.7.0).
    • Protein Tensors: A dedicated Protein Tensor Module (v1.6.0).
    • AlphaFold2 Support: Ability to create protein graphs from AlphaFold2 data (v1.5.0).
    • RNA & Molecular Graphs: RNA graph construction from dotbracket notation (v1.5.0) and molecular graph construction (v1.4.0).
    • Deep Learning Integration: Ready-to-go Dataloaders for PyTorch Geometric (v1.3.0).
    • Graph Manipulation: Extracting subgraphs from protein graphs (v1.2.0) and performing protein graph analytics (v1.2.0).
    • Visualization & CLI: Interactive Plotly visualization and a dedicated CLI (v1.2.0).
    • Interactomics: Support for Protein-Protein Interaction (PPI) networks using AlphaFold2 (v1.1.0).
  6. Define protein graph edges

    master

    Edges in protein graphs can be defined using several different criteria through the graphein.protein.edges submodules:

    • Distance: Edges based on spatial proximity between atoms or residues (graphein.protein.edges.distance).
    • Intramolecular: Edges representing intramolecular interactions (graphein.protein.edges.intramolecular).
    • Atomic: Edges defined at the atomic level (graphein.protein.edges.atomic).
  7. Install Graphein via Conda environment

    master

    You can set up a complete development environment using the provided Conda YAML files. This is recommended if you need specific GPU builds (CUDA 11.1) for integrated deep learning libraries.

    # For a full dev environment (includes GPU builds)
    git clone https://www.github.com/a-r-j/graphein
    cd graphein
    conda env create -f environment-dev.yml
    pip install -e .
    
    # For a lighter install
    git clone https://www.github.com/a-r-j/graphein
    cd graphein
    conda env create -f environment.yml
    pip install -e .
  8. Install Graphein for Development

    master

    If you intend to contribute to Graphein or need a development environment that includes GPU builds (CUDA 11.1) for geometric deep learning libraries, use the following methods.

    Pip installation:

    • Dev dependencies: pip install graphein[dev]
    • All dependencies: pip install graphein[all]

    Conda installation:

    1. Clone the repository.
    2. Create the environment using environment-dev.yml.
    3. Install in editable mode using pip install -e ..

    A devcontainer is also provided for running the development environment in a lightweight container via VS Code.

    # Pip
    pip install graphein[dev] # For dev dependencies
    pip install graphein[all] # To get the lot
    
    # Conda
    git clone https://www.github.com/a-r-j/graphein
    cd graphein
    conda env create -f environment-dev.yml
    pip install -e .
  9. Explore PROTEINS_LIGANDS dataset

    master

    The PROTEINS_LIGANDS dataset contains protein-ligand interactions. It is a collection of non-redundant PDB chains of ligand-interacting protein chains.

    Dataset Properties:

    • Source: ccPDB
    • Redundancy Reduction: Blastclust (25% identity) and LPC
    • Selection Criteria: PDB resolution $\le$ 3 $\AA$, chain length $\ge$ 80 amino acids, and interaction distance (SO4 - amino acid) between 0-4.0 $\AA$.

    Available Subsets:

    PDB LigandLigand Name# ProteinsDataset
    SO4Sulphate3312SO4_3312
    PO4Phosphate1299PO4_1299
    NAGN-Acetylglucosamine727NAG_727
    HEMHeme176HEM176
    BMEBeta-Mercaptoethanol191BME191
    EDOEthylene Glycol1507EDO1507
    PLPVitamin B6 Phosphate65PLP65

    For a full walkthrough on how to parse this dataset, use the provided Colab notebook.

    https://colab.research.google.com/research/urls?urls=https://github.com/a-r-j/graphein/blob/master/datasets/proteins_ligands/parse_dataset.ipynb
  10. Install Deep Learning Libraries

    master

    Graphein supports various deep learning configurations. While the Conda dev environment includes CUDA 11.1 and PyTorch, you can manually install these libraries via Conda:

    • pytorch
    • pytorch3d (requires fvcore and iopath)
    • dgl (via dglteam channel)
    • pytorch-geometric (via rusty1s and conda-forge channels)
    conda install -c pytorch pytorch
    conda install -c pytorch3d pytorch3d
    conda install -c dglteam dgl
    conda install pytorch-geometric -c rusty1s -c conda-forge
  11. Install optional utilities (DSSP, PyMol, GetContacts)

    master

    Some Graphein features require external utilities not available via PyPI.

    • DSSP: Required for computing secondary structural features.
    • PyMol: Required for PyMol visualisations & mesh generation.
    • GetContacts: An alternative way to compute intramolecular interactions.

    Use the following commands to install them via Conda or manual setup:

    conda install -c salilab dssp # Required for computing secondary structural features
    conda install -c schrodinger pymol # Required for PyMol visualisations & mesh generation
    
    # GetContacts setup
    conda install -c conda-forge vmd-python
    git clone https://github.com/getcontacts/getcontacts
    echo "export PATH=$PATH:`pwd`/getcontacts" >> ~/.bashrc
    source ~/.bashrc