00001 #ifndef ALGO_ALIGN___NW_SPLICED_ALIGNER__HPP 00002 #define ALGO_ALIGN___NW_SPLICED_ALIGNER__HPP 00003 00004 /* $Id: nw_spliced_aligner.hpp 127187 2008-05-08 23:53:46Z kapustin $ 00005 * =========================================================================== 00006 * 00007 * PUBLIC DOMAIN NOTICE 00008 * National Center for Biotechnology Information 00009 * 00010 * This software/database is a "United States Government Work" under the 00011 * terms of the United States Copyright Act. It was written as part of 00012 * the author's official duties as a United States Government employee and 00013 * thus cannot be copyrighted. This software/database is freely available 00014 * to the public for use. The National Library of Medicine and the U.S. 00015 * Government have not placed any restriction on its use or reproduction. 00016 * 00017 * Although all reasonable efforts have been taken to ensure the accuracy 00018 * and reliability of the software and data, the NLM and the U.S. 00019 * Government do not and cannot warrant the performance or results that 00020 * may be obtained by using this software or data. The NLM and the U.S. 00021 * Government disclaim all warranties, express or implied, including 00022 * warranties of performance, merchantability or fitness for any particular 00023 * purpose. 00024 * 00025 * Please cite the author in any work or product based on this material. 00026 * 00027 * =========================================================================== 00028 * 00029 * Author: Yuri Kapustin 00030 * 00031 * File Description: 00032 * Base class for spliced aligners. 00033 * 00034 */ 00035 00036 #include "nw_band_aligner.hpp" 00037 00038 00039 /** @addtogroup AlgoAlignSpliced 00040 * 00041 * @{ 00042 */ 00043 00044 00045 BEGIN_NCBI_SCOPE 00046 00047 class CSplicedAligner: public CBandAligner 00048 { 00049 public: 00050 00051 // Setters and getters 00052 void SetWi(unsigned char splice_type, TScore value); 00053 TScore GetWi(unsigned char splice_type); 00054 00055 void SetCDS(size_t cds_start, size_t cds_stop) { 00056 m_cds_start = cds_start; 00057 m_cds_stop = cds_stop; 00058 } 00059 00060 void SetIntronMinSize(size_t s) { 00061 m_IntronMinSize = s; 00062 } 00063 00064 size_t GetIntronMinSize(void) const { 00065 return m_IntronMinSize; 00066 } 00067 00068 static size_t GetDefaultIntronMinSize (void) { 00069 return 25; 00070 } 00071 00072 void CheckPreferences(void); 00073 00074 virtual size_t GetSpliceTypeCount(void) = 0; 00075 00076 protected: 00077 00078 CSplicedAligner(); 00079 00080 CSplicedAligner( const char* seq1, size_t len1, 00081 const char* seq2, size_t len2); 00082 CSplicedAligner(const string& seq1, const string& seq2); 00083 00084 size_t m_IntronMinSize; 00085 size_t m_cds_start, m_cds_stop; 00086 00087 virtual bool x_CheckMemoryLimit(void); 00088 00089 virtual TScore* x_GetSpliceScores() = 0; 00090 00091 // a trivial but helpful memory allocator for core dynprog 00092 // that promptly throws std::bad_alloc on failure 00093 template<class T> 00094 struct SAllocator { 00095 00096 SAllocator (size_t N) { 00097 m_Buf = new T [N]; 00098 memset((void*)m_Buf, 0, N * sizeof(T)); 00099 } 00100 00101 ~SAllocator() { delete[] m_Buf; } 00102 00103 T * GetPointer(void) { 00104 return m_Buf; 00105 } 00106 00107 T * m_Buf; 00108 }; 00109 }; 00110 00111 00112 END_NCBI_SCOPE 00113 00114 /* @} */ 00115 00116 #endif /* ALGO_ALIGN___SPLICED_ALIGNER__HPP */ 00117 00118
1.4.6
Modified on Mon Dec 07 16:20:32 2009 by modify_doxy.py rev. 173732