- // add tag data (create new TAG entry with TYPE and VALUE)
- // TYPE is one of {A, i, f, Z, H} depending on VALUE - see SAM/BAM spec for details
- // returns true if new data added, false if error or TAG already exists
- // N.B. - will NOT modify existing tag. Use EditTag() instead
- // @tag - two character tag name
- // @type - single character tag type (see SAM/BAM spec for details)
- // @value - value to associate with tag
- bool AddTag(const std::string& tag, const std::string& type, const std::string& value); // type must be Z or H
- bool AddTag(const std::string& tag, const std::string& type, const uint32_t& value); // type must be A or i
- bool AddTag(const std::string& tag, const std::string& type, const int32_t& value); // type must be A or i
- bool AddTag(const std::string& tag, const std::string& type, const float& value); // type must be A, i, or f
-
- // edit tag data (sets existing TAG with TYPE to VALUE or adds new TAG if not already present)
- // TYPE is one of {A, i, f, Z, H} depending on VALUE - see SAM/BAM spec for details
- // returns true if edit was successfaul, false if error
- // @tag - two character tag name
- // @type - single character tag type (see SAM/BAM spec for details)
- // @value - new value for tag
- bool EditTag(const std::string& tag, const std::string& type, const std::string& value); // type must be Z or H
- bool EditTag(const std::string& tag, const std::string& type, const uint32_t& value); // type must be A or i
- bool EditTag(const std::string& tag, const std::string& type, const int32_t& value); // type must be A or i
- bool EditTag(const std::string& tag, const std::string& type, const float& value); // type must be A, i, or f
-
- // specific tag data access methods - these only remain for legacy support
- // returns whether specific tag could be retrieved
- bool GetEditDistance(uint32_t& editDistance) const; // get "NM" tag data (equivalent to GetTag("NM", editDistance))
- bool GetReadGroup(std::string& readGroup) const; // get "RG" tag data (equivalent to GetTag("RG", readGroup))
-
- // generic tag data access methods
- // returns whether tag is found & tag type is compatible with DESTINATION
- // @tag - two character tag name
- // @destination - if found, tag value is stored here
- bool GetTag(const std::string& tag, std::string& destination) const; // access variable-length char or hex strings
- bool GetTag(const std::string& tag, uint32_t& destination) const; // access unsigned integer data
- bool GetTag(const std::string& tag, int32_t& destination) const; // access signed integer data
- bool GetTag(const std::string& tag, float& destination) const; // access floating point data
-
- // retrieve the tag type code for TAG
- // returns true if tag could be found and type determined
+ // adds a tag
+ bool AddTag(const std::string& tag, const std::string& type, const std::string& value);
+ bool AddTag(const std::string& tag, const std::string& type, const uint32_t& value);
+ bool AddTag(const std::string& tag, const std::string& type, const int32_t& value);
+ bool AddTag(const std::string& tag, const std::string& type, const float& value);
+
+ // adds a "binary array" tag
+ bool AddTag(const std::string& tag, const std::vector<uint8_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<int8_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<uint16_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<int16_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<uint32_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<int32_t>& values);
+ bool AddTag(const std::string& tag, const std::vector<float>& values);
+
+ // edits a tag
+ bool EditTag(const std::string& tag, const std::string& type, const std::string& value);
+ bool EditTag(const std::string& tag, const std::string& type, const uint32_t& value);
+ bool EditTag(const std::string& tag, const std::string& type, const int32_t& value);
+ bool EditTag(const std::string& tag, const std::string& type, const float& value);
+
+ // edits a "binary array" tag
+ bool EditTag(const std::string& tag, const std::vector<uint8_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<int8_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<uint16_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<int16_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<uint32_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<int32_t>& values);
+ bool EditTag(const std::string& tag, const std::vector<float>& values);
+
+ // retrieves data for a tag
+ bool GetTag(const std::string& tag, std::string& destination) const;
+ bool GetTag(const std::string& tag, uint32_t& destination) const;
+ bool GetTag(const std::string& tag, int32_t& destination) const;
+ bool GetTag(const std::string& tag, float& destination) const;
+
+ // retrieves data for a "binary array" tag
+ bool GetTag(const std::string& tag, std::vector<uint32_t>& destination) const;
+ bool GetTag(const std::string& tag, std::vector<int32_t>& destination) const;
+ bool GetTag(const std::string& tag, std::vector<float>& destination) const;
+
+ // retrieves the BAM tag-type character for a tag