Example #1
0
def relative_resfile_from_reference(workspace, insertion, pose,
        reference_pose):
    '''
    Convert a resfile to relative resfiles given a LUCS insertion.
    Note: Resfile/original PDB must have Rosetta numbering, i.e. start
    with the first residue having the number 1. Otherwise, the function
    will require the original pose and the LUCS pose.
    '''
    resfile_parser = input_files.Resfile(input_resfile=workspace.resfile_path)
    start = insertion['start']

    chain = 'A'
    designable = []
    for res in resfile_parser.design[chain]:
        if int(res) < insertion['start']:
            designable.append(int(res))
        else:
            designable.append(int(res) + (pose.size() -
                reference_pose.size()))

    designable.extend([j for j in range(insertion['start'],
        insertion['stop'])])
    repackable = []
    if chain in resfile_parser.repack:
        for res in resfile_parser.repack[chain]:
            if int(res) < insertion['start']:
                repackable.append(int(res))
            else:
                repackable.append(int(res) + (pose.size() -
                    reference_pose.size()))


    return designable, repackable
Example #2
0
def fold_tree_from_resfile(workspace, pose):
    from klab.rosetta import input_files
    resfile_parser = input_files.Resfile(input_resfile=workspace.resfile_path)
    ft_dict = {}

    for chain in resfile_parser.design:
        designable = [int(key) for key in resfile_parser.design[chain]]
        if chain in resfile_parser.repack:
            repackable = [int(key) for key in resfile_parser.repack[chain]]
            print(repackable)
        else:
            repackable = []

        designable.extend(repackable)
        if designable:
            start = pose.pdb_info().pdb2pose(chain, min(designable))
            end = pose.pdb_info().pdb2pose(chain, max(designable))
            mid = int((start + end) / 2)
            ft_dict[chain] = (start, mid, end)

    print(ft_dict)
    ft = FoldTree()
    # go through each chain
    jumpno = 1
    for chain in range(1, pose.num_chains() + 1):
        chainstart = pose.chain_begin(chain)
        chainstop = pose.chain_end(chain)

        pdbchain = pose.pdb_info().pose2pdb(chainstart).split(' ')[1]
        print(pdbchain)
        if pdbchain in ft_dict:
            # Edge to start of design region
            ft.add_edge(chainstart, ft_dict[pdbchain][0], -1)
            # Edge from start of design region to middle of design region
            ft.add_edge(ft_dict[pdbchain][0], ft_dict[pdbchain][1], -1)
            # Edge from end of design region to end of chain
            ft.add_edge(ft_dict[pdbchain][2], chainstop, -1)
            # Edge from end of design region to middle of chain
            ft.add_edge(ft_dict[pdbchain][2], ft_dict[pdbchain][1], -1)
            # Jump from start of design region to end of design region
            ft.add_edge(ft_dict[pdbchain][0], ft_dict[pdbchain][2], jumpno)
            jumpno += 1
        else:
            ft.add_edge(chainstart, chainstop, -1)

        # Add jump between chain and next chain
        if chain < pose.num_chains():
            ft.add_edge(chainstop, chainstop + 1, jumpno)
            jumpno += 1

    return ft
Example #3
0
            <Nterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Nterm>
            <Cterm>
                    <all append="DEGHKNQRST" />
                    <all exclude="CAFILMPVWY" />
            </Cterm>
    </LayerDesign>''')
    taskfactory.push_back(ld)
    packertask = taskfactory.create_task_and_apply_taskoperations(pose)

    fd.task_factory = taskfactory

    # Parse resfile & create movemap
    resfile_parser = input_files.Resfile(input_resfile=workspace.resfile_path)
    designable = []
    repackable = []
    for chain in resfile_parser.design:
        designable.extend([int(key) for key in resfile_parser.design[chain]])
    for chain in resfile_parser.repack:
        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()