ppALIGN API documentation
src/posterdecode.hpp
00001 /****************************************************************************** 00002 Copyright 2009 Stefan Wolfsheimer & Gregory Nuel. 00003 00004 This file is part of ppALIGN 00005 00006 ppALIGN is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 ppALIGN is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with ppALIGN; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 *******************************************************************************/ 00020 00021 #ifndef _POSTER_DECODE_HPP_ 00022 #define _POSTER_DECODE_HPP_ 00023 #include "partitionworkspace.hpp" 00024 00025 00028 class DriverPosterDecode : public PartitionDriverBase 00029 { 00030 public: 00031 DriverPosterDecode(); 00032 00035 void SetMaxSize(size_t mem); 00036 virtual void BeforeComputation(); 00037 virtual bool NeedForwardBackward() { return true; } 00038 virtual void OnForwardBackward(PartitionWorkspace::ForwardBackwardInfo & fb_info); 00039 virtual void AfterComputation(); 00040 00041 00042 00047 double Decode(Align & a); 00048 00054 double Decode(); 00055 00056 private: 00057 00058 struct Cell 00059 { 00060 double pij; 00061 double max_pij; 00062 int nij; 00063 AlignState backtrace; 00064 }; 00065 00066 bool do_local; 00068 std::vector<Cell> poster_ws; 00069 00070 std::vector<std::vector<Cell>::iterator> poster_ws_itr; 00071 std::vector<std::vector<Cell>::iterator>::iterator poster_pair; 00072 00073 00074 Pair pos_local; 00075 double max_local; 00076 00077 size_t poster_decode_mem; 00078 00079 // dangling ends for local alignment 00080 std::vector<double> back_dang_ins; 00081 std::vector<double> back_dang_del; 00082 std::vector<double> for_dang_ins; 00083 std::vector<double> for_dang_del; 00084 00085 void ComputeGlobal(); 00086 void ComputeLocal(); 00087 double DecodeGlobal(Align & a); 00088 double DecodeLocal(Align & a); 00089 00090 inline void HandleMaxLocal(long i, long j, double p, long n); 00091 00092 }; 00093 00094 00095 00096 00097 #endif