@@ -1428,7 +1428,6 @@ int sam_passes_filter(const sam_hdr_t *h, const bam1_t *b,
1428
1428
1429
1429
/// Converts a BAM aux tag to SAM format
1430
1430
/*
1431
- * @param b Pointer to the bam record
1432
1431
* @param key Two letter tag key
1433
1432
* @param type Single letter type code: ACcSsIifHZB.
1434
1433
* @param tag Tag data pointer, in BAM format
@@ -1616,6 +1615,29 @@ static inline const uint8_t *sam_format_aux1(const uint8_t *key,
1616
1615
return NULL ;
1617
1616
}
1618
1617
1618
+ /// Return a pointer to a BAM record's first aux field
1619
+ /** @param b Pointer to the BAM record
1620
+ @return Aux field pointer, or NULL if the record has none
1621
+
1622
+ When NULL is returned, errno will also be set to ENOENT. ("Aux field pointers"
1623
+ point to the TYPE byte within the auxiliary data for that field; but in general
1624
+ it is unnecessary for user code to be aware of this.)
1625
+ */
1626
+ HTSLIB_EXPORT
1627
+ uint8_t * bam_aux_first (const bam1_t * b );
1628
+
1629
+ /// Return a pointer to a BAM record's next aux field
1630
+ /** @param b Pointer to the BAM record
1631
+ @param s Aux field pointer, as returned by bam_aux_first()/_next()/_get()
1632
+ @return Pointer to the next aux field, or NULL if already last or error
1633
+
1634
+ Whenever NULL is returned, errno will also be set: ENOENT if @p s was the
1635
+ record's last aux field; otherwise EINVAL, indicating that the BAM record's
1636
+ aux data is corrupt.
1637
+ */
1638
+ HTSLIB_EXPORT
1639
+ uint8_t * bam_aux_next (const bam1_t * b , const uint8_t * s );
1640
+
1619
1641
/// Return a pointer to an aux record
1620
1642
/** @param b Pointer to the bam record
1621
1643
@param tag Desired aux tag
@@ -1628,6 +1650,19 @@ static inline const uint8_t *sam_format_aux1(const uint8_t *key,
1628
1650
HTSLIB_EXPORT
1629
1651
uint8_t * bam_aux_get (const bam1_t * b , const char tag [2 ]);
1630
1652
1653
+ /// Return the aux field's 2-character tag
1654
+ /** @param s Aux field pointer, as returned by bam_aux_first()/_next()/_get()
1655
+ @return Pointer to the tag characters, NOT NUL-terminated
1656
+ */
1657
+ static inline
1658
+ const char * bam_aux_tag (const uint8_t * s ) { return (const char * ) (s - 2 ); }
1659
+
1660
+ /// Return the aux field's type character
1661
+ /** @param s Aux field pointer, as returned by bam_aux_first()/_next()/_get()
1662
+ @return The type character: one of cCsSiI/fd/A/Z/H/B
1663
+ */
1664
+ static inline char bam_aux_type (const uint8_t * s ) { return * s ; }
1665
+
1631
1666
/// Return a SAM formatting string containing a BAM tag
1632
1667
/** @param b Pointer to the bam record
1633
1668
@param tag Desired aux tag
@@ -1739,6 +1774,19 @@ int bam_aux_append(bam1_t *b, const char tag[2], char type, int len, const uint8
1739
1774
HTSLIB_EXPORT
1740
1775
int bam_aux_del (bam1_t * b , uint8_t * s );
1741
1776
1777
+ /// Delete tag data from a bam record
1778
+ /* @param b The bam record to update
1779
+ @param s Pointer to the aux field to delete, as returned by
1780
+ bam_aux_first()/_next()/_get()
1781
+ @return Pointer to the following aux field, or NULL if none or on error
1782
+
1783
+ Whenever NULL is returned, errno will also be set: ENOENT if the aux field
1784
+ deleted was the record's last one; otherwise EINVAL, indicating that the
1785
+ BAM record's aux data is corrupt.
1786
+ */
1787
+ HTSLIB_EXPORT
1788
+ uint8_t * bam_aux_erase (bam1_t * b , uint8_t * s );
1789
+
1742
1790
/// Update or add a string-type tag
1743
1791
/* @param b The bam record to update
1744
1792
@param tag Tag identifier
0 commit comments