Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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))
    # 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)
    setPoseExtraScore(pose, 'EXTRA_METRIC_AllAtom_RMSD', all_atom_rmsd)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
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))