예제 #1
0
파일: test_hmm.py 프로젝트: mbiokyle29/576
    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)
예제 #2
0
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)