Changeset 3213
- Timestamp:
- May 5, 2014, 9:51:59 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/cigar.cc
r3201 r3213 78 78 } 79 79 80 if (!suite.add(cig.length()==17)) 81 suite.err() << "error: length: " << cig.length() << " expected 17\n"; 82 if (!suite.add(cig.query_length()==16)) 83 suite.err() << "error: query length: " << cig.query_length() 84 << " expected 16\n"; 85 if (!suite.add(cig.reference_length()==17)) 86 suite.err() << "error: length: " << cig.reference_length() 87 << " expected 17\n"; 88 80 89 if (!suite.add(cig.op(0)==0)) 81 90 suite.err() << "error: cig.op(0): " << cig.op(0) << " expected 0\n"; -
trunk/yat/utility/Aligner.cc
r3212 r3213 169 169 170 170 171 uint32_t Aligner::Cigar::length(uint8_t mask) const 172 { 173 uint32_t res = 0; 174 for (size_t i=0; i<cigar_.size(); ++i) 175 if (bam_cigar_type(op(i)) & mask) 176 res += oplen(i); 177 return res; 178 } 179 180 181 uint32_t Aligner::Cigar::length(void) const 182 { 183 return length(3); 184 } 185 186 171 187 char Aligner::Cigar::opchr(size_t i) const 172 188 { … … 238 254 239 255 256 uint32_t Aligner::Cigar::query_length(void) const 257 { 258 return length(1); 259 } 260 261 262 uint32_t Aligner::Cigar::reference_length(void) const 263 { 264 return length(2); 265 } 266 267 240 268 size_t Aligner::Cigar::size(void) const 241 269 { -
trunk/yat/utility/Aligner.h
r3212 r3213 184 184 185 185 /** 186 Total length of operations counting operations that consume 187 either (or both) query and reference e.g. match, insertion, 188 or deletion. HardClip or Padding operations are ignored. 189 */ 190 uint32_t length(void) const; 191 192 /** 186 193 See table in class documntation. 187 194 … … 226 233 227 234 /** 235 \brief Translate CIGAR to a query length. 236 237 Calculate total length of operations which consume a query 238 e.g. match or insetion. See table in class documentation. 239 240 This is the same function as bam_cigar2qlen in samtools C 241 API. 242 */ 243 uint32_t query_length(void) const; 244 245 /** 246 \brief Translate CIGAR to a reference length. 247 248 Calculate total length of operations which consume a reference 249 e.g. match or deletion. See table in class documentation. 250 251 Similar to bam_calend but does not handle \c BAM_CBACK as it has 252 not been included in SAM specification. 253 http://sourceforge.net/p/samtools/mailman/message/29373646/ 254 */ 255 uint32_t reference_length(void) const; 256 257 /** 228 258 \return cigar element \a i 229 259 */ … … 237 267 std::deque<uint32_t> cigar_; 238 268 269 // calculate length only counting operations whose type is set 270 // in mask, i.e., mask & type returns true 271 uint32_t length(uint8_t mask) const; 239 272 // using compiler generated copy 240 273 // Cigar(const Cigar& other); -
trunk/yat/utility/Cigar.h
r3212 r3213 30 30 // allow inclusion of config_bam.h so this file is available also without bam.h 31 31 #ifdef YAT_HAVE_LIBBAM 32 #include " config_bam.h"32 #include "yat/omic/config_bam.h" 33 33 #include YAT_BAM_HEADER 34 34 #else // if bam.h is not available #define CIGAR
Note: See TracChangeset
for help on using the changeset viewer.