00001 #ifndef ALGO_ALIGN_SPLIGN_FORMATTER__HPP 00002 #define ALGO_ALIGN_SPLIGN_FORMATTER__HPP 00003 00004 /* $Id: splign_formatter.hpp 176653 2009-11-19 18:45:38Z 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 * Splign formatter 00033 */ 00034 00035 #include <algo/align/splign/splign.hpp> 00036 00037 00038 BEGIN_NCBI_SCOPE 00039 00040 BEGIN_SCOPE(objects) 00041 class CSeq_id; 00042 class CDense_seg; 00043 class CSeq_align; 00044 class CSeq_align_set; 00045 class CScope; 00046 END_SCOPE(objects) 00047 00048 00049 class CSplignFormatter: public CObject 00050 { 00051 public: 00052 00053 CSplignFormatter(const CSplign::TResults& results); 00054 CSplignFormatter(const CSplign& splign); 00055 00056 // setters 00057 void SetSeqIds(CConstRef<objects::CSeq_id> id1, 00058 CConstRef<objects::CSeq_id> id2); 00059 00060 enum ETextFlags { 00061 eTF_None = 0, 00062 eTF_NoExonScores = 0x0001, 00063 eTF_UseFastaStyleIds = 0x0002 00064 }; 00065 00066 enum EAsnFlags { 00067 eAF_Disc, 00068 eAF_SplicedSegNoParts, 00069 eAF_SplicedSegWithParts 00070 }; 00071 00072 // formatters 00073 string AsExonTable(const CSplign::TResults* results = 0, 00074 ETextFlags flags = eTF_None) const; 00075 00076 /// Format alignment as plain text. 00077 /// 00078 /// @param scope 00079 /// Source for sequence data. 00080 /// @param results 00081 /// Splign results for formatting. If not specified, the results 00082 /// will be read from the object used to construct the formatter. 00083 /// @param line_width 00084 /// The maximum number of alignment chars per line. 00085 /// @param segnum 00086 /// The segment to print in each compartment, or -1 to print all segments. 00087 /// @return 00088 /// Formatted alignment. 00089 string AsAlignmentText(CRef<objects::CScope> scope, 00090 const CSplign::TResults* results = 0, 00091 size_t line_width = 80, 00092 int segnum = -1) 00093 const; 00094 00095 /// Format alignment as a seq-align-set 00096 /// 00097 /// @param results 00098 /// Splign results for formatting. If not specified, the results 00099 /// will be read from the object used to construct the formatter. 00100 /// @param asn_flags 00101 /// Must be one of the eAF_* flags specifying seq-align content. 00102 /// @return 00103 /// Formatted alignment as a seq-align-set reference. 00104 CRef<objects::CSeq_align_set> AsSeqAlignSet( 00105 const CSplign::TResults* results = 0, 00106 EAsnFlags asn_flags = eAF_SplicedSegWithParts) 00107 const; 00108 00109 private: 00110 00111 const CSplign::TResults m_splign_results; 00112 00113 CConstRef<objects::CSeq_id> m_QueryId, m_SubjId; 00114 00115 CRef<objects::CSeq_align> x_Compartment2SeqAlign( 00116 const vector<size_t>& boxes, 00117 const vector<string>& transcripts, 00118 const vector<float>& scores) const; 00119 00120 void x_Exon2DS(const size_t* box, const string& trans, 00121 objects::CDense_seg* pds) const; 00122 00123 void x_Init(void); 00124 }; 00125 00126 00127 END_NCBI_SCOPE 00128 00129 #endif 00130 00131
1.4.6
Modified on Mon Dec 07 16:20:32 2009 by modify_doxy.py rev. 173732