def molWeight(protseq): protweight = {"A":89,"V":117,"L":131,"I":131,"P":115,"F":165, "W":204,"M":149,"G":75,"S":105,"C":121,"T":119, "Y":181,"N":132,"Q":146,"D":133,"E":147, "K":146,"R":174,"H":155 } totalW = 0 protseq = protseq.upper() #so proteins in lower case also OK for aa in protseq: if aa in protweight: totalW = totalW + protweight[aa] H2O = 18 #weight of water molecule totalW = totalW-(H2O*(len(protseq)-1)) #reduce weight for all amino bonds return totalW