1 #ifndef gamgee__hts_memory__guard
2 #define gamgee__hts_memory__guard
105 inline uint32_t
encoded_size(
const int8_t field_type,
const uint32_t field_length,
bool add_type_descriptor =
true) {
106 const auto type_descriptor_size = add_type_descriptor ? (field_length >= 15 ?
int_encoded_size(field_length) + 2 : 1) : 0;
115 #endif // gamgee__hts_memory__guard
void hts_idx_destroy(hts_idx_t *idx)
Definition: hts.c:878
void bcf_hdr_destroy(bcf_hdr_t *h)
Definition: vcf.c:714
void operator()(htsFile *p) const
Definition: hts_memory.h:20
void bcf_destroy1(bcf1_t *v)
Definition: vcf.c:841
bam1_t * sam_shallow_copy(bam1_t *original)
creates a shallow copy of an existing bam1_t: copies core fields but not the data buffer or fields re...
Definition: hts_memory.cpp:128
shared_ptr< bcf_hdr_t > make_shared_variant_header(bcf_hdr_t *bcf_hdr_ptr)
wraps a pre-allocated bcf_hdr_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:63
bam_hdr_t * sam_header_deep_copy(bam_hdr_t *original)
creates a deep copy of an existing bam_hdr_t
Definition: hts_memory.cpp:103
void hts_itr_destroy(hts_itr_t *iter)
Definition: hts.c:1346
void bam_destroy1(bam1_t *b)
Definition: sam.c:213
a functor object to delete a bcf_srs_t pointer
Definition: hts_memory.h:70
uint8_t int_encoded_size(const int32_t val)
Definition: hts_memory.h:104
a functor object to delete a bam1_t pointer
Definition: hts_memory.h:42
shared_ptr< bcf1_t > make_shared_variant(bcf1_t *bcf_ptr)
wraps a pre-allocated bcf1_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:55
bcf1_t * variant_deep_copy(bcf1_t *original)
creates a deep copy of an existing bcf1_t
Definition: hts_memory.cpp:111
void bam_hdr_destroy(bam_hdr_t *h)
Definition: sam.c:51
bcf_hdr_t * variant_header_deep_copy(bcf_hdr_t *original)
creates a deep copy of an existing bcf_hdr_t
Definition: hts_memory.cpp:119
shared_ptr< htsFile > make_shared_hts_file(htsFile *hts_file_ptr)
wraps a pre-allocated htsFile in a shared_ptr with correct deleter
Definition: hts_memory.cpp:15
uint32_t encoded_size(const int8_t field_type, const uint32_t field_length, bool add_type_descriptor=true)
Definition: hts_memory.h:105
int hts_close(htsFile *fp)
Definition: hts.c:367
void operator()(hts_itr_t *p) const
Definition: hts_memory.h:34
void bcf_sr_destroy(bcf_srs_t *readers)
Definition: synced_bcf_reader.c:265
shared_ptr< bam_hdr_t > make_shared_sam_header(bam_hdr_t *sam_header_ptr)
wraps a pre-allocated bam_hdr_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:47
void operator()(hts_idx_t *p) const
Definition: hts_memory.h:27
std::unique_ptr< hts_itr_t, HtsIteratorDeleter > make_unique_hts_itr(hts_itr_t *hts_itr_ptr)
wraps a pre-allocated hts_itr_t in a unique_ptr with correct deleter
Definition: hts_memory.cpp:87
shared_ptr< bam1_t > make_shared_sam(bam1_t *sam_ptr)
wraps a pre-allocated bam1_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:39
a functor object to delete an htsFile pointer
Definition: hts_memory.h:19
Definition: exceptions.h:9
uint8_t bcf_type_to_element_size(const int32_t htslib_type)
Returns the number of bytes required to store each BCF_BT_* type.
Definition: hts_memory.cpp:154
uint8_t int_encoded_type(const int32_t min_val, const int32_t max_val)
Given a min and max value, determines whether int8, int16, or int32 BCF encoding is required...
Definition: hts_memory.cpp:161
std::shared_ptr< bcf_srs_t > make_shared_synced_variant_reader(bcf_srs_t *synced_reader_ptr)
wraps a pre-allocated bcf_srs_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:71
shared_ptr< hts_idx_t > make_shared_hts_index(hts_idx_t *hts_index_ptr)
wraps a pre-allocated hts_idx_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:23
Definition: synced_bcf_reader.h:120
std::string htslib_filter_name(bcf_hdr_t *header, bcf1_t *body, int index)
helper function to translate an index into a string in the filter list
Definition: hts_memory.cpp:144
a functor object to delete an hts file index pointer
Definition: hts_memory.h:26
a functor object to delete an hts file iterator pointer
Definition: hts_memory.h:33
unique_ptr< htsFile, HtsFileDeleter > make_unique_hts_file(htsFile *hts_file_ptr)
wraps a pre-allocated htsFile in a unique_ptr with correct deleter
Definition: hts_memory.cpp:79
a functor object to delete a bcf1_t pointer
Definition: hts_memory.h:63
shared_ptr< hts_itr_t > make_shared_hts_itr(hts_itr_t *hts_itr_ptr)
wraps a pre-allocated hts_itr_t in a shared_ptr with correct deleter
Definition: hts_memory.cpp:31
void operator()(bcf1_t *p) const
Definition: hts_memory.h:64
kstring_t initialize_htslib_buffer(const uint32_t initial_capacity)
Returns a newly-allocated kstring_t buffer suitable for passing to htslib.
Definition: hts_memory.cpp:186
void operator()(bam1_t *p) const
Definition: hts_memory.h:43
void operator()(bcf_srs_t *p) const
Definition: hts_memory.h:71
bam1_t * sam_deep_copy(bam1_t *original)
creates a deep copy of an existing bam1_t
Definition: hts_memory.cpp:95