1 // File Description 2 /// \file BamRecordView.h 3 /// \brief Defines the BamRecordView class. 4 // 5 // Author: Derek Barnett 6 7 #ifndef BAMRECORDVIEW_H 8 #define BAMRECORDVIEW_H 9 10 #include <cstdint> 11 12 #include "pbbam/BamRecord.h" 13 14 namespace PacBio { 15 namespace BAM { 16 17 /// \brief Provides a re-usable "view" onto a BamRecord 18 /// 19 /// This class acts a convenience wrapper for working with per-base BamRecord 20 /// data. Most of these BamRecord methods take a list of parameters, to adjust 21 /// how the underlying data are presented to client code. Often these parameters 22 /// will be re-used for each BamRecord method call. Thus, to simplify such 23 /// client code, a BamRecordView can be used to state those parameters once, and 24 /// then simply request the desired fields. 25 /// 26 /// \internal 27 /// \todo Sync up method names with BamRecord 28 /// \endinternal 29 /// 30 class PBBAM_EXPORT BamRecordView 31 { 32 public: 33 /// \brief Constructs a view onto \p record using the supplied parameters. 34 /// 35 /// For frame or QV data, if \p aligned is true, a value of 0 (Accuracy or 36 /// QualityValue) will be used at each inserted or padded base location. 37 /// 38 /// \param[in] record BamRecord data source. 39 /// \param[in] orientation Orientation of output. 40 /// \param[in] aligned if true, gaps/padding will be inserted, per 41 /// Cigar info. 42 /// \param[in] exciseSoftClips if true, any soft-clipped positions will be 43 /// removed from query ends 44 /// 45 BamRecordView(const BamRecord& record, const Orientation orientation, const bool aligned, 46 const bool exciseSoftClips, 47 const PulseBehavior pulseBehavior = PulseBehavior::ALL); 48 49 public: 50 /// \returns BamRecord::AltLabelQV with this view's parameters applied 51 QualityValues AltLabelQVs() const; 52 53 /// \returns BamRecord::AltLabelTag with this view's parameters applied 54 std::string AltLabelTags() const; 55 56 /// \returns BamRecord::DeletionQV with this view's parameters applied 57 QualityValues DeletionQVs() const; 58 59 /// \returns BamRecord::DeletionTag with this view's parameters applied 60 std::string DeletionTags() const; 61 62 /// \returns BamRecord::InsertionQV with this view's parameters applied 63 QualityValues InsertionQVs() const; 64 65 /// \returns BamRecord::IPD with this view's parameters applied 66 Frames IPD() const; 67 68 /// \returns BamRecord::LabelQV with this view's parameters applied 69 QualityValues LabelQVs() const; 70 71 /// \returns BamRecord::MergeQV with this view's parameters applied 72 QualityValues MergeQVs() const; 73 74 /// \returns BamRecord::PulseMergeQV with this view's parameters applied 75 QualityValues PulseMergeQVs() const; 76 77 /// \returns BamRecord::Pkmean with this view's parameters applied 78 std::vector<float> Pkmean() const; 79 80 /// \returns BamRecord::Pkmid with this view's parameters applied 81 std::vector<float> Pkmid() const; 82 83 /// \returns BamRecord::Pkmean2 with this view's parameters applied 84 std::vector<float> Pkmean2() const; 85 86 /// \returns BamRecord::Pkmid2 with this view's parameters applied 87 std::vector<float> Pkmid2() const; 88 89 /// \returns BamRecord::PreBaseFrames with this view's parameters applied 90 Frames PrebaseFrames() const; 91 92 /// \returns BamRecord::PrePulseFrames with this view's parameters applied 93 Frames PrePulseFrames() const; 94 95 /// \returns BamRecord::PulseCalls with this view's parameters applied 96 std::string PulseCalls() const; 97 98 /// \returns BamRecord::PulseCallWidth with this view's parameters applied 99 Frames PulseCallWidth() const; 100 101 /// \returns BamRecord::PulseWidths with this view's parameters applied 102 Frames PulseWidths() const; 103 104 /// \returns BamRecord::Qualities with this view's parameters applied 105 QualityValues Qualities() const; 106 107 /// \returns BamRecord::Sequence with this view's parameters applied 108 std::string Sequence() const; 109 110 /// \returns BamRecord::StartFrame with this view's parameters applied 111 std::vector<uint32_t> StartFrames() const; 112 113 /// \returns BamRecord::SubstitutionQV with this view's parameters applied 114 QualityValues SubstitutionQVs() const; 115 116 /// \returns BamRecord::SubstitutionTag with this view's parameters applied 117 std::string SubstitutionTags() const; 118 119 private: 120 const BamRecord& record_; 121 Orientation orientation_; 122 bool aligned_; 123 bool exciseSoftClips_; 124 PulseBehavior pulseBehavior_; 125 }; 126 127 } // namespace BAM 128 } // namespace PacBio 129 130 #include "pbbam/internal/BamRecordView.inl" 131 132 #endif // BAMRECORDVIEW_H 133