/
protein properties for Diploma
47 lines (40 loc) · 2.15 KB
/
protein properties for Diploma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from Bio.SeqUtils.ProtParam import ProteinAnalysis
def main():
sequence = input("Enter the amino acid sequence: ")
name = input("Enter the peptide name: ")
aa_composition = convert(sequence)
calculating_amount_aa(aa_composition)
cationic, hydrophobic, other, total = calculating_amount_aa(aa_composition)
calclulating_perc_aa(cationic, hydrophobic, other, total)
# Converting a sequence to a ProteinAnalysis object
def convert(seq):
global protein
protein = ProteinAnalysis(seq)
# Get the amount of each amino acid in a sequence
aa_composition = protein.count_amino_acids()
return aa_composition
def calculating_amount_aa(aa_composition):
# Obtaining the amount of cationic amino acids (R, H, K)
cationic_count = sum([aa_composition[aa] for aa in ['R', 'H', 'K']])
# Obtaining the amount of lipophilic amino acids (F, I, L, A, M, V, Pro, T)
hydrophobic_count = sum([aa_composition[aa] for aa in ['F', 'I', 'L', 'A', 'M', 'V', 'P', 'T']])
# obtaining the amount of other amino acids (G, Y, W, Q, E, N, D, S, C)
other_count = sum([aa_composition[aa] for aa in ['G', 'Y', 'W', 'Q', 'E', 'N', 'D', 'S', 'C']])
# Obtaining the total amount of amino acids
total_count = sum(aa_composition.values())
# Displaying the results
print("Amount of cationic amino acids: ", cationic_count)
print("Amount of lipophilic amino acids: ", hydrophobic_count)
print("Amount of other amino acids: ", other_count)
return cationic_count, hydrophobic_count, other_count, total_count
# Calculate percentages of cationic and lipophilic amino acids
def calclulating_perc_aa(cationic, hydrophobic, other, total):
cationic_percentage = cationic / total * 100
hydrophobic_percentage = hydrophobic/ total * 100
other_percentage = other / total * 100
print("Percentage of cationic amino acids: ", round(cationic_percentage, 2), "%")
print("Percentage of lipophilic amino acids: ", round(hydrophobic_percentage, 2), "%")
print("Percentage of other amino acids: ", round(other_percentage, 2), "%")
print("Molecular mass of peptide:", "%0.2f" % protein.molecular_weight(), "G/mole")
if __name__ == "__main__":
main()