Created
April 29, 2014 14:10
-
-
Save lambdalisue/11401530 to your computer and use it in GitHub Desktop.
A library to define the residual hydrophobicities
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
# coding=utf-8 | |
""" | |
""" | |
__author__ = 'Alisue <lambdalisue@hashnote.net>' | |
# Refence: | |
# Eisenberg D., Schwarz E., Komarony M., Wall R. | |
# J. Mol. Biol. 179:125-142(1984). | |
HYDROPHOBICITIES = { | |
'A': 0.620, 'R': -2.530, 'N': -0.780, 'D': -0.900, 'C': 0.290, | |
'Q': -0.850, 'E': -0.740, 'G': 0.480, 'H': -0.400, 'I': 1.380, | |
'L': 1.060, 'K': -1.500, 'M': 0.640, 'F': 1.190, 'P': 0.120, | |
'S': -0.180, 'T': -0.050, 'W': 0.810, 'Y': 0.260, 'V': 1.080, | |
} | |
def get_hydrophobicity(sequence, average=False): | |
""" | |
Get total (or average) residual hydrophobicity of the sequence | |
""" | |
sequence = sequence.upper() | |
nof = 0 | |
hydrophobicity = 0 | |
for c in sequence: | |
if c in HYDROPHOBICITIES: | |
hydrophobicity += HYDROPHOBICITIES[c] | |
nof += 1 | |
if average: | |
hydrophobicity /= float(nof) | |
return hydrophobicity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment