本文整理匯總了Python中nose.plugins.attrib.attr方法的典型用法代碼示例。如果您正苦於以下問題:Python attrib.attr方法的具體用法?Python attrib.attr怎麽用?Python attrib.attr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nose.plugins.attrib
的用法示例。
在下文中一共展示了attrib.attr方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_tutorials
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_tutorials():
with TemporaryDirectory() as tmp:
tmp_path = Path(tmp)
# Copy tutorial file resources
for f_path in _TUTORIAL_FILES:
src = _TUTORIALS_ROOT / f_path
dest = tmp_path / f_path
dest.parent.mkdir(parents=True, exist_ok=True)
if src.is_dir():
shutil.copytree(src, dest)
else:
shutil.copy(src, dest)
# Emit a test for each notebook
for nb_path in notebooks_in_path(_TUTORIALS_ROOT):
rel_path = nb_path.relative_to(_TUTORIALS_ROOT)
workdir = tmp_path / rel_path.parent
workdir.mkdir(parents=True, exist_ok=True)
description = "Running notebook {}".format(rel_path)
yield attr(description=description)(run_notebook), nb_path, workdir
示例2: test_mutate_from_alanine
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_mutate_from_alanine():
"""
generate alanine dipeptide system (vacuum) and mutating to every other amino acid as a sanity check...
"""
#TODO: run the full pipeline for all of the aminos; at the moment, large perturbations (i.e. to ARG have the potential of
# generating VERY large nonbonded energies, to which numerical precision cannot achieve a proper threshold of 1e-6.
# in the future, we can look to use sterics or something fancy. At the moment, we recommend conservative transforms
# or transforms that have more unique _old_ atoms than new
aminos = ['ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE','LEU','LYS','MET','PHE','SER','THR','TRP','TYR','VAL']
attempt_full_pipeline_aminos = ['CYS', 'ILE', 'SER', 'THR', 'VAL'] #let's omit rings and large perturbations for now
ala, system_generator = generate_atp()
for amino in aminos:
if amino in attempt_full_pipeline_aminos:
_ = generate_dipeptide_top_pos_sys(ala.topology, amino, ala.system, ala.positions, system_generator, conduct_htf_prop = True)
else:
_ = generate_dipeptide_top_pos_sys(ala.topology, amino, ala.system, ala.positions, system_generator, conduct_geometry_prop = False)
#@attr('advanced')
示例3: test_run_point_mutation_propose
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_run_point_mutation_propose():
"""
Propose a random mutation in insulin
"""
import perses.rjmc.topology_proposal as topology_proposal
pdbid = "2HIU"
topology, positions = load_pdbid_to_openmm(pdbid)
modeller = app.Modeller(topology, positions)
for chain in modeller.topology.chains():
pass
modeller.delete([chain])
max_point_mutants = 1
chain_id = 'A'
system_generator = create_simple_protein_system_generator()
system = system_generator.create_system(modeller.topology)
pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, max_point_mutants=max_point_mutants)
pm_top_proposal = pm_top_engine.propose(system, modeller.topology)
#@attr('advanced')
示例4: exampletest_single
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def exampletest_single(example_dir):
init_pwd = os.getcwd()
os.chdir(_path('examples/') + example_dir)
print(os.getcwd())
sys.path.append(os.getcwd())
try:
s = __import__('solve')
s = reload(s)
s.test()
finally:
sys.path.pop()
os.chdir(init_pwd)
## BEGIN EXAMPLE TESTS
#@attr(speed='slow')
#def test_9447_nobranch(): exampletest_single('9447_nobranch') # hours? also broken right now
示例5: _test_notebooks_in_path
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def _test_notebooks_in_path(root_path):
with TemporaryDirectory() as tmp:
tmp_path = Path(tmp)
for nb_path in notebooks_in_path(root_path):
rel_path = nb_path.relative_to(root_path)
workdir = tmp_path / rel_path.parent
workdir.mkdir(parents=True, exist_ok=True)
description = "Running notebook {}".format(rel_path)
yield attr(description=description)(run_notebook), nb_path, workdir
示例6: attr
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def attr(tag):
def func(f):
return f
return func
示例7: test_corrcoef
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_corrcoef():
prng = RandomState(42)
x = prng.rand(10)
y = x
group = prng.randint(3, size=10)
res1 = corrcoef(x, y, group)
res2 = corrcoef(x, y, group)
assert_equal(res1, res2)
#@attr('slow')
示例8: test_propose_self
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_propose_self():
"""
Propose a mutation to remain at WT in insulin
"""
import perses.rjmc.topology_proposal as topology_proposal
pdbid = "2HIU"
topology, positions = load_pdbid_to_openmm(pdbid)
modeller = app.Modeller(topology, positions)
for chain in modeller.topology.chains():
pass
modeller.delete([chain])
system_generator = create_simple_protein_system_generator()
system = system_generator.create_system(modeller.topology)
chain_id = 'A'
for chain in modeller.topology.chains():
if chain.id == chain_id:
residues = chain._residues
mutant_res = np.random.choice(residues[1:-1])
allowed_mutations = [(mutant_res.id,mutant_res.name)]
pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, allowed_mutations=allowed_mutations)
pm_top_proposal = pm_top_engine.propose(system, modeller.topology)
assert pm_top_proposal.old_topology == pm_top_proposal.new_topology
assert pm_top_proposal.old_system == pm_top_proposal.new_system
assert pm_top_proposal.old_chemical_state_key == pm_top_proposal.new_chemical_state_key
#@attr('advanced')
示例9: test_specify_allowed_mutants
# 需要導入模塊: from nose.plugins import attrib [as 別名]
# 或者: from nose.plugins.attrib import attr [as 別名]
def test_specify_allowed_mutants():
"""
Make sure proposals can be made using optional argument allowed_mutations
This test has three possible insulin systems: wild type, Q5E, and Q5N/Y14F
"""
chain_id = 'A'
allowed_mutations = [('5','GLU'),('5','ASN'),('14','PHE')]
import perses.rjmc.topology_proposal as topology_proposal
pdbid = "2HIU"
topology, positions = load_pdbid_to_openmm(pdbid)
modeller = app.Modeller(topology, positions)
for chain in modeller.topology.chains():
pass
modeller.delete([chain])
system_generator = create_simple_protein_system_generator()
system = system_generator.create_system(modeller.topology)
chain_id = 'A'
for chain in modeller.topology.chains():
if chain.id == chain_id:
residues = chain._residues
mutant_res = np.random.choice(residues[1:-1])
pm_top_engine = topology_proposal.PointMutationEngine(modeller.topology, system_generator, chain_id, allowed_mutations=allowed_mutations)
ntrials = 10
for trian in range(ntrials):
pm_top_proposal = pm_top_engine.propose(system, modeller.topology)
# Check to make sure no out-of-bounds atoms are present in new_to_old_atom_map
natoms_old = pm_top_proposal.n_atoms_old
natoms_new = pm_top_proposal.n_atoms_new
if not set(pm_top_proposal.new_to_old_atom_map.values()).issubset(range(natoms_old)):
msg = "Some old atoms in TopologyProposal.new_to_old_atom_map are not in span of old atoms (1..%d):\n" % natoms_old
msg += str(pm_top_proposal.new_to_old_atom_map)
raise Exception(msg)
if not set(pm_top_proposal.new_to_old_atom_map.keys()).issubset(range(natoms_new)):
msg = "Some new atoms in TopologyProposal.new_to_old_atom_map are not in span of old atoms (1..%d):\n" % natoms_new
msg += str(pm_top_proposal.new_to_old_atom_map)
raise Exception(msg)
#@attr('advanced')