def main(): """ This is a tailor-made propka-executable for propka's GUI, but also useful for commandline execution """ # I. preliminaries # loading options, flaggs and arguments; making a version object options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating the protein object myProtein = Protein(pdbfile=pdbfiles[0], options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. optimise 'single-site' mutation and selecting the good determinants mutations = [] for mutation in options.mutations: # II.a. combinatorial search of 'determinants' for each site best_mutation = myProtein.optimizeMutationDeterminants( atoms=atoms, mutation=mutation, version=version, options=options) if best_mutation != None: mutations.append(best_mutation) # III. combinatorial search of single-site mutations with their resulting 'determinants' if len(mutations) > 0: best_mutation = myProtein.optimizeMultipleMutations( mutations=mutations, atoms=atoms, version=version, options=options) else: print("Could not find any mutation combination more stable than WT\n") sys.exit(8)
def main(): """ This is the main that just performs the determinant search """ # I. preliminaries # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating protein object myProtein = Protein(pdbfile=pdbfiles[0], options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. optimise 'single-site' mutation and selecting the good determinants mutations = [] for mutation in options.mutations: # II.a. combinatorial search of 'determinants' for each site best_mutation = myProtein.optimizeMutationDeterminants( atoms=atoms, mutation=mutation, version=version, options=options) if best_mutation != None: mutations.append(best_mutation)
def main(): """ This is the main that just performs the determinant search """ # I. preliminaries # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating protein object myProtein = Protein(pdbfile=pdbfiles[0], options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. optimise 'single-site' mutation and selecting the good determinants mutations = [] for mutation in options.mutations: # II.a. combinatorial search of 'determinants' for each site best_mutation = myProtein.optimizeMutationDeterminants(atoms=atoms, mutation=mutation, version=version, options=options) if best_mutation != None: mutations.append( best_mutation )
def main(): """ Simple main that creates the proteins, mutates the protein, calculates pKa values, and prints pKa files """ # I. preliminaries # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating protein object and calculating reference folding energy myProtein = Protein(pdbfile=pdbfiles[0], options=options) myProtein.calculatePKA(version=version, options=options) dG_ref = myProtein.calculateFoldingEnergy(options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = mutate.makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. making mutations and calculating the folding energy for mutation in options.mutations: pka_print(mutation) newProtein = mutate.makeMutatedProtein(myProtein, atoms=atoms, mutation=mutation, options=options) # calculating pKa values for ionizable residues newProtein.calculatePKA(version=version, options=options) newProtein.writePKA(options=options) dG_mut = newProtein.calculateFoldingEnergy(options=options) pka_print("staliblization:") pka_print("%8.2lf %6.2lf %s" % (dG_ref, dG_ref-dG_ref, "WT")) pka_print("%8.2lf %6.2lf %s" % (dG_mut, dG_mut-dG_ref, "Mutant")) newProtein.writePDB(hydrogens=True, options=options)
def main(): """ This is a tailor-made propka-executable for propka's GUI, but also useful for commandline execution """ # I. preliminaries # loading options, flaggs and arguments; making a version object options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating the protein object myProtein = Protein(pdbfile=pdbfiles[0], options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. optimise 'single-site' mutation and selecting the good determinants mutations = [] for mutation in options.mutations: # II.a. combinatorial search of 'determinants' for each site best_mutation = myProtein.optimizeMutationDeterminants(atoms=atoms, mutation=mutation, version=version, options=options) if best_mutation != None: mutations.append( best_mutation ) # III. combinatorial search of single-site mutations with their resulting 'determinants' if len(mutations) > 0: best_mutation = myProtein.optimizeMultipleMutations(mutations=mutations, atoms=atoms, version=version, options=options) else: pka_print("Could not find any mutation combination more stable than WT\n") sys.exit(8)
def main(): """ Simple main that creates the proteins, protonates them, and prints new pdb files with hydrogen atoms """ # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() for pdbfile in pdbfiles: # creating protein object myProtein = Protein(pdbfile=pdbfile, options=options) filename = "%s_new.pdb" % (myProtein.name) myProtein.writePDB(filename=filename, hydrogens=True)
def main(): """ Simple main that creates the proteins, calculates pKa values, and prints pKa files """ # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() for pdbfile in pdbfiles: # creating protein object myProtein = Protein(pdbfile=pdbfile, options=options) # calculating pKa values for ionizable residues myProtein.calculatePKA(options=options) # printing pka file myProtein.writePKA(options=options)
def main(): """ Simple main that creates the proteins, mutates the protein, calculates pKa values, and prints pKa files """ # I. preliminaries # loading options, flaggs and arguments options, pdbfiles = lib.loadOptions() version = propka.makeVersion(label=options.version_label) # creating protein object and calculating reference folding energy myProtein = Protein(pdbfile=pdbfiles[0], options=options) myProtein.calculatePKA(version=version, options=options) dG_ref = myProtein.calculateFoldingEnergy(options=options) # creating a dictionary with atom objects needed for e.g. alignment mutations atoms = mutate.makeCompositeAtomsDictionary(protein=myProtein, pdbfiles=pdbfiles, options=options) # II. making mutations and calculating the folding energy for mutation in options.mutations: print(mutation) newProtein = mutate.makeMutatedProtein(myProtein, atoms=atoms, mutation=mutation, options=options) # calculating pKa values for ionizable residues newProtein.calculatePKA(version=version, options=options) newProtein.writePKA(options=options) dG_mut = newProtein.calculateFoldingEnergy(options=options) print("staliblization:") print("%8.2lf %6.2lf %s" % (dG_ref, dG_ref - dG_ref, "WT")) print("%8.2lf %6.2lf %s" % (dG_mut, dG_mut - dG_ref, "Mutant")) newProtein.writePDB(hydrogens=True, options=options)
def makeMutatedProtein(protein, mutation=None, atoms=None, alignment=None, options=None): """ returning a new protein, mutation approach determined from options.mutator """ from Source.protein import Protein as Protein print("mutator: %s" % (options.mutator.label)) print("type: %s\n" % (options.mutator.type)) # checking mutation format # making sure string-mutation has chainID in it, and then recasting into dictionary-mutation. if isinstance(mutation, str): if alignment == None: alignment = readAlignmentFiles(filenames=options.alignment, mesophile=protein.name, options=options) pdbcode, rest = splitStringMutationInTwo(mutation) if pdbcode == None: mutation = remakeStringMutation(mutation, protein.atoms.keys()) else: mutation = remakeStringMutation(mutation, protein.atoms.keys(), atoms[pdbcode].keys()) dict_mutation = recastIntoDictionary(mutation, alignment=alignment, protein=protein) elif isinstance(mutation, dict): # this is already in dictionary-format dict_mutation = mutation pdbfile = "%s.pdb" % (protein.name) newfile = "%s_mut.pdb" % (protein.name) if options.mutator.label == "alignment": newAtoms = mutateAtomsDictionaryUsingAlignment(protein, mutation=dict_mutation, atoms=atoms, options=options) printMutation(dict_mutation) name = "%s_mut" % (protein.name) newProtein = Protein(atoms=newAtoms, name=name, options=options) newProtein.writePDB(filename=newfile, options=options) newProtein = Protein(pdbfile=newfile, name=name, options=options) #fixProtonationIssues(protein, newProtein) elif options.mutator.label in ["overlap"]: newAtoms = mutateAtomsDictionaryUsingOverlap(protein, mutation=dict_mutation, atoms=atoms, options=options) printMutation(dict_mutation) name = "%s_mut" % (protein.name) newProtein = Protein(atoms=newAtoms, name=name, options=options) newProtein.writePDB(filename=newfile, options=options) newProtein = Protein(pdbfile=newfile, name=name, options=options) #fixProtonationIssues(protein, newProtein) elif options.mutator.label in ["scwrl3", "scwrl4", "scwrl"]: seqfile = "x-ray.seq" sequence = protein.makeSequence(mutation=dict_mutation, program="scwrl", options=options) output.writeScwrlSequenceFile(sequence, filename=seqfile, options=options) executeScwrl(pdbfile, newfile, seqfile, options=options) newProtein = Protein(pdbfile=newfile, options=options) cmd = "rm %s" % (newfile); os.system(cmd) elif options.mutator.label in ["jackal", "scap"]: scapfile = "%s_scap.list" % protein.name mutation_data = splitIntoMutationData(mutation) output.writeJackalScapFile(mutationData=mutation_data, filename=scapfile, options=options) executeJackal(pdbfile, scapfile, newfile, options=options) newProtein = Protein(pdbfile=newfile, options=options) cmd = "rm %s %s" % (scapfile, newfile); os.system(cmd) elif options.mutator.label in ["whatif", "WhatIf"]: mutation_data = splitIntoMutationData(mutation) output.writeWhatIfFile(mutationData=mutation_data, pdbfile=pdbfile, newfile=newfile, options=options) executeWhatIf(newfile=newfile, options=options) newProtein = Protein(pdbfile=newfile, options=options) cmd = "rm %s" % (newfile); os.system(cmd) else: print("don't know how to use mutator \"%s\"" % (options.mutator.label)) sys.exit(9) return newProtein