parser.add_option("--native",dest="native",help="native structure") parser.add_option("--CA",dest="ca",help="calculate CA rmsd",default=False,action="store_true") parser.add_option("--res",dest="residues",help="list of residues to use",default="") parser.add_option("--table",dest="table",help="output a tab delimited table",default="") parser.add_option("--chain",dest="chain",help="calculate RMSD of only 1 chain",default="") parser.add_option("--term",dest="term",help="score term to use") (options,args)=parser.parse_args() if len(args) <1: parser.error("specify at least 1 protein to compare to native") print "calculating RMSD between ", len(args), " decoys and the native structure ", options.native if options.ca: print "calculating CA RMSD" else: print "calculating all-atom RMSD" native = util.load_pdb(options.native) score_rmsd = [] name_score_rmsd =[] for decoy_file in args: tag = decoy_file.split("/").pop().split(".")[0] decoy = util.load_pdb(decoy_file.rstrip()) score_table = rosettaScore.ScoreTable(decoy_file) rms = pdbStat.calculate_rms(native,decoy,options.ca,options.residues,"",options.chain) score = score_table.get_score(0,options.term) #0 is the pose energy score_rmsd.append( (rms,score) ) name_score_rmsd.append( (decoy_file,rms,score) ) make_table(name_score_rmsd,options.table)
usage = "%prog [options] alignment_file.aln template.pdb output.pdb" parser=OptionParser(usage) parser.add_option("--template",dest="template",help="name of the template sequence", default="template") parser.add_option("--target", dest ="target",help="name of the target sequence",default="target") parser.add_option("--chain",dest="chain",help="chain to thread pdb around",default="A") parser.add_option("--align_format",dest="align_format",help="alignment file format, choose from clustal, emboss, fasta, fasta-m10,ig,nexus,phylip,stockholm. See http://biopython.org/wiki/AlignIO for details",default="clustal") (options,args)= parser.parse_args() if len(args) != 3: parser.error("you must specify an alignment file, template pdb, and output pdb") #read in our input files alignment_file = fileutil.universal_open(args[0],'rU') alignment_data = AlignIO.read(alignment_file,options.align_format) alignment_file.close() template_struct = util.load_pdb(args[1]) #if len(alignment_data) != 2: # sys.exit("alignment file must have exactly 2 sequences!") #find all the gaps, get numeric IDs from the string tags in the alignment file try: template_gaps = alignment.find_gaps(alignment_data,options.template) except LookupError: sys.exit("could not find "+options.template+" in alignment file") try: target_gaps = alignment.find_gaps(alignment_data,options.target) except LookupError: sys.exit("could not find "+options.target+" in alignment file") try: template_id = alignment.get_id_from_tag(alignment_data,options.template)
#!/usr/bin/env python2.5 import array import Bio.PDB from optparse import OptionParser from rosettautil.protein import util from rosettautil.rosetta import loops from rosettautil.util import fileutil usage = "%prog [options] loopfile.txt input.pdb output.pdb" parser = OptionParser(usage) (options, args) = parser.parse_args() loop_manager = loops.RosettaLoopManager() loop_manager.read(args[0]) input_struct = util.load_pdb(args[1]) zero_triplet = array.array('f', [0.0, 0.0, 0.0]) for atom in input_struct.get_atoms(): resnum = atom.get_parent().get_id()[1] if loop_manager.is_res_in_loop(resnum): atom.set_coord(zero_triplet) atom.set_occupancy(-1.0) pdb_io = Bio.PDB.PDBIO() pdb_io.set_structure(input_struct) outfile = fileutil.universal_open(args[2], 'w') pdb_io.save(outfile) outfile.close()
default=False, action="store_true") parser.add_option("--norestart", dest="norestart", help="don't start renumbering at each chain, default=False", default=False, action="store_true") parser.add_option( "--keep-table", dest="table", help="Preserve the rosetta score table at the bottom of the pdb", action="store_true", default=False) (options, args) = parser.parse_args() struct = util.load_pdb(args[0]) try: residue_id = int(options.start) except ValueError: sys.exit("residue number specified with -n must be an integer") chain_id = "" for residue in struct.get_residues(): chain = residue.get_parent() if (chain_id != chain.get_id() and not options.norestart): chain_id = chain.get_id() residue_id = int(options.start) #print chain.get_id() if (options.preserve): hetero = residue.id[0] insert = residue.id[2]
usage = "%prog [options] native.pdb designed.pdb" parser = OptionParser(usage) parser.add_option( "--best", dest="best", help="print out the top n mutations in terms of total energy, default = 10", default=10) parser.add_option( "--worst", dest="worst", help= "print out the bottom n mutations in terms of total energy, default = 10", default=10) (options, args) = parser.parse_args() native_struct = util.load_pdb(args[0]) designed_struct = util.load_pdb(args[1]) native_residues = native_struct.get_residues() designed_residues = designed_struct.get_residues() native_scores = rosettaScore.ScoreTable(args[0]) designed_scores = rosettaScore.ScoreTable(args[1]) native_sequence = "" designed_sequence = "" concensus = "" conserved_count = 0.0 total_count = 0.0
class mutation: def __init__(self,resno,nat,des,delta,nat_score,des_score): self.native=nat self.designed=des self.delta=delta self.native_score=nat_score self.designed_score = des_score self.resno = resno usage = "%prog [options] native.pdb designed.pdb" parser = OptionParser(usage) parser.add_option("--best",dest="best",help="print out the top n mutations in terms of total energy, default = 10",default=10) parser.add_option("--worst",dest="worst",help="print out the bottom n mutations in terms of total energy, default = 10",default=10) (options,args) = parser.parse_args() native_struct = util.load_pdb(args[0]) designed_struct = util.load_pdb(args[1]) native_residues = native_struct.get_residues() designed_residues = designed_struct.get_residues() native_scores = rosettaScore.ScoreTable(args[0]) designed_scores = rosettaScore.ScoreTable(args[1]) native_sequence = "" designed_sequence = "" concensus = "" conserved_count = 0.0
dest="chain", help="calculate RMSD of only 1 chain", default="") parser.add_option("--term", dest="term", help="score term to use") (options, args) = parser.parse_args() if len(args) < 1: parser.error("specify at least 1 protein to compare to native") print "calculating RMSD between ", len( args), " decoys and the native structure ", options.native if options.ca: print "calculating CA RMSD" else: print "calculating all-atom RMSD" native = util.load_pdb(options.native) score_rmsd = [] name_score_rmsd = [] for decoy_file in args: tag = decoy_file.split("/").pop().split(".")[0] decoy = util.load_pdb(decoy_file.rstrip()) score_table = rosettaScore.ScoreTable(decoy_file) rms = pdbStat.calculate_rms(native, decoy, options.ca, options.residues, "", options.chain) score = score_table.get_score(0, options.term) #0 is the pose energy score_rmsd.append((rms, score)) name_score_rmsd.append((decoy_file, rms, score)) make_table(name_score_rmsd, options.table)
from rosettautil.rosetta import rosettaScore from rosettautil.protein import util from rosettautil.util import fileutil from Bio.PDB import * from optparse import OptionParser usage = "%prog input.pdb output.pdb" parser= OptionParser(usage) parser.add_option("-n",dest="start",help="residue number to start with, default is 1",default=1) parser.add_option("--preserve",dest="preserve",help="preserve insertion code and heteroflags",default=False, action="store_true") parser.add_option("--norestart",dest="norestart",help="don't start renumbering at each chain, default=False",default=False, action="store_true") parser.add_option("--keep-table",dest="table",help="Preserve the rosetta score table at the bottom of the pdb",action="store_true",default=False) (options, args) = parser.parse_args() struct = util.load_pdb(args[0]) try: residue_id = int(options.start) except ValueError: sys.exit("residue number specified with -n must be an integer") chain_id = "" for residue in struct.get_residues(): chain = residue.get_parent() if(chain_id != chain.get_id() and not options.norestart): chain_id = chain.get_id() residue_id=int(options.start) #print chain.get_id() if(options.preserve): hetero = residue.id[0] insert = residue.id[2]