def testTestCase(self): hmm = HMM() hmm.train(self.small_train) log.info(hmm) hmm.log_transform() # test test_output = [] for seq in self.small_test: test_output.append(hmm.viterbi(seq)) self.assertEqual(self.small_output, test_output)
def main(): parser = argparse.ArgumentParser( description = (" Train a HMM to detect exon/intron gaps "), ) parser.add_argument("--train", help="path to training data file", default="./test/small_training.fa") parser.add_argument("--test", help="path to testing data file", default="./test/small_test.fa") opts = parser.parse_args() hmm = HMM() # train training_wheels = read_data(opts.train) hmm.train(training_wheels) print hmm hmm.log_transform() # test testing_seqs = read_data(opts.test) for seq in testing_seqs: print hmm.log_viterbi(seq)