#ifndef HHVITERBIRUNNER #define HHVITERBIRUNNER #include "hhhmmsimd.h" #include "hhviterbimatrix.h" #include "hhviterbi.h" #include "hhfunc.h" #include #include class ViterbiConsumerThread { int thread_id; Viterbi * viterbiAlgo; HMMSimd* q_simd; HMMSimd* t_hmm_simd; ViterbiMatrix* viterbiMatrix; int job_size; const int ssm_mode; public: ViterbiConsumerThread(int pthread_id, Parameters& par, HMMSimd* q_simd, HMMSimd* t_hmm_simd, ViterbiMatrix* pviterbiMatrix, const int ssm_mode, const float S73[NDSSP][NSSPRED][MAXCF], const float S33[NSSPRED][MAXCF][NSSPRED][MAXCF], const float S37[NSSPRED][MAXCF][NDSSP]) : thread_id(pthread_id), q_simd(q_simd), t_hmm_simd(t_hmm_simd), viterbiMatrix(pviterbiMatrix), job_size(0), ssm_mode(ssm_mode){ viterbiAlgo = new Viterbi(par.maxres, par.loc, par.egq, par.egt, par.corr, par.min_overlap, par.shift, ssm_mode, par.ssw, S73, S33, S37); } ~ViterbiConsumerThread(){ delete viterbiAlgo; } std::vector hits; std::vector > excludeAlignments; void clear(); void align(int maxres, int nseqdis, const float smin, const char ssm); }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // Wrapper Viterbi call ///////////////////////////////////////////////////////////////////////////////////////////////////////////// class ViterbiRunner { public: ViterbiRunner(ViterbiMatrix ** viterbiMatrix, std::vector &databases, int threads) : viterbiMatrix(viterbiMatrix), databases(databases), thread_count(threads) { } std::vector alignment(Parameters& par, HMMSimd * q_simd, std::vector dbfiles, const float qsc, float* pb, const float S[20][20], const float Sim[20][20], const float R[20][20], const int ssm_mode, const float S73[NDSSP][NSSPRED][MAXCF], const float S33[NSSPRED][MAXCF][NSSPRED][MAXCF], const float S37[NSSPRED][MAXCF][NDSSP]); private: ViterbiMatrix** viterbiMatrix; std::vector databases; int thread_count; void merge_thread_results(std::vector &all_hits, std::vector &dbfiles_to_align, std::map > &excludeAlignments, std::vector &threads, int alignment, const float smin); void exclude_alignments(int maxResElem, HMMSimd* q_simd, HMMSimd* t_hmm_simd, std::map > &excludeAlignments, ViterbiMatrix* viterbiMatrix); void exclude_regions(char* exclstr, int maxResElem, HMMSimd* q_hmm_simd, HMMSimd* t_hmm_simd, ViterbiMatrix* viterbiMatrix); void exclude_template_regions(char* exclstr, int maxResElem, HMMSimd* q_hmm_simd, HMMSimd* t_hmm_simd, ViterbiMatrix* viterbiMatrix); float calculateEarlyStop(Parameters& par, HMM * q, std::vector &all_hits, unsigned int startPos); }; #endif