dhtslib.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_inttype
int bcf_enc_inttype(long x)

ditto ditto ditto

bcf_enc_vchar
void bcf_enc_vchar(kstring_t* s, int l, const(char)* a)
bcf_enc_vfloat
void bcf_enc_vfloat(kstring_t* s, int n, float* a)
bcf_enc_vint
void bcf_enc_vint(kstring_t* s, int n, int32_t* a, int wsize)

Undocumented

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
void 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)

Undocumented

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)
Undocumented in source. Be warned that the author may not have intended to support it.
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)

bcf_get_info_*() - get INFO values, integers or floats @hdr: BCF header @line: BCF record @tag: INFO tag to retrieve @dst: *dst is pointer to a memory location, can point to NULL @ndst: pointer to the size of allocated memory

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)

The following functions are for internal use and should rarely be called directly

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
deprecated 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
deprecated 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
auto 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
auto 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)
bcf_hdr_parse_line
bcf_hrec_t* bcf_hdr_parse_line(const(bcf_hdr_t)* h, const(char)* line, int* len)

The following functions are for internal use and should rarely be called directly

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

Append new VCF header line, returns 0 on success

bcf_hdr_read
bcf_hdr_t* bcf_hdr_read(htsFile* fp)

Reads VCF or BCF header

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 @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 @is_file: @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)

Ditto 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)

The following functions are for internal use and should rarely be called directly

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

Writes VCF or BCF header

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

Add key to header record

bcf_hrec_destroy
void bcf_hrec_destroy(bcf_hrec_t* hrec)

Deallocate header record

bcf_hrec_dup
bcf_hrec_t* bcf_hrec_dup(bcf_hrec_t* hrec)

Duplicate header record

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

Lookup header record by key

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

The following functions are for internal use and should rarely be called directly

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

Set key's value for header record

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)

Load a BCF file's CSI index

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

Load BCF index with explicit fn and explicit index fn

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()

Initialize a bcf1_t object; equivalent to calloc(1, sizeof(bcf1_t))

bcf_is_snp
int bcf_is_snp(bcf1_t* v)

ditto (TODO: what is this? should this be bool?)

bcf_itr_next
auto 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)

bcf_read() - read next VCF or BCF record

bcf_readrec
int bcf_readrec(BGZF* fp, void* _null, void* v, int* tid, int* beg, int* 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 @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 @is_file: @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)

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

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)
Undocumented in source. Be warned that the author may not have intended to support it.
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)

bcf_write() - write one VCF or BCF record. The type is determined at the open() call.

hrec_add_idx
void hrec_add_idx(bcf_hrec_t* hrec, int idx)

Index header record

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)
vcf_hdr_write
int vcf_hdr_write(htsFile* fp, const(bcf_hdr_t)* h)

The following functions work only with VCFs and should rarely be called directly. Usually one wants to use their bcf_* alternatives, which work transparently with both VCFs and BCFs.

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)
vcf_write
int vcf_write(htsFile* fp, const(bcf_hdr_t)* h, bcf1_t* v)

The following functions work only with VCFs and should rarely be called directly. Usually one wants to use their bcf_* alternatives, which work transparently with both VCFs and BCFs.

Static variables

bcf_float_missing
uint32_t bcf_float_missing;
bcf_float_vector_end
uint32_t bcf_float_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.

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;

Allele(s) was edited

BCF1_DIRTY_FLT
enum int BCF1_DIRTY_FLT;

FILTER was edited

BCF1_DIRTY_ID
enum int BCF1_DIRTY_ID;

vptr offset, i.e., the size of the INFO key plus size+type bytes indicates that vptr-vptr_off must be freed; set only when modified and the new data block is bigger than the original +//// ID was edite

BCF1_DIRTY_INF
enum int BCF1_DIRTY_INF;

INFO was edited

BCF_BT_CHAR
enum int BCF_BT_CHAR;

char (8 bit)

BCF_BT_FLOAT
enum int BCF_BT_FLOAT;

float (32?)

BCF_BT_INT16
enum int BCF_BT_INT16;

int16

BCF_BT_INT32
enum int BCF_BT_INT32;

int32

BCF_BT_INT8
enum int BCF_BT_INT8;

int8

BCF_BT_NULL
enum int BCF_BT_NULL;

* VCF record * **************//// nul

BCF_DT_CTG
enum int BCF_DT_CTG;

dictionary type: CONTIG

BCF_DT_ID
enum int BCF_DT_ID;

dictionary type: ID

BCF_DT_SAMPLE
enum int BCF_DT_SAMPLE;

dictionary type: SAMPLE

BCF_ERR_CHAR
enum int BCF_ERR_CHAR;

BCF error:

BCF_ERR_CTG_INVALID
enum int BCF_ERR_CTG_INVALID;

BCF error:

BCF_ERR_CTG_UNDEF
enum int BCF_ERR_CTG_UNDEF;

BCF error: undefined contig

BCF_ERR_LIMITS
enum int BCF_ERR_LIMITS;

BCF error:

BCF_ERR_NCOLS
enum int BCF_ERR_NCOLS;

BCF error:

BCF_ERR_TAG_INVALID
enum int BCF_ERR_TAG_INVALID;

BCF error:

BCF_ERR_TAG_UNDEF
enum int BCF_ERR_TAG_UNDEF;

BCF error: undefined tag

BCF_UN_ALL
enum int BCF_UN_ALL;

everything

BCF_UN_FLT
enum int BCF_UN_FLT;

up to FILTER

BCF_UN_FMT
enum int BCF_UN_FMT;

unpack format and each sample

BCF_UN_INFO
enum int BCF_UN_INFO;

up to INFO

BCF_UN_SHR
enum int BCF_UN_SHR;

all shared information

BCF_UN_STR
enum int BCF_UN_STR;

up to ALT inclusive

VCF_BND
enum int VCF_BND;

breakend

VCF_INDEL
enum int VCF_INDEL;

INDEL

VCF_MNP
enum int VCF_MNP;

MNP

VCF_OTHER
enum int VCF_OTHER;

other (e.g. SV)

VCF_REF
enum int VCF_REF;

ref (e.g. in a gVCF)

VCF_SNP
enum int VCF_SNP;

SNP

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_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