本文整理汇总了Python中utils.Atom_utils.find_atom_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Atom_utils.find_atom_ids方法的具体用法?Python Atom_utils.find_atom_ids怎么用?Python Atom_utils.find_atom_ids使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Atom_utils
的用法示例。
在下文中一共展示了Atom_utils.find_atom_ids方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDisulphidePotential
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def testDisulphidePotential(self):
initStruct("test_data/acaggaca/acaggaca.psf")
disulphide_calculator = Disulphide_shift_calculator(self.get_single_member_ensemble_simulation())
result = self.make_result_array()
expected = self.make_result_array()
for elem in acaggaca_ss_shifts:
index = Atom_utils.find_atom_ids(*elem)[0]
expected[index] += acaggaca_ss_shifts[elem]
for elem in acaggaca_ss_sidechain_corrections:
index = Atom_utils.find_atom_ids(*elem)[0]
expected[index] -= acaggaca_ss_shifts[elem]
disulphide_calculator.set_shifts(result)
self.assertSequenceAlmostEqual(expected, result, self.DEFAULT_DECIMAL_PLACES)
示例2: testDisulphideComponents
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def testDisulphideComponents(self):
disulphide_calculator = Disulphide_shift_calculator(self.get_single_member_ensemble_simulation())
components = disulphide_calculator._get_component_list('ATOM')
expected = [(Atom_utils.find_atom_ids(*elem)[0],acaggaca_ss_shifts[elem]) for elem in acaggaca_ss_shifts]
expected.sort()
self.assertSequenceEqual([elem[0] for elem in components], [elem[0] for elem in expected])
示例3: testIndexToAtomId
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def testIndexToAtomId(self):
shift_table = self.create_ala_3_shift_table()
atom_id_indices = dict(shift_table.get_indices_for_atom_id())
for i,elem in enumerate(shift_table.dump_observed_shifts()):
atom_ids = Atom_utils.find_atom_ids(*elem[0])
self.assertEqual(len(atom_ids), 1)
atom_id = atom_ids[0]
self.assertEqual(atom_id_indices[atom_id],i)
del atom_id_indices[atom_id]
self.assertEmpty(atom_id_indices)
示例4: test_energy_penalty_error
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_energy_penalty_error(self):
atom_id= Atom_utils.find_atom_ids(*self.KEY_2_CA)[0]
shift_table, calculator, xcamshift = self._setup_test_energy_penalties(self.KEY_2_CA)
target_atom_ids = Atom_utils.find_atom_ids(*self.KEY_2_CA)
for error in ala_4.ala_4_CA_2_energies_for_error:
xcamshift._set_restraint_error(atom_id, error)
expected_energies = ala_4.ala_4_CA_2_energies_for_error[error]
max_offset = max(expected_energies.keys())
for offset in range(-max_offset,max_offset):
offset_shift_table = copy.copy(shift_table)
offset_shift_table[self.KEY_2_CA] += offset
observed_shifts = Observed_shift_table(offset_shift_table)
xcamshift._set_restraint_error(atom_id,error)
calculator.set_observed_shifts(observed_shifts.get_native_shifts(target_atom_ids))
calculator.set_energy_term_cache(xcamshift._get_energy_term_cache().get_native_components())
expected_energy = expected_energies[abs(offset)]
self.assertAlmostEqual(calculator(array.array('i',[0]),None),expected_energy,places=4)
示例5: test_overall_shifts_a4
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_overall_shifts_a4(self):
xcamshift_potential = self._get_xcamshift()
shifts = self.make_result_array()
shifts = xcamshift_potential.set_shifts(shifts)
expected = [0.0] * len(shifts)
for target_atom_key in ala_4.ala_4_expected_shifts:
target_atom_id = Atom_utils.find_atom_ids(*target_atom_key)[0]
expected[target_atom_id] = ala_4.ala_4_expected_shifts[target_atom_key]
self.assertSequenceAlmostEqual(expected, shifts,self.DEFAULT_DECIMAL_PLACES)
示例6: test_vin_shifts
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_vin_shifts(self):
xcamshift = self._get_xcamshift()
vin_shifts_copy = dict(vin_shifts)
for key in vin_shifts:
segment, residue_number, atom = key
atom_ids = Atom_utils.find_atom_ids(segment, residue_number, atom)
shift = xcamshift._calc_single_atom_shift(atom_ids[0])
expected_shift = vin_shifts_copy[key]
self.assertAlmostEqual(expected_shift, shift, places=self.DEFAULT_DECIMAL_PLACES - 2, msg=`key`)
del vin_shifts_copy[key]
self.assertEmpty(vin_shifts_copy)
示例7: _do_test_component_shifts
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def _do_test_component_shifts(self, xcamshift, component_shifts):
xcamshift._prepare(TARGET_ATOM_IDS_CHANGED, None)
xcamshift._prepare(ROUND_CHANGED, None)
component_shifts_keys = component_shifts.keys()
component_shifts_keys.sort()
for i, key in enumerate(component_shifts_keys):
segment, residue_number, atom, sub_potential = key
sub_potential = xcamshift.get_named_sub_potential(sub_potential)
atom_ids = Atom_utils.find_atom_ids(segment, residue_number, atom)
if len(atom_ids) > 0:
xcamshift._prepare(TARGET_ATOM_IDS_CHANGED, atom_ids)
shift = sub_potential._calc_single_atom_shift(atom_ids[0])
expected_shift = component_shifts[key]
residue_type = Atom_utils._get_residue_type_from_atom_id(atom_ids[0])
self.assertAlmostEqual(shift, expected_shift, self.DEFAULT_DECIMAL_PLACES - 2, msg=`key` + " " + residue_type)
示例8: test_agaga_shifts
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_agaga_shifts(self):
xcamshift = self._get_xcamshift()
xcamshift._prepare(ROUND_CHANGED, None)
agaga_shifts_copy = dict( agaga_shifts)
for key in agaga_shifts:
segment, residue_number, atom = key
if residue_number in (2,4) and atom == 'HA':
atom = 'HA1'
atom_ids = Atom_utils.find_atom_ids(segment, residue_number, atom)
shift = xcamshift._calc_single_atom_shift(atom_ids[0])
expected_shift = agaga_shifts_copy[key]
self.assertAlmostEqual(expected_shift, shift, places=self.DEFAULT_DECIMAL_PLACES - 2, msg=`key`)
del agaga_shifts_copy[key]
self.assertEmpty(agaga_shifts_copy)
示例9: test_energy_penalty
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_energy_penalty(self):
expected_energies = ala_4.ala_4_CA_2_energies_for_shift_offsets
shift_table, calculator, xcamshift = self._setup_test_energy_penalties(self.KEY_2_CA)
max_offset = max(expected_energies.keys())
target_atom_ids = Atom_utils.find_atom_ids(*self.KEY_2_CA)
for offset in range(-max_offset,max_offset):
offset_shift_table = copy.copy(shift_table)
offset_shift_table[self.KEY_2_CA] += offset
observed_shifts = Observed_shift_table(offset_shift_table)
calculator.set_observed_shifts(observed_shifts.get_native_shifts(target_atom_ids))
expected_energy = expected_energies[abs(offset)]
self.assertAlmostEqual(calculator(array.array('i',[0]),None),expected_energy,places=4)
示例10: test_vin_component_shifts
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_vin_component_shifts(self):
xcamshift = self._get_xcamshift()
sub_potential_shifts = dict(vin_subpotential_shifts)
for key in vin_subpotential_shifts:
segment, residue_number, atom, sub_potential_name = key
atom_ids = Atom_utils.find_atom_ids(segment, residue_number, atom)
sub_potential = xcamshift.get_named_sub_potential(sub_potential_name)
shift = sub_potential._calc_single_atom_shift(atom_ids[0])
expected_shift = vin_subpotential_shifts[key]
self.assertAlmostEqual(expected_shift, shift, places=self.DEFAULT_DECIMAL_PLACES - 1, msg=`key`)
del sub_potential_shifts[key]
self.assertEmpty(sub_potential_shifts)
示例11: test_agaga_component_shifts
# 需要导入模块: from utils import Atom_utils [as 别名]
# 或者: from utils.Atom_utils import find_atom_ids [as 别名]
def test_agaga_component_shifts(self):
xcamshift = Xcamshift()
xcamshift._prepare(ROUND_CHANGED, None)
sub_potential_shifts = dict(agaga_subpotential_shifts)
for key in agaga_subpotential_shifts:
segment, residue_number, atom, sub_potential_name = key
if residue_number in (2,4) and atom == 'HA':
atom = 'HA1'
atom_ids = Atom_utils.find_atom_ids(segment, residue_number, atom)
sub_potential = xcamshift.get_named_sub_potential(sub_potential_name)
shift = sub_potential._calc_single_atom_shift(atom_ids[0])
expected_shift = agaga_subpotential_shifts[key]
self.assertAlmostEqual(expected_shift, shift, places=self.DEFAULT_DECIMAL_PLACES - 1, msg=`key`)
del sub_potential_shifts[key]
self.assertEmpty(sub_potential_shifts)