Esempio n. 1
0
 def run_test(self, k, seq_name, expected_name):
     with open(util.find_file(seq_name, __file__), "r") as fp:
         fp.readline()  # skip count
         seq = fp.readline().strip()
     expected = seqio.read_list(expected_name, __file__)
     actual = main.generate_kmers(seq, k)
     self.assertItemsEqual(actual, expected)
Esempio n. 2
0
 def test_sample2(self):
     with open(util.find_file("sample2.txt", __file__), "r") as fp:
         dna = fp.readline().strip()
         protein = fp.readline().strip()
     expected = seqio.read_list("expected2.txt", __file__)
     actual = main.find_encodings(dna, protein)
     self.assertItemsEqual(actual, expected)
Esempio n. 3
0
def main(fname):
    start = time.time()
    seqs = seqio.read_list(sys.argv[1])
    result = build_overlap_graph(seqs)
    for p in result:
        print (p[0], "->", p[1])
    end = time.time()
    eprint(round((end - start), 5))
Esempio n. 4
0
    def run_test(self, sample_name, expected_name):
        seqs = seqio.read_list(sample_name, __file__)

        expected = []
        with open(util.find_file(expected_name, __file__), "r") as fp:
            for line in fp:
                bits = line.strip().split()
                expected.append((bits[0], bits[2]))

        actual = main.build_overlap_graph(seqs)
        self.assertItemsEqual(actual, expected)
Esempio n. 5
0
    def run_test(self, sample_name, expected_name):
        seqs, _ = fasta.read(util.find_file(sample_name, __file__))
        expected = seqio.read_list(util.find_file(expected_name, __file__))
        actual = main.find_corrections(seqs)

        self.assertItemsEqual(actual, expected)
Esempio n. 6
0
def main(fname):
    seqs = seqio.read_list(fname, __file__)
    chromosome = assemble_circular_chromosome(seqs)
    print chromosome
Esempio n. 7
0
 def test_sample1(self):
     seqs = seqio.read_list("sample1.txt", __file__)
     expected = "GATTACA"
     self.run_test(seqs, expected)
Esempio n. 8
0
 def test_sample2(self):
     seqs = seqio.read_list("sample2.txt", __file__)
     expected = seqio.read_one("expected2.txt", __file__)
     self.run_test(seqs, expected)
Esempio n. 9
0
 def run_test(self, sample_name, expected_name):
     seqs = seqio.read_list(sample_name, __file__)
     expected = seqio.read_one(expected_name, __file__)
     actual = main.reconstruct_string(seqs)
     self.assertEquals(actual, expected)
Esempio n. 10
0
def main(fname):
    seqs = seqio.read_list(fname)
    graph = make_graph(seqs)
    for line in debruijn.format_adjacency(graph):
        print line