本文整理汇总了Python中indra.preassembler.Preassembler.combine_related方法的典型用法代码示例。如果您正苦于以下问题:Python Preassembler.combine_related方法的具体用法?Python Preassembler.combine_related怎么用?Python Preassembler.combine_related使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indra.preassembler.Preassembler
的用法示例。
在下文中一共展示了Preassembler.combine_related方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_flatten_evidence_hierarchy
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_flatten_evidence_hierarchy():
braf = Agent('BRAF')
mek = Agent('MAP2K1')
st1 = Phosphorylation(braf, mek, evidence=[Evidence(text='foo')])
st2 = Phosphorylation(braf, mek, 'S', '218',
evidence=[Evidence(text='bar')])
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_related()
assert len(pa.related_stmts) == 1
flattened = flatten_evidence(pa.related_stmts)
assert len(flattened) == 1
top_stmt = flattened[0]
assert len(top_stmt.evidence) == 2
assert 'bar' in [e.text for e in top_stmt.evidence]
assert 'foo' in [e.text for e in top_stmt.evidence]
assert len(top_stmt.supported_by) == 1
supporting_stmt = top_stmt.supported_by[0]
assert len(supporting_stmt.evidence) == 1
assert supporting_stmt.evidence[0].text == 'foo'
supporting_stmt.evidence[0].text = 'changed_foo'
assert supporting_stmt.evidence[0].text == 'changed_foo'
assert 'changed_foo' not in [e.text for e in top_stmt.evidence]
assert 'foo' in [e.text for e in top_stmt.evidence]
assert {ev.annotations.get('support_type') for ev in top_stmt.evidence} \
== {'direct', 'supported_by'}
示例2: test_pathsfromto
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_pathsfromto():
bp = biopax.process_pc_pathsfromto(['MAP2K1'], ['MAPK1'])
bp.get_phosphorylation()
assert_pmids(bp.statements)
pre = Preassembler(hierarchies, bp.statements)
pre.combine_related()
assert unicode_strs(pre.unique_stmts)
示例3: test_render_stmt_graph
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_render_stmt_graph():
braf = Agent('BRAF', db_refs={'HGNC': '1097'})
mek1 = Agent('MAP2K1', db_refs={'HGNC': '6840'})
mek = Agent('MEK', db_refs={'FPLX':'MEK'})
# Statements
p0 = Phosphorylation(braf, mek)
p1 = Phosphorylation(braf, mek1)
p2 = Phosphorylation(braf, mek1, position='218')
p3 = Phosphorylation(braf, mek1, position='222')
p4 = Phosphorylation(braf, mek1, 'serine')
p5 = Phosphorylation(braf, mek1, 'serine', '218')
p6 = Phosphorylation(braf, mek1, 'serine', '222')
stmts = [p0, p1, p2, p3, p4, p5, p6]
pa = Preassembler(hierarchies, stmts=stmts)
pa.combine_related()
graph = render_stmt_graph(pa.related_stmts, reduce=False)
# One node for each statement
assert len(graph.nodes()) == 7
# Edges:
# p0 supports p1-p6 = 6 edges
# p1 supports p2-p6 = 5 edges
# p2 supports p5 = 1 edge
# p3 supports p6 = 1 edge
# p4 supports p5-p6 = 2 edges
# (p5 and p6 support none--they are top-level)
# 6 + 5 + 1 + 1 + 2 = 15 edges
assert len(graph.edges()) == 15
示例4: test_modification_refinement_residue_noenz
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_modification_refinement_residue_noenz():
erbb3 = Agent('Erbb3')
st1 = Phosphorylation(None, erbb3)
st2 = Phosphorylation(None, erbb3, 'Y')
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_related()
assert len(pa.related_stmts) == 1
示例5: test_translocation
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_translocation():
st1 = Translocation(Agent('AKT'), None, None)
st2 = Translocation(Agent('AKT'), None, 'plasma membrane')
st3 = Translocation(Agent('AKT'), None, 'nucleus')
pa = Preassembler(hierarchies, stmts=[st1, st2, st3])
pa.combine_related()
assert len(pa.related_stmts) == 2
示例6: test_complex_refinement_order
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_complex_refinement_order():
st1 = Complex([Agent('MED23'), Agent('ELK1')])
st2 = Complex([Agent('ELK1', mods=[ModCondition('phosphorylation')]),
Agent('MED23')])
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_duplicates()
pa.combine_related()
assert len(pa.related_stmts) == 1
示例7: test_complex_agent_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_complex_agent_refinement():
ras = Agent('RAS')
raf1 = Agent('RAF', mods=[ModCondition('ubiquitination', None, None, True)])
raf2 = Agent('RAF', mods=[ModCondition('ubiquitination', None, None, False)])
st1 = Complex([ras, raf1])
st2 = Complex([ras, raf2])
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_related()
assert len(pa.unique_stmts) == 2
assert len(pa.related_stmts) == 2
示例8: test_complex_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_complex_refinement():
ras = Agent('RAS')
raf = Agent('RAF')
mek = Agent('MEK')
st1 = Complex([ras, raf])
st2 = Complex([mek, ras, raf])
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_related()
assert len(pa.unique_stmts) == 2
assert len(pa.related_stmts) == 2
示例9: test_homodimer_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_homodimer_refinement():
egfr = Agent('EGFR')
erbb = Agent('ERBB2')
st1 = Complex([erbb, erbb])
st2 = Complex([erbb, egfr])
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_duplicates()
assert len(pa.unique_stmts) == 2
pa.combine_related()
assert len(pa.related_stmts) == 2
示例10: test_flatten_stmts
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_flatten_stmts():
st1 = Phosphorylation(Agent('MAP3K5'), Agent('RAF1'), 'S', '338')
st2 = Phosphorylation(None, Agent('RAF1'), 'S', '338')
st3 = Phosphorylation(None, Agent('RAF1'))
st4 = Phosphorylation(Agent('PAK1'), Agent('RAF1'), 'S', '338')
st5 = Phosphorylation(None, Agent('RAF1'), evidence=Evidence(text='foo'))
pa = Preassembler(hierarchies, stmts=[st1, st2, st3, st4, st5])
pa.combine_duplicates()
pa.combine_related()
assert len(pa.related_stmts) == 2
assert len(flatten_stmts(pa.unique_stmts)) == 4
assert len(flatten_stmts(pa.related_stmts)) == 4
示例11: test_activation_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_activation_refinement():
subj = Agent('alcohol', db_refs={'CHEBI': 'CHEBI:16236',
'HMDB': 'HMDB00108',
'PUBCHEM': '702',
'TEXT': 'alcohol'})
obj = Agent('endotoxin', db_refs={'TEXT': 'endotoxin'})
st1 = Inhibition(subj, obj)
st2 = Activation(subj, obj)
pa = Preassembler(hierarchies, stmts=[st1, st2])
pa.combine_duplicates()
assert len(pa.unique_stmts) == 2
pa.combine_related()
assert len(pa.related_stmts) == 2
示例12: test_association_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_association_refinement():
health = 'UN/entities/human/health'
food = 'UN/entities/human/food'
food_security = 'UN/entities/human/food/food_security'
eh = Event(Concept('health', db_refs={'UN': [(health, 1.0)]}))
ef = Event(Concept('food', db_refs={'UN': [(food, 1.0)]}))
efs = Event(Concept('food security', db_refs={'UN': [(food_security, 1.0)]}))
st1 = Association([eh, ef], evidence=[Evidence(source_api='eidos1')])
st2 = Association([ef, eh], evidence=[Evidence(source_api='eidos2')])
st3 = Association([eh, efs], evidence=[Evidence(source_api='eidos3')])
st4 = Association([ef, efs], evidence=[Evidence(source_api='eidos4')])
eidos_ont = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../sources/eidos/eidos_ontology.rdf')
hm = HierarchyManager(eidos_ont, True, True)
hierarchies = {'entity': hm}
pa = Preassembler(hierarchies, [st1, st2, st3, st4])
unique_stmts = pa.combine_duplicates() # debugging
assert len(unique_stmts) == 3
rel_stmts = pa.combine_related()
assert len(rel_stmts) == 2
eh_efs_stmt = [st for st in rel_stmts if (st.members[0].concept.name in
{'health', 'food security'} and st.members[1].concept.name
in {'health', 'food security'})][0]
assert len(eh_efs_stmt.supported_by) == 1
assert (eh_efs_stmt.supported_by[0].members[0].concept.name
in {'food', 'health'})
assert (eh_efs_stmt.supported_by[0].members[1].concept.name
in {'food', 'health'})
示例13: test_return_toplevel
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_return_toplevel():
src = Agent('SRC', db_refs = {'HGNC': '11283'})
nras = Agent('NRAS', db_refs = {'HGNC': '7989'})
st1 = Phosphorylation(src, nras, 'tyrosine', '32')
st2 = Phosphorylation(src, nras)
pa = Preassembler(hierarchies, stmts=[st1, st2])
stmts = pa.combine_related(return_toplevel=True)
assert len(stmts) == 1
assert len(stmts[0].supported_by) == 1
assert len(stmts[0].supported_by[0].supports) == 1
stmts = pa.combine_related(return_toplevel=False)
assert len(stmts) == 2
ix = 1 if stmts[0].residue else 0
assert len(stmts[1-ix].supported_by) == 1
assert len(stmts[1-ix].supported_by[0].supports) == 1
assert len(stmts[ix].supports) == 1
assert len(stmts[ix].supports[0].supported_by) == 1
示例14: test_flatten_evidence_multilevel
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_flatten_evidence_multilevel():
braf = Agent('BRAF')
mek = Agent('MAP2K1')
st1 = Phosphorylation(braf, mek, evidence=[Evidence(text='foo')])
st2 = Phosphorylation(braf, mek, 'S',
evidence=[Evidence(text='bar')])
st3 = Phosphorylation(braf, mek, 'S', '218',
evidence=[Evidence(text='baz')])
pa = Preassembler(hierarchies, stmts=[st1, st2, st3])
pa.combine_related()
assert len(pa.related_stmts) == 1
flattened = flatten_evidence(pa.related_stmts)
assert len(flattened) == 1
top_stmt = flattened[0]
assert len(top_stmt.evidence) == 3, len(top_stmt.evidence)
anns = [ev.annotations['support_type'] for ev in top_stmt.evidence]
assert anns.count('direct') == 1
assert anns.count('supported_by') == 2
示例15: test_conversion_refinement
# 需要导入模块: from indra.preassembler import Preassembler [as 别名]
# 或者: from indra.preassembler.Preassembler import combine_related [as 别名]
def test_conversion_refinement():
ras = Agent('RAS', db_refs={'FPLX': 'RAS'})
hras = Agent('HRAS', db_refs={'HGNC': '5173'})
gtp = Agent('GTP')
gdp = Agent('GDP')
st1 = Conversion(ras, gtp, gdp)
st2 = Conversion(hras, gtp, gdp)
st3 = Conversion(hras, [gtp, gdp], gdp)
st4 = Conversion(hras, [gdp, gtp], gdp)
pa = Preassembler(hierarchies, stmts=[st1, st2, st3, st4])
toplevel_stmts = pa.combine_related()
assert len(toplevel_stmts) == 2