]> git.donarmstrong.com Git - samtools.git/blobdiff - bam.h
Add bam_validate1().
[samtools.git] / bam.h
diff --git a/bam.h b/bam.h
index 27a9a96e33a3b236c61fc1b22f5c4461c6163805..a8769e26a38c3dc62ee4ded2dc793a90884d19a3 100644 (file)
--- a/bam.h
+++ b/bam.h
@@ -455,6 +455,21 @@ extern "C" {
 
        char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of);
 
+       /*!
+         @abstract       Check whether a BAM record is plausibly valid
+         @param  header  associated header structure, or NULL if unavailable
+         @param  b       alignment to validate
+         @return         0 if the alignment is invalid; non-zero otherwise
+
+         @discussion  Simple consistency check of some of the fields of the
+         alignment record.  If the header is provided, several additional checks
+         are made.  Not all fields are checked, so a non-zero result is not a
+         guarantee that the record is valid.  However it is usually good enough
+         to detect when bam_seek() has been called with a virtual file offset
+         that is not the offset of an alignment record.
+        */
+       int bam_validate1(const bam_header_t *header, const bam1_t *b);
+
        const char *bam_get_library(bam_header_t *header, const bam1_t *b);