def testGreedyMotifSearch(self):
     k = 3
     dna = [
         'GGCGTTCAGGCA', 'AAGAATCAGTCA', 'CAAGGAGTTCGC', 'CACGTCAATCAC',
         'CAATAATATTCG'
     ]
     bestMotifs, _ = greedyMotifSearch(dna, k)
     self.assertEquals(bestMotifs, ['CAG', 'CAG', 'CAA', 'CAA', 'CAA'])
 def testGreedyMotifSearchWithPseudocount(self):
     k = 3
     dna = [
         'GGCGTTCAGGCA', 'AAGAATCAGTCA', 'CAAGGAGTTCGC', 'CACGTCAATCAC',
         'CAATAATATTCG'
     ]
     bestMotifs, _ = greedyMotifSearch(dna, k, True)
     self.assertEquals(bestMotifs, ['TTC', 'ATC', 'TTC', 'ATC', 'TTC'])
 def testGreedyMotifSearchWithPseudocountFromFile(self):
     """
     Greedy Motif Search from file
     """
     with open('data/greedyMotifPseudocount.txt') as fp:
         vals = [int(x) for x in fp.readline().split()]
         k = vals[0]
         dna = [seq for seq in fp.readlines()]
         bestMotifs, _ = greedyMotifSearch(dna, k, True)
         print 'Best Motifs'
         for motif in bestMotifs:
             print motif
 def testGreedyMotifSearchFromFile(self):
     """
     Greedy Motif Search from file
     """
     with open('data/greedyMotif2.txt') as fp:
         vals = [int(x) for x in fp.readline().strip().split(' ')]
         k = vals[0]
         dna = [seq.strip() for seq in fp.readlines()]
         bestMotifs, _ = greedyMotifSearch(dna, k)
         print 'Best Motifs'
         for motif in bestMotifs:
             print motif
 def testGreedyMotifSearchWithPseudocountFromFile(self):
     """
     Greedy Motif Search from file
     """
     with open("data/greedyMotifPseudocount.txt") as fp:
         vals = [int(x) for x in fp.readline().split()]
         k = vals[0]
         dna = [seq for seq in fp.readlines()]
         bestMotifs, _ = greedyMotifSearch(dna, k, True)
         print "Best Motifs"
         for motif in bestMotifs:
             print motif
 def testGreedyMotifSearchFromFile(self):
     """
     Greedy Motif Search from file
     """
     with open("data/greedyMotif2.txt") as fp:
         vals = [int(x) for x in fp.readline().strip().split(" ")]
         k = vals[0]
         dna = [seq.strip() for seq in fp.readlines()]
         bestMotifs, _ = greedyMotifSearch(dna, k)
         print "Best Motifs"
         for motif in bestMotifs:
             print motif
 def testGreedyMotifSearchWithPseudocount(self):
     k = 3
     dna = ["GGCGTTCAGGCA", "AAGAATCAGTCA", "CAAGGAGTTCGC", "CACGTCAATCAC", "CAATAATATTCG"]
     bestMotifs, _ = greedyMotifSearch(dna, k, True)
     self.assertEquals(bestMotifs, ["TTC", "ATC", "TTC", "ATC", "TTC"])
 def testGreedyMotifSearch(self):
     k = 3
     dna = ["GGCGTTCAGGCA", "AAGAATCAGTCA", "CAAGGAGTTCGC", "CACGTCAATCAC", "CAATAATATTCG"]
     bestMotifs, _ = greedyMotifSearch(dna, k)
     self.assertEquals(bestMotifs, ["CAG", "CAG", "CAA", "CAA", "CAA"])