htslib.vcf

D bindings to htslib-1.9 vcf Copyright 2018 James S Blachly, MD Changes are MIT licensed Section numbers refer to VCF Specification v4.2: https://samtools.github.io/hts-specs/VCFv4.2.pdf

Members

Aliases

BCF_UN_IND
alias BCF_UN_IND = BCF_UN_FMT

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_clear1
alias bcf_clear1 = bcf_clear

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_close
alias bcf_close = hts_close

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_destroy1
alias bcf_destroy1 = bcf_destroy

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_empty1
alias bcf_empty1 = bcf_empty

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_init1
alias bcf_init1 = bcf_init

These macros are defined only for consistency with other parts of htslib

bcf_itr_destroy
alias bcf_itr_destroy = hts_itr_destroy

BCF index

bcf_open
alias bcf_open = hts_open

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_read1
alias bcf_read1 = bcf_read

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_write1
alias bcf_write1 = bcf_write

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcfFile
alias vcfFile = htsFile

bcf_open and vcf_open mode: please see hts_open() in hts.h

vcf_close
alias vcf_close = hts_close

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcf_format1
alias vcf_format1 = vcf_format

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcf_open
alias vcf_open = hts_open

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcf_parse1
alias vcf_parse1 = vcf_parse

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcf_read1
alias vcf_read1 = vcf_read

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

vcf_write1
alias vcf_write1 = vcf_write

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Enums

BCF_HL_FLT
anonymousenum BCF_HL_FLT

Header struct *

Functions

bcf_add_filter
int bcf_add_filter(const(bcf_hdr_t)* hdr, bcf1_t* line, int flt_id)

bcf_add_filter() - adds to the FILTER column @flt_id: filter ID to add, numeric ID returned by bcf_hdr_id2int(hdr, BCF_DT_ID, "PASS")

bcf_add_id
int bcf_add_id(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* id)

bcf_update_id() - sets new ID string bcf_add_id() - adds to the ID string checking for duplicates

bcf_alleles2gt
auto bcf_alleles2gt(int a, int b)

Conversion between alleles indexes to Number=G genotype index (assuming diploid, all 0-based)

bcf_clear
void bcf_clear(bcf1_t* v)

Make the bcf1_t object ready for next read. Intended mostly for internal use, the user should rarely need to call this function directly.

bcf_copy
bcf1_t* bcf_copy(bcf1_t* dst, bcf1_t* src)

bcf_dup() - create a copy of BCF record.

bcf_destroy
void bcf_destroy(bcf1_t* v)

Deallocate a bcf1_t object

bcf_dup
bcf1_t* bcf_dup(bcf1_t* src)

bcf_dup() - create a copy of BCF record.

bcf_empty
void bcf_empty(bcf1_t* v)

Same as bcf_destroy() but frees only the memory allocated by bcf1_t, not the bcf1_t object itself.

bcf_enc_int1
int bcf_enc_int1(kstring_t* s, int32_t x)

Undocumented Encode integer variant 1

bcf_enc_inttype
int bcf_enc_inttype(long x)

Undocumented Encode integer type?

bcf_enc_size
int bcf_enc_size(kstring_t* s, int size, int type)

ditto Undocumented Encode size?

bcf_enc_vchar
int bcf_enc_vchar(kstring_t* s, int l, const(char)* a)

@param s kstring to write into @param l length of input @param a input data to encode @return 0 on success; < 0 on error

bcf_enc_vfloat
int bcf_enc_vfloat(kstring_t* s, int n, float* a)

@param s kstring to write into @param n total number of items in @p a (<= 0 to encode BCF_BT_NULL) @param a input data to encode @return 0 on success; < 0 on error

bcf_enc_vint
int bcf_enc_vint(kstring_t* s, int n, int32_t* a, int wsize)

@param s kstring to write into @param n total number of items in @p a (<= 0 to encode BCF_BT_NULL) @param a input data to encode @param wsize vector length (<= 0 is equivalent to @p n) @return 0 on success; < 0 on error @note @p n should be an exact multiple of @p wsize

bcf_float_is_missing
int bcf_float_is_missing(float f)
bcf_float_is_vector_end
int bcf_float_is_vector_end(float f)

u wot

bcf_float_set
void bcf_float_set(float* ptr, uint32_t value)

u wot

bcf_float_set_missing
void bcf_float_set_missing(float x)

float vector macros

bcf_float_set_vector_end
void bcf_float_set_vector_end(float x)

float vector macros

bcf_fmt_array
int bcf_fmt_array(kstring_t* s, int n, int type, void* data)
bcf_fmt_sized_array
uint8_t* bcf_fmt_sized_array(kstring_t* s, uint8_t* ptr)

@param s kstring to write into @param n number of items in @p data @param type type of items in @p data @param data BCF format data @return 0 on success -1 if out of memory

bcf_format_gt
int bcf_format_gt(bcf_fmt_t* fmt, int isample, kstring_t* str)

(Undocumented) Format GT field

bcf_get_fmt
bcf_fmt_t* bcf_get_fmt(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key)

bcf_get_fmt() - returns pointer to FORMAT's field data @header: for access to BCF_DT_ID dictionary @line: VCF line obtained from vcf_parse1 @fmt: one of GT,PL,...

bcf_get_fmt_id
bcf_fmt_t* bcf_get_fmt_id(bcf1_t* line, int id)

bcf_get_*_id() - returns pointer to FORMAT/INFO field data given the header index instead of the string ID @line: VCF line obtained from vcf_parse1 @id: The header index for the tag, obtained from bcf_hdr_id2int()

bcf_get_format_char
auto bcf_get_format_char(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_format_float
auto bcf_get_format_float(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_format_int32
auto bcf_get_format_int32(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_format_string
int bcf_get_format_string(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, char*** dst, int* ndst)
bcf_get_format_values
int bcf_get_format_values(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst, int type)

bcf_get_format_*() - same as bcf_get_info*() above

bcf_get_genotypes
auto bcf_get_genotypes(const(bcf_hdr_t)* hdr, bcf1_t* line, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_info
bcf_info_t* bcf_get_info(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key)

bcf_get_fmt() - returns pointer to FORMAT's field data @header: for access to BCF_DT_ID dictionary @line: VCF line obtained from vcf_parse1 @fmt: one of GT,PL,...

bcf_get_info_flag
auto bcf_get_info_flag(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_info_float
auto bcf_get_info_float(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_info_id
bcf_info_t* bcf_get_info_id(bcf1_t* line, int id)

bcf_get_*_id() - returns pointer to FORMAT/INFO field data given the header index instead of the string ID @line: VCF line obtained from vcf_parse1 @id: The header index for the tag, obtained from bcf_hdr_id2int()

bcf_get_info_int32
auto bcf_get_info_int32(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

bcf_get_info_*() - get INFO values, integers or floats @param hdr: BCF header @param line: BCF record @param tag: INFO tag to retrieve @param dst: *dst is pointer to a memory location, can point to NULL @param ndst: pointer to the size of allocated memory @return >=0 on success -1 .. no such INFO tag defined in the header -2 .. clash between types defined in the header and encountered in the VCF record -3 .. tag is not present in the VCF record -4 .. the operation could not be completed (e.g. out of memory)

bcf_get_info_int64
auto bcf_get_info_int64(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, int64_t** dst, int* ndst)

@param hdr: BCF header @param line: BCF record @param tag: INFO tag to retrieve @param dst: *dst is pointer to a memory location, can point to NULL @param ndst: pointer to the size of allocated memory @return >=0 on success -1 .. no such INFO tag defined in the header -2 .. clash between types defined in the header and encountered in the VCF record -3 .. tag is not present in the VCF record -4 .. the operation could not be completed (e.g. out of memory)

bcf_get_info_string
auto bcf_get_info_string(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_get_info_values
int bcf_get_info_values(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* tag, void** dst, int* ndst, int type)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_get_variant_type
int bcf_get_variant_type(bcf1_t* rec, int ith_allele)

bcf_get_variant_types - returns one of VCF_REF, VCF_SNP, etc

bcf_get_variant_types
int bcf_get_variant_types(bcf1_t* rec)

bcf_get_variant_types - returns one of VCF_REF, VCF_SNP, etc

bcf_gt2alleles
void bcf_gt2alleles(int igt, int* a, int* b)

Conversion between alleles indexes to Number=G genotype index (assuming diploid, all 0-based)

bcf_gt_allele
auto bcf_gt_allele(int val)
bcf_gt_is_missing
auto bcf_gt_is_missing(int val)
bcf_gt_is_phased
auto bcf_gt_is_phased(int idx)

Macros for setting genotypes correctly, for use with bcf_update_genotypes only; idx corresponds to VCF's GT (1-based index to ALT or 0 for the reference allele) and val is the opposite, obtained from bcf_get_genotypes() below.

bcf_gt_phased
auto bcf_gt_phased(int idx)
bcf_gt_unphased
auto bcf_gt_unphased(int idx)

Macros for setting genotypes correctly, for use with bcf_update_genotypes only; idx corresponds to VCF's GT (1-based index to ALT or 0 for the reference allele) and val is the opposite, obtained from bcf_get_genotypes() below.

bcf_has_filter
int bcf_has_filter(const(bcf_hdr_t)* hdr, bcf1_t* line, char* filter)

Returns 1 if present, 0 if absent, or -1 if filter does not exist. "PASS" and "." can be used interchangeably.

bcf_hdr_add_hrec
int bcf_hdr_add_hrec(bcf_hdr_t* hdr, bcf_hrec_t* hrec)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_hdr_add_sample
int bcf_hdr_add_sample(bcf_hdr_t* hdr, const(char)* sample)

bcf_hdr_add_sample() - add a new sample. @param sample: sample name to be added

bcf_hdr_append
int bcf_hdr_append(bcf_hdr_t* h, const(char)* line)

Append new VCF header line, returns 0 on success

bcf_hdr_combine
int bcf_hdr_combine(bcf_hdr_t* dst, const(bcf_hdr_t)* src)

Copy header lines from src to dst if not already present in dst. See also bcf_translate(). Returns 0 on success or sets a bit on error: 1 .. conflicting definitions of tag length // todo

bcf_hdr_destroy
void bcf_hdr_destroy(bcf_hdr_t* h)

Destroy a BCF header struct

bcf_hdr_dup
bcf_hdr_t* bcf_hdr_dup(const(bcf_hdr_t)* hdr)

Create a new header using the supplied template

bcf_hdr_fmt_text
char* bcf_hdr_fmt_text(const(bcf_hdr_t)* hdr, int is_bcf, int* len)

Returns formatted header (newly allocated string) and its length, excluding the terminating \0. If is_bcf parameter is unset, IDX fields are discarded. @deprecated Use bcf_hdr_format() instead as it can handle huge headers.

bcf_hdr_format
int bcf_hdr_format(const(bcf_hdr_t)* hdr, int is_bcf, kstring_t* str)

If _is_bcf_ is zero, IDX fields are discarded. @return 0 if successful, or negative if an error occurred @since 1.4

bcf_hdr_get_hrec
bcf_hrec_t* bcf_hdr_get_hrec(const(bcf_hdr_t)* hdr, int type, const(char)* key, const(char)* value, const(char)* str_class)

bcf_hdr_get_hrec() - get header line info @param type: one of the BCF_HL_* types: FLT,INFO,FMT,CTG,STR,GEN @param key: the header key for generic lines (e.g. "fileformat"), any field for structured lines, typically "ID". @param value: the value which pairs with key. Can be be NULL for BCF_HL_GEN @param str_class: the class of BCF_HL_STR line (e.g. "ALT" or "SAMPLE"), otherwise NULL

bcf_hdr_get_version
const(char)* bcf_hdr_get_version(const(bcf_hdr_t)* hdr)

VCF version, e.g. VCFv4.2

bcf_hdr_id2coltype
uint32_t bcf_hdr_id2coltype(const(bcf_hdr_t)* hdr, int type, int int_id)
bcf_hdr_id2hrc
auto bcf_hdr_id2hrc(const(bcf_hdr_t)* hdr, int dict_type, int col_type, int int_id)

bcf_hdr_id2*() - Macros for accessing bcf_idinfo_t @type: one of BCF_HL_FLT, BCF_HL_INFO, BCF_HL_FMT @int_id: return value of bcf_hdr_id2int, must be >=0

bcf_hdr_id2int
int bcf_hdr_id2int(const(bcf_hdr_t)* hdr, int type, const(char)* id)

bcf_hdr_id2int() - Translates string into numeric ID bcf_hdr_int2id() - Translates numeric ID into string @type: one of BCF_DT_ID, BCF_DT_CTG, BCF_DT_SAMPLE @id: tag name, such as: PL, DP, GT, etc.

bcf_hdr_id2length
auto bcf_hdr_id2length(const(bcf_hdr_t)* hdr, int type, int int_id)

bcf_hdr_id2*() - Macros for accessing bcf_idinfo_t @type: one of BCF_HL_FLT, BCF_HL_INFO, BCF_HL_FMT @int_id: return value of bcf_hdr_id2int, must be >=0

bcf_hdr_id2name
const(char)* bcf_hdr_id2name(const(bcf_hdr_t)* hdr, int rid)

bcf_hdr_name2id() - Translates sequence names (chromosomes) into numeric ID bcf_hdr_id2name() - Translates numeric ID to sequence name

bcf_hdr_id2number
auto bcf_hdr_id2number(const(bcf_hdr_t)* hdr, int type, int int_id)
bcf_hdr_id2type
uint32_t bcf_hdr_id2type(const(bcf_hdr_t)* hdr, int type, int int_id)
bcf_hdr_idinfo_exists
auto bcf_hdr_idinfo_exists(const(bcf_hdr_t)* hdr, int type, int int_id)

bcf_hdr_id2*() - Macros for accessing bcf_idinfo_t @type: one of BCF_HL_FLT, BCF_HL_INFO, BCF_HL_FMT @int_id: return value of bcf_hdr_id2int, must be >=0

bcf_hdr_init
bcf_hdr_t* bcf_hdr_init(const(char)* mode)

bcf_hdr_init() - create an empty BCF header. @param mode "r" or "w"

bcf_hdr_int2id
auto bcf_hdr_int2id(const(bcf_hdr_t)* hdr, int type, int int_id)

bcf_hdr_id2int() - Translates string into numeric ID bcf_hdr_int2id() - Translates numeric ID into string @type: one of BCF_DT_ID, BCF_DT_CTG, BCF_DT_SAMPLE @id: tag name, such as: PL, DP, GT, etc.

bcf_hdr_merge
bcf_hdr_t* bcf_hdr_merge(bcf_hdr_t* dst, const(bcf_hdr_t)* src)

bcf_hdr_merge() - copy header lines from src to dst, see also bcf_translate() @param dst: the destination header to be merged into, NULL on the first pass @param src: the source header

bcf_hdr_name2id
int bcf_hdr_name2id(const(bcf_hdr_t)* hdr, const(char)* id)

bcf_hdr_name2id() - Translates sequence names (chromosomes) into numeric ID bcf_hdr_id2name() - Translates numeric ID to sequence name

bcf_hdr_nsamples
auto bcf_hdr_nsamples(bcf_hdr_t* hdr)

Get number of samples

bcf_hdr_parse
int bcf_hdr_parse(bcf_hdr_t* hdr, char* htxt)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_hdr_parse_line
bcf_hrec_t* bcf_hdr_parse_line(const(bcf_hdr_t)* h, const(char)* line, int* len)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_hdr_printf
int bcf_hdr_printf(bcf_hdr_t* h, const(char)* format, ...)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_hdr_read
bcf_hdr_t* bcf_hdr_read(htsFile* fp)

@param fp The file to read the header from @return Pointer to a populated header structure on success; NULL on failure

bcf_hdr_remove
void bcf_hdr_remove(bcf_hdr_t* h, int type, const(char)* key)

bcf_hdr_remove() - remove VCF header tag @param type: one of BCF_HL_* @param key: tag name or NULL to remove all tags of the given type

bcf_hdr_seqnames
const(char)** bcf_hdr_seqnames(const(bcf_hdr_t)* h, int* nseqs)

Creates a list of sequence names. It is up to the caller to free the list (but not the sequence names)

bcf_hdr_set
int bcf_hdr_set(bcf_hdr_t* hdr, const(char)* fname)

Read VCF header from a file and update the header

bcf_hdr_set_samples
int bcf_hdr_set_samples(bcf_hdr_t* hdr, const(char)* samples, int is_file)

bcf_hdr_set_samples() - for more efficient VCF parsing when only one/few samples are needed @param samples samples to include or exclude from file or as a comma-separated string. LIST|FILE .. select samples in list/file ^LIST|FILE .. exclude samples from list/file - .. include all samples NULL .. exclude all samples @param is_file @p samples is a file (1) or a comma-separated list (0)

bcf_hdr_set_version
void bcf_hdr_set_version(bcf_hdr_t* hdr, const(char)* _version)

@param hdr BCF header struct @param version Version to set, e.g. "VCFv4.3" @return 0 on success; < 0 on error NB: mangled second parameter to _version

bcf_hdr_subset
bcf_hdr_t* bcf_hdr_subset(const(bcf_hdr_t)* h0, int n, const(char*)* samples, int* imap)

bcf_hdr_subset() - creates a new copy of the header removing unwanted samples @param n: number of samples to keep @param samples: names of the samples to keep @param imap: mapping from index in @samples to the sample index in the original file

bcf_hdr_sync
int bcf_hdr_sync(bcf_hdr_t* h)

@param h Header @return 0 on success, -1 on failure

bcf_hdr_write
int bcf_hdr_write(htsFile* fp, bcf_hdr_t* h)

@param fp Output file @param h The header to write @return 0 on success; -1 on failure

bcf_hrec_add_key
void bcf_hrec_add_key(bcf_hrec_t* hrec, const(char)* str, size_t len)

@param hrec Header record @param str Key name @param len Length of @p str @return 0 on success; -1 on failure

bcf_hrec_destroy
void bcf_hrec_destroy(bcf_hrec_t* hrec)

@param hrec Header record

bcf_hrec_dup
bcf_hrec_t* bcf_hrec_dup(bcf_hrec_t* hrec)

@param hrec Header record to copy @return A new header record on success; NULL on failure

bcf_hrec_find_key
int bcf_hrec_find_key(bcf_hrec_t* hrec, const(char)* key)

Lookup header record by key

bcf_hrec_format
int bcf_hrec_format(const(bcf_hrec_t)* hrec, kstring_t* str)

@param hrec Header record @param str Destination kstring @return 0 on success; < 0 on error

bcf_hrec_set_val
void bcf_hrec_set_val(bcf_hrec_t* hrec, int i, const(char)* str, size_t len, int is_quoted)

@param hrec Header record @param i Index of value @param str Value to set @param len Length of @p str @param is_quoted Value should be quoted @return 0 on success; -1 on failure

bcf_idx_init
int bcf_idx_init(htsFile* fp, bcf_hdr_t* h, int min_shift, const(char)* fnidx)

@param fp File handle for the data file being written. @param h BCF header structured (needed for BAI and CSI). @param min_shift CSI bin size (CSI default is 14). @param fnidx Filename to write index to. This pointer must remain valid until after bcf_idx_save is called. @return 0 on success, <0 on failure. @note This must be called after the header has been written, but before any other data.

bcf_idx_save
int bcf_idx_save(htsFile* fp)

@param fp File handle for the data file being written. @return 0 on success, <0 on failure.

bcf_index_build
int bcf_index_build(const(char)* fn, int min_shift)

bcf_index_build() - Generate and save an index file @fn: Input VCF(compressed)/BCF filename @min_shift: log2(width of the smallest bin), e.g. a value of 14 imposes a 16k base lower limit on the width of index bins. Positive to generate CSI, or 0 to generate TBI. However, a small value of min_shift would create a large index, which would lead to reduced performance when using the index. A recommended value is 14. For BCF files, only the CSI index can be generated.

bcf_index_build2
int bcf_index_build2(const(char)* fn, const(char)* fnidx, int min_shift)

bcf_index_build2() - Generate and save an index to a specific file @fn: Input VCF/BCF filename @fnidx: Output filename, or NULL to add .csi/.tbi to @fn @min_shift: Positive to generate CSI, or 0 to generate TBI

bcf_index_build3
int bcf_index_build3(const(char)* fn, const(char)* fnidx, int min_shift, int n_threads)

bcf_index_build3() - Generate and save an index to a specific file @fn: Input VCF/BCF filename @fnidx: Output filename, or NULL to add .csi/.tbi to @fn @min_shift: Positive to generate CSI, or 0 to generate TBI @n_threads: Number of VCF/BCF decoder threads

bcf_index_load
auto bcf_index_load(const(char)* fn)

@param fn BCF file name @return The index, or NULL if an error occurred. @note This only works for BCF files. Consider synced_bcf_reader instead which works for both BCF and VCF.

bcf_index_load2
hts_idx_t* bcf_index_load2(const(char)* fn, const(char)* fnidx)

@param fn Input BAM/BCF/etc filename @param fnidx The input index filename @return The index, or NULL if an error occurred. @note This only works for BCF files. Consider synced_bcf_reader instead which works for both BCF and VCF.

bcf_index_load3
hts_idx_t* bcf_index_load3(const(char)* fn, const(char)* fnidx, int flags)

@param fn Input BAM/BCF/etc filename @param fnidx The input index filename @param flags Flags to alter behaviour (see description) @return The index, or NULL if an error occurred. @note This only works for BCF files. Consider synced_bcf_reader instead which works for both BCF and VCF.

bcf_index_seqnames
auto bcf_index_seqnames(const(hts_idx_t)* idx, const(bcf_hdr_t)* hdr, int* nptr)

Get a list (char **) of sequence names from the index -- free only the array, not the values

bcf_init
bcf1_t* bcf_init()

Allocate and initialize a bcf1_t object.

bcf_is_snp
int bcf_is_snp(bcf1_t* v)

returns int as ersatz bool, but dlang bool is 8-bit

bcf_itr_next
int bcf_itr_next(htsFile* htsfp, hts_itr_t* itr, void* r)

Iterate through the range r should (probably) point to your VCF (BCF) row structure TODO: attempt to define parameter r as bcf1_t *, which is what I think it should be

bcf_itr_queryi
auto bcf_itr_queryi(const(hts_idx_t)* idx, int tid, int beg, int end)

Generate an iterator for an integer-based range query

bcf_itr_querys
auto bcf_itr_querys(const(hts_idx_t)* idx, const(bcf_hdr_t)* hdr, const(char)* s)

Generate an iterator for a string-based range query

bcf_read
int bcf_read(htsFile* fp, const(bcf_hdr_t)* h, bcf1_t* v)

@param fp The file to read the record from @param h The header for the vcf/bcf file @param v The bcf1_t structure to populate @return 0 on success; -1 on end of file; < -1 on critical error

bcf_readrec
int bcf_readrec(BGZF* fp, void* _null, void* v, int* tid, hts_pos_t* beg, hts_pos_t* end)

NOTE: C API second parameter called "null", mangled here as _null

bcf_remove_filter
int bcf_remove_filter(const(bcf_hdr_t)* hdr, bcf1_t* line, int flt_id, int pass)

bcf_remove_filter() - removes from the FILTER column @flt_id: filter ID to remove, numeric ID returned by bcf_hdr_id2int(hdr, BCF_DT_ID, "PASS") @pass: when set to 1 and no filters are present, set to PASS

bcf_seqname
const(char)* bcf_seqname(const(bcf_hdr_t)* hdr, bcf1_t* rec)

bcf_hdr_name2id() - Translates sequence names (chromosomes) into numeric ID bcf_hdr_id2name() - Translates numeric ID to sequence name

bcf_subset
int bcf_subset(const(bcf_hdr_t)* h, bcf1_t* v, int n, int* imap)

See the description of bcf_hdr_subset()

bcf_subset_format
int bcf_subset_format(const(bcf_hdr_t)* hdr, bcf1_t* rec)

bcf_hdr_set_samples() - for more efficient VCF parsing when only one/few samples are needed @param samples samples to include or exclude from file or as a comma-separated string. LIST|FILE .. select samples in list/file ^LIST|FILE .. exclude samples from list/file - .. include all samples NULL .. exclude all samples @param is_file @p samples is a file (1) or a comma-separated list (0)

bcf_translate
int bcf_translate(const(bcf_hdr_t)* dst_hdr, bcf_hdr_t* src_hdr, bcf1_t* src_line)

bcf_translate() - translate tags ids to be consistent with different header. This function is useful when lines from multiple VCF need to be combined. @dst_hdr: the destination header, to be used in bcf_write(), see also bcf_hdr_combine() @src_hdr: the source header, used in bcf_read() @src_line: line obtained by bcf_read()

bcf_unpack
int bcf_unpack(bcf1_t* b, int which)

bcf_unpack() - unpack/decode a BCF record (fills the bcf1_t::d field)

bcf_update_alleles
int bcf_update_alleles(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)** alleles, int nals)
bcf_update_alleles_str
int bcf_update_alleles_str(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* alleles_string)

bcf_update_alleles() and bcf_update_alleles_str() - update REF and ALLT column @alleles: Array of alleles @nals: Number of alleles @alleles_string: Comma-separated alleles, starting with the REF allele

bcf_update_filter
int bcf_update_filter(const(bcf_hdr_t)* hdr, bcf1_t* line, int* flt_ids, int n)

bcf_update_filter() - sets the FILTER column @flt_ids: The filter IDs to set, numeric IDs returned by bcf_hdr_id2int(hdr, BCF_DT_ID, "PASS") @n: Number of filters. If n==0, all filters are removed

bcf_update_format
int bcf_update_format(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values, int n, int type)

bcf_update_format_*() - functions for updating FORMAT fields @values: pointer to the array of values, the same number of elements is expected for each sample. Missing values must be padded with bcf_*_missing or bcf_*_vector_end values. @n: number of values in the array. If n==0, existing tag is removed.

bcf_update_format_char
auto bcf_update_format_char(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(char)** values, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_format_float
auto bcf_update_format_float(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(float)* values, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_format_int32
auto bcf_update_format_int32(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(int)* values, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_format_string
int bcf_update_format_string(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(char)** values, int n)

bcf_update_format_*() - functions for updating FORMAT fields @values: pointer to the array of values, the same number of elements is expected for each sample. Missing values must be padded with bcf_*_missing or bcf_*_vector_end values. @n: number of values in the array. If n==0, existing tag is removed.

bcf_update_genotypes
auto bcf_update_genotypes(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)** gts, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_id
int bcf_update_id(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* id)

bcf_update_id() - sets new ID string bcf_add_id() - adds to the ID string checking for duplicates

bcf_update_info
int bcf_update_info(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values, int n, int type)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_update_info_flag
auto bcf_update_info_flag(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_info_float
auto bcf_update_info_float(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values, int n)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_update_info_int32
auto bcf_update_info_int32(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values, int n)

bcf_update_info_*() - functions for updating INFO fields @param hdr: the BCF header @param line: VCF line to be edited @param key: the INFO tag to be updated @param values: pointer to the array of values. Pass NULL to remove the tag. @param n: number of values in the array. When set to 0, the INFO tag is removed @return 0 on success or negative value on error.

bcf_update_info_int64
auto bcf_update_info_int64(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(int64_t)* values, int n)

@param hdr: the BCF header @param line: VCF line to be edited @param key: the INFO tag to be updated @param values: pointer to the array of values. Pass NULL to remove the tag. @param n: number of values in the array. When set to 0, the INFO tag is removed @return 0 on success or negative value on error.

bcf_update_info_string
auto bcf_update_info_string(const(bcf_hdr_t)* hdr, bcf1_t* line, const(char)* key, const(void)* values)

Undocumented in source. Be warned that the author may not have intended to support it.

bcf_write
int bcf_write(htsFile* fp, bcf_hdr_t* h, bcf1_t* v)

@param fp The file to write to @param h The header for the vcf/bcf file @param v The bcf1_t structure to write @return 0 on success; -1 on error

hrec_add_idx
void hrec_add_idx(bcf_hrec_t* hrec, int idx)

@param hrec Header record @param idx IDX value to add @return 0 on success; -1 on failure

vcf_format
int vcf_format(const(bcf_hdr_t)* h, const(bcf1_t)* v, kstring_t* s)

The opposite of vcf_parse. It should rarely be called directly, see vcf_write

vcf_hdr_read
bcf_hdr_t* vcf_hdr_read(htsFile* fp)

@param fp The file to read the header from @return Pointer to a populated header structure on success; NULL on failure

vcf_hdr_write
int vcf_hdr_write(htsFile* fp, const(bcf_hdr_t)* h)

@param fp Output file @param h The header to write @return 0 on success; -1 on failure

vcf_parse
int vcf_parse(kstring_t* s, const(bcf_hdr_t)* h, bcf1_t* v)

Parse VCF line contained in kstring and populate the bcf1_t struct The line must not end with \n or \r characters.

vcf_read
int vcf_read(htsFile* fp, const(bcf_hdr_t)* h, bcf1_t* v)

@param fp The file to read the record from @param h The header for the vcf file @param v The bcf1_t structure to populate @return 0 on success; -1 on end of file; < -1 on error

vcf_write
int vcf_write(htsFile* fp, const(bcf_hdr_t)* h, bcf1_t* v)

@param fp The file to write to @param h The header for the vcf file @param v The bcf1_t structure to write @return 0 on success; -1 on error

vcf_write_line
int vcf_write_line(htsFile* fp, kstring_t* line)

@param line Line to write @param fp File to write it to @return 0 on success; -1 on failure

Static variables

bcf_float_missing
uint32_t bcf_float_missing;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_float_vector_end
uint32_t bcf_float_vector_end;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_type_shift
uint8_t[16] bcf_type_shift;

Lookup table used in bcf_record_check MAINTAINER: in C header is []

Structs

bcf1_t
struct bcf1_t

The bcf1_t structure corresponds to one VCF/BCF line. Reading from VCF file is slower because the string is first to be parsed, packed into BCF line (done in vcf_parse), then unpacked into internal bcf1_t structure. If it is known in advance that some of the fields will not be required (notably the sample columns), parsing of these can be skipped by setting max_unpack appropriately. Similarly, it is fast to output a BCF line because the columns (kept in shared.s, indiv.s, etc.) are written directly by bcf_write, whereas a VCF line must be formatted in vcf_format.

bcf_dec_t
struct bcf_dec_t

Variable-length data from a VCF record

bcf_fmt_t
struct bcf_fmt_t

FORMAT field data (§1.4.2 Genotype fields)

bcf_hdr_t
struct bcf_hdr_t

Structured repreentation of VCF header (§1.2) Note that bcf_hdr_t structs must always be created via bcf_hdr_init()

bcf_hrec_t
struct bcf_hrec_t

Structured representation of a header line (§1.2)

bcf_idinfo_t
struct bcf_idinfo_t

ID Dictionary entry

bcf_idpair_t
struct bcf_idpair_t

ID Dictionary k/v

bcf_info_t
struct bcf_info_t

INFO field data (§1.4.1 Fixed fields, (8) INFO)

variant_t
struct variant_t

variant type record embedded in bcf_dec_t variant type and the number of bases affected, negative for deletions

Variables

BCF1_DIRTY_ALS
enum int BCF1_DIRTY_ALS;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF1_DIRTY_FLT
enum int BCF1_DIRTY_FLT;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF1_DIRTY_ID
enum int BCF1_DIRTY_ID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF1_DIRTY_INF
enum int BCF1_DIRTY_INF;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_CHAR
enum int BCF_BT_CHAR;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_FLOAT
enum int BCF_BT_FLOAT;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_INT16
enum int BCF_BT_INT16;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_INT32
enum int BCF_BT_INT32;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_INT64
enum int BCF_BT_INT64;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_INT8
enum int BCF_BT_INT8;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_BT_NULL
enum int BCF_BT_NULL;

VCF record *

BCF_DT_CTG
enum int BCF_DT_CTG;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_DT_ID
enum int BCF_DT_ID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_DT_SAMPLE
enum int BCF_DT_SAMPLE;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_CHAR
enum int BCF_ERR_CHAR;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_CTG_INVALID
enum int BCF_ERR_CTG_INVALID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_CTG_UNDEF
enum int BCF_ERR_CTG_UNDEF;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_LIMITS
enum int BCF_ERR_LIMITS;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_NCOLS
enum int BCF_ERR_NCOLS;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_TAG_INVALID
enum int BCF_ERR_TAG_INVALID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_ERR_TAG_UNDEF
enum int BCF_ERR_TAG_UNDEF;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MAX_BT_INT16
enum int16_t BCF_MAX_BT_INT16;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MAX_BT_INT32
enum int32_t BCF_MAX_BT_INT32;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MAX_BT_INT8
enum int8_t BCF_MAX_BT_INT8;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MIN_BT_INT16
enum int16_t BCF_MIN_BT_INT16;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MIN_BT_INT32
enum int32_t BCF_MIN_BT_INT32;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_MIN_BT_INT8
enum int8_t BCF_MIN_BT_INT8;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_ALL
enum int BCF_UN_ALL;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_FLT
enum int BCF_UN_FLT;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_FMT
enum int BCF_UN_FMT;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_INFO
enum int BCF_UN_INFO;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_SHR
enum int BCF_UN_SHR;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BCF_UN_STR
enum int BCF_UN_STR;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_BND
enum int VCF_BND;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_INDEL
enum int VCF_INDEL;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_MNP
enum int VCF_MNP;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_OTHER
enum int VCF_OTHER;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_OVERLAP
enum int VCF_OVERLAP;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_REF
enum int VCF_REF;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

VCF_SNP
enum int VCF_SNP;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

bcf_gt_missing
enum int bcf_gt_missing;

Macros for setting genotypes correctly, for use with bcf_update_genotypes only; idx corresponds to VCF's GT (1-based index to ALT or 0 for the reference allele) and val is the opposite, obtained from bcf_get_genotypes() below.

bcf_int16_missing
enum int16_t bcf_int16_missing;
bcf_int16_vector_end
enum int16_t bcf_int16_vector_end;
bcf_int32_missing
enum int32_t bcf_int32_missing;
bcf_int32_vector_end
enum int32_t bcf_int32_vector_end;
bcf_int64_missing
enum int64_t bcf_int64_missing;
bcf_int64_vector_end
enum int64_t bcf_int64_vector_end;
bcf_int8_missing
enum int8_t bcf_int8_missing;

Note that in contrast with BCFv2.1 specification, HTSlib implementation allows missing values in vectors. For integer types, the values 0x80, 0x8000, 0x80000000 are interpreted as missing values and 0x81, 0x8001, 0x80000001 as end-of-vector indicators. Similarly for floats, the value of 0x7F800001 is interpreted as a missing value and 0x7F800002 as an end-of-vector indicator. Note that the end-of-vector byte is not part of the vector.

bcf_int8_vector_end
enum int8_t bcf_int8_vector_end;
bcf_str_missing
enum char bcf_str_missing;
bcf_str_vector_end
enum char bcf_str_vector_end;

Note that in contrast with BCFv2.1 specification, HTSlib implementation allows missing values in vectors. For integer types, the values 0x80, 0x8000, 0x80000000 are interpreted as missing values and 0x81, 0x8001, 0x80000001 as end-of-vector indicators. Similarly for floats, the value of 0x7F800001 is interpreted as a missing value and 0x7F800002 as an end-of-vector indicator. Note that the end-of-vector byte is not part of the vector.

Meta