Exemplo n.º 1
0
def test_path_graph_factory():
    t_dict, locus = read_single_locus('path1.gtf')
    sgraph = SpliceGraph.create(t_dict.values())
    pgraphfactory = PathGraphFactory(sgraph)
    g1 = pgraphfactory.create(k=1)
    assert len(g1) == 5
    g2 = pgraphfactory.create(k=2)
    assert len(g2) == 6
    gopt, k = pgraphfactory.create_optimal()
    assert k == 2
    return
Exemplo n.º 2
0
def test_path1():
    t_dict, locus = read_single_locus('path1.gtf')
    transfrags = locus.get_transfrags(Strand.POS)
    sgraph = SpliceGraph.create(transfrags)
    k = 2
    pgf = PathGraphFactory(sgraph)
    pgraph = pgf.create(k)
    paths = find_paths(pgraph)
    return
Exemplo n.º 3
0
def test_topological_sort():
    G = Graph()
    G.add_path((G.SOURCE, 10, 20, 30, 40, G.SINK))
    G.add_path((G.SOURCE, 10, 30, 40, G.SINK))
    G.add_path((G.SOURCE, 10, G.SINK))
    G.add_path((G.SOURCE, 20, G.SINK))
    assert G.is_topological_sort(G.topological_sort())
    t_dict, locus = read_single_locus('noc2l_locus.gtf')
    for sgraph in locus.create_splice_graphs():
        pgf = PathGraphFactory(sgraph)
        G = pgf.create(k=1)
        assert G.is_topological_sort(G.topological_sort())
        assert G.is_topological_sort(G.topological_sort_dfs())