Changeset 3300
- Timestamp:
- Aug 20, 2014, 7:43:27 AM (9 years ago)
- Location:
- branches/0.12-stable/yat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.12-stable/yat/omic/BamRead.cc
r3222 r3300 107 107 assert(bam_); 108 108 return bam_->l_aux; 109 } 110 111 112 uint32_t BamRead::calend(const bam1_core_t *c, const uint32_t *cigar) const 113 { 114 int k, end = c->pos; 115 for (k = 0; k < c->n_cigar; ++k) { 116 int op = bam_cigar_op(cigar[k]); 117 int len = bam_cigar_oplen(cigar[k]); 118 if (op == BAM_CBACK) { // move backward 119 int l, u, v; 120 if (k == c->n_cigar - 1) break; // skip trailing 'B' 121 for (l = k - 1, u = v = 0; l >= 0; --l) { 122 int op1 = bam_cigar_op(cigar[l]); 123 int len1 = bam_cigar_oplen(cigar[l]); 124 if (bam_cigar_type(op1)&1) { // consume query 125 if (u + len1 >= len) { // stop 126 if (bam_cigar_type(op1)&2) v += len - u; 127 break; 128 } else u += len1; 129 } 130 if (bam_cigar_type(op1)&2) v += len1; 131 } 132 end = l < 0? c->pos : end - v; 133 } else if (bam_cigar_type(op)&2) end += bam_cigar_oplen(cigar[k]); 134 } 135 return end; 109 136 } 110 137 … … 186 213 bam1_core_t& BamRead::core(void) 187 214 { return bam_->core; } 215 216 217 int32_t BamRead::end(void) const 218 { 219 assert(bam_); 220 return this->calend(&core(), bam1_cigar(bam_)); 221 } 188 222 189 223 … … 328 362 329 363 330 int32_t BamRead::end(void) const331 {332 assert(bam_);333 return bam_calend(&core(), bam1_cigar(bam_));334 }335 336 337 364 void BamRead::swap(BamRead& other) 338 365 { -
branches/0.12-stable/yat/omic/BamRead.h
r3222 r3300 309 309 friend class OutBamFile; 310 310 friend class BamReadIterator; 311 // FIXME guard out this 312 uint32_t calend(const bam1_core_t *c, const uint32_t *cigar) const; 311 313 }; 312 314 -
branches/0.12-stable/yat/utility/Cigar.h
r3213 r3300 59 59 #endif // end of YAT_HAVE_LIBBAM 60 60 61 // CBACK is not defined in old versions of bam.h 62 #ifndef BAM_CBACK 63 #define BAM_CBACK 9 64 #endif 65 61 66 // backport #defines from samtools 0.1.19 62 67 #ifndef BAM_CIGAR_STR
Note: See TracChangeset
for help on using the changeset viewer.