Ejemplo n.º 1
0
import construct_brujin_graph

def construct_euler_path(brujin_graph):

    # try to find the begining of the graph
    node_could_start = []
    for one_node in brujin_graph.values():
        if len(one_node.out_path) - len(one_node.in_path) == 1:
            node_could_start.append(one_node)

    if len(node_could_start) > 1:
        raise Exception("more than one node with len(out) - len(in) == 1")

    # try to find the end of the graph
    node_could_end = []
    for one_node in brujin_graph.values():
        if len(one_node.in_path) - len(one_node.out_path) == 1:
            node_could_end.append(one_node)

    if len(node_could_end) > 1:
        raise Exception("more than one node with len(in) - len(out) == 1")

if __name__ == "__main__":
    sample_brujin_graph = construct_brujin_graph.construct_brujin_graph(construct_brujin_graph.generate_sample_reads(), read_length=3)
    construct_euler_path(sample_brujin_graph)
Ejemplo n.º 2
0
import get_reads
import construct_brujin_graph

if __name__ == "__main__":

    read_length = 50
    
    all_reads = get_reads.get_reads('practice1', read_length)
    brujin_graph = construct_brujin_graph.construct_brujin_graph(all_reads)