NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions
vcf.c File Reference
#include <zlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include "htslib/kstring.h"
#include "htslib/bgzf.h"
#include "htslib/vcf.h"
#include "htslib/tbx.h"
#include "htslib/hfile.h"
#include "htslib/khash.h"
#include "htslib/kseq.h"

Go to the source code of this file.

Classes

struct  fmt_aux_t
 

Macros

#define bit_array_size(n)   ((n)/8+1)
 
#define bit_array_set(a, i)   ((a)[(i)/8] |= 1 << ((i)%8))
 
#define bit_array_clear(a, i)   ((a)[(i)/8] &= ~(1 << ((i)%8)))
 
#define bit_array_test(a, i)   ((a)[(i)/8] & (1 << ((i)%8)))
 
#define BRANCH(type_t, is_missing, is_vector_end, kprint)
 
#define BRANCH(type_t, is_missing, is_vector_end, set_missing, out_type_t)
 
#define BRANCH(type_t, is_missing, is_vector_end, set_missing, set_vector_end, out_type_t)
 

Functions

typedef khash_t (vdict)
 
int bcf_hdr_sync (bcf_hdr_t *h)
 
int bcf_hdr_add_sample (bcf_hdr_t *h, const char *s)
 
void bcf_hdr_parse_sample_line (bcf_hdr_t *h, const char *str)
 
void bcf_hrec_destroy (bcf_hrec_t *hrec)
 
bcf_hrec_tbcf_hrec_dup (bcf_hrec_t *hrec)
 
void bcf_hrec_debug (FILE *fp, bcf_hrec_t *hrec)
 
void bcf_header_debug (bcf_hdr_t *hdr)
 
void bcf_hrec_add_key (bcf_hrec_t *hrec, const char *str, int len)
 
void bcf_hrec_set_val (bcf_hrec_t *hrec, int i, const char *str, int len, int is_quoted)
 
void hrec_add_idx (bcf_hrec_t *hrec, int idx)
 
int bcf_hrec_find_key (bcf_hrec_t *hrec, const char *key)
 
bcf_hrec_tbcf_hdr_parse_line (const bcf_hdr_t *h, const char *line, int *len)
 
int bcf_hdr_register_hrec (bcf_hdr_t *hdr, bcf_hrec_t *hrec)
 
int bcf_hdr_add_hrec (bcf_hdr_t *hdr, bcf_hrec_t *hrec)
 
bcf_hrec_tbcf_hdr_get_hrec (const bcf_hdr_t *hdr, int type, const char *id)
 
void bcf_hdr_check_sanity (bcf_hdr_t *hdr)
 
int bcf_hdr_parse (bcf_hdr_t *hdr, char *htxt)
 
int bcf_hdr_append (bcf_hdr_t *hdr, const char *line)
 
void bcf_hdr_remove (bcf_hdr_t *hdr, int type, const char *key)
 
int bcf_hdr_printf (bcf_hdr_t *hdr, const char *fmt,...)
 
const char * bcf_hdr_get_version (const bcf_hdr_t *hdr)
 
void bcf_hdr_set_version (bcf_hdr_t *hdr, const char *version)
 
bcf_hdr_tbcf_hdr_init (const char *mode)
 
void bcf_hdr_destroy (bcf_hdr_t *h)
 
bcf_hdr_tbcf_hdr_read (htsFile *hfp)
 
int bcf_hdr_write (htsFile *hfp, const bcf_hdr_t *h)
 
bcf1_tbcf_init1 ()
 
void bcf_clear (bcf1_t *v)
 
void bcf_empty1 (bcf1_t *v)
 
void bcf_destroy1 (bcf1_t *v)
 
int bcf_subset_format (const bcf_hdr_t *hdr, bcf1_t *rec)
 
int bcf_read (htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
 
int bcf_readrec (BGZF *fp, void *null, void *vv, int *tid, int *beg, int *end)
 
bcf1_tbcf_dup (bcf1_t *src)
 
int bcf_write (htsFile *hfp, const bcf_hdr_t *h, bcf1_t *v)
 
bcf_hdr_tvcf_hdr_read (htsFile *fp)
 
int bcf_hdr_set (bcf_hdr_t *hdr, const char *fname)
 
void bcf_hrec_format (const bcf_hrec_t *hrec, kstring_t *str)
 
char * bcf_hdr_fmt_text (const bcf_hdr_t *hdr, int is_bcf, int *len)
 
const char ** bcf_hdr_seqnames (const bcf_hdr_t *h, int *n)
 
int vcf_hdr_write (htsFile *fp, const bcf_hdr_t *h)
 
void bcf_enc_vint (kstring_t *s, int n, int32_t *a, int wsize)
 
void bcf_enc_vfloat (kstring_t *s, int n, float *a)
 
void bcf_enc_vchar (kstring_t *s, int l, const char *a)
 
void bcf_fmt_array (kstring_t *s, int n, int type, void *data)
 
uint8_tbcf_fmt_sized_array (kstring_t *s, uint8_t *ptr)
 
int _vcf_parse_format (kstring_t *s, const bcf_hdr_t *h, bcf1_t *v, char *p, char *q)
 
int vcf_parse (kstring_t *s, const bcf_hdr_t *h, bcf1_t *v)
 
int vcf_read (htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
 
int bcf_unpack (bcf1_t *b, int which)
 
int vcf_format (const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s)
 
int vcf_write_line (htsFile *fp, kstring_t *line)
 
int vcf_write (htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
 
int bcf_hdr_id2int (const bcf_hdr_t *h, int which, const char *id)
 
hts_idx_tbcf_index (htsFile *fp, int min_shift)
 
int bcf_index_build (const char *fn, int min_shift)
 
void bcf_hdr_combine (bcf_hdr_t *dst, const bcf_hdr_t *src)
 
int bcf_translate (const bcf_hdr_t *dst_hdr, bcf_hdr_t *src_hdr, bcf1_t *line)
 
bcf_hdr_tbcf_hdr_dup (const bcf_hdr_t *hdr)
 
bcf_hdr_tbcf_hdr_subset (const bcf_hdr_t *h0, int n, char *const *samples, int *imap)
 
int bcf_hdr_set_samples (bcf_hdr_t *hdr, const char *samples, int is_file)
 
int bcf_subset (const bcf_hdr_t *h, bcf1_t *v, int n, int *imap)
 
int bcf_is_snp (bcf1_t *v)
 
int bcf_get_variant_types (bcf1_t *rec)
 
int bcf_get_variant_type (bcf1_t *rec, int ith_allele)
 
int bcf_update_info (const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const void *values, int n, int type)
 
int bcf_update_format_string (const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const char **values, int n)
 
int bcf_update_format (const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const void *values, int n, int type)
 
int bcf_update_filter (const bcf_hdr_t *hdr, bcf1_t *line, int *flt_ids, int n)
 
int bcf_add_filter (const bcf_hdr_t *hdr, bcf1_t *line, int flt_id)
 
int bcf_remove_filter (const bcf_hdr_t *hdr, bcf1_t *line, int flt_id, int pass)
 
int bcf_has_filter (const bcf_hdr_t *hdr, bcf1_t *line, char *filter)
 
int bcf_update_alleles (const bcf_hdr_t *hdr, bcf1_t *line, const char **alleles, int nals)
 
int bcf_update_alleles_str (const bcf_hdr_t *hdr, bcf1_t *line, const char *alleles_string)
 
int bcf_update_id (const bcf_hdr_t *hdr, bcf1_t *line, const char *id)
 
bcf_fmt_tbcf_get_fmt (const bcf_hdr_t *hdr, bcf1_t *line, const char *key)
 
bcf_info_tbcf_get_info (const bcf_hdr_t *hdr, bcf1_t *line, const char *key)
 
int bcf_get_info_values (const bcf_hdr_t *hdr, bcf1_t *line, const char *tag, void **dst, int *ndst, int type)
 
int bcf_get_format_string (const bcf_hdr_t *hdr, bcf1_t *line, const char *tag, char ***dst, int *ndst)
 
int bcf_get_format_values (const bcf_hdr_t *hdr, bcf1_t *line, const char *tag, void **dst, int *ndst, int type)
 

Macro Definition Documentation

#define bit_array_clear (   a,
 
)    ((a)[(i)/8] &= ~(1 << ((i)%8)))

Definition at line 808 of file vcf.c.

#define bit_array_set (   a,
 
)    ((a)[(i)/8] |= 1 << ((i)%8))

Definition at line 807 of file vcf.c.

#define bit_array_size (   n)    ((n)/8+1)

Definition at line 806 of file vcf.c.

#define bit_array_test (   a,
 
)    ((a)[(i)/8] & (1 << ((i)%8)))

Definition at line 809 of file vcf.c.

#define BRANCH (   type_t,
  is_missing,
  is_vector_end,
  kprint 
)
Value:
{ \
type_t *p = (type_t *) data; \
for (j=0; j<n; j++) \
{ \
if ( is_vector_end ) break; \
if ( j ) kputc(',', s); \
if ( is_missing ) kputc('.', s); \
else kprint; \
} \
}
#define BRANCH (   type_t,
  is_missing,
  is_vector_end,
  set_missing,
  out_type_t 
)
Value:
{ \
out_type_t *tmp = (out_type_t *) *dst; \
type_t *p = (type_t *) info->vptr; \
for (j=0; j<info->len; j++) \
{ \
if ( is_vector_end ) return j; \
if ( is_missing ) set_missing; \
else *tmp = p[j]; \
tmp++; \
} \
return j; \
}
#define BRANCH (   type_t,
  is_missing,
  is_vector_end,
  set_missing,
  set_vector_end,
  out_type_t 
)
Value:
{ \
out_type_t *tmp = (out_type_t *) *dst; \
type_t *p = (type_t*) fmt->p; \
for (i=0; i<nsmpl; i++) \
{ \
for (j=0; j<fmt->n; j++) \
{ \
if ( is_missing ) set_missing; \
else if ( is_vector_end ) { set_vector_end; break; } \
else *tmp = p[j]; \
tmp++; \
} \
for (; j<fmt->n; j++) { set_vector_end; tmp++; } \
p = (type_t *)((char *)p + fmt->size); \
} \
}

Function Documentation

int _vcf_parse_format ( kstring_t s,
const bcf_hdr_t h,
bcf1_t v,
char *  p,
char *  q 
)

Definition at line 1413 of file vcf.c.

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

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

If flt_id is PASS, all existing filters are removed first. If other than PASS, existing PASS is removed.

Definition at line 2707 of file vcf.c.

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.

Definition at line 733 of file vcf.c.

void bcf_destroy1 ( bcf1_t v)

Definition at line 775 of file vcf.c.

bcf1_t* bcf_dup ( bcf1_t src)

Definition at line 1055 of file vcf.c.

void bcf_empty1 ( bcf1_t v)

Definition at line 765 of file vcf.c.

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

Definition at line 1339 of file vcf.c.

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

Definition at line 1333 of file vcf.c.

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

Definition at line 1294 of file vcf.c.

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

Definition at line 1345 of file vcf.c.

uint8_t* bcf_fmt_sized_array ( kstring_t s,
uint8_t ptr 
)

Definition at line 1384 of file vcf.c.

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 : for access to BCF_DT_ID dictionary VCF line obtained from vcf_parse1 : one of GT,PL,...

Returns bcf_fmt_t* if the call succeeded, or returns NULL when the field is not available.

Definition at line 2829 of file vcf.c.

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

Definition at line 2917 of file vcf.c.

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

Definition at line 2955 of file vcf.c.

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

Definition at line 2841 of file vcf.c.

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

Definition at line 2853 of file vcf.c.

int bcf_get_variant_type ( bcf1_t rec,
int  ith_allele 
)

Definition at line 2476 of file vcf.c.

int bcf_get_variant_types ( bcf1_t rec)

bcf_get_variant_type[s]() - returns one of VCF_REF, VCF_SNP, etc

Definition at line 2471 of file vcf.c.

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.

Definition at line 2739 of file vcf.c.

int bcf_hdr_add_hrec ( bcf_hdr_t hdr,
bcf_hrec_t hrec 
)

Definition at line 428 of file vcf.c.

int bcf_hdr_add_sample ( bcf_hdr_t hdr,
const char *  sample 
)

bcf_hdr_add_sample() - add a new sample.

Parameters
sample,:Sample name to be added. After all samples have been added, NULL must be passed to update internal header structures.

Definition at line 32 of file vcf.c.

int bcf_hdr_append ( bcf_hdr_t h,
const char *  line 
)

Append new VCF header line, returns 0 on success

Definition at line 532 of file vcf.c.

void bcf_hdr_check_sanity ( bcf_hdr_t hdr)

Definition at line 481 of file vcf.c.

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

Definition at line 2112 of file vcf.c.

void bcf_hdr_destroy ( bcf_hdr_t h)

Destroy a BCF header struct

Definition at line 650 of file vcf.c.

bcf_hdr_t* bcf_hdr_dup ( const bcf_hdr_t hdr)

Create a new header using the supplied template

Definition at line 2251 of file vcf.c.

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.

Definition at line 1236 of file vcf.c.

bcf_hrec_t* bcf_hdr_get_hrec ( const bcf_hdr_t hdr,
int  type,
const char *  id 
)

Definition at line 463 of file vcf.c.

const char* bcf_hdr_get_version ( const bcf_hdr_t hdr)

Definition at line 604 of file vcf.c.

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 : one of BCF_DT_ID, BCF_DT_CTG, BCF_DT_SAMPLE : tag name, such as: PL, DP, GT, etc.

Returns -1 if string is not in dictionary, otherwise numeric ID which identifies fields in BCF records.

Definition at line 2044 of file vcf.c.

bcf_hdr_t* bcf_hdr_init ( const char *  mode)

bcf_hdr_init() - create an empty BCF header.

Parameters
mode"r" or "w"

When opened for writing, the mandatory fileFormat and FILTER=PASS lines are added automatically.

Definition at line 634 of file vcf.c.

int bcf_hdr_parse ( bcf_hdr_t hdr,
char *  htxt 
)

Definition at line 505 of file vcf.c.

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

Definition at line 244 of file vcf.c.

void bcf_hdr_parse_sample_line ( bcf_hdr_t h,
const char *  str 
)

Definition at line 67 of file vcf.c.

int bcf_hdr_printf ( bcf_hdr_t hdr,
const char *  fmt,
  ... 
)

Definition at line 581 of file vcf.c.

bcf_hdr_t* bcf_hdr_read ( htsFile fp)

Reads VCF or BCF header

Definition at line 672 of file vcf.c.

int bcf_hdr_register_hrec ( bcf_hdr_t hdr,
bcf_hrec_t hrec 
)

Definition at line 305 of file vcf.c.

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

bcf_hdr_remove() - remove VCF header tag

Parameters
type,:one of BCF_HL_*
key,:tag name

Definition at line 542 of file vcf.c.

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)

Definition at line 1256 of file vcf.c.

int bcf_hdr_set ( bcf_hdr_t hdr,
const char *  fname 
)

Read VCF header from a file and update the header

Definition at line 1193 of file vcf.c.

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 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 a file (1) or a comma-separated list (1)

The bottleneck of VCF reading is parsing of genotype fields. If the reader knows in advance that only subset of samples is needed (possibly no samples at all), the performance of bcf_read() can be significantly improved by calling bcf_hdr_set_samples after bcf_hdr_read(). The function bcf_read() will subset the VCF/BCF records automatically with the notable exception when reading records via bcf_itr_next(). In this case, bcf_subset_format() must be called explicitly, because bcf_readrec() does not see the header.

Returns 0 on success, -1 on error or a positive integer if the list contains samples not present in the VCF header. In such a case, the return value is the index of the offending sample.

Definition at line 2297 of file vcf.c.

void bcf_hdr_set_version ( bcf_hdr_t hdr,
const char *  version 
)

Definition at line 615 of file vcf.c.

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

bcf_hdr_subset() - creates a new copy of the header removing unwanted samples

Parameters
n,:number of samples to keep
samples,:names of the samples to keep
imap,:mapping from index in to the sample index in the original file

Sample names not present in h0 are ignored. The number of unmatched samples can be checked by comparing n and bcf_hdr_nsamples(out_hdr). This function can be used to reorder samples. See also bcf_subset() which subsets individual records.

Definition at line 2260 of file vcf.c.

int bcf_hdr_sync ( bcf_hdr_t h)

Definition at line 87 of file vcf.c.

int bcf_hdr_write ( htsFile fp,
const bcf_hdr_t h 
)

Writes VCF or BCF header

Definition at line 705 of file vcf.c.

void bcf_header_debug ( bcf_hdr_t hdr)

Definition at line 168 of file vcf.c.

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

Definition at line 186 of file vcf.c.

void bcf_hrec_debug ( FILE *  fp,
bcf_hrec_t hrec 
)

Definition at line 159 of file vcf.c.

void bcf_hrec_destroy ( bcf_hrec_t hrec)

Definition at line 122 of file vcf.c.

bcf_hrec_t* bcf_hrec_dup ( bcf_hrec_t hrec)

Definition at line 138 of file vcf.c.

int bcf_hrec_find_key ( bcf_hrec_t hrec,
const char *  key 
)

Definition at line 229 of file vcf.c.

void bcf_hrec_format ( const bcf_hrec_t hrec,
kstring_t str 
)

Definition at line 1232 of file vcf.c.

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

Definition at line 198 of file vcf.c.

hts_idx_t* bcf_index ( htsFile fp,
int  min_shift 
)

Definition at line 2057 of file vcf.c.

int bcf_index_build ( const char *  fn,
int  min_shift 
)

Definition at line 2094 of file vcf.c.

bcf1_t* bcf_init1 ( )

Definition at line 726 of file vcf.c.

int bcf_is_snp ( bcf1_t v)

Definition at line 2391 of file vcf.c.

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

bcf_read() - read next VCF or BCF record

Returns -1 on critical errors, 0 otherwise. On errors which are not critical for reading, such as missing header definitions, v->errcode is set to one of BCF_ERR* code and must be checked before calling vcf_write().

Definition at line 853 of file vcf.c.

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

Helper function for the bcf_itr_next() macro; internal use, ignore it

Definition at line 861 of file vcf.c.

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 : filter ID to remove, numeric ID returned by bcf_id2int(hdr, BCF_DT_ID, "PASS") : when set to 1 and no filters are present, set to PASS

Definition at line 2725 of file vcf.c.

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

See the description of bcf_hdr_subset()

Definition at line 2363 of file vcf.c.

int bcf_subset_format ( const bcf_hdr_t hdr,
bcf1_t rec 
)

Definition at line 812 of file vcf.c.

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. : the destination header, to be used in bcf_write(), see also bcf_hdr_combine() : the source header, used in bcf_read() : line obtained by bcf_read()

Definition at line 2137 of file vcf.c.

int bcf_unpack ( bcf1_t b,
int  which 
)

Definition at line 1859 of file vcf.c.

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

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

Not that in order for indexing to work correctly in presence of INFO/END tag, the length of reference allele (line->rlen) must be set explicitly by the caller, or otherwise, if rlen is zero, strlen(line->d.allele[0]) is used to set the length on bcf_write().

Definition at line 2772 of file vcf.c.

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

Definition at line 2799 of file vcf.c.

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

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

Definition at line 2694 of file vcf.c.

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

Definition at line 2591 of file vcf.c.

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

Definition at line 2565 of file vcf.c.

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

Definition at line 2816 of file vcf.c.

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

Definition at line 2482 of file vcf.c.

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

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

Definition at line 1079 of file vcf.c.

void hrec_add_idx ( bcf_hrec_t hrec,
int  idx 
)

Definition at line 218 of file vcf.c.

typedef khash_t ( vdict  )

Definition at line 16 of file vcf.c.

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

bcf_hdr_idinfo_exists(h,BCF_HL_FMT,fmt[i].id) )

Definition at line 1928 of file vcf.c.

bcf_hdr_t* vcf_hdr_read ( htsFile fp)

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.

Definition at line 1118 of file vcf.c.

int vcf_hdr_write ( htsFile fp,
const bcf_hdr_t h 
)

Definition at line 1276 of file vcf.c.

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

Definition at line 1642 of file vcf.c.

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

Definition at line 1817 of file vcf.c.

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

Definition at line 2028 of file vcf.c.

int vcf_write_line ( htsFile fp,
kstring_t line 
)

Definition at line 2017 of file vcf.c.