proteusPy
Summary
proteusPy is a Python package specializing in the modeling and analysis of proteins of known structure with an emphasis on Disulfide bonds. This package reprises my molecular modeling program Proteus, a structure-based program developed as part of my graduate thesis. The package relies on the Turtle3D class to create and manipulate local coordinate systems. It does this by implementing the functions Move
, Roll
, Yaw
, Pitch
and Turn
for movement in a three-dimensional space. The initial implementation focuses on the Disulfide class. The class implements methods to analyze the protein structure stabilizing element known as a Disulfide Bond. This class and its underlying methods are being used to perform a structural analysis of over 35,800 disulfide-bond containing proteins in the RCSB protein data bank (https://www.rcsb.org).
General Capabilities
- Interactively display disulfides contained in the RCSB in a variety of display styles
- Calculate geometric and energetic properties about these disulfides
- Create binary and sextant structural classes by characterizing the disulfide torsional angles into n classes
- Build idealized disulfide bonds from dihedral angle input
- Find disulfide neighbors based on dihedral angle input
- Overlap disulfides onto a common frame of reference for display
- Build protein backbones from backbone phi, psi dihedral angle templates
- More in development
See API Reference for the API documentation with examples.
Requirements
- PC running MacOS, Linux, Windows with git, git-lfs, make and C compiler installed.
- 8 GB RAM
- 1 GB disk space
Installation
It's simplest to clone the repo via GitHub since it contains all of the notebooks, data and test programs. Installation includes installing my Biopython fork which is required to rebuild the database (this is not needed generally). I highly recommend using Miniforge since it includes mamba. The installation instructions below assume a clean install with no package manager or compiler installed.
MacOS/Linux
- Install Miniforge: https://github.com/conda-forge/miniforge (existing Anaconda installations are fine but please install mamba)
- Install git-lfs:
- Install
make
on your system. - From a shell prompt while sitting in your repo dir:
$ git clone https://github.com/suchanek/proteusPy.git $ cd proteusPy $ make pkg $ conda activate proteusPy $ make install
Windows
- Install Miniforge: https://github.com/conda-forge/miniforge (existing Anaconda installations are fine but please install mamba)
- Install git for Windows and configure for Bash:
- Install git-lfs:
- Install GNU make:
- Open a Miniforge prompt and cd into your repo dir:
(base) C:\Users\egs\repos> git clone https://github.com/suchanek/proteusPy.git (base) C:\Users\egs\repos> cd proteusPy (base) C:\Users\egs\repos\proteuspy> make pkg (base) C:\Users\egs\repos>\proteuspy> conda activate proteusPy (proteusPy) C:\Users\egs\repos> make install
Testing
I currently have pytest
and docstring testing for the modules in place. To run them cd
into the repository and run:
$ make tests
The modules will run their docstring tests and disulfide visualization windows will open. Simply close them. If all goes normally there will be no errors. If you're not running the development version of proteusPy you may need to install pytest
. Simply perform: pip install pytest
. Docstring testing is sensitive to formatting; occasionally the black
formatter changes the docstrings. As a result there may be some docstring tests that fail.
Usage
Once the package is installed it's possible to load, visualize and analyze the Disulfide bonds in the RCSB Disulfide database. The general approach is:
- Load the database
- Access disulfide(s)
- Analyze
- Visualize
A simple example is shown below:
import proteusPy
from proteusPy import Load_PDB_SS, Disulfide
PDB_SS = Load_PDB_SS(verbose=True)
best_ss = PDB_SS["2q7q_75D_140D"]
best_ss.display(style="sb", light=True)
The notebooks directory contains my Jupyter notebooks and is a good place to start:
- Analysis_2q7q.ipynb provides an example of visualizing the lowest energy Disulfide contained in the database and searching for nearest neighbors on the basis of conformational similarity.
- Anearest_relatives.ipynb gives an example of searching for disulfides based on sequence similarity.
The programs subdirectory contains the primary programs for downloading the RCSB disulfide-containing structure files, extracting the disulfides and creating the disulfide database:
- DisulfideDownloader.py: Downloads the raw RCSB structure files.
- DisulfideExtractor.py: Extracts the disulfides and creating the database loaders
- DisulfideClass_Analysis.py: Performs binary or sextant analysis on the disulfide database.
The first time one loads the database via Load_PDB_SS() the system will attempt to download the full and subset database from Google Drive. If this fails the system will attempt to rebuild the database from the repo's data subdirectory (not the package's). If you've downloaded from github this will work correctly. If you've installed from pyPi via pip it will fail.
Quickstart
After installation is complete launch jupyter lab:
$ jupyter notebook
and open notebooks/Analysis_2q7q.ipynb
. This notebook looks at the disulfide bond with the lowest energy in the entire database. There are several other notebooks in this directory that illustrate using the program. Some of these reflect active development work so may not be 'fully baked'.
Visualizing Disulfides with pyVista
PyVista is an excellent 3D visualization framework and I've used it for the Disulfide visualization engine. It uses the VTK library on the back end and provides high-level access to 3d rendering. The menu strip provided in the Disulfide visualization windows allows the user to turn borders, rulers, bounding boxes on and off and reset the orientations. Please try them out! There is also a button for local vs server rendering. Local rendering is usually much smoother. To manipulate:
- Click and drag your mouse to rotate
- Use the mouse wheel to zoom (3 finger zoom on trackpad)
Performance
- Manipulating and searching through long lists of disulfides can take time. I've added progress bars for many of these operations.
- Rendering many disulfides in pyvista can also take time to load and may be slow to display in real time, depending on your hardware. I added optimization to reduce cylinder complexity as a function of total cylinders rendered, but it can still be less than perfect. The faster your GPU the better!
Contributing/Reporting
I welcome anyone interested in collaborating on proteusPy! Feel free to contact me at suchanek@mac.com, fork the repository: https://github.com/suchanek/proteusPy/ and get coding. Issues can be reported to https://github.com/suchanek/proteusPy/issues.
Citing proteusPy
The proteusPy package was developed by Eric G. Suchanek, PhD. If you find it useful in your research and wish to cite it please use the following BibTeX entry:
@software{proteusPy2024,
author = {Eric G. Suchanek, PhD},
title = {proteusPy: A Package for Modeling and Analyzing Proteins of Known Structure},
year = {2024},
publisher = {GitHub},
version = {0.92},
journal = {GitHub repository},
url = {https://github.com/suchanek/proteusPy}
}
Publications
- Computer-aided Strategies for Protein Design
- An engineered intersubunit disulfide enhances the stability and DNA binding of the N-terminal domain of .lambda. repressor
- Introduction of intersubunit disulfide bonds in the membrane-distal region of the influenza hemagglutinin abolishes membrane fusion activity
- Analysis of disulfide bonds in protein structures
1# Initialization for the proteusPy package 2# Copyright (c) 2024 Eric G. Suchanek, PhD., all rights reserved 3# Subject to the BSD public license. 4 5""" 6.. include:: ../README.md 7""" 8 9from pathlib import Path 10 11__pdoc__ = { 12 "version": None, 13 "__all__": False, 14} 15 16import copy 17import datetime 18import glob 19import math 20import os 21import sys 22import time 23import warnings 24 25import Bio 26import matplotlib 27import numpy 28import plotly 29from Bio.PDB import Select, Vector 30from Bio.PDB.vectors import calc_angle, calc_dihedral 31 32from .angle_annotation import * 33from .atoms import * 34from .data import * 35from .Disulfide import ( 36 Disulfide, 37 Disulfide_Energy_Function, 38 Download_Disulfides, 39 Extract_Disulfides, 40 check_header_from_file, 41 check_header_from_id, 42 parse_ssbond_header_rec, 43) 44from .DisulfideClass_Constructor import DisulfideClass_Constructor 45from .DisulfideClasses import ( 46 create_classes, 47 create_quat_classes, 48 enumerate_sixclass_fromlist, 49 filter_by_percentage, 50 get_half_quadrant, 51 get_quadrant, 52 get_sixth_quadrant, 53 plot_binary_to_sixclass_incidence, 54 plot_count_vs_class_df, 55 plot_count_vs_classid, 56 torsion_to_sixclass, 57) 58from .DisulfideExceptions import ( 59 DisulfideConstructionException, 60 DisulfideConstructionWarning, 61 DisulfideIOException, 62) 63from .DisulfideList import DisulfideList, load_disulfides_from_id 64from .DisulfideLoader import ( 65 DisulfideLoader, 66 Download_PDB_SS, 67 Download_PDB_SS_GitHub, 68 Load_PDB_SS, 69) 70from .ProteusGlobals import ( 71 _ANG_INIT, 72 _FLOAT_INIT, 73 _INT_INIT, 74 CAMERA_POS, 75 MODEL_DIR, 76 PDB_DIR, 77 WINFRAME, 78 WINSIZE, 79) 80from .ProteusPyWarning import ProteusPyWarning 81from .Residue import ( 82 build_residue, 83 get_backbone_from_chain, 84 to_alpha, 85 to_carbonyl, 86 to_nitrogen, 87 to_oxygen, 88) 89from .turtle3D import ORIENT_BACKBONE, ORIENT_SIDECHAIN, Turtle3D 90from .utility import ( 91 Check_chains, 92 distance3d, 93 distance_squared, 94 generate_vector_dataframe, 95 get_jet_colormap, 96 image_to_ascii_art, 97 print_memory_used, 98 retrieve_git_lfs_files, 99) 100from .version import __version__ 101 102# end of file