bartongroup / ProIntVar

The core bits of ProIntVar
MIT License
2 stars 0 forks source link

ProIntVar

ProIntVar-Core is a Python module that implements methods for working with protein structures (handles mmCIF, DSSP, SIFTS, protein interactions, etc.) and genetic variation (via UniProt and Ensembl APIs).

ProIntVar core is now separated from ProIntVar-Analysis, which contains analysis scripts that use ProIntVar Core components.

Table of Contents

Key features

Overview

ProIntVar handles data with aid of Pandas DataFrames. Data such as protein structures (sequence and atom 3D coordinates) and respective annotations (from structural analysis, e.g. interacting interfaces, secondary structure and solvent accessibility), as well as protein sequences and annotations (e.g. genetic variants, and other functional information) are handled by the classes/methods so that each modular (components) table can be integrated onto a single 'merged table'.

screenshot

The methods implemenented in prointvar/merger.py allow for the different components to be merged together onto a single Pandas DataFrame.

Dependencies

Using Python 3.5+.

Check requirements.txt for all dependencies.

Installing

Setting up a virtual environment

$ virtualenv --python `which python` env
$ source env/bin/activate

Installing ProIntVar


# alternatively
$ git clone https://github.com/bartongroup/ProIntVar.git

# installing requirements
$ cd ProIntVar
$ pip install -r requirements.txt

# then...  
$ python setup.py test
$ python setup.py install

Configuration

Editing the provided template configuration settings

$ cd /path/to/desired/working/dir/

# Get a copy of the template config.ini file shipped with ProIntVar
$ ProIntVar-config-setup new_config.ini

# Update the settings according to user preferences and push them
$ ProIntVar-config-load new_config.ini

Testing that the new values are correctly loaded by ProIntVar

$ python
>>> from prointvar.config import config
>>> config.db_tmp
'tmp'

How to use

ProIntVar CLI

There are several tools provided with the ProIntVar CLI, each having its own options and arguments. Pass the --help for more information about each tool.

An example usage of the CLI is to download some files from main repositories. Using the Downloader interface in the CLI to download some macromolecular structures:

# downloads structures in mmCIF format to the directory defined in the config.ini
ProIntVar download --mmcif 2pah
# downloads SIFTS record in XML format
ProIntVar download --sifts 2pah

ProIntVar Classes

Each main class in ProIntVar works as an independent component that can be used on its own or together with other classes. Generally each main class produces/parses data to a pandas DataFrame. The classes/methods provided in prointvar.merger can be used to merge DataFrames. Merging DataFrames is not trivial, since there must be common features in the tables to be merged. More information on how to use the TableMerger class and which features (columns) from each table can be used to merge with confidence is provided below.

prointvar.pdbx

Using PDBXreader to parse a mmCIF formatted macromolecular structure.


import os
from prointvar.config import config as cfg
from prointvar.pdbx import PDBXreader
from prointvar.fetchers import download_structure_from_pdbe

download_structure_from_pdbe('2pah')
input_struct = os.path.join(cfg.db_root, cfg.db_pdbx, '2pah.cif')
df = PDBXreader(inputfile=input_struct).atoms(format_type="mmcif")
# pandas DataFrame
df.head()

We can convert the format of the mmCIF structure to PDB format.


from prointvar.pdbx import PDBXwriter

output_struct = os.path.join(cfg.db_root, cfg.db_pdbx, '2pah.pdb')
w = PDBXwriter(outputfile=output_struct)
w.run(df, format_type="pdb")

prointvar.dssp

With the DSSP classes we can read DSSP formatted files and also generate DSSP output for mmCIF or PDB structures.


from prointvar.dssp import DSSPrunner, DSSPreader

input_struct = os.path.join(cfg.db_root, cfg.db_pdbx, '2pah.cif')
output_dssp = os.path.join(cfg.db_root, cfg.db_dssp, '2pah.dssp')
DSSPrunner(inputfile=input_struct, outputfile=output_dssp).write()

df2 = DSSPreader(inputfile=output_dssp).read()
# pandas DataFrame
df2.head()

prointvar.sifts

Parsing the SIFTS UniProt-PDB cross-mapping is as simple.


from prointvar.sifts import SIFTSreader
from prointvar.fetchers import download_sifts_from_ebi

download_sifts_from_ebi('2pah')
input_sifts = os.path.join(cfg.db_root, cfg.db_sifts, '2pah.xml')
df3 = SIFTSreader(inputfile=input_sifts).read()
# pandas DataFrame
df3.head()

prointvar.merger

Now protein structure, secondary structure and solvent accessibility can be merged onto protein sequence (via SIFTS).


from prointvar.merger import TableMerger

mdf = TableMerger(pdbx_table=df, dssp_table=df2, sifts_table=df3).merge()
# pandas DataFrame
mdf.head()

Additional Information

Table merger

TODO

Project Structure

TODO

Guidelines on file names and extensions

PDB/PDBx/mmCIF Macromolecular structures

DSSP Secondary Structure

SIFTS Structure-Sequence (PDB-UniProt) cross-reference

Arpeggio Interface Contacts

HBPLUS Hydrogen-Bond Contacts

Reduce PDBs filled with Hydrogen

Licensing

The MIT License (MIT). See license for details.