Beispiel #1
0
def make_cyjs_network(results, model, stmts):
    path_stmts = get_path_stmts(results, model, stmts)
    path_genes = get_path_genes(path_stmts)
    path_uuids = [list(path.keys()) for path in path_stmts]
    all_path_uuids = []
    for p in path_uuids:
        all_path_uuids += p
    print(json.dumps(path_uuids, indent=1))
    #filtered_stmts = ac.filter_gene_list(stmts, path_genes, 'one')
    filtered_stmts = ac.filter_uuid_list(stmts, all_path_uuids)
    ca = CyJSAssembler(filtered_stmts)
    cm = ca.make_model()
    ca.set_CCLE_context(['SKMEL28_SKIN'])
    ca.save_json('output/korkut_model')
Beispiel #2
0
def make_cyjs_network(results, model, stmts):
    path_stmts = get_path_stmts(results, model, stmts)
    path_genes = get_path_genes(path_stmts)
    # Get UUIDs to use as filter
    path_uuids = [list(path.keys()) for path in path_stmts]
    all_path_uuids = []
    for p in path_uuids:
        all_path_uuids += p
    #filtered_stmts = ac.filter_gene_list(stmts, path_genes, 'one')
    filtered_stmts = ac.filter_uuid_list(stmts, all_path_uuids)
    ac.dump_statements(filtered_stmts, 'output/korkut_cyjs_model.pkl')
    ca = CyJSAssembler(filtered_stmts)
    cm = ca.make_model()
    ca.set_CCLE_context(['SKMEL28_SKIN'])
    ca.save_json('output/korkut_model')
Beispiel #3
0
def remove_kappa_dead_rules(stmts, model, dead_rules):
    # FIXME: we should probably check that a statement we remove has all its
    # generated rules recognized as dead. If it has at least one live rule
    # coming from it, we shouldn't remove it. But the dead rules should still
    # be removed somehow from the final model.
    dead_uuids  = set()
    for rule in dead_rules:
        for ann in model.annotations:
            if ann.subject == rule and ann.predicate == 'from_indra_statement':
                dead_uuids.add(ann.object)
    all_uuids = {stmt.uuid for stmt in stmts}
    live_uuids = all_uuids - dead_uuids
    stmts = ac.filter_uuid_list(stmts, live_uuids)
    pa = PysbAssembler()
    pa.add_statements(stmts)
    model = pa.make_model()
    return stmts, model
Beispiel #4
0
def test_filter_uuid_list():
    st_out = ac.filter_uuid_list([st1, st4], [st1.uuid])
    assert len(st_out) == 1
Beispiel #5
0
def remove_contradicts(stmts, conflicts):
    remove_stmts = []
    for s1, s2 in conflicts:
        remove_stmts.append(s1.uuid if s1.belief < s2.belief else s2.uuid)
    stmts = ac.filter_uuid_list(stmts, remove_stmts, invert=True)
    return stmts