示例#1
0
def test_maximal_non_branching_paths():
    input = {1: [2],
             2: [3],
             3: [4, 5],
             6: [7],
             7: [6]}

    expected = [[1, 2, 3],
                [3, 4],
                [3, 5],
                [6, 7, 6]]

    actual = contigs.maximal_non_branching_paths(input)

    assert (expected == actual)
示例#2
0
import contigs
import kmer_reconstruction
import sys
import debruijn


filename = sys.argv[1]

with open(filename, 'r') as f:
    lines = [l.strip() for l in f.readlines() if l.strip() != '']
    graph = debruijn.create_from_patterns(lines)
    res = contigs.maximal_non_branching_paths(graph)
    cgs = [kmer_reconstruction.reconstruct(ks) for ks in res]
    output = '\n'.join(cgs)
    print(output)