计算蛋白质分子量大小(MW)、等电点(pI)和消光系数

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# -*- coding: UTF-8 -*-

AA="ACDEFGHIKLMNPQRSTVWY"
AA_residue={'A': 71.0788,'C': 103.1388,'D': 115.0886,'E': 129.1155,'F': 147.1766,'G': 57.0519,'H': 137.1411,'I': 113.1594,'K': 128.1741,'L': 113.1594,'M': 131.1926,'N': 114.1038,'P': 97.1167,'Q': 128.1307,'R': 156.1875,'S': 87.0782,'T': 101.1051,'V': 99.1326,'W': 186.2132,'Y': 163.176}
pI_e={'C': 9.0,'D': 4.0,'E': 4.5,'H': 6.4,'K': 10.4,'R': 12.0,'Y': 10.0}
COOH="CDEY"
NH2="HKR"


P=raw_input(u"请输入蛋白序列:\n",)

number={k:P.count(k) for k in AA}

a=0
for k in AA:
    a += number[k]*AA_residue[k]

E=(number['Y']*1490+number['W']*5500+number['C']/2*125)/a

def f(x) :
    b=0
    c=0
    for m in COOH:
        b += (number[m]*(10**x))/(10**x+10**pI_e[m])
    for n in NH2:
        c += (number[n]*10**pI_e[n])/(10**x+10**pI_e[n])
    return b+10**x/(10**x+10**3.2)-10**8.2/(10**x+10**8.2)-c
    
r=3.2
s=12.0
x=(r+s)/2
for i in range(11) :
    if f(x)>0:
        s=x
        x=(r+s)/2
    elif f(x)<0:
        r=x
        x=(r+s)/2


print(u"分子量大小为: "+str(round((a+18.01524)/1000,2))+u" kD    pI值为: "+str(round(x,2)))
print(u"消光系数:"+str(round(E,2)))