Beispiel #1
0
def merge_indivdual_chain_pdbs(file, end, res_type):
    #### reads in each chain into merge list
    merge, merged_coords = [], []
    count = 0
    restraint_count = -1
    for chain in range(0, g_var.system[res_type]):
        merge_temp = []
        if os.path.exists(file + '_' + str(chain) + end):
            with open(file + '_' + str(chain) + end, 'r') as pdb_input:
                merge_temp += read_in.filter_input(pdb_input.readlines(),
                                                   False)
        else:
            sys.exit('cannot find chain: ' + file + '_' + str(chain) + end)
        if res_type + '_aligned' in file:
            count, restraint_count = at_mod_p.write_disres(
                merge_temp, chain, file, count, restraint_count)
        merge, merge_coords = fix_chirality(merge, merge_temp, merged_coords,
                                            res_type)
    if res_type + '_aligned' not in file:
        coords, index_conversion = index_conversion_generate(
            merge, merge_coords)
    if 'aligned' in file.split('/')[-1]:
        write_pdb(merge, merge_coords, {},
                  g_var.working_dir + 'PROTEIN/PROTEIN_aligned_merged.pdb')
    else:
        write_pdb(
            merge, coords, index_conversion, g_var.working_dir + res_type +
            '/' + res_type + '_de_novo_merged.pdb')
Beispiel #2
0
def read_in_merged_pdbs(merge, merge_coords, location):
    if os.path.exists(location):
    #### opens pdb files and writes straight to merged_cg2at pdb
        with open(location, 'r') as pdb_input:
            read_in_atoms = read_in.filter_input(pdb_input.readlines(), False)
            merge_coords += [[line_sep['x'],line_sep['y'],line_sep['z']] for line_sep in read_in_atoms ]
            return merge+read_in_atoms, merge_coords
    else:
        sys.exit('cannot find minimised residue: \n'+ location)