-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.py
executable file
·126 lines (90 loc) · 4.63 KB
/
test.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/python
"""
PepFun: open source protocols for peptide-related computational analysis
From publication "PepFun: open source protocols for peptide-related computational analysis"
Journal of Cheminformatics
Authors: Rodrigo Ochoa, Pilar Cossio
Year: 2020
Script to test the PepFun functionalities
"""
########################################################################################
# Authorship
########################################################################################
__author__ = "Rodrigo Ochoa"
__credits__ = ["Rodrigo Ochoa", "Pilar Cossio"]
__license__ = "MIT"
__version__ = "1.0"
__email__ = "rodrigo.ochoa@udea.edu.co"
########################################################################################
# Import PepFun functions
########################################################################################
from pepfun import *
########################################################################################
# Main File
########################################################################################
if __name__ == '__main__':
############################################################
# Example input data
############################################################
sequence="KMGRLFR"
pdb_file="auxiliar/example_structure.pdb"
chain="C"
dssp_route="auxiliar/mkdssp"
pep_conformation="linear"
contact_threshold=4.0
############################################################
# Test peptide sequence functions
############################################################
print("### TEST PEPTIDE SEQUENCE FUNCTIONS ###")
pep=peptide_sequence(sequence)
print("The main peptide sequence is: {}".format(pep.sequence))
pep.compute_peptide_charges()
print("Net charge at pH 7: {}".format(pep.netCharge))
pep.calculate_properties_from_mol()
print("Molecular weight: {}".format(pep.mol_weight))
pep.calculate_properties_from_sequence()
print("Average Hydrophobicity: {}".format(pep.avg_hydro))
print("Isoelectric Point: {}".format(pep.isoelectric_point))
pep.align_position_matrix("KAGRSFR")
print("Alignment score by position with peptide KAGRSFR is: {}".format(pep.score_matrix))
pep.align_position_local("KAGRSFR")
print("The number of dismatches with peptide KAGRSFR are: {}".format(pep.dismatch))
similarity=pep.similarity_pair("KMGRLFR","KAGRSFR")
print("The similarity between peptides KMGRLFR and KAGRSFR is: {}".format(similarity))
pep.similar_smiles("KAGRSFR")
print("The SMILES similarity is: {}".format(pep.smiles_similarity))
pep.solubility_rules()
print("{} solubility rules failed from 5".format(pep.solubility_rules_failed))
pep.synthesis_rules()
print("{} synthesis rules failed from 5".format(pep.synthesis_rules_failed))
print("SEQUENCE TESTS PASSED OK")
############################################################
# Test peptide structure functions
############################################################
print("### TEST PEPTIDE STRUCTURE FUNCTIONS ###")
pepStr=peptide_structure(pdb_file,chain)
print("Peptide sequence based on the PDB file is: {}".format(pepStr.sequence))
pepStr.get_secondary_structure(dssp_route)
print("The predicted secondary structure is: {}".format(pepStr.total_dssp))
pepStr.get_hydrogen_bonds(dssp_route)
pepStr.plot_hydrogen_bonds(pep_conformation)
pepStr.get_heavy_atom_contacts(contact_threshold)
print("The total number of contacts are: {}".format(pepStr.total_contacts))
print("The total number of hydrogen bonds are: {}".format(pepStr.number_hydrogen_bonds))
print("The following are the details per amino acid in the peptide:")
print(pepStr.positions)
print("STRUCTURE TESTS PASSED OK")
############################################################
# Test additional functions
############################################################
print("### TEST ADDITIONAL FUNCTIONS ###")
# Select one of the following methods:
#list_peptides=generate_sequences(2,"natural")
#list_peptides=combinatorial_library(10,"natural")
list_peptides=generate_peptide_pattern("XERTX")
# Print the peptides and store them in an external file
print("The number of peptides generated in the library are: {}".format(len(list_peptides)))
library_report=open("auxiliar/library_generated.txt","w")
for pep in list_peptides: library_report.write("{}\n".format(pep))
library_report.close()
print("ADDITIONAL TESTS PASSED OK")