1 // File Description 2 /// \file CigarOperation.cpp 3 /// \brief Implements the CigarOperation class. 4 // 5 // Author: Derek Barnett 6 7 #include "PbbamInternalConfig.h" 8 9 #include "pbbam/CigarOperation.h" 10 11 #include <htslib/sam.h> 12 13 namespace PacBio { 14 namespace BAM { 15 CharToType(const char c)16CigarOperationType CigarOperation::CharToType(const char c) 17 { 18 switch (c) { 19 case 'S': 20 return CigarOperationType::SOFT_CLIP; 21 case '=': 22 return CigarOperationType::SEQUENCE_MATCH; 23 case 'X': 24 return CigarOperationType::SEQUENCE_MISMATCH; 25 case 'I': 26 return CigarOperationType::INSERTION; 27 case 'D': 28 return CigarOperationType::DELETION; 29 case 'N': 30 return CigarOperationType::REFERENCE_SKIP; 31 case 'H': 32 return CigarOperationType::HARD_CLIP; 33 case 'P': 34 return CigarOperationType::PADDING; 35 case 'M': 36 return CigarOperationType::ALIGNMENT_MATCH; 37 default: 38 return CigarOperationType::UNKNOWN_OP; 39 } 40 } 41 TypeToChar(const CigarOperationType type)42char CigarOperation::TypeToChar(const CigarOperationType type) 43 { 44 return bam_cigar_opchr(static_cast<int>(type)); 45 } 46 47 bool CigarOperation::validate_ = true; 48 49 } // namespace BAM 50 } // namespace PacBio 51