Changeset 3398
- Timestamp:
- Mar 25, 2015, 8:57:32 AM (8 years ago)
- Location:
- trunk/yat/omic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/omic/BamRead.cc
r3395 r3398 228 228 { 229 229 int offset = 4*c.size() - 4*core().n_cigar; 230 230 231 231 reserve(data_size() + offset); 232 232 /* … … 348 348 char BamRead::sequence_str(size_t i) const 349 349 { 350 #if YAT_HAVE_HTSLIB 351 return seq_nt16_str[sequence(i)]; 352 #elif HAVE_BAM_NT16_REV_TABLE 353 return bam_nt16_rev_table[sequence(i)]; 354 #else 355 std::string table = "=ACMGRSVTWYHKDBN"; 356 return table[sequence(i)]; 357 #endif 350 return nt16_str(sequence(i)); 358 351 } 359 352 … … 374 367 // copy sequence 375 368 for (size_t i=0; i<seq.size(); ++i) 376 #if YAT_HAVE_HTSLIB 377 sequence(i, seq_nt16_table[static_cast<size_t>(seq[i])]); 378 #else 379 sequence(i, bam_nt16_table[static_cast<size_t>(seq[i])]); 380 #endif 369 sequence(i, nt16_table(seq[i])); 381 370 core().l_qseq = seq.size(); 382 371 // copy quality … … 442 431 { 443 432 std::swap(bam_, other.bam_); 433 } 434 435 436 const unsigned char nt16_table(char c) 437 { 438 #if YAT_HAVE_HTSLIB 439 return seq_nt16_table[static_cast<uint8_t>(c)]; 440 #else 441 return bam_nt16_table[static_cast<uint8_t>(c)]; 442 #endif 443 } 444 445 446 const char nt16_str(uint8_t x) 447 { 448 assert(x<16); 449 #if YAT_HAVE_HTSLIB 450 return seq_nt16_str[x]; 451 #elif HAVE_BAM_NT16_REV_TABLE 452 return bam_nt16_rev_table[x]; 453 #else 454 char table[16] = "=ACMGRSVTWYHKDBN"; 455 return table[x]; 456 #endif 444 457 } 445 458 -
trunk/yat/omic/BamRead.h
r3395 r3398 325 325 const int& data_size(void) const; 326 326 }; 327 328 /** 329 Convert nucleotide character to 4-bit encoding. The result is 330 encoded as 1/2/4/8 for A/C/G/T or combinations of these bits. 331 332 This is the same functionality that is provided in HTSLIB's 333 global array \c seq_nt16_table, but this function works also when 334 building against libbam. In libbam the array was called \c 335 bam_nt16_table. 336 337 This is the inverse of function nt16_str. 338 339 \since New in yat 0.13 340 */ 341 const unsigned char nt16_table(char); 342 343 /** 344 Convert a 4-bit encoded nucleotide to a character. 345 346 This is the same functionality that is provided in HTSLIB's 347 global array seq_nt16_str, but this function works also when 348 building against libbam. In libbam the array was called \c 349 bam_nt16_rev_table. 350 351 This is the inverse of function nt16_table. 352 353 \since New in yat 0.13 354 */ 355 const char nt16_str(uint8_t); 327 356 328 357 /**
Note: See TracChangeset
for help on using the changeset viewer.