NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vcfutils.h
Go to the documentation of this file.
1 /*
2  Time will show if this module will be merged into others
3  or perhaps removed completely.
4 */
5 #ifndef VCF_UTILS_H
6 #define VCF_UTILS_H
7 
8 #include "vcf.h"
9 
10 
20 int bcf_trim_alleles(const bcf_hdr_t *header, bcf1_t *line);
21 
22 
29 void bcf_remove_alleles(const bcf_hdr_t *header, bcf1_t *line, int mask);
30 
31 
46 int bcf_calc_ac(const bcf_hdr_t *header, bcf1_t *line, int *ac, int which);
47 
48 
64 #define GT_HOM_RR 0 // note: the actual value of GT_* matters, used in dosage r2 calculation
65 #define GT_HOM_AA 1
66 #define GT_HET_RA 2
67 #define GT_HET_AA 3
68 #define GT_HAPL_R 4
69 #define GT_HAPL_A 5
70 #define GT_UNKN 6
71 int bcf_gt_type(bcf_fmt_t *fmt_ptr, int isample, int *ial, int *jal);
72 
73 static inline int bcf_acgt2int(char c)
74 {
75  if ( (int)c>96 ) c -= 32;
76  if ( c=='A' ) return 0;
77  if ( c=='C' ) return 1;
78  if ( c=='G' ) return 2;
79  if ( c=='T' ) return 3;
80  return -1;
81 }
82 #define bcf_int2acgt(i) "ACGT"[i]
83 
90 #define bcf_ij2G(i, j) ((j)*((j)+1)/2+(i))
91 
92 #endif