-
Notifications
You must be signed in to change notification settings - Fork 239
/
convert.h
51 lines (40 loc) · 2.44 KB
/
convert.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* convert.h -- functions for converting between VCF/BCF and related formats.
Copyright (C) 2014-2024 Genome Research Ltd.
Author: Petr Danecek <pd3@sanger.ac.uk>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#ifndef __CONVERT_H__
#define __CONVERT_H__
#include <htslib/vcf.h>
typedef struct _convert_t convert_t;
enum convert_option
{
allow_undef_tags, // see `bcftools query --allow-undef-tags`, throws an error if tag is not defined otherwise
subset_samples, // in bracketed expressions (e.g. [ %GT]) consider only marked samples
header_samples, // include sample name in bracketed tags (e.g. SAMPLE1:GT SAMPLE2:GT for [ %GT])
force_newline, // automatically insert a newline when not part of the formatting expression
print_filtered, // print the provided string instead of discarding samples not included in subset_samples
no_hdr_indices, // drop column indices when printing header, i.e. "#CHROM", not "#[1]CHROM"
};
convert_t *convert_init(bcf_hdr_t *hdr, int *samples, int nsamples, const char *str);
void convert_destroy(convert_t *convert);
int convert_set_option(convert_t *convert, enum convert_option opt, ...);
int convert_header(convert_t *convert, kstring_t *str);
int convert_line(convert_t *convert, bcf1_t *rec, kstring_t *str);
int convert_max_unpack(convert_t *convert);
int convert_is_tag_used(convert_t *convert, char *tag);
const char **convert_list_used_tags(convert_t *convert, int *ntags);
#endif