00001 /* $Id: Seq_align.hpp 169611 2009-09-01 16:21:07Z dicuccio $ 00002 * =========================================================================== 00003 * 00004 * PUBLIC DOMAIN NOTICE 00005 * National Center for Biotechnology Information 00006 * 00007 * This software/database is a "United States Government Work" under the 00008 * terms of the United States Copyright Act. It was written as part of 00009 * the author's official duties as a United States Government employee and 00010 * thus cannot be copyrighted. This software/database is freely available 00011 * to the public for use. The National Library of Medicine and the U.S. 00012 * Government have not placed any restriction on its use or reproduction. 00013 * 00014 * Although all reasonable efforts have been taken to ensure the accuracy 00015 * and reliability of the software and data, the NLM and the U.S. 00016 * Government do not and cannot warrant the performance or results that 00017 * may be obtained by using this software or data. The NLM and the U.S. 00018 * Government disclaim all warranties, express or implied, including 00019 * warranties of performance, merchantability or fitness for any particular 00020 * purpose. 00021 * 00022 * Please cite the author in any work or product based on this material. 00023 * 00024 * =========================================================================== 00025 * 00026 * Author: ....... 00027 * 00028 * File Description: 00029 * ....... 00030 * 00031 * Remark: 00032 * This code was originally generated by application DATATOOL 00033 * using specifications from the data definition file 00034 * 'seqalign.asn'. 00035 */ 00036 00037 #ifndef OBJECTS_SEQALIGN_SEQ_ALIGN_HPP 00038 #define OBJECTS_SEQALIGN_SEQ_ALIGN_HPP 00039 00040 00041 // generated includes 00042 #include <objects/seqalign/Seq_align_.hpp> 00043 #include <objects/seqloc/Na_strand.hpp> 00044 #include <util/range.hpp> 00045 00046 // generated classes 00047 00048 BEGIN_NCBI_SCOPE 00049 00050 BEGIN_objects_SCOPE /// namespace ncbi::objects:: 00051 00052 class CSeq_id; 00053 00054 class CSeq_align : public CSeq_align_Base 00055 { 00056 typedef CSeq_align_Base Tparent; 00057 public: 00058 /// enum controlling known named scores 00059 enum EScoreType { 00060 //< generic 'score' 00061 eScore_Score, 00062 00063 //< blast-style 'bit_score' 00064 eScore_BitScore, 00065 00066 //< blast-style 'e_value' 00067 eScore_EValue, 00068 00069 //< count of identities (num_ident) 00070 eScore_IdentityCount, 00071 00072 //< count of mismatches (num_mismatch) 00073 eScore_MismatchCount, 00074 00075 //< percent identity (0.0-100.0) (pct_identity) 00076 eScore_PercentIdentity, 00077 00078 //< percent coverage (0.0-100.0) (pct_coverage) 00079 eScore_PercentCoverage, 00080 00081 //< blast-style 'sum_e' 00082 eScore_SumEValue, 00083 00084 //< Composition-adjustment method from BLAST (comp_adjustment_method) 00085 eScore_CompAdjMethod 00086 }; 00087 00088 /// constructor 00089 CSeq_align(void); 00090 /// destructor 00091 ~CSeq_align(void); 00092 00093 /// Validatiors 00094 TDim CheckNumRows(void) const; 00095 void Validate (bool full_test = false) const; 00096 00097 /// GetSeqRange 00098 /// NB: On a Spliced-seg, in case the product-type is protein, 00099 /// these only return the amin part of Prot-pos. The frame is 00100 /// ignored. 00101 CRange<TSeqPos> GetSeqRange(TDim row) const; 00102 TSeqPos GetSeqStart(TDim row) const; 00103 TSeqPos GetSeqStop (TDim row) const; 00104 00105 /// Retrieves the total number of gaps in an alignment 00106 /// @throws CSeqalignException if alignment type is not supported 00107 TSeqPos GetTotalGapCount() const; 00108 00109 /// Retrieves the number of gap openings in an alignment (ignoring how many 00110 /// gaps are in the gapped region) 00111 /// @throws CSeqalignException if alignment type is not supported 00112 TSeqPos GetNumGapOpenings() const; 00113 00114 /// Get strand (the first one if segments have different strands). 00115 ENa_strand GetSeqStrand(TDim row) const; 00116 00117 /// Get seq-id (the first one if segments have different ids). 00118 /// Throw exception if row is invalid. 00119 const CSeq_id& GetSeq_id(TDim row) const; 00120 00121 /// Get score 00122 bool GetNamedScore(const string& id, int &score) const; 00123 bool GetNamedScore(const string& id, double &score) const; 00124 00125 bool GetNamedScore(EScoreType type, int &score) const; 00126 bool GetNamedScore(EScoreType type, double &score) const; 00127 00128 void SetNamedScore(const string& id, int score); 00129 void SetNamedScore(const string& id, double score); 00130 00131 void SetNamedScore(EScoreType type, int score); 00132 void SetNamedScore(EScoreType type, double score); 00133 00134 00135 /// Reverse the segments' orientation 00136 /// NOTE: currently *only* works for dense-seg 00137 void Reverse(void); 00138 00139 /// Swap the position of two rows in the alignment 00140 /// NOTE: currently *only* works for dense-seg & disc 00141 void SwapRows(TDim row1, TDim row2); 00142 00143 /// Create a Dense-seg from a Std-seg 00144 /// Used by AlnMgr to handle nucl2prot alignments 00145 // 00146 00147 /// NOTE: Here we assume that the same rows on different segments 00148 /// contain the same sequence. Without access to OM we can only check 00149 /// if the ids are the same via SerialEquals, and we throw an exception 00150 /// if not equal. Since the same sequence can be represented with a 00151 /// different type of seq-id, we provide an optional callback mechanism 00152 /// to compare id1 and id2, and if both resolve to the same sequence 00153 /// and id2 is preferred, to SerialAssign it to id1. Otherwise, again, 00154 /// an exception should be thrown. 00155 struct SSeqIdChooser : CObject 00156 { 00157 virtual void ChooseSeqId(CSeq_id& id1, const CSeq_id& id2) = 0; 00158 }; 00159 CRef<CSeq_align> CreateDensegFromStdseg(SSeqIdChooser* SeqIdChooser = 0) const; 00160 00161 CRef<CSeq_align> CreateDensegFromDisc(SSeqIdChooser* SeqIdChooser = 0) const; 00162 00163 /// Create a Dense-seg with widths from Dense-seg of nucleotides 00164 /// Used by AlnMgr to handle translated nucl2nucl alignments 00165 /// IMPORTANT NOTE: Do *NOT* use for alignments containing proteins; 00166 /// the code will not check for this 00167 CRef<CSeq_align> CreateTranslatedDensegFromNADenseg(void) const; 00168 00169 00170 /// Offset row's coords 00171 void OffsetRow(TDim row, TSignedSeqPos offset); 00172 00173 /// @deprecated (use sequence::RemapAlignToLoc()) 00174 /// @sa RemapAlignToLoc 00175 NCBI_DEPRECATED void RemapToLoc(TDim row, 00176 const CSeq_loc& dst_loc, 00177 bool ignore_strand = false); 00178 00179 protected: 00180 /// retrieve a named score object 00181 CConstRef<CScore> x_GetNamedScore(const string& name) const; 00182 CRef<CScore> x_SetNamedScore(const string& name); 00183 00184 private: 00185 /// Prohibit copy constructor and assignment operator 00186 CSeq_align(const CSeq_align& value); 00187 CSeq_align& operator=(const CSeq_align& value); 00188 00189 }; 00190 00191 00192 /// Remap seq-align row to the seq-loc. 00193 /// Treats the given row as being relative to the location, maps it 00194 /// to the sequence(s) referenced by this location. 00195 /// @param align 00196 /// The seq-align object to be mapped (the object will be modified!). 00197 /// @param row 00198 /// Row to be mapped. 00199 /// @param loc 00200 /// Seq-loc to which the row should be mapped. 00201 /// @result 00202 /// Reference to the new seq-align with the mapped row. 00203 00204 CRef<CSeq_align> RemapAlignToLoc(const CSeq_align& align, 00205 CSeq_align::TDim row, 00206 const CSeq_loc& loc); 00207 00208 00209 /////////////////// CSeq_align inline methods 00210 00211 // constructor 00212 inline 00213 CSeq_align::CSeq_align(void) 00214 { 00215 } 00216 00217 00218 /////////////////// end of CSeq_align inline methods 00219 00220 00221 END_objects_SCOPE /// namespace ncbi::objects:: 00222 00223 END_NCBI_SCOPE 00224 00225 #endif /// OBJECTS_SEQALIGN_SEQ_ALIGN_HPP 00226 /* Original file checksum: lines: 93, chars: 2426, CRC32: 6ba198f0 */ 00227 00228
1.4.6
Modified on Wed Dec 09 08:17:39 2009 by modify_doxy.py rev. 173732