ToPS
PairHiddenMarkovModelCreator.cpp
00001 /*
00002  *       PairHiddenMarkovModelCreator.cpp
00003  *
00004  *       Copyright 2011 Vitor Onuchic <vitoronuchic@gmail.com>
00005  *                      Ígor Bonádio <ibonadio@ime.usp.br>
00006  *                      Andre Yoshiaki Kashiwabara <akashiwabara@usp.br>
00007  *                      Alan Mitchell Durham <aland@usp.br>
00008  *
00009  *       This program is free software; you can redistribute it and/or modify
00010  *       it under the terms of the GNU  General Public License as published by
00011  *       the Free Software Foundation; either version 3 of the License, or
00012  *       (at your option) any later version.
00013  *
00014  *       This program is distributed in the hope that it will be useful,
00015  *       but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *       GNU General Public License for more details.
00018  *
00019  *       You should have received a copy of the GNU General Public License
00020  *       along with this program; if not, write to the Free Software
00021  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022  *       MA 02110-1301, USA.
00023  */
00024 
00025 #include "PairHiddenMarkovModelCreator.hpp"
00026 #include "DiscreteIIDModelCreator.hpp"
00027 #include "DiscreteIIDModel.hpp"
00028 #include "ConfigurationReader.hpp"
00029 #include "PairHiddenMarkovModel.hpp"
00030 #include "Alphabet.hpp"
00031 #include "Symbol.hpp"
00032 
00033 namespace tops {
00034   ProbabilisticModelPtr PairHiddenMarkovModelCreator::create(ProbabilisticModelParameters & parameters) const {
00035     ProbabilisticModelParameterValuePtr state_names = parameters.getMandatoryParameterValue("state_names");
00036     ProbabilisticModelParameterValuePtr observation_symbols = parameters.getMandatoryParameterValue("observation_symbols");
00037     ProbabilisticModelParameterValuePtr number_of_emissions = parameters.getMandatoryParameterValue("number_of_emissions");
00038     ProbabilisticModelParameterValuePtr transitions = parameters.getMandatoryParameterValue("transitions");
00039     ProbabilisticModelParameterValuePtr emissions = parameters.getMandatoryParameterValue("emission_probabilities");
00040 
00041     if((state_names == NULL)||
00042        (observation_symbols == NULL)||
00043        (number_of_emissions == NULL) ||
00044        (transitions == NULL) ||
00045        (emissions == NULL))
00046       {
00047         std::cerr << help() << std::endl;
00048       }
00049     ProbabilisticModelPtr model = PairHiddenMarkovModelPtr(new PairHiddenMarkovModel());
00050     model->initialize(parameters);
00051     return model;
00052   }
00053 }