95 std::cerr <<
"Model is NULL. traceback::name(...) must have valid HMM model defined.\n";
110 std::string current_label=
"";
112 size_t path_size=
size();
115 std::cerr <<
"Model is NULL. traceback::gff(...) must have valid HMM model defined.\n";
119 for(
size_t k = path_size-1;k !=
SIZE_MAX; k--){
121 std::string new_label=st->
getGFF();
122 if (new_label.compare(
"")==0){
129 ln.
end=path_size-(k+1);
138 current_label=new_label;
151 ln.
end=path_size-(k+1);
161 current_label=new_label;
163 else if (new_label.compare(current_label)==0){
172 ln.
end=path_size-(k+1);
181 current_label=new_label;
198 std::cout << std::endl << std::endl;
267 std::cerr <<
"Model is NULL. traceback::print_label() must have valid HMM model defined.\n";
280 std::cout << std::endl << std::endl;
286 std::string current_label=
"";
288 size_t path_size=this->
size();
291 std::cerr <<
"Model is NULL. traceback::print_gff(...) must have valid HMM model defined.\n";
295 for(
size_t k=path_size-1;k !=
SIZE_MAX;k--){
297 std::string new_label=st->
getGFF();
298 if (new_label.compare(
"")==0){
300 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size-(k+1) <<
"\t" << score <<
"\t+\t.\tRank:"<<ranking<<
",Counts:" << times<<
",Posterior:"<<posterior<<std::endl;
302 current_label=new_label;
310 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size <<
"\t" << score <<
"\t+\t.\tRank:"<<ranking<<
",Counts:" << times<<
",Posterior:"<<posterior<<std::endl;
314 current_label=new_label;
316 else if (new_label.compare(current_label)==0){
320 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size-(k+1) <<
"\t" << score <<
"\t+\t.\tRank:"<<ranking<<
",Counts:" << times<<
",Posterior:"<<posterior<<std::endl;
322 current_label=new_label;
332 std::string current_label=
"";
334 size_t path_size=
size();
336 if (sequence_name[0] ==
'>'){
337 sequence_name = sequence_name.substr(1);
340 std::cerr <<
"Model is NULL. traceback::print_gff(...) must have valid HMM model defined.\n";
345 for(
size_t k = path_size-1; k !=
SIZE_MAX; k--){
347 std::string new_label=st->
getGFF();
350 if (new_label.compare(
"")==0){
352 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size-(k+1) <<
"\t.\t+\t."<<std::endl;
354 current_label=new_label;
363 current_label=new_label;
365 else if (new_label.compare(current_label)==0){
367 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size <<
"\t.\t+\t."<<std::endl;
374 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size-(k+1) <<
"\t.\t+\t."<<std::endl;
377 current_label=new_label;
380 std::cout << sequence_name <<
"\tStochHMM\t" << current_label <<
"\t"<< start <<
"\t" << path_size <<
"\t.\t+\t."<<std::endl;
388 std::cout << std::endl<<std::endl;
523 std::map<traceback_path,int>::iterator pathsIterator;
524 for(pathsIterator=
paths.begin();pathsIterator!=
paths.end();pathsIterator++){
541 size_t sequenceSize=((*
pathAccess[0]).first).size();
545 std::vector<int> states(stateSize,0);
548 std::map<traceback_path,int>::iterator it;
550 for( it =
paths.begin(); it!=
paths.end();it++){
551 int count = (*it).second;
552 for(
size_t position=0;position<sequenceSize;position++){
553 int tbState=(*it).first[position];
554 (*table)[position][tbState]+=count;
566 std::string header_row =
"Position";
568 for (
size_t state_iter =0; state_iter<hmm->
state_size(); state_iter++){
573 std::cout << header_row << std::endl;
575 for(
size_t position = 0; position <
table->size(); position++){
576 std::string line =
join((*
table)[position],
'\t');
577 std::cout << position+1 <<
"\t" << line << std::endl;
586 for(
size_t iter=0; iter<this->
size(); iter++){
587 std::cout <<
"Traceback occurred:\t " << (*
pathAccess[iter]).second << std::endl;
589 std::cout << std::endl;
596 for(
size_t iter=0; iter<this->
size(); iter++){
597 std::cout <<
"Traceback occurred:\t " << (*
pathAccess[iter]).second << std::endl;
599 std::cout << std::endl;
606 for(
size_t iter=0; iter<this->
size(); iter++){
607 std::cout <<
"Traceback occurred:\t " << (*
pathAccess[iter]).second << std::endl;
609 std::cout << std::endl;
615 bool sortTBVec(std::map<traceback_path,int>::iterator lhs, std::map<traceback_path,int>::iterator rhs)
617 return ((*lhs).second < (*rhs).second);