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 !"
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")
# 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 pep.regularize() pep.write_xyz("pep_%04i.xyz" % (i))