def main(): args = docopt.docopt(__doc__) folder = args['<folder>'] init() target = pose_from_file(args['<input>']) workspace = pipeline.workspace_from_dir(folder) loop = workspace.largest_loop #mobile = pose_from_file('/Users/benjaminrjagger/UCSF/cas_des/CPP_sims/4un3_1051_penetratin/input.pdb.gz') # ins_len = chain_end_res(mobile, 1) - chain_end_res(target, 1) # des_res = list(range(1, int(loop.start)-1)) + list(range(int(loop.end)+1, chain_end_res(mobile, 1))) # wt_res = list(range(1,int(loop.start) -1)) + list(range(int(loop.end)+1 - ins_len, chain_end_res(target, 1))) # res_map = map_unsigned_long_unsigned_long() # for i in range(len(des_res)): # res_map[des_res[i]] = wt_res[i] # rmsd = CA_rmsd(mobile, target, res_map) for root, dirs, files in os.walk(workspace.output_dir): for name in files: if name.endswith('.pdb.gz') or name.endswith('.pdb'): pdbpath = os.path.join(root, name) mobile = pose_from_file(pdbpath) ins_len = chain_end_res(mobile, 1) - chain_end_res(target, 1) des_res = list(range( 1, int(loop.start) - 1)) + list( range(int(loop.end) + 1, chain_end_res(mobile, 1))) wt_res = list(range(1, int(loop.start) - 1)) + list( range( int(loop.end) + 1 - ins_len, chain_end_res(target, 1))) res_map = map_unsigned_long_unsigned_long() for i in range(len(des_res)): res_map[des_res[i]] = wt_res[i] rmsd = CA_rmsd(mobile, target, res_map) metric_name = 'EXTRA_METRIC_CA_RMSD_NO_LOOP [[-]]' if name.endswith('.pdb.gz'): add_lines_to_gzip(pdbpath, [metric_name + ' ' + str(rmsd)]) if name.endswith('.pdb'): add_lines_reg(pdbpath, [metric_name + ' ' + str(rmsd)]) #rmsd = all_atom_rmsd(mobile, target) print(rmsd)
def _get_ca_metric(self, coordinates, target): return CA_rmsd(coordinates, target)
repackable.extend([int(key) for key in resfile_parser.repack[chain]]) fd.setup_default_movemap(bb=designable.extend(repackable), chi=designable.extend(repackable)) if test_run: fd.rounds = 1 print(fd.movemap) print(fd.task_factory) fd.apply() # Create new pose from input file for comparison input_pose = pose_from_file(pdbpath) #input_pose = pose_from_file(workspace.input_pdb_path) # Calculate several different types of RMSD ca_rmsd = CA_rmsd(fd.pose, input_pose) all_atom_rmsd = all_atom_rmsd(fd.pose, input_pose) filters = workspace.get_filters(fd.pose, task_id=job_info['task_id'], score_fragments=False, test_run=test_run) filters.run_filters() # Add RMSDs as extra metrics, which will be printed at the end of # the PDB file. setPoseExtraScore(fd.pose, 'EXTRA_METRIC_CA_RMSD', ca_rmsd) setPoseExtraScore(fd.pose, 'EXTRA_METRIC_AllAtom_RMSD', all_atom_rmsd) total_time = time.time() - start_time setPoseExtraScore(fd.pose, 'EXTRA_METRIC_Run time', total_time)
running_EFRETKsq_AVG = running_EFRETKsq_SUM / running_TRESP_count TRESPEFRET = compute_TRESP_EFRET(p, CaM_Mutant[0], CaM_Mutant[4], CaM_Mutant[1], CaM_Mutant[3]) running_TRESPEFRET_SUM += TRESPEFRET running_TRESP_AVG = running_TRESPEFRET_SUM / running_TRESP_count outf = open( str(CaM_Mutant[0]) + '_' + str(CaM_Mutant[1]) + '_' + str(CaM_Mutant[2]) + '_' + str(CaM_Mutant[3]) + '_' + str(args.Number_of_Input_Structure) + ".score", 'a') pdb_out = str(CaM_Mutant[0]) + '_' + str( CaM_Mutant[1]) + '_' + str(CaM_Mutant[2]) + '_' + str( CaM_Mutant[3]) + '_' + str( args.Number_of_Input_Structure) + '_' + str(i) + ".pdb" outf.write( "%s\t%.3f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n" % (pdb_out, SF1(p), CA_rmsd(mutant_start_pose, p), R, K_sq, EFRET, EFRETKsq, TRESPEFRET, running_EFRET_AVG, running_EFRETKsq_AVG, running_TRESP_AVG)) if args.Dump_PDBs and args.Dump_PDBs == True: p.dump_pdb(pdb_out) outf.close() if args.Show_Results and args.Show_Results == True: pmm.apply(p) print('Instantaneous Energy:' + str(SF1(p))) print('Average EFRET:' + str(running_EFRET_AVG)) print('Average EFRETKsq:' + str(running_EFRETKsq_AVG)) print('Average TRESP EFRET:' + str(running_TRESP_AVG)) ### For Trp if CaM_Mutant[0] == 'TRP': EFRET_1, EFRET_2, EFRET_W = compute_EFRET(p, CaM_Mutant[0], CaM_Mutant[4],
if test_run: # What happens when --test-run is supplied? lm.mark_as_test_run() # Add pose and apply lm.pose = pose lm.apply() # Get and run default filters filters = workspace.get_filters(lm.pose, task_id=job_info['task_id'], score_fragments=True, test_run=test_run) filters.run_filters() # Calculate RMSD from input input_pose = pose_from_file(workspace.input_path(job_info)) ca_rmsd = CA_rmsd(lm.pose, input_pose) all_atom_rmsd = all_atom_rmsd(lm.pose, input_pose) loop = workspace.largest_loop rmsd = CA_rmsd(input_pose, lm.pose, loop.start, loop.end) # Add RMSDs to pose for parsing setPoseExtraScore(lm.pose, 'EXTRA_METRIC_CA_RMSD', ca_rmsd) setPoseExtraScore(lm.pose, 'EXTRA_METRIC_AllAtom_RMSD', all_atom_rmsd) setPoseExtraScore(lm.pose, 'EXTRA_METRIC_Loop_RMSD', rmsd) if not os.path.exists(workspace.output_prefix(job_info)): os.mkdir(workspace.output_prefix(job_info)) pose.dump_pdb(workspace.output_path(job_info))
dalphaball_path, pdbpath)) relax.add_init_arg('-total_threads 1') if test_run: relax.rounds = 1 relax.pose = pose # Warning: This is an all-atom movemap. Constrain to input coords if # you don't want things to move around a lot. relax.setup_default_movemap() relax.apply() # This will compare it to the input to this step input_pose = pose_from_file(pdbpath) # But you can uncomment this to compare to the input to the # workspace #input_pose = pose_from_file(workspace.input_pdb_path) ca_rmsd = CA_rmsd(relax.pose, input_pose) all_atom_rmsd = all_atom_rmsd(relax.pose, input_pose) score_fragments = os.path.exists(workspace.loops_path) filters = workspace.get_filters(relax.pose, task_id=job_info['task_id'], score_fragments=score_fragments, test_run=test_run) filters.run_filters() input_name = os.path.basename(pdbpath).split(".")[0] out = workspace.output_prefix( job_info) + input_name + workspace.output_suffix(job_info) + '.pdb.gz' setPoseExtraScore(relax.pose, 'EXTRA_METRIC_CA_RMSD', ca_rmsd) setPoseExtraScore(relax.pose, 'EXTRA_METRIC_AllAtom_RMSD', all_atom_rmsd)
# print('PRINTING MOVEMAP AND TASK FACTORY') # print(fd.movemap) # print(fd.task_factory) # fd.mover.add_constraint_generator(csts) # fd.mover.constrain_relax_to_start_coords(True) # fd.mover.ramp_down_constraints(False) # Before we apply FastDesign, also setup and run RotamerTrials # fd.apply() protocol.apply(pose) # This will compare it to the input to the step input_pose = pose_from_file(pdbpath) # But you can uncomment this to compare it to the input to the # project #input_pose = pose_from_file(workspace.input_pdb_path) ca_rmsd = CA_rmsd(pose, input_pose) all_atom_rmsd = all_atom_rmsd(pose, input_pose) # score_fragments = os.path.exists(workspace.loops_path) score_fragments = False filters = workspace.get_filters(pose, task_id=job_info['task_id'], score_fragments=score_fragments, test_run=test_run) filters.run_filters() input_name = os.path.basename(pdbpath).split(".")[0] out = workspace.output_prefix( job_info) + input_name + workspace.output_suffix(job_info) + '.pdb.gz' setPoseExtraScore(pose, 'EXTRA_METRIC_CA_RMSD', ca_rmsd)
def main(): args = docopt.docopt(__doc__) print(args) cluster.require_qsub() start_time = time.time() workspace, job_info = big_jobs.initiate() pdbpath = workspace.input_path(job_info) if not os.path.exists(workspace.output_prefix(job_info)): os.mkdir(workspace.output_prefix(job_info)) outpath = workspace.output_path(job_info) test_run = job_info.get('test_run', False) # append location of Rosetta binaries to path sys.path.append('/wynton/home/kortemme/krivacic/source/bin') # find necessary files tmers = glob.glob( os.path.join(workspace.fragments_dir, workspace.fragments_tag(pdbpath) + '?', '*3mers.gz')) nmers = glob.glob( os.path.join(workspace.fragments_dir, workspace.fragments_tag(pdbpath) + '?', '*9mers.gz')) ss2 = glob.glob( os.path.join(workspace.fragments_dir, workspace.fragments_tag(pdbpath) + '?', '*psipred_ss2')) # Run the ab initio relaxation script. relax_abinitio = [ 'AbinitioRelax.linuxgccrelease', '-abinitio:relax', '-use_filters', 'true', '-abinitio::increase_cycles', '10', '-abinitio::rg_reweight', '0.5', '-abinitio::rsd_wt_helix', '0.5', '-abinitio::rsd_wt_loop', '0.5', '-relax::fast', '-in:file:fasta', workspace.fasta_path, '-in:file:frag3', tmers, '-in:file:frag9', nmers, '-in:file:psipred_ss2', ss2, '-nstruct', args.nstruct, '-out:pdb_gz', '-out:prefix', workspace.output_prefix(job_info), '-out:suffix', workspace.output_suffix(job_info), # '--outdir', workspace.fragments_dir, # '--memfree', args['--mem-free'] ] if args['--dry-run']: print(' '.join(relax_abinitio)) else: subprocess.call(relax_abinitio) init() pose = pose_from_file(outpath) input_pose = pose_from_file(pdbpath) ca_rmsd = CA_rmsd(pose, input_pose) all_atom_rmsd = all_atom_rmsd(pose, input_pose) setPoseExtraScore(pose, 'EXTRA_METRIC_CA_RMSD [[-]]', ca_rmsd) setPoseExtraScore(pose, 'EXTRA_METRIC_AllAtom_RMSD [[-]]', all_atom_rmsd) filters = workspace.get_filters(pose, task_id=job_info['task_id'], score_fragments=not test_run, test_run=test_run) filters.run_filters() total_time = time.time() - start_time setPoseExtraScore(pose, 'EXTRA_METRIC_Run time', total_time) outname = os.path.basename(outpath) outfolder = os.path.join(workspace.output_prefix(job_info), 'filtered') pose.dump_pdb(os.path.join(outfolder, outpath))
'DAlphaBall', 'DAlphaBall.gcc') #lm.add_init_arg('-holes:dalphaball {}'.format(dalphaball_path)) # Init arguments needed to run FragmentScoreFilter & BUNS dalphaball_path = os.path.join(workspace.rosetta_dir, 'source', 'external', 'DAlpahBall', 'DAlphaBall.gcc') lm.add_init_arg('-holes:dalphaball {} -in:file:s {}'.format( dalphaball_path, pdbpath)) lm.add_init_arg('-in:file:s {}'.format(pdbpath)) if test_run: lm.mover.centroid_stage().mark_as_test_run() lm.mover.fullatom_stage().mark_as_test_run() lm.pose = pose lm.apply() input_pose = pose_from_file(workspace.input_path(job_info)) ca_rmsd = CA_rmsd(lm.pose, input_pose) all_atom_rmsd = all_atom_rmsd(lm.pose, input_pose) input_name = os.path.basename(workspace.input_path(job_info)).split('.')[0] out = workspace.output_prefix( job_info) + input_name + workspace.output_suffix(job_info) + '.pdb.gz' filters = workspace.get_filters(lm.pose, task_id=job_info['task_id'], score_fragments=True, test_run=test_run) filters.run_filters() setPoseExtraScore(lm.pose, 'EXTRA_METRIC_CA_RMSD', ca_rmsd) setPoseExtraScore(lm.pose, 'EXTRA_METRIC_AllAtom_RMSD', all_atom_rmsd)