A simplified implementation of DSSP algorithm for PyTorch and NumPy
Maintained. Last release 2 weeks ago, commits in 1 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install pydsspPyDSSP
A simplified implementation of DSSP algorithm for PyTorch and NumPy
What's this?
DSSP (Dictionary of Secondary Structure of Protein) is a popular algorithm for assigning secondary structure of protein backbone structure. [ Wolfgang Kabsch, and Christian Sander (1983)] This repository is a python implementation of DSSP algorithm that simplifies some parts of the algorithm.
General Info
- It's NOT a complete implementation of the original DSSP, as some parts have been simplified (some more details here). However, an average of over 97% of secondary structure determinations agree with the original.
- The algorithm used to identify hydrogen bonded residue pairs is exactly the same as the original DSSP algorithm, but is extended to output the hydrogen-bond-pair-matrix as continuous values in the range [0,1].
- With the continuous variable extension above, the hydrogen-bond-pair-matrix is differentiable with torch.Tensor as input.
Install
install through PyPi
pip install pydssp
to install the latest version
pip install git+https://github.com/ShintaroMinami/PyDSSP.git
install by git clone
git clone https://github.com/ShintaroMinami/PyDSSP.git
cd PyDSSSP
python setup.py install
How to use
To use pydssp script
If you have already installed pydssp, you should be able to use pydssp command.
pydssp input_01.pdb input_02.pdb ... input_N.pdb -o output.result
The output.result will be a text format, looking like follows,
-EEEEE-E--EEEEEE---EEEE-HHHH--EEEE--------- input_01.pdb
-HHHHHHHHHHHHHH----HHHHHHHHHHHHHHHHHHH--- input_02.pdb
-EEEE-----EEEE----EEEE--E---EEE-----EEE-EEE-- input_03.pdb
...
To use as python module
Import & test coordinates
# Import
import torch
import pydssp
# Sample coordinates
batch, length, atoms, xyz = 10, 100, 4, 3
## atoms should be 4 (N, CA, C, O) or 5 (N, CA, C, O, H)
coord = torch.randn([batch, length, atoms, xyz]) # batch-dim is optional
To get hydrogen-bond matrix: pydssp.get_hbond_map()
hbond_matrix = pydssp.get_hbond_map(coord)
print(hbond_matrix.shape) # should be (batch, length, length)