Created
April 24, 2017 22:35
-
-
Save JoaoRodrigues/fd66a4ded49974b19730758a6f8f8e51 to your computer and use it in GitHub Desktop.
Relative Solvent Accessibilities using Biopython and DSSP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Demonstration of calling DSSP and accessing accessibilities using Biopython | |
""" | |
from Bio.PDB import PDBParser, DSSP | |
# Make sure you downloaded 1ctf in PDB format first.. | |
pdb_filepath = '1ctf.pdb' | |
parser = PDBParser(QUIET=1) | |
structure = parser.get_structure('randompdb', pdb_filepath) | |
dssp_data = DSSP(structure[0], pdb_filepath) | |
# Option 1 | |
# Use DSSP dictionary directly, each key being (<str chain>, <tuple resid>) | |
# e.g. ('A', (' ', 120, ' ')) | |
print(dssp_data[('A', (' ', 120, ' '))]) | |
# (68, 'K', '-', 0.7414634146341463, -133.3, 360.0, -65, -2.2, -65, -2.5, -2, -0.4, -2, -0.0) | |
# Option 2 | |
# Iterate over structure and get .xtra method of each residue | |
# DSSP automatically populates fields there | |
for residue in structure.get_residues(): | |
resid = residue.id[1] | |
resname = residue.resname | |
abs_sasa = residue.xtra['EXP_DSSP_ASA'] | |
rel_sasa = residue.xtra['EXP_DSSP_RASA'] | |
print('{}{}\t{:6.3f}\t{:6.3f}'.format(resname, resid, abs_sasa, rel_sasa)) | |
# Returns: | |
# GLU53 190.000 0.979 | |
# PHE54 56.000 0.284 | |
# ASP55 46.000 0.282 | |
# VAL56 0.000 0.000 | |
# ILE57 18.000 0.107 | |
# LEU58 0.000 0.000 | |
# LYS59 85.000 0.415 | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment