def structure_gen(self, pep_seq): if not os.path.exists("strs"): os.makedirs("strs") print "Structure being Generated !" b = len(pep_seq) bar = Bar('Processing PEPTIDES', fill='>', max=b) for seq in pep_seq: try: pep = Peptide(seq, nterm="charged", cterm="neutral") pep.regularize() pep.write_pdb(os.path.join("./strs", seq + ".pdb")) bar.next() obConversion = openbabel.OBConversion() obConversion.SetInAndOutFormats("pdb", "sdf") mol = openbabel.OBMol() obConversion.ReadFile(mol, os.path.join("./strs", seq + ".pdb")) mol.AddHydrogens() obConversion.WriteFile(mol, os.path.join("./strs", seq + ".sdf")) except: pass bar.finish() print "Structure Generation Finished !"
def generate_residue(residue, output, seed, number, cterm, nterm): set_seed(seed) for i in range(number): pept = Peptide(residue.upper(), nterm=nterm, cterm=cterm) pept.sample_bb_angles(1) if residue != "P": pept.sample_chi_angles(1) if output is None: name = 'c{:s}c'.format(residue) + '_{:06d}.mol2'.format(i) else: name = output + '_{:06d}.mol2'.format(i) pept.write_file('mol2', str(name)) bb = pept.get_bb_angles(1) print(bb) return True
def generate_peptide(sequence, sample, output, seed, number): start = time.time() set_seed(seed) for i in range(number): pept = Peptide(sequence.upper(), nterm="neutral", cterm="neutral") pept.sample_bb_angles(sample) if sequence[sample] != "P": pept.sample_chi_angles(sample) if output is None: name = sequence + '_{:06d}.pdb'.format(i) else: name = output + '_{:06d}.pdb'.format(i) pept.write_pdb(str(name)) bb = pept.get_bb_angles(2) print(bb) # print("TE : {:12.4f}".format(time.time() - start)) return True
from fragbuilder import Peptide from fragbuilder import G09_opt from fragbuilder import G09_energy from fragbuilder import G09_NMR sequence = "GLG" pep = Peptide(sequence, nterm="methyl", cterm="methyl") print "Charge:", pep.get_charge() for i in pep.get_residue_numbers(): pep.sample_bb_angles(i) pep.sample_chi_angles(i) pep.optimize() opt = G09_opt(pep) opt.set_method("B3LYP/6-31G(d)") opt.write_com("g09_opt_%s.com" % (sequence)) opt.write_com("g09_opt_%s_constraint.com" % (sequence), constraint_dihedrals=True) energy = G09_energy(pep) energy.set_method("PM3") energy.write_com("g09_energy_%s.com" % (sequence)) nmr = G09_NMR(pep) nmr.set_method("B3LYP/6-31+G(d,p)") nmr.write_com("g09_nmr_%s.com" % (sequence))
from fragbuilder import Peptide # Create a peptide object with the sequence # glycine-leucine-glycine. sequence = "GLG" pep = Peptide(sequence) # Define a list of angles. angles = range(-180, 180, 60) # Double loop over phi/psi angles in the desired range. for psi in angles: for phi in angles: # Set the second (leucine) residue to (phi, psi). pep.set_bb_angles(2, [phi, psi]) # Save each conformation. pep.write_xyz("pep_%04i_%04i.xyz" % (phi, psi))
from __future__ import print_function from fragbuilder import Peptide # Make a GLG peptide object sequence = "GLG" pep = Peptide(sequence, nterm="neutral", cterm="charged") print("SMILES: ", pep.get_smiles()) print("Charge: ", pep.get_charge()) print("Length: ", pep.get_length()) print("Sequence:", pep.get_sequence()) # Set [PHI, PSI] angles for residues 1, 2 and 3 pep.set_bb_angles(1, [ -156.3, 142.3]) pep.set_bb_angles(2, [ 48.8, 42.3]) pep.set_bb_angles(3, [ 81.3, 0.2]) # Set and read chi angles for residue 2 pep.set_chi_angles(2, [ -50.6, -75.1]) print(pep.get_bb_angles(2)) # Sample (and set) backbone angles for residue 2 print(pep.sample_bb_angles(2)) print(pep.get_bb_angles(2)) # Sample (and set) chi angles for residue 2 print(pep.sample_chi_angles(2)) print(pep.get_chi_angles(2)) # Write files pep.write_xyz("pep.xyz")
from __future__ import print_function from fragbuilder import Peptide from fragbuilder import G09_opt from fragbuilder import G09_energy from fragbuilder import G09_NMR sequence = "GLG" pep = Peptide(sequence, nterm="methyl", cterm="methyl") print("Charge:", pep.get_charge()) for i in pep.get_residue_numbers(): pep.sample_bb_angles(i) pep.sample_chi_angles(i) pep.optimize() opt = G09_opt(pep) opt.set_method("B3LYP/6-31G(d)") opt.write_com("g09_opt_%s.com" % (sequence)) opt.write_com("g09_opt_%s_constraint.com" % (sequence), constraint_dihedrals=True) energy = G09_energy(pep) energy.set_method("PM3") energy.write_com("g09_energy_%s.com" % (sequence)) nmr = G09_NMR(pep) nmr.set_method("B3LYP/6-31+G(d,p)") nmr.write_com("g09_nmr_%s.com" % (sequence))
from fragbuilder import Peptide # Make a GLG peptide object sequence = "GLG" pep = Peptide(sequence, nterm="neutral", cterm="charged") print "SMILES: ", pep.get_smiles() print "Charge: ", pep.get_charge() print "Length: ", pep.get_length() print "Sequence:", pep.get_sequence() # Set [PHI, PSI] angles for residues 1, 2 and 3 pep.set_bb_angles(1, [ -156.3, 142.3]) pep.set_bb_angles(2, [ 48.8, 42.3]) pep.set_bb_angles(3, [ 81.3, 0.2]) # Set and read chi angles for residue 2 pep.set_chi_angles(2, [ -50.6, -75.1]) print pep.get_bb_angles(2) # Sample (and set) backbone angles for residue 2 print pep.sample_bb_angles(2) print pep.get_bb_angles(2) # Sample (and set) chi angles for residue 2 print pep.sample_chi_angles(2) print pep.get_chi_angles(2) # Write files pep.write_xyz("pep.xyz") pep.write_pdb("pep.pdb", QUIET=False)
from fragbuilder import Peptide # Make a peptide object sequence = "YDG" pep = Peptide(sequence) # Set some angles that will clash pep.set_bb_angles(1, [ -156.3, 142.3]) pep.set_bb_angles(2, [48.8, 42.3]) pep.set_bb_angles(3, [81.3, 0.2]) # Write an XYZ file pep.write_xyz("clash.xyz") # Remove clashes (keep dihedral angles) pep.regularize() # Write another XYZ file pep.write_xyz("noclash.xyz")
# Extract length and sequence n = pdb.get_length() seq = pdb.get_sequence() # Loop over residue numbers for i in pdb.get_residue_numbers(): # Ignore first and last few residues as omega, # phi, or psi may be undefined. if (i < 3) or (i > n - 2): continue # Determine sequence of the three-residues # peptide model and make a Peptide object pep_seq = seq[i - 2:i + 1] pep = Peptide(pep_seq) print(i, pep_seq) # Loop over preceding, central, and following residue. for j in [-1, 0, 1]: # Read backbone and chi angles from pdb object bb = pdb.get_bb_angles(i + j) chi = pdb.get_chi_angles(i + j) # Set matching angles in the Peptide object pep.set_bb_angles(2 + j, bb) pep.set_chi_angles(2 + j, chi) # Short optimization and save xyz file
from fragbuilder import Peptide aas = "FYWDENQHKRGASTCVLIMP" for l1 in aas: # Define sequence seq = "A" + l1 * 10 + "A" print seq # Create peptide pep = Peptide(seq, nterm="charged", cterm="charged") # Sample (and set) backbone angles for residue 2 for i in range(10): pep.sample_bb_angles(2 + i) print pep.get_bb_angles(2 + i) # Sample (and set) chi angles for residue 2 try: pep.sample_chi_angles(2 + i) print pep.get_chi_angles(2 + i) except: pass # MMFF94 optimization pep.optimize() # Write files filename = seq + ".pdb" pep.write_pdb(filename, QUIET=False)
from fragbuilder import Peptide # Make a GLAG peptide object sequence = "GLAG" pep = Peptide(sequence) # Loop over residues: for i in pep.get_residue_numbers(): pep.sample_bb_angles(i) pep.sample_chi_angles(i) # Regularize to remove any steric clashes pep.regularize() # Write files pep.write_xyz("pep.xyz")
from fragbuilder import Peptide # Make a peptide object sequence = "YDG" pep = Peptide(sequence) # Set some angles that will clash pep.set_bb_angles(1, [-156.3, 142.3]) pep.set_bb_angles(2, [48.8, 42.3]) pep.set_bb_angles(3, [81.3, 0.2]) # Write an XYZ file pep.write_xyz("clash.xyz") # Remove clashes (keep dihedral angles) pep.regularize() # Write another XYZ file pep.write_xyz("noclash.xyz")