NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
vcfutils.h File Reference
#include "vcf.h"

Go to the source code of this file.

Macros

#define GT_HOM_RR   0
 
#define GT_HOM_AA   1
 
#define GT_HET_RA   2
 
#define GT_HET_AA   3
 
#define GT_HAPL_R   4
 
#define GT_HAPL_A   5
 
#define GT_UNKN   6
 
#define bcf_int2acgt(i)   "ACGT"[i]
 
#define bcf_ij2G(i, j)   ((j)*((j)+1)/2+(i))
 

Functions

int bcf_trim_alleles (const bcf_hdr_t *header, bcf1_t *line)
 
void bcf_remove_alleles (const bcf_hdr_t *header, bcf1_t *line, int mask)
 
int bcf_calc_ac (const bcf_hdr_t *header, bcf1_t *line, int *ac, int which)
 
int bcf_gt_type (bcf_fmt_t *fmt_ptr, int isample, int *ial, int *jal)
 

Macro Definition Documentation

#define bcf_ij2G (   i,
 
)    ((j)*((j)+1)/2+(i))

bcf_ij2G() - common task: allele indexes to Number=G index (diploid) ,j: allele indexes, 0-based, i<=j

Returns index to the Number=G diploid array

Definition at line 90 of file vcfutils.h.

#define bcf_int2acgt (   i)    "ACGT"[i]

Definition at line 82 of file vcfutils.h.

#define GT_HAPL_A   5

Definition at line 69 of file vcfutils.h.

#define GT_HAPL_R   4

Definition at line 68 of file vcfutils.h.

#define GT_HET_AA   3

Definition at line 67 of file vcfutils.h.

#define GT_HET_RA   2

Definition at line 66 of file vcfutils.h.

#define GT_HOM_AA   1

Definition at line 65 of file vcfutils.h.

#define GT_HOM_RR   0

bcf_gt_type() - determines type of the genotype : the GT format field as set for example by set_fmt_ptr : sample index (starting from 0) : index of the 1st non-reference allele (starting from 1) : index of the 2nd non-reference allele (starting from 1)

Returns the type of the genotype (one of GT_HOM_RR, GT_HET_RA, GT_HOM_AA, GT_HET_AA, GT_HAPL_R, GT_HAPL_A or GT_UNKN). If $ial is not NULL and the genotype has one or more non-reference alleles, $ial will be set. In case of GT_HET_AA, $ial is the position of the allele which appeared first in ALT. If $jal is not null and the genotype is GT_HET_AA, $jal will be set and is the position of the second allele in ALT.

Definition at line 64 of file vcfutils.h.

#define GT_UNKN   6

Definition at line 70 of file vcfutils.h.

Function Documentation

int bcf_calc_ac ( const bcf_hdr_t header,
bcf1_t line,
int *  ac,
int  which 
)

bcf_calc_ac() - calculate the number of REF and ALT alleles : for access to BCF_DT_ID dictionary VCF line obtained from vcf_parse1 : array of length line->n_allele : determine if INFO/AN,AC and indv fields be used

Returns 1 if the call succeeded, or 0 if the value could not be determined.

The value of determines if existing INFO/AC,AN can be used (BCF_UN_INFO) and and if indv fields can be splitted (BCF_UN_FMT).

Definition at line 3 of file vcfutils.c.

int bcf_gt_type ( bcf_fmt_t fmt_ptr,
int  isample,
int *  ial,
int *  jal 
)

Definition at line 84 of file vcfutils.c.

void bcf_remove_alleles ( const bcf_hdr_t header,
bcf1_t line,
int  mask 
)

bcf_remove_alleles() - remove ALT alleles according to bitmask : for access to BCF_DT_ID dictionary VCF line obtained from vcf_parse1 : alleles to remove

Definition at line 177 of file vcfutils.c.

int bcf_trim_alleles ( const bcf_hdr_t header,
bcf1_t line 
)

bcf_trim_alleles() - remove ALT alleles unused in genotype fields : for access to BCF_DT_ID dictionary VCF line obtain from vcf_parse1

Returns the number of removed alleles on success or negative on error: -1 .. some allele index is out of bounds

Definition at line 135 of file vcfutils.c.