Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vcfutils.h
Go to the documentation of this file.
1 /* vcfutils.h -- allele-related utility functions.
2 
3  Copyright (C) 2012, 2013 Genome Research Ltd.
4 
5  Author: Petr Danecek <pd3@sanger.ac.uk>
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 DEALINGS IN THE SOFTWARE. */
24 
25 #ifndef HTSLIB_VCFUTILS_H
26 #define HTSLIB_VCFUTILS_H
27 
28 #include "vcf.h"
29 
30 
40 int bcf_trim_alleles(const bcf_hdr_t *header, bcf1_t *line);
41 
42 
49 void bcf_remove_alleles(const bcf_hdr_t *header, bcf1_t *line, int mask);
50 
51 
66 int bcf_calc_ac(const bcf_hdr_t *header, bcf1_t *line, int *ac, int which);
67 
68 
84 #define GT_HOM_RR 0 // note: the actual value of GT_* matters, used in dosage r2 calculation
85 #define GT_HOM_AA 1
86 #define GT_HET_RA 2
87 #define GT_HET_AA 3
88 #define GT_HAPL_R 4
89 #define GT_HAPL_A 5
90 #define GT_UNKN 6
91 int bcf_gt_type(bcf_fmt_t *fmt_ptr, int isample, int *ial, int *jal);
92 
93 static inline int bcf_acgt2int(char c)
94 {
95  if ( (int)c>96 ) c -= 32;
96  if ( c=='A' ) return 0;
97  if ( c=='C' ) return 1;
98  if ( c=='G' ) return 2;
99  if ( c=='T' ) return 3;
100  return -1;
101 }
102 #define bcf_int2acgt(i) "ACGT"[i]
103 
110 #define bcf_ij2G(i, j) ((j)*((j)+1)/2+(i))
111 
112 #endif
Definition: vcf.h:136
int bcf_trim_alleles(const bcf_hdr_t *header, bcf1_t *line)
Definition: vcfutils.c:159
Definition: vcf.h:194
int bcf_gt_type(bcf_fmt_t *fmt_ptr, int isample, int *ial, int *jal)
Definition: vcfutils.c:108
void bcf_remove_alleles(const bcf_hdr_t *header, bcf1_t *line, int mask)
Definition: vcfutils.c:201
Definition: vcf.h:100
int bcf_calc_ac(const bcf_hdr_t *header, bcf1_t *line, int *ac, int which)
Definition: vcfutils.c:27