def get_restraint_values(threes): res_type_group = get_res_type_group(threes[-2].resname, threes[-1].resname) if res_type_group is None: return None restraint_values = [] key = threes.get_cdl_key(force_plus_one=True, omega_cdl=True) previous_key = None if len(key) == 4: previous_key = key[:2] key = key[-2:] if previous_key: rv = omega_database[res_type_group][previous_key] restraint_values.append(rv) else: restraint_values.append(None) rv = omega_database[res_type_group][key] restraint_values.append(rv) return restraint_values
def get_restraint_values(threes, interpolate=False): from mmtbx.conformation_dependent_library import utils res_type_group = cdl_utils.get_res_type_group( threes[1].resname, threes[2].resname, ) if res_type_group is None: return None if interpolate: restraint_values = ["2", -1] key = threes.get_cdl_key(exact=interpolate) for i in range(2,26): grid = utils.get_grid_values(res_type_group, key[0], key[1], column=i) index = utils.get_index(*key) r = utils.interpolate_2d(grid, index) restraint_values.append(r) else: key = threes.get_cdl_key() restraint_values = cdl_database[res_type_group][key] return restraint_values
def test_cdl_lookup(hierarchy, filename, restraints_manager, ): for i, threes in enumerate(cdl.generate_protein_threes( hierarchy, #restraints_manager=restraints_manager geometry=restraints_manager.geometry, ) ): res_type_group = cdl_utils.get_res_type_group( threes[1].resname, threes[2].resname, ) key = threes.get_cdl_key(force_plus_one=True) key = key[-2:] restraint_values = omega_database[res_type_group][key] print i, key, restraint_values[:4], filenames[filename][2] del threes.registry.n threes.registry.n = {} assert restraint_values[:4] == filenames[filename][2][i]
def run2(args=(), out=sys.stdout): argument_interpreter = libtbx.phil.command_line.argument_interpreter( master_phil=master_phil, home_scope="cdl_lookup") phils = [] phil_args = [] pdbs = [] for arg in args: if os.path.isfile(arg): if iotbx.pdb.is_pdb_file(arg): pdbs.append(arg) continue try : file_phil = phil.parse(file_name=arg) except RuntimeError : pass else : phils.append(file_phil) else : phil_args.append(arg) phils.append(argument_interpreter.process(arg)) working_phil = master_phil.fetch(sources=phils) working_phil.show() working_params = working_phil.extract() if working_params.cdl_lookup.residue_group_class is None: working_params.cdl_lookup.residue_group_class = cdl_utils.get_res_type_group( *tuple(working_params.cdl_lookup.residue_names.split(",")[1:]) ) print "\nPeptide triplet class : %s" % working_params.cdl_lookup.residue_group_class key = working_params.cdl_lookup.phi_psi_angles.split(",") key[0] = int(key[0]) key[1] = int(key[1]) key = tuple(key) restraints_values = cdl_database[working_params.cdl_lookup.residue_group_class][key] outl = conformation_dependent_library.restraints_show(restraints_values) print "\nCDL values\n%s" % outl return restraints_values
def get_restraint_values(threes, interpolate=False): from mmtbx.conformation_dependent_library import utils res_type_group = cdl_utils.get_res_type_group( threes[1].resname, threes[2].resname, ) if res_type_group is None: return None if interpolate: restraint_values = ["2", -1] key = threes.get_cdl_key(exact=interpolate) for i in range(2, 26): grid = utils.get_grid_values(res_type_group, key[0], key[1], column=i) index = utils.get_index(*key) r = utils.interpolate_2d(grid, index) restraint_values.append(r) else: key = threes.get_cdl_key() if key is None: return None restraint_values = cdl_database[res_type_group][key] return restraint_values
def run2(args=(), out=sys.stdout): argument_interpreter = libtbx.phil.command_line.argument_interpreter( master_phil=master_phil, home_scope="cdl_lookup") phils = [] phil_args = [] pdbs = [] for arg in args: if os.path.isfile(arg): if iotbx.pdb.is_pdb_file(arg): pdbs.append(arg) continue try: file_phil = phil.parse(file_name=arg) except RuntimeError: pass else: phils.append(file_phil) else: phil_args.append(arg) phils.append(argument_interpreter.process(arg)) working_phil = master_phil.fetch(sources=phils) working_phil.show() working_params = working_phil.extract() if working_params.cdl_lookup.residue_group_class is None: working_params.cdl_lookup.residue_group_class = cdl_utils.get_res_type_group( *tuple(working_params.cdl_lookup.residue_names.split(",")[1:])) print "\nPeptide triplet class : %s" % working_params.cdl_lookup.residue_group_class key = working_params.cdl_lookup.phi_psi_angles.split(",") key[0] = int(key[0]) key[1] = int(key[1]) key = tuple(key) restraints_values = cdl_database[ working_params.cdl_lookup.residue_group_class][key] outl = conformation_dependent_library.restraints_show(restraints_values) print "\nCDL values\n%s" % outl return restraints_values
def test_cdl_lookup( hierarchy, filename, restraints_manager, ): for i, threes in enumerate( cdl.generate_protein_threes( hierarchy, #restraints_manager=restraints_manager geometry=restraints_manager.geometry, cdl_class=True, )): res_type_group = cdl_utils.get_res_type_group( threes[1].resname, threes[2].resname, ) key = threes.get_cdl_key(force_plus_one=True) key = key[-2:] print('res_type_group', res_type_group, key) restraint_values = omega_database[res_type_group][key] print(i, key, restraint_values[:4], filenames[filename][2]) del threes.registry.n threes.registry.n = {} assert restraint_values[:4] == filenames[filename][2][i]
def get_restraint_values(threes): res_type_group = get_res_type_group( threes[-2].resname, threes[-1].resname, ) if res_type_group is None: return None restraint_values = [] key = threes.get_cdl_key(force_plus_one=True, omega_cdl=True, ) if key is None: return None previous_key = None if len(key)==4: previous_key = key[:2] key = key[-2:] if previous_key: rv = omega_database[res_type_group][previous_key] restraint_values.append(rv) else: restraint_values.append(None) rv= omega_database[res_type_group][key] restraint_values.append(rv) return restraint_values
def get_restraint_values(threes, cdl_svl=False, interpolate=False): from mmtbx.conformation_dependent_library import utils res_type_group = cdl_utils.get_res_type_group( threes[1].resname, threes[2].resname, ) if res_type_group is None: return None # if cdl_svl: assert not interpolate key = '%s/%s' % (['trans', 'cis'][threes.cis_group()], ['trans', 'cis'][threes.cis_group(omega_cdl=True)]) assert cdl_svl_database.get(key, None) current = cdl_svl_database[key] restraint_values = current[res_type_group] return restraint_values # if threes.cis_group(): resnames = threes.get_resnames() if resnames[1]=='PRO': # cis-PRO restraint_values = ['?', 0, 127.0, 2.4] # CNA restraint_values += [102.6, 1.1, # NAB 112.1, 2.6, # NAC 112.0, 2.5, # BAC 120.2, 2.4, # ACO 117.1, 2.8, # ACN 121.1, 1.9, # OCN 1.338, 0.019, # CN 1.468, 0.017, # NA 1.533, 0.018, # AB 1.524, 0.020, # AC 1.228, 0.020, # CO ] restraint_values += [120.6, 2.2, # CND 111.5, 1.4, # AND 103.8, 1.2, # NDG 104.0, 1.9, # ABG 105.4, 2.3, # BGD 1.506, 0.039, # BG 1.512, 0.027, # GD 1.474, 0.014, # ND ] else: # cis-NonPRO restraint_values = ['?', 0, 123.0, 3.0] return restraint_values # if interpolate: restraint_values = ["2", -1] key = threes.get_cdl_key(exact=interpolate) for i in range(2,26): grid = utils.get_grid_values(res_type_group, key[0], key[1], column=i) index = utils.get_index(*key) r = utils.interpolate_2d(grid, index) restraint_values.append(r) else: key = threes.get_cdl_key() if key is None: return None restraint_values = cdl_database[res_type_group][key] return restraint_values