36 #include <htslib/hts.h>
37 #include <htslib/vcf.h>
46 namespace population {
52 VcfFormatHelper::VcfFormatHelper()
56 VcfFormatHelper::bcf_int8_vector_end_ == bcf_int8_vector_end,
57 "Definitions of bcf_int8_vector_end in htslib and of VcfFormatHelper::bcf_int8_vector_end_ "
58 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
61 VcfFormatHelper::bcf_int16_vector_end_ == bcf_int16_vector_end,
62 "Definitions of bcf_int16_vector_end in htslib and of VcfFormatHelper::bcf_int16_vector_end_ "
63 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
66 VcfFormatHelper::bcf_int32_vector_end_ == bcf_int32_vector_end,
67 "Definitions of bcf_int32_vector_end in htslib and of VcfFormatHelper::bcf_int32_vector_end_ "
68 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
71 VcfFormatHelper::bcf_int64_vector_end_ == bcf_int64_vector_end,
72 "Definitions of bcf_int64_vector_end in htslib and of VcfFormatHelper::bcf_int64_vector_end_ "
73 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
76 VcfFormatHelper::bcf_str_vector_end_ == bcf_str_vector_end,
77 "Definitions of bcf_str_vector_end in htslib and of VcfFormatHelper::bcf_str_vector_end_ "
78 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
81 VcfFormatHelper::bcf_int8_missing_ == bcf_int8_missing,
82 "Definitions of bcf_int8_missing in htslib and of VcfFormatHelper::bcf_int8_missing_ "
83 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
86 VcfFormatHelper::bcf_int16_missing_ == bcf_int16_missing,
87 "Definitions of bcf_int16_missing in htslib and of VcfFormatHelper::bcf_int16_missing_ "
88 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
91 VcfFormatHelper::bcf_int32_missing_ == bcf_int32_missing,
92 "Definitions of bcf_int32_missing in htslib and of VcfFormatHelper::bcf_int32_missing_ "
93 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
96 VcfFormatHelper::bcf_int64_missing_ == bcf_int64_missing,
97 "Definitions of bcf_int64_missing in htslib and of VcfFormatHelper::bcf_int64_missing_ "
98 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
101 VcfFormatHelper::bcf_str_missing_ == bcf_str_missing,
102 "Definitions of bcf_str_missing in htslib and of VcfFormatHelper::bcf_str_missing_ "
103 "in genesis differ. Please submit a bug report at https://github.com/lczech/genesis/issues"
111 int32_t VcfFormatHelper::bcf_hdr_nsamples_( ::bcf_hdr_t
const* header )
113 return bcf_hdr_nsamples( header );
116 std::string VcfFormatHelper::hdr_sample_name_( ::bcf_hdr_t
const* header,
size_t index )
118 assert( bcf_hdr_nsamples(header) == header->n[BCF_DT_SAMPLE] );
119 auto const smp_cnt = header->n[BCF_DT_SAMPLE];
120 if(
static_cast<long>( index ) >= smp_cnt ) {
121 throw std::invalid_argument(
122 "Cannot get sample name for sample at index " +
std::to_string(index) +
123 ", as the VCF/BCF file only uses " +
std::to_string( smp_cnt ) +
" samples."
126 return header->samples[index];
129 int VcfFormatHelper::bcf_get_format_string_(
130 const bcf_hdr_t *hdr, bcf1_t *line,
const char *tag,
char ***dst,
int *ndst
132 return bcf_get_format_string( hdr, line, tag, dst, ndst );
135 int VcfFormatHelper::bcf_get_format_values_(
136 const bcf_hdr_t *hdr, bcf1_t *line,
const char *tag,
void **dst,
int *ndst,
int type
138 return bcf_get_format_values( hdr, line, tag, dst, ndst, type);
141 int VcfFormatHelper::bcf_get_genotypes_(
const bcf_hdr_t *hdr, bcf1_t *line,
void **dst,
int *ndst )
143 return bcf_get_genotypes( hdr, line, dst, ndst );
146 int VcfFormatHelper::bcf_float_is_vector_end_(
float f)
148 return bcf_float_is_vector_end(f);
151 int VcfFormatHelper::bcf_float_is_missing_(
float f)
153 return bcf_float_is_missing(f);
159 #endif // htslib guard